Skip to content

Conversation

msridhar
Copy link

Make the contents of some AtomicReference variables @Nullable. This is in preparation for uber/NullAway#1298 which causes new errors to be reported for these variables.

@msridhar msridhar force-pushed the atomicreference-nullable-fixes branch from 38b84f0 to 7a39a3a Compare September 19, 2025 23:38
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 19, 2025
@msridhar
Copy link
Author

FYI @sdeleuze

.send(FlowAdapters.toPublisher(new OutputStreamPublisher<>(
os -> body.writeTo(StreamUtils.nonClosing(os)), new ByteBufMapper(outbound),
executorRef.getAndSet(null), null)));
Objects.requireNonNull(executorRef.getAndSet(null)), null)));
Copy link
Author

Choose a reason for hiding this comment

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

This is the only logic change in this PR (all other changes are just adding @Nullable annotations). I'm pretty confident in the change based on the surrounding code but I'm not an expert so it should be reviewed

Copy link
Contributor

@sdeleuze sdeleuze Sep 23, 2025

Choose a reason for hiding this comment

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

LGTM, but I would welcome a confirmation from @jhoeller and/or @rstoyanchev.

Copy link
Contributor

Choose a reason for hiding this comment

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

After discussing with Juergen and Rossen, looks fine but we would like @violetagg confirmation.

Copy link
Member

Choose a reason for hiding this comment

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

There is already assert in OutputStreamPublisher, so do we need this here or it is to suppress the warnings?
basically we will check twice.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point. That's not a hot code path but conceptually this double check is annoying.

@msridhar Would declaring a AtomicReference<@NullUnmarked Executor> executorRef field be acceptable here with your upcoming changes to not trigger warnings without having to do the double check?

@sdeleuze sdeleuze requested a review from jhoeller September 23, 2025 07:05
@sdeleuze sdeleuze self-assigned this Sep 23, 2025
@sdeleuze sdeleuze added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 23, 2025
@sdeleuze sdeleuze added this to the 7.0.0-RC1 milestone Sep 23, 2025
@sdeleuze sdeleuze added the status: waiting-for-internal-feedback An issue that needs input from a member or another Spring Team label Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-internal-feedback An issue that needs input from a member or another Spring Team type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants