-
Notifications
You must be signed in to change notification settings - Fork 1.1k
GH-10083: Apply Nullability to core
handler
package
#10364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Related to: spring-projects#10083 `MessageProcessorMessageSource` now provides a fake message to the underlying messageProcessor since the contract requires. add `@Nullable` on `CheckedCallable.call()`, since in `LockRequestHandlerAdvice.doInvoke()`, there is a lambda `ExecutionCallback::execute` which will be running inside the `call()`, and its Nullable. Signed-off-by: Jiandong Ma <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a lot, but great.
Let's see if we can manage such a big review as well!
...ng-integration-core/src/main/java/org/springframework/integration/core/RecoveryCallback.java
Outdated
Show resolved
Hide resolved
...tegration-core/src/main/java/org/springframework/integration/core/ErrorMessagePublisher.java
Show resolved
Hide resolved
...re/src/main/java/org/springframework/integration/endpoint/MessageProcessorMessageSource.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/springframework/integration/handler/support/PayloadsArgumentResolver.java
Outdated
Show resolved
Hide resolved
spring-integration-core/src/main/java/org/springframework/integration/util/CheckedCallable.java
Outdated
Show resolved
Hide resolved
...tegration-core/src/main/java/org/springframework/integration/support/locks/LockRegistry.java
Outdated
Show resolved
Hide resolved
...tion-core/src/main/java/org/springframework/integration/store/AbstractMessageGroupStore.java
Outdated
Show resolved
Hide resolved
...tion-core/src/main/java/org/springframework/integration/store/AbstractMessageGroupStore.java
Outdated
Show resolved
Hide resolved
…r()` revert `@Nullable` on `CheckedCallable.call()` as it is nullable from generic type definition, for `LockRequestHandlerAdvice`, add NullAway since `ExecutionCallback.execute` is Nullable as well. move fakeMessage to a static final constant in `MessageProcessorMessageSource` add NullAway on `RequestHandlerRetryAdvice.recoveryCallback.recover()`, need rework on retry component use `Map.computeIfAbsent` in `PayloadsArgumentResolver` and `PayloadExpressionArgumentResolver` add more detailed reason (critical path, dataflow analysis) on NullAway method. Signed-off-by: Jiandong Ma <[email protected]>
ok, I have addressed most review comments, two of them are not revised due to it may take me more time.
@artembilan happy Friday, if any new reviews I will solve on next week. |
...e/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java
Show resolved
Hide resolved
@@ -35,8 +35,7 @@ public class ExpressionEvaluatingMessageHandler extends AbstractMessageHandler { | |||
|
|||
private final ExpressionEvaluatingMessageProcessor<Void> processor; | |||
|
|||
@SuppressWarnings("NullAway.Init") | |||
private String componentType; | |||
private String componentType = "expression-evaluating-handler"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I mean remove setComponentType()
at all.
This contract is not meant to be overridden by end-user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I tried that, unit test failed a lot, there it will call setComponentType()
@@ -36,8 +36,7 @@ public class MethodInvokingMessageHandler extends AbstractMessageHandler impleme | |||
|
|||
private final MethodInvokingMessageProcessor<Object> processor; | |||
|
|||
@SuppressWarnings("NullAway.Init") | |||
private String componentType; | |||
private String componentType = "method-invoking-handler"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DITTO
@@ -59,8 +59,9 @@ public ErrorMessageSendingRecoverer() { | |||
* The {@link DefaultErrorMessageStrategy} is used for building an error message to publish. | |||
* @param channel the message channel to publish error messages on recovery action. | |||
*/ | |||
@SuppressWarnings("this-escape") | |||
public ErrorMessageSendingRecoverer(@Nullable MessageChannel channel) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This must not be null
.
Looks like you have missed some parts of my previous explanation.
@@ -74,7 +75,7 @@ public ErrorMessageSendingRecoverer(@Nullable MessageChannel channel) { | |||
* @since 4.3.10 | |||
*/ | |||
@SuppressWarnings("this-escape") | |||
public ErrorMessageSendingRecoverer(@Nullable MessageChannel channel, @Nullable ErrorMessageStrategy errorMessageStrategy) { | |||
public ErrorMessageSendingRecoverer(MessageChannel channel, ErrorMessageStrategy errorMessageStrategy) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to this our contract that ternary operator in the setErrorMessageStrategy()
call is redundant.
@@ -152,6 +152,7 @@ protected void onInit() { | |||
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); | |||
} | |||
|
|||
@SuppressWarnings("NullAway") // CheckedCallable.call() is nullable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still have doubts in this.
Will take a look one more time when the rest of concerns are addressed.
Sounds good! Pulling your branch locally for clean up and merge. Thank you! |
Related to: #10083
MessageProcessorMessageSource
now provides a fake message to the underlying messageProcessor since the contract requires.add
@Nullable
onCheckedCallable.call()
, since inLockRequestHandlerAdvice.doInvoke()
, there is a lambdaExecutionCallback::execute
which will be running inside thecall()
, and its Nullable.