Skip to content

Conversation

cppwfs
Copy link
Contributor

@cppwfs cppwfs commented Sep 10, 2025

No description provided.

@cppwfs cppwfs requested a review from artembilan September 10, 2025 15:55
@@ -300,7 +302,7 @@ public static final class CommandMethod {

private final Class<?>[] parameterTypes;

private String description;
private @Nullable String description;
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer NullAway.Init.
See the logic in the populateDescriptionIntoCommand().
So, whenever this CommandMethod is initialized after populateCommandMethod(), the description is not null.

@@ -132,7 +133,7 @@ public record ControlBusBean(String beanName, List<ControlBusCommand> commands)

}

public record ControlBusCommand(String command, String description, List<Class<?>> parameterTypes) {
public record ControlBusCommand(String command, @Nullable String description, List<Class<?>> parameterTypes) {
Copy link
Member

Choose a reason for hiding this comment

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

Therefore the change in this class will go away.

@@ -273,7 +274,7 @@ else if (conversionService.canConvert(key.getClass(), String.class)) {
throw new MessagingException("Unsupported channel mapping type for router ["
+ key.getClass() + "]");
}

Assert.notNull(channelKey, "'channelKey' must not be null");
Copy link
Member

Choose a reason for hiding this comment

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

I think this is a false impression.
See the logic:

				else if (conversionService.canConvert(key.getClass(), String.class)) {
					channelKey = conversionService.convert(key, String.class);
				}

I believe, according to that canConvert() Javadocs, the convert result would never be null.
So, we probably need @SuppressWarnings("NullAway") instead.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah... This is a critical path execution for the router logic, so I'd rather bite a bullet and suppress than extra code.

@@ -43,6 +43,7 @@
* The REST Controller to provide the management API for Control Bus pattern.
*
* @author Artem Bilan
* @author Glenn Renfro
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, my friend, but looks like this is only change in this class 🥶

Copy link
Contributor Author

@cppwfs cppwfs Sep 10, 2025

Choose a reason for hiding this comment

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

I debated which direction on both instances. There was a remote path where they could be null. So I chose the code path vs the SuppressWarning. But if it has no chance at null, then we are good to Suppress. And for performance for sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doh! But I wanted my name here 😄

@artembilan artembilan merged commit b2810cd into spring-projects:main Sep 10, 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