From 2ba66cc9a19f275e18fb473c4e599b73915c09c0 Mon Sep 17 00:00:00 2001 From: skarthikeya Date: Sat, 17 Nov 2018 21:22:09 +0530 Subject: [PATCH] Adding NonNull annotation --- src/main/java/io/reactivex/Observable.java | 24 ++++++++++++++++++++++ src/main/java/io/reactivex/Single.java | 21 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/src/main/java/io/reactivex/Observable.java b/src/main/java/io/reactivex/Observable.java index 41f10e395f..3cb8bfb1d2 100644 --- a/src/main/java/io/reactivex/Observable.java +++ b/src/main/java/io/reactivex/Observable.java @@ -1735,6 +1735,7 @@ public static Observable error(final Throwable exception) { */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) + @NonNull public static Observable fromArray(T... items) { ObjectHelper.requireNonNull(items, "items is null"); if (items.length == 0) { @@ -1775,6 +1776,7 @@ public static Observable fromArray(T... items) { * @since 2.0 */ @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable fromCallable(Callable supplier) { ObjectHelper.requireNonNull(supplier, "supplier is null"); @@ -1808,6 +1810,7 @@ public static Observable fromCallable(Callable supplier) { * @see ReactiveX operators documentation: From */ @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable fromFuture(Future future) { ObjectHelper.requireNonNull(future, "future is null"); @@ -1845,6 +1848,7 @@ public static Observable fromFuture(Future future) { * @see ReactiveX operators documentation: From */ @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable fromFuture(Future future, long timeout, TimeUnit unit) { ObjectHelper.requireNonNull(future, "future is null"); @@ -1886,6 +1890,7 @@ public static Observable fromFuture(Future future, long time * @see ReactiveX operators documentation: From */ @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.CUSTOM) public static Observable fromFuture(Future future, long timeout, TimeUnit unit, Scheduler scheduler) { ObjectHelper.requireNonNull(scheduler, "scheduler is null"); @@ -1921,6 +1926,7 @@ public static Observable fromFuture(Future future, long time * @see ReactiveX operators documentation: From */ @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.CUSTOM) public static Observable fromFuture(Future future, Scheduler scheduler) { ObjectHelper.requireNonNull(scheduler, "scheduler is null"); @@ -1946,6 +1952,7 @@ public static Observable fromFuture(Future future, Scheduler * @see ReactiveX operators documentation: From */ @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable fromIterable(Iterable source) { ObjectHelper.requireNonNull(source, "source is null"); @@ -1982,6 +1989,7 @@ public static Observable fromIterable(Iterable source) { */ @BackpressureSupport(BackpressureKind.UNBOUNDED_IN) @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable fromPublisher(Publisher publisher) { ObjectHelper.requireNonNull(publisher, "publisher is null"); @@ -2010,6 +2018,7 @@ public static Observable fromPublisher(Publisher publisher) * @return the new Observable instance */ @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable generate(final Consumer> generator) { ObjectHelper.requireNonNull(generator, "generator is null"); @@ -2041,6 +2050,7 @@ public static Observable generate(final Consumer> generator) { * @return the new Observable instance */ @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable generate(Callable initialState, final BiConsumer> generator) { ObjectHelper.requireNonNull(generator, "generator is null"); @@ -2073,6 +2083,7 @@ public static Observable generate(Callable initialState, final BiCo * @return the new Observable instance */ @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable generate( final Callable initialState, @@ -2139,6 +2150,7 @@ public static Observable generate(Callable initialState, BiFunction * @return the new Observable instance */ @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable generate(Callable initialState, BiFunction, S> generator, Consumer disposeState) { @@ -2199,6 +2211,7 @@ public static Observable interval(long initialDelay, long period, TimeUnit * @since 1.0.12 */ @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.CUSTOM) public static Observable interval(long initialDelay, long period, TimeUnit unit, Scheduler scheduler) { ObjectHelper.requireNonNull(unit, "unit is null"); @@ -2295,6 +2308,7 @@ public static Observable intervalRange(long start, long count, long initia * @return the new Observable instance */ @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.CUSTOM) public static Observable intervalRange(long start, long count, long initialDelay, long period, TimeUnit unit, Scheduler scheduler) { if (count < 0) { @@ -2344,6 +2358,7 @@ public static Observable intervalRange(long start, long count, long initia * @see #fromIterable(Iterable) */ @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable just(T item) { ObjectHelper.requireNonNull(item, "The item is null"); @@ -2370,6 +2385,7 @@ public static Observable just(T item) { */ @SuppressWarnings("unchecked") @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable just(T item1, T item2) { ObjectHelper.requireNonNull(item1, "The first item is null"); @@ -2400,6 +2416,7 @@ public static Observable just(T item1, T item2) { */ @SuppressWarnings("unchecked") @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable just(T item1, T item2, T item3) { ObjectHelper.requireNonNull(item1, "The first item is null"); @@ -2433,6 +2450,7 @@ public static Observable just(T item1, T item2, T item3) { */ @SuppressWarnings("unchecked") @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable just(T item1, T item2, T item3, T item4) { ObjectHelper.requireNonNull(item1, "The first item is null"); @@ -2469,6 +2487,7 @@ public static Observable just(T item1, T item2, T item3, T item4) { */ @SuppressWarnings("unchecked") @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable just(T item1, T item2, T item3, T item4, T item5) { ObjectHelper.requireNonNull(item1, "The first item is null"); @@ -2508,6 +2527,7 @@ public static Observable just(T item1, T item2, T item3, T item4, T item5 */ @SuppressWarnings("unchecked") @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable just(T item1, T item2, T item3, T item4, T item5, T item6) { ObjectHelper.requireNonNull(item1, "The first item is null"); @@ -2550,6 +2570,7 @@ public static Observable just(T item1, T item2, T item3, T item4, T item5 */ @SuppressWarnings("unchecked") @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable just(T item1, T item2, T item3, T item4, T item5, T item6, T item7) { ObjectHelper.requireNonNull(item1, "The first item is null"); @@ -2595,6 +2616,7 @@ public static Observable just(T item1, T item2, T item3, T item4, T item5 */ @SuppressWarnings("unchecked") @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable just(T item1, T item2, T item3, T item4, T item5, T item6, T item7, T item8) { ObjectHelper.requireNonNull(item1, "The first item is null"); @@ -2643,6 +2665,7 @@ public static Observable just(T item1, T item2, T item3, T item4, T item5 */ @SuppressWarnings("unchecked") @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable just(T item1, T item2, T item3, T item4, T item5, T item6, T item7, T item8, T item9) { ObjectHelper.requireNonNull(item1, "The first item is null"); @@ -2694,6 +2717,7 @@ public static Observable just(T item1, T item2, T item3, T item4, T item5 */ @SuppressWarnings("unchecked") @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Observable just(T item1, T item2, T item3, T item4, T item5, T item6, T item7, T item8, T item9, T item10) { ObjectHelper.requireNonNull(item1, "The first item is null"); diff --git a/src/main/java/io/reactivex/Single.java b/src/main/java/io/reactivex/Single.java index 168c9c216a..469e741a2f 100644 --- a/src/main/java/io/reactivex/Single.java +++ b/src/main/java/io/reactivex/Single.java @@ -180,6 +180,7 @@ public static Single ambArray(final SingleSource... sources) * @since 2.0 */ @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.FULL) public static Flowable concat(Iterable> sources) { @@ -226,6 +227,7 @@ public static Observable concat(ObservableSource Flowable concat(Publisher> sources) { @@ -251,6 +253,7 @@ public static Flowable concat(Publisher Flowable concat(PublisherReactiveX operators documentation: Concat */ @CheckReturnValue + @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings("unchecked") @@ -313,6 +317,7 @@ public static Flowable concat( * @see ReactiveX operators documentation: Concat */ @CheckReturnValue + @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings("unchecked") @@ -350,6 +355,7 @@ public static Flowable concat( * @see ReactiveX operators documentation: Concat */ @CheckReturnValue + @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings("unchecked") @@ -381,6 +387,7 @@ public static Flowable concat( * @since 2.0 */ @CheckReturnValue + @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings({ "unchecked", "rawtypes" }) @@ -406,6 +413,7 @@ public static Flowable concatArray(SingleSource... sources) */ @BackpressureSupport(BackpressureKind.FULL) @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Flowable concatArrayEager(SingleSource... sources) { return Flowable.fromArray(sources).concatMapEager(SingleInternalHelper.toFlowable()); @@ -433,6 +441,7 @@ public static Flowable concatArrayEager(SingleSource... sour */ @BackpressureSupport(BackpressureKind.FULL) @CheckReturnValue + @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Flowable concatEager(Publisher> sources) { return Flowable.fromPublisher(sources).concatMapEager(SingleInternalHelper.toFlowable()); @@ -458,6 +467,7 @@ public static Flowable concatEager(Publisher Flowable concatEager(Iterable> sources) { return Flowable.fromIterable(sources).concatMapEager(SingleInternalHelper.toFlowable()); @@ -813,6 +823,7 @@ public static Single fromObservable(ObservableSource observa */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) + @NonNull public static Single just(final T item) { ObjectHelper.requireNonNull(item, "value is null"); return RxJavaPlugins.onAssembly(new SingleJust(item)); @@ -849,6 +860,7 @@ public static Single just(final T item) { * @see #mergeDelayError(Iterable) */ @CheckReturnValue + @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) public static Flowable merge(Iterable> sources) { @@ -886,6 +898,7 @@ public static Flowable merge(Iterable * @since 2.0 */ @CheckReturnValue + @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings({ "unchecked", "rawtypes" }) @@ -961,6 +974,7 @@ public static Single merge(SingleSource Flowable merge( * @see #mergeDelayError(SingleSource, SingleSource, SingleSource) */ @CheckReturnValue + @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings("unchecked") @@ -1065,6 +1080,7 @@ public static Flowable merge( * @see #mergeDelayError(SingleSource, SingleSource, SingleSource, SingleSource) */ @CheckReturnValue + @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings("unchecked") @@ -1096,6 +1112,7 @@ public static Flowable merge( * @since 2.2 */ @CheckReturnValue + @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) public static Flowable mergeDelayError(Iterable> sources) { @@ -1119,6 +1136,7 @@ public static Flowable mergeDelayError(Iterable Flowable mergeDelayError(Publisher Flowable mergeDelayError( * @since 2.2 */ @CheckReturnValue + @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings("unchecked") @@ -1235,6 +1255,7 @@ public static Flowable mergeDelayError( * @since 2.2 */ @CheckReturnValue + @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings("unchecked")