More nullability annotations#5251
Conversation
vanniktech
left a comment
There was a problem hiding this comment.
You probably don't want to mess up the imports.
Codecov Report
@@ Coverage Diff @@
## 2.x #5251 +/- ##
============================================
- Coverage 95.97% 95.96% -0.01%
- Complexity 5741 5746 +5
============================================
Files 628 628
Lines 41075 41077 +2
Branches 5698 5699 +1
============================================
- Hits 39420 39418 -2
- Misses 660 664 +4
Partials 995 995
Continue to review full report at Codecov.
|
akarnokd
left a comment
There was a problem hiding this comment.
Some of the non-public components don't need annotation.
| import io.reactivex.internal.operators.flowable.*; | ||
| import io.reactivex.internal.operators.maybe.*; | ||
| import io.reactivex.internal.operators.observable.*; | ||
| import io.reactivex.internal.functions.Functions; |
There was a problem hiding this comment.
Please don't unroll star imports.
| private static final long serialVersionUID = -8219729196779211169L; | ||
|
|
||
| ActionDisposable(Action value) { | ||
| ActionDisposable(@NonNull Action value) { |
There was a problem hiding this comment.
Non-public components don't really need such annotations.
| import java.util.*; | ||
|
|
||
| import io.reactivex.exceptions.*; | ||
| import io.reactivex.annotations.NonNull; |
There was a problem hiding this comment.
Please don't unroll star imports.
| import io.reactivex.functions.Action; | ||
| import io.reactivex.internal.disposables.EmptyDisposable; | ||
| import io.reactivex.internal.functions.*; | ||
| import io.reactivex.internal.functions.Functions; |
There was a problem hiding this comment.
Please don't unroll star imports.
| private final boolean allowInterrupt; | ||
|
|
||
| FutureDisposable(Future<?> run, boolean allowInterrupt) { | ||
| FutureDisposable(@Nullable Future<?> run, boolean allowInterrupt) { |
There was a problem hiding this comment.
Non-public components don't really need this annotation.
| import org.reactivestreams.*; | ||
|
|
||
| import io.reactivex.*; | ||
| import io.reactivex.Flowable; |
There was a problem hiding this comment.
Please don't unroll star imports.
|
|
||
| import org.reactivestreams.*; | ||
|
|
||
| import io.reactivex.annotations.*; |
There was a problem hiding this comment.
What IDE are you using that reorders imports?
| static final AsyncSubscription[] TERMINATED = new AsyncSubscription[0]; | ||
|
|
||
|
|
||
| @NonNull |
| * @param <T> the value type | ||
| */ | ||
| public final class Timed<T> { | ||
| @Nullable |
| * @throws NullPointerException if unit is null | ||
| */ | ||
| public Timed(T value, long time, TimeUnit unit) { | ||
| public Timed(@Nullable T value, long time, @NonNull TimeUnit unit) { |
akarnokd
left a comment
There was a problem hiding this comment.
A couple of changes are still needed.
| * @throws IllegalArgumentException if <code>exceptions</code> is empty. | ||
| */ | ||
| public CompositeException(Throwable... exceptions) { | ||
| public CompositeException(@Nullable Throwable... exceptions) { |
| * @throws IllegalArgumentException if <code>errors</code> is empty. | ||
| */ | ||
| public CompositeException(Iterable<? extends Throwable> errors) { | ||
| public CompositeException(@Nullable Iterable<? extends Throwable> errors) { |
| */ | ||
| public static RuntimeException propagate(Throwable t) { | ||
| @NonNull | ||
| public static RuntimeException propagate(@Nullable Throwable t) { |
There was a problem hiding this comment.
The argument should be @NonNull.
| * @see <a href="https://github.com/ReactiveX/RxJava/issues/748#issuecomment-32471495">RxJava: StackOverflowError is swallowed (Issue #748)</a> | ||
| */ | ||
| public static void throwIfFatal(Throwable t) { | ||
| public static void throwIfFatal(@Nullable Throwable t) { |
There was a problem hiding this comment.
The argument should be @NonNull.
| * the {@code Throwable} to signal; if null, a NullPointerException is constructed | ||
| */ | ||
| public OnErrorNotImplementedException(String message, Throwable e) { | ||
| public OnErrorNotImplementedException(String message, @Nullable Throwable e) { |
There was a problem hiding this comment.
The e argument should be @NonNull.
| */ | ||
| public abstract class GroupedObservable<K, T> extends Observable<T> { | ||
|
|
||
| @Nullable |
|
|
||
| static final int QUEUE_LINK_SIZE = 4; | ||
|
|
||
| @SuppressWarnings("rawtypes") | ||
| static final AsyncSubscription[] TERMINATED = new AsyncSubscription[0]; | ||
|
|
||
| * Returns the contained value. | ||
| * @return the contained value | ||
| */ | ||
| @Nullable |
| @Experimental | ||
| public final class SingleSubject<T> extends Single<T> implements SingleObserver<T> { | ||
|
|
||
| * the {@code Throwable} to signal; if null, a NullPointerException is constructed | ||
| */ | ||
| public OnErrorNotImplementedException(String message, Throwable e) { | ||
| public OnErrorNotImplementedException(String message, @NonNull Throwable e) { |
There was a problem hiding this comment.
Looks like this should be Nullable
| * the {@code Throwable} to signal; if null, a NullPointerException is constructed | ||
| */ | ||
| public OnErrorNotImplementedException(Throwable e) { | ||
| public OnErrorNotImplementedException(@NonNull Throwable e) { |
| * @throws IllegalArgumentException if <code>exceptions</code> is empty. | ||
| */ | ||
| public CompositeException(Throwable... exceptions) { | ||
| public CompositeException(@NonNull Throwable... exceptions) { |
There was a problem hiding this comment.
Nullable instead? The code handles it explicitly.
Added nullability annotations to:
and some others