Skip to content

Conversation

artembilan
Copy link
Member

Related to: #10083

  • Fix all the reported issues and IDE suggestions
  • Also, improve Nullability in the TailAdapterSpec and couple DSL Specs in JDBC module according to a new Nullability rules in the core dsl package

Related to: spring-projects#10083

* Fix all the reported issues and IDE suggestions
* Also, improve Nullability in the `TailAdapterSpec` and couple DSL Specs in JDBC module
according to a new Nullability rules in the core `dsl` package
Copy link
Contributor

@cppwfs cppwfs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just a couple of questions.

@@ -31,9 +33,9 @@
*/
public class QueueChannelSpec extends MessageChannelSpec<QueueChannelSpec, QueueChannel> {

protected Queue<Message<?>> queue; // NOSONAR
protected @Nullable Queue<Message<?>> queue; // NOSONAR
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious. Why do we need to keep the //NOSONAR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this property is set from extension classes.
Yes, we may remove it since does not look like anything currently in our CI/CD complains 😄

@@ -47,7 +50,9 @@ public MessageProducerSpec(@Nullable P producer) {
*/
@Override
public S id(@Nullable String id) {
this.target.setBeanName(id);
if (id != null) {
this.target.setBeanName(id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, why are we not throwing an error when they tryin to set the id to null, as it pertains to the bean name?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah... The logic is a bit convoluted and indeed there is a path when this method is called with null.
That is still not a problem because if an id is null, the real bean name is going to be generated in the IntegrationFlowBeanPostProcessor on this.target bean registration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. So a bean name does not have to match the id in that case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does match if id is provided.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could there be a case where:

mySpec.id("myID");
//beanName is now "myId"
//id is now "myId"
mySpec.id(null); //user calls id again and sets it to null
// beanName is "myId"
// id is null

Is this an issue?  

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. This is a problem.

Let me play with that if you are fine having more files to review in this already big PR 😄
For example:

	public static AmqpMessageChannelSpec<?, ?> channel(ConnectionFactory connectionFactory) {
		return channel(null, connectionFactory);
	}

	public static AmqpMessageChannelSpec<?, ?> channel(@Nullable String id, ConnectionFactory connectionFactory) {
		return new AmqpMessageChannelSpec<>(connectionFactory)
				.id(id);
	}

So, the first method would not call the second just to have a nice delegation and code flow.
This way an id in the second method would not be null.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review and coffee are a beautiful thing. 😆

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turned out that wasn't too bad.
Just only much more classes to review yet 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WOOHOO! Thanks for looking into this and resolving it!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! For reviewing this, spotting concern and raising your doubts.
I’m glad that I decided to not save you from boring code pushing the original change directly upstream 🤗

* Fix all the affected classes to deal with not-null or ensure they provide not-null
@cppwfs
Copy link
Contributor

cppwfs commented Aug 8, 2025

LGTM Thanks for the hard work!

@artembilan artembilan merged commit 5610d0c into spring-projects:main Aug 8, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants