Skip to content

Conversation

@chemicL
Copy link
Member

@chemicL chemicL commented Sep 17, 2025

The JSR-305-based reactor.util.annotation.* classes have been deprecated in favour of JSpecify annotations.
The build runs NullAway errorprone plugin. Several public APIs have been refined to better reflect the nullability characteristics and also some internal implementations have also been adjusted based on the new compilation warnings.
This PR replaces #4016.

chemicL added 16 commits August 6, 2025 15:49
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
…otations.NullMarked

Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
…ing imports

Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
@chemicL chemicL added this to the 3.8.0-RC1 milestone Sep 17, 2025
@chemicL chemicL added type/enhancement A general enhancement warn/deprecation This issue/PR introduces deprecations labels Sep 17, 2025
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>

@Nullable
public Object scanUnsafe(Attr key) {
public @Nullable Object scanUnsafe(Attr key) {

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
Scannable.scanUnsafe
; it is advisable to add an Override annotation.
This method overrides
InnerProducer.scanUnsafe
; it is advisable to add an Override annotation.

@Nullable
public abstract CoreSubscriber<? super I> subscribeOrReturn(CoreSubscriber<? super O> actual) throws Throwable;
public abstract @Nullable CoreSubscriber<? super I> subscribeOrReturn(CoreSubscriber<? super O> actual) throws Throwable;

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
OptimizableOperator<O,I>.subscribeOrReturn
; it is advisable to add an Override annotation.

@Nullable
public abstract CoreSubscriber<? super I> subscribeOrReturn(CoreSubscriber<? super O> actual) throws Throwable;
public abstract @Nullable CoreSubscriber<? super I> subscribeOrReturn(CoreSubscriber<? super O> actual) throws Throwable;

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
OptimizableOperator<O,I>.subscribeOrReturn
; it is advisable to add an Override annotation.
}

R accumulatedValue() {
@Nullable R accumulatedValue() {

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
BaseFluxToMonoOperator<T,R>.accumulatedValue
; it is advisable to add an Override annotation.
Copy link
Contributor

@sdeleuze sdeleuze left a comment

Choose a reason for hiding this comment

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

LGTM, modulo 2 minor comments and the remark I shared previously on double checking arrays nullability manually as the JSpecifyMode is not yet enabled yet.

}

@Override
public final CoreSubscriber<? super T> subscribeOrReturn(CoreSubscriber<? super T> actual) {
Copy link
Contributor

@sdeleuze sdeleuze Sep 17, 2025

Choose a reason for hiding this comment

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

Is the removal of final done on purpose?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, final class, redundant marker

// super.getError() returns null by default and this method would throw NPE in that
// case, however the parent's contract is to return nullable Throwable
@Override
@Nullable
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you tried explicit @NonNull instead of @SuppressWarnings?

Copy link
Member Author

Choose a reason for hiding this comment

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

The problem is actually in the argument passed to scanOrDefault which is required to be non-null, otherwise the method throws. Somehow the contract of that method is that it should not accept null values, yet there is extra verification using Object.requireNonNull in place in the body. This is the only weird use of it that can pass on a null argument. Since the class is deprecated I don't want to spend much more time investigating.

Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
@chemicL chemicL marked this pull request as ready for review September 18, 2025 09:36
@chemicL chemicL requested a review from a team as a code owner September 18, 2025 09:36
@chemicL chemicL merged commit 300f627 into main Sep 18, 2025
10 of 11 checks passed
@chemicL chemicL deleted the nullability-jspecify branch September 18, 2025 13:03
chemicL added a commit that referenced this pull request Oct 31, 2025
This change addresses the remaining NullAway warnings left after #4091.

It also contains public API refinenements around StepVerifier and
TestPublisher from reactor-test to allow verifying non-compliant
Publishers against null values.

Follow-up on #878
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/enhancement A general enhancement warn/deprecation This issue/PR introduces deprecations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants