-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Nullability fixes for AtomicReference #35514
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
base: main
Are you sure you want to change the base?
Nullability fixes for AtomicReference #35514
Conversation
Signed-off-by: Manu Sridharan <[email protected]>
38b84f0
to
7a39a3a
Compare
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))); |
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 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
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.
LGTM, but I would welcome a confirmation from @jhoeller and/or @rstoyanchev.
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.
After discussing with Juergen and Rossen, looks fine but we would like @violetagg confirmation.
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.
There is already assert in OutputStreamPublisher
, so do we need this here or it is to suppress the warnings?
basically we will check twice.
spring-framework/spring-web/src/main/java/org/springframework/http/client/OutputStreamPublisher.java
Line 76 in 20aac6d
Assert.notNull(executor, "Executor must not be null"); |
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.
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?
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.