Skip to content

Conversation

ngocnhan-tran1996
Copy link
Contributor

No description provided.

* Create new Debezium message producer inbound channel adapter.
* @param debeziumBuilder - pre-configured Debezium Engine Builder instance.
*/
@SuppressWarnings("NullAway.Init")
Copy link
Member

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?

Copy link
Contributor Author

@ngocnhan-tran1996 ngocnhan-tran1996 Jul 31, 2025

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;
Copy link
Member

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;
Copy link
Member

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(() -> {
Copy link
Member

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();
Copy link
Member

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]>
@artembilan artembilan merged commit a065eb8 into spring-projects:main Aug 1, 2025
3 checks passed
@ngocnhan-tran1996 ngocnhan-tran1996 deleted the gh-10083 branch August 3, 2025 10:45
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