-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Apply Nullability to Debezium module #10275
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
Signed-off-by: Tran Ngoc Nhan <[email protected]>
131f0b9
to
5ee9b06
Compare
* Create new Debezium message producer inbound channel adapter. | ||
* @param debeziumBuilder - pre-configured Debezium Engine Builder instance. | ||
*/ | ||
@SuppressWarnings("NullAway.Init") |
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.
Why this annotation here, but not on the property itself?
And why do we need it at all?
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.
When I ran gradlew :spring-integration-debezium:check
on my local machine, the following exception occurred:
DebeziumMessageProducer.java:79: error: [NullAway] initializer method does not guarantee @NonNull fields debeziumEngine (line 58), taskExecutor (line 63) are initialized along all control-flow paths (remember to check for exceptions or early returns).
public DebeziumMessageProducer(Builder<ChangeEvent<byte[], byte[]>> debeziumBuilder) {
^
(see http://t.uber.com/nullaway )
1 error
After reviewing the related PRs, I’ve updated my PR accordingly.
Signed-off-by: Tran Ngoc Nhan <[email protected]>
private final DebeziumEngine.Builder<ChangeEvent<byte[], byte[]>> debeziumEngineBuilder; | ||
|
||
private DebeziumEngine<ChangeEvent<byte[], byte[]>> debeziumEngine; | ||
private @Nullable DebeziumEngine<ChangeEvent<byte[], byte[]>> debeziumEngine; |
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 cannot be null according to ctor logic.
* Debezium Engine is designed to be submitted to an {@link Executor}. | ||
*/ | ||
private TaskExecutor taskExecutor; | ||
private @Nullable TaskExecutor taskExecutor; |
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 has to be @SuppressWarnings("NullAway.Init")
instead since it is initialized in the onInit()
.
} | ||
this.lifecycleLatch = new CountDownLatch(1); | ||
this.taskExecutor.execute(() -> { | ||
Objects.requireNonNull(this.taskExecutor).execute(() -> { |
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.
Please, remove all the Objects.requireNonNull
.
// settings. This continues until this connector is stopped. | ||
// This method can be called repeatedly as needed. | ||
this.debeziumEngine.run(); | ||
Objects.requireNonNull(this.debeziumEngine).run(); |
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 property also has to be marked with @SuppressWarnings("NullAway.Init")
instead.
Signed-off-by: Tran Ngoc Nhan <[email protected]>
No description provided.