Skip to content

Conversation

ngocnhan-tran1996
Copy link
Contributor

No description provided.

this.lastTime += 1; //NOSONAR - single poller thread
}
this.metadataStore.put(this.metadataKey, this.lastTime + "");
Objects.requireNonNull(this.metadataStore).put(this.metadataKey, this.lastTime + "");
Copy link
Member

Choose a reason for hiding this comment

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

We prefer to avoid Objects.requireNonNull as much as possible, especially in critical path executions.
So, use @SuppressWarnings("NullAway.Init") on the metadataStore property instead.
In fact, it is really initialized from the onInit().

HttpRequest.newBuilder()
.GET()
.uri(this.feedUrl.toURI())
.uri(Objects.requireNonNull(this.feedUrl).toURI())
Copy link
Member

Choose a reason for hiding this comment

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

Well, this one is indeed can be null according to the constructors logic.
However, since we have here if..else, there is no chance that we come at this point and it is still null.
So, this method has to be marked with a @SuppressWarnings("NullAway") // Dataflow analysis limitation instead.

Signed-off-by: Tran Ngoc Nhan <[email protected]>
@artembilan artembilan merged commit 05ff0e6 into spring-projects:main Aug 1, 2025
2 checks passed
@ngocnhan-tran1996 ngocnhan-tran1996 deleted the gh-10083-feed-module 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