Skip to content

Commit

Permalink
Adding NonNull annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
freakomonk committed Nov 17, 2018
1 parent 7058126 commit 2ba66cc
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/main/java/io/reactivex/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -1735,6 +1735,7 @@ public static <T> Observable<T> error(final Throwable exception) {
*/
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
@NonNull
public static <T> Observable<T> fromArray(T... items) {
ObjectHelper.requireNonNull(items, "items is null");
if (items.length == 0) {
Expand Down Expand Up @@ -1775,6 +1776,7 @@ public static <T> Observable<T> fromArray(T... items) {
* @since 2.0
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> fromCallable(Callable<? extends T> supplier) {
ObjectHelper.requireNonNull(supplier, "supplier is null");
Expand Down Expand Up @@ -1808,6 +1810,7 @@ public static <T> Observable<T> fromCallable(Callable<? extends T> supplier) {
* @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a>
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> fromFuture(Future<? extends T> future) {
ObjectHelper.requireNonNull(future, "future is null");
Expand Down Expand Up @@ -1845,6 +1848,7 @@ public static <T> Observable<T> fromFuture(Future<? extends T> future) {
* @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a>
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> fromFuture(Future<? extends T> future, long timeout, TimeUnit unit) {
ObjectHelper.requireNonNull(future, "future is null");
Expand Down Expand Up @@ -1886,6 +1890,7 @@ public static <T> Observable<T> fromFuture(Future<? extends T> future, long time
* @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a>
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.CUSTOM)
public static <T> Observable<T> fromFuture(Future<? extends T> future, long timeout, TimeUnit unit, Scheduler scheduler) {
ObjectHelper.requireNonNull(scheduler, "scheduler is null");
Expand Down Expand Up @@ -1921,6 +1926,7 @@ public static <T> Observable<T> fromFuture(Future<? extends T> future, long time
* @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a>
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.CUSTOM)
public static <T> Observable<T> fromFuture(Future<? extends T> future, Scheduler scheduler) {
ObjectHelper.requireNonNull(scheduler, "scheduler is null");
Expand All @@ -1946,6 +1952,7 @@ public static <T> Observable<T> fromFuture(Future<? extends T> future, Scheduler
* @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a>
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> fromIterable(Iterable<? extends T> source) {
ObjectHelper.requireNonNull(source, "source is null");
Expand Down Expand Up @@ -1982,6 +1989,7 @@ public static <T> Observable<T> fromIterable(Iterable<? extends T> source) {
*/
@BackpressureSupport(BackpressureKind.UNBOUNDED_IN)
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> fromPublisher(Publisher<? extends T> publisher) {
ObjectHelper.requireNonNull(publisher, "publisher is null");
Expand Down Expand Up @@ -2010,6 +2018,7 @@ public static <T> Observable<T> fromPublisher(Publisher<? extends T> publisher)
* @return the new Observable instance
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> generate(final Consumer<Emitter<T>> generator) {
ObjectHelper.requireNonNull(generator, "generator is null");
Expand Down Expand Up @@ -2041,6 +2050,7 @@ public static <T> Observable<T> generate(final Consumer<Emitter<T>> generator) {
* @return the new Observable instance
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T, S> Observable<T> generate(Callable<S> initialState, final BiConsumer<S, Emitter<T>> generator) {
ObjectHelper.requireNonNull(generator, "generator is null");
Expand Down Expand Up @@ -2073,6 +2083,7 @@ public static <T, S> Observable<T> generate(Callable<S> initialState, final BiCo
* @return the new Observable instance
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T, S> Observable<T> generate(
final Callable<S> initialState,
Expand Down Expand Up @@ -2139,6 +2150,7 @@ public static <T, S> Observable<T> generate(Callable<S> initialState, BiFunction
* @return the new Observable instance
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T, S> Observable<T> generate(Callable<S> initialState, BiFunction<S, Emitter<T>, S> generator,
Consumer<? super S> disposeState) {
Expand Down Expand Up @@ -2199,6 +2211,7 @@ public static Observable<Long> interval(long initialDelay, long period, TimeUnit
* @since 1.0.12
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.CUSTOM)
public static Observable<Long> interval(long initialDelay, long period, TimeUnit unit, Scheduler scheduler) {
ObjectHelper.requireNonNull(unit, "unit is null");
Expand Down Expand Up @@ -2295,6 +2308,7 @@ public static Observable<Long> intervalRange(long start, long count, long initia
* @return the new Observable instance
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.CUSTOM)
public static Observable<Long> intervalRange(long start, long count, long initialDelay, long period, TimeUnit unit, Scheduler scheduler) {
if (count < 0) {
Expand Down Expand Up @@ -2344,6 +2358,7 @@ public static Observable<Long> intervalRange(long start, long count, long initia
* @see #fromIterable(Iterable)
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> just(T item) {
ObjectHelper.requireNonNull(item, "The item is null");
Expand All @@ -2370,6 +2385,7 @@ public static <T> Observable<T> just(T item) {
*/
@SuppressWarnings("unchecked")
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> just(T item1, T item2) {
ObjectHelper.requireNonNull(item1, "The first item is null");
Expand Down Expand Up @@ -2400,6 +2416,7 @@ public static <T> Observable<T> just(T item1, T item2) {
*/
@SuppressWarnings("unchecked")
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> just(T item1, T item2, T item3) {
ObjectHelper.requireNonNull(item1, "The first item is null");
Expand Down Expand Up @@ -2433,6 +2450,7 @@ public static <T> Observable<T> just(T item1, T item2, T item3) {
*/
@SuppressWarnings("unchecked")
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> just(T item1, T item2, T item3, T item4) {
ObjectHelper.requireNonNull(item1, "The first item is null");
Expand Down Expand Up @@ -2469,6 +2487,7 @@ public static <T> Observable<T> just(T item1, T item2, T item3, T item4) {
*/
@SuppressWarnings("unchecked")
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> just(T item1, T item2, T item3, T item4, T item5) {
ObjectHelper.requireNonNull(item1, "The first item is null");
Expand Down Expand Up @@ -2508,6 +2527,7 @@ public static <T> Observable<T> just(T item1, T item2, T item3, T item4, T item5
*/
@SuppressWarnings("unchecked")
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> just(T item1, T item2, T item3, T item4, T item5, T item6) {
ObjectHelper.requireNonNull(item1, "The first item is null");
Expand Down Expand Up @@ -2550,6 +2570,7 @@ public static <T> Observable<T> just(T item1, T item2, T item3, T item4, T item5
*/
@SuppressWarnings("unchecked")
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> just(T item1, T item2, T item3, T item4, T item5, T item6, T item7) {
ObjectHelper.requireNonNull(item1, "The first item is null");
Expand Down Expand Up @@ -2595,6 +2616,7 @@ public static <T> Observable<T> just(T item1, T item2, T item3, T item4, T item5
*/
@SuppressWarnings("unchecked")
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> 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");
Expand Down Expand Up @@ -2643,6 +2665,7 @@ public static <T> Observable<T> just(T item1, T item2, T item3, T item4, T item5
*/
@SuppressWarnings("unchecked")
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> 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");
Expand Down Expand Up @@ -2694,6 +2717,7 @@ public static <T> Observable<T> just(T item1, T item2, T item3, T item4, T item5
*/
@SuppressWarnings("unchecked")
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> 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");
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/io/reactivex/Single.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ public static <T> Single<T> ambArray(final SingleSource<? extends T>... sources)
* @since 2.0
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
@BackpressureSupport(BackpressureKind.FULL)
public static <T> Flowable<T> concat(Iterable<? extends SingleSource<? extends T>> sources) {
Expand Down Expand Up @@ -226,6 +227,7 @@ public static <T> Observable<T> concat(ObservableSource<? extends SingleSource<?
* @since 2.0
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Flowable<T> concat(Publisher<? extends SingleSource<? extends T>> sources) {
Expand All @@ -251,6 +253,7 @@ public static <T> Flowable<T> concat(Publisher<? extends SingleSource<? extends
* @since 2.0
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
@SuppressWarnings({ "unchecked", "rawtypes" })
Expand Down Expand Up @@ -280,6 +283,7 @@ public static <T> Flowable<T> concat(Publisher<? extends SingleSource<? extends
* @see <a href="http://reactivex.io/documentation/operators/concat.html">ReactiveX operators documentation: Concat</a>
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -313,6 +317,7 @@ public static <T> Flowable<T> concat(
* @see <a href="http://reactivex.io/documentation/operators/concat.html">ReactiveX operators documentation: Concat</a>
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -350,6 +355,7 @@ public static <T> Flowable<T> concat(
* @see <a href="http://reactivex.io/documentation/operators/concat.html">ReactiveX operators documentation: Concat</a>
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -381,6 +387,7 @@ public static <T> Flowable<T> concat(
* @since 2.0
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
@SuppressWarnings({ "unchecked", "rawtypes" })
Expand All @@ -406,6 +413,7 @@ public static <T> Flowable<T> concatArray(SingleSource<? extends T>... sources)
*/
@BackpressureSupport(BackpressureKind.FULL)
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Flowable<T> concatArrayEager(SingleSource<? extends T>... sources) {
return Flowable.fromArray(sources).concatMapEager(SingleInternalHelper.<T>toFlowable());
Expand Down Expand Up @@ -433,6 +441,7 @@ public static <T> Flowable<T> concatArrayEager(SingleSource<? extends T>... sour
*/
@BackpressureSupport(BackpressureKind.FULL)
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Flowable<T> concatEager(Publisher<? extends SingleSource<? extends T>> sources) {
return Flowable.fromPublisher(sources).concatMapEager(SingleInternalHelper.<T>toFlowable());
Expand All @@ -458,6 +467,7 @@ public static <T> Flowable<T> concatEager(Publisher<? extends SingleSource<? ext
*/
@BackpressureSupport(BackpressureKind.FULL)
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Flowable<T> concatEager(Iterable<? extends SingleSource<? extends T>> sources) {
return Flowable.fromIterable(sources).concatMapEager(SingleInternalHelper.<T>toFlowable());
Expand Down Expand Up @@ -813,6 +823,7 @@ public static <T> Single<T> fromObservable(ObservableSource<? extends T> observa
*/
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
@NonNull
public static <T> Single<T> just(final T item) {
ObjectHelper.requireNonNull(item, "value is null");
return RxJavaPlugins.onAssembly(new SingleJust<T>(item));
Expand Down Expand Up @@ -849,6 +860,7 @@ public static <T> Single<T> just(final T item) {
* @see #mergeDelayError(Iterable)
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Flowable<T> merge(Iterable<? extends SingleSource<? extends T>> sources) {
Expand Down Expand Up @@ -886,6 +898,7 @@ public static <T> Flowable<T> merge(Iterable<? extends SingleSource<? extends T>
* @since 2.0
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
@SuppressWarnings({ "unchecked", "rawtypes" })
Expand Down Expand Up @@ -961,6 +974,7 @@ public static <T> Single<T> merge(SingleSource<? extends SingleSource<? extends
* @see #mergeDelayError(SingleSource, SingleSource)
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -1011,6 +1025,7 @@ public static <T> Flowable<T> merge(
* @see #mergeDelayError(SingleSource, SingleSource, SingleSource)
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -1065,6 +1080,7 @@ public static <T> Flowable<T> merge(
* @see #mergeDelayError(SingleSource, SingleSource, SingleSource, SingleSource)
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -1096,6 +1112,7 @@ public static <T> Flowable<T> merge(
* @since 2.2
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Flowable<T> mergeDelayError(Iterable<? extends SingleSource<? extends T>> sources) {
Expand All @@ -1119,6 +1136,7 @@ public static <T> Flowable<T> mergeDelayError(Iterable<? extends SingleSource<?
* @since 2.2
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
@SuppressWarnings({ "unchecked", "rawtypes" })
Expand Down Expand Up @@ -1153,6 +1171,7 @@ public static <T> Flowable<T> mergeDelayError(Publisher<? extends SingleSource<?
* @since 2.2
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -1192,6 +1211,7 @@ public static <T> Flowable<T> mergeDelayError(
* @since 2.2
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -1235,6 +1255,7 @@ public static <T> Flowable<T> mergeDelayError(
* @since 2.2
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
@SuppressWarnings("unchecked")
Expand Down

0 comments on commit 2ba66cc

Please sign in to comment.