Introduce JSpecify for nullability annotations#4091
Conversation
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>
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
|
|
||
| @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
|
|
||
| @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
| } | ||
|
|
||
| R accumulatedValue() { | ||
| @Nullable R accumulatedValue() { |
Check notice
Code scanning / CodeQL
Missing Override annotation Note
sdeleuze
left a comment
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Is the removal of final done on purpose?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Have you tried explicit @NonNull instead of @SuppressWarnings?
There was a problem hiding this comment.
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>
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.