Skip to content

Commit c67263f

Browse files
authored
3.x: Cleanup javadoc for parameter validation all around (#6835)
* 3.x: Cleanup javadoc for parameter validation all around * More cleanup * Last set of intended changes
1 parent 1e4dbcf commit c67263f

20 files changed

+2506
-1575
lines changed

src/main/java/io/reactivex/rxjava3/core/Completable.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public static Completable concat(@NonNull Iterable<? extends CompletableSource>
235235
* </dl>
236236
* @param sources the sources to concatenate
237237
* @return the {@code Completable} instance which completes only when all sources complete
238-
* @throws NullPointerException if sources is {@code null}
238+
* @throws NullPointerException if {@code sources} is {@code null}
239239
*/
240240
@CheckReturnValue
241241
@SchedulerSupport(SchedulerSupport.NONE)
@@ -1655,6 +1655,7 @@ public final Completable doOnSubscribe(@NonNull Consumer<? super Disposable> onS
16551655
* </dl>
16561656
* @param onTerminate the {@code Action} to call just before this {@code Completable} terminates
16571657
* @return the new {@code Completable} instance
1658+
* @throws NullPointerException if {@code onTerminate} is {@code null}
16581659
* @see #doFinally(Action)
16591660
*/
16601661
@CheckReturnValue
@@ -1677,6 +1678,7 @@ public final Completable doOnTerminate(@NonNull Action onTerminate) {
16771678
* </dl>
16781679
* @param onAfterTerminate the {@code Action} to call after this {@code Completable} terminates
16791680
* @return the new {@code Completable} instance
1681+
* @throws NullPointerException if {@code onAfterTerminate} is {@code null}
16801682
* @see #doFinally(Action)
16811683
*/
16821684
@CheckReturnValue
@@ -2034,7 +2036,7 @@ public final Completable repeat() {
20342036
* </dl>
20352037
* @param times the number of times the re-subscription should happen
20362038
* @return the new {@code Completable} instance
2037-
* @throws IllegalArgumentException if times is less than zero
2039+
* @throws IllegalArgumentException if {@code times} is negative
20382040
*/
20392041
@CheckReturnValue
20402042
@SchedulerSupport(SchedulerSupport.NONE)
@@ -2076,7 +2078,7 @@ public final Completable repeatUntil(@NonNull BooleanSupplier stop) {
20762078
* this {@code Completable} and returns a {@code Publisher} that emits items for repeating or completes to indicate the
20772079
* repetition should stop
20782080
* @return the new {@code Completable} instance
2079-
* @throws NullPointerException if {@code stop} is {@code null}
2081+
* @throws NullPointerException if {@code handler} is {@code null}
20802082
*/
20812083
@CheckReturnValue
20822084
@SchedulerSupport(SchedulerSupport.NONE)
@@ -2619,7 +2621,7 @@ public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull
26192621
* @param other the other {@code Completable} instance to switch to in case of a timeout,
26202622
* if {@code null} a {@link TimeoutException} is emitted instead
26212623
* @return the new {@code Completable} instance
2622-
* @throws NullPointerException if {@code unit} or {@code scheduler}
2624+
* @throws NullPointerException if {@code unit}, {@code scheduler} or {@code other} is {@code null}
26232625
*/
26242626
@CheckReturnValue
26252627
@NonNull

src/main/java/io/reactivex/rxjava3/core/Flowable.java

+1,812-1,283
Large diffs are not rendered by default.

src/main/java/io/reactivex/rxjava3/core/Maybe.java

+40-19
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ public static <T> Flowable<T> concat(
308308
* @param <T> the value type
309309
* @param sources the {@code Publisher} of {@code MaybeSource} instances
310310
* @return the new {@code Flowable} instance
311+
* @throws NullPointerException if {@code sources} is {@code null}
311312
*/
312313
@BackpressureSupport(BackpressureKind.FULL)
313314
@CheckReturnValue
@@ -433,6 +434,7 @@ public static <T> Flowable<T> concatArrayDelayError(@NonNull MaybeSource<? exten
433434
* @param <T> the value type
434435
* @param sources a sequence of {@code MaybeSource}s that need to be eagerly concatenated
435436
* @return the new {@code Flowable} instance with the specified concatenation behavior
437+
* @throws NullPointerException if {@code sources} is {@code null}
436438
*/
437439
@SuppressWarnings({ "rawtypes", "unchecked" })
438440
@BackpressureSupport(BackpressureKind.FULL)
@@ -488,6 +490,7 @@ public static <T> Flowable<T> concatDelayError(@NonNull Iterable<? extends Maybe
488490
* @param <T> the common element base type
489491
* @param sources the {@code Publisher} sequence of {@code MaybeSource}s
490492
* @return the new {@code Flowable} with the concatenating behavior
493+
* @throws NullPointerException if {@code sources} is {@code null}
491494
*/
492495
@SuppressWarnings({ "unchecked", "rawtypes" })
493496
@BackpressureSupport(BackpressureKind.FULL)
@@ -515,6 +518,7 @@ public static <T> Flowable<T> concatDelayError(@NonNull Publisher<? extends Mayb
515518
* @param <T> the value type
516519
* @param sources a sequence of {@code MaybeSource} that need to be eagerly concatenated
517520
* @return the new {@code Flowable} instance with the specified concatenation behavior
521+
* @throws NullPointerException if {@code sources} is {@code null}
518522
*/
519523
@SuppressWarnings({ "rawtypes", "unchecked" })
520524
@BackpressureSupport(BackpressureKind.FULL)
@@ -544,6 +548,7 @@ public static <T> Flowable<T> concatEager(@NonNull Iterable<? extends MaybeSourc
544548
* @param <T> the value type
545549
* @param sources a sequence of {@code MaybeSource}s that need to be eagerly concatenated
546550
* @return the new {@code Flowable} instance with the specified concatenation behavior
551+
* @throws NullPointerException if {@code sources} is {@code null}
547552
*/
548553
@SuppressWarnings({ "rawtypes", "unchecked" })
549554
@BackpressureSupport(BackpressureKind.FULL)
@@ -1044,6 +1049,7 @@ public static <T> Flowable<T> merge(@NonNull Iterable<? extends MaybeSource<? ex
10441049
* @param <T> the common and resulting value type
10451050
* @param sources the {@code Flowable} sequence of {@code MaybeSource} sources
10461051
* @return the new {@code Flowable} instance
1052+
* @throws NullPointerException if {@code sources} is {@code null}
10471053
* @see #mergeDelayError(Publisher)
10481054
*/
10491055
@BackpressureSupport(BackpressureKind.FULL)
@@ -1437,6 +1443,7 @@ public static <T> Flowable<T> mergeDelayError(@NonNull Iterable<? extends MaybeS
14371443
* a {@code Publisher} that emits {@code MaybeSource}s
14381444
* @return a {@code Flowable} that emits all of the items emitted by the {@code MaybeSource}s emitted by the
14391445
* {@code source} {@code Publisher}
1446+
* @throws NullPointerException if {@code sources} is {@code null}
14401447
* @see <a href="http://reactivex.io/documentation/operators/merge.html">ReactiveX operators documentation: Merge</a>
14411448
*/
14421449
@BackpressureSupport(BackpressureKind.FULL)
@@ -1662,6 +1669,7 @@ public static <T> Maybe<T> never() {
16621669
* @param <T>
16631670
* the type of items emitted by each {@code MaybeSource}
16641671
* @return a {@code Single} that emits a {@code Boolean} value that indicates whether the two sequences are the same
1672+
* @throws NullPointerException if {@code source1} or {@code source2} is {@code null}
16651673
* @see <a href="http://reactivex.io/documentation/operators/sequenceequal.html">ReactiveX operators documentation: SequenceEqual</a>
16661674
*/
16671675
@CheckReturnValue
@@ -1720,6 +1728,7 @@ public static <T> Single<Boolean> sequenceEqual(@NonNull MaybeSource<? extends T
17201728
* @param unit
17211729
* time units to use for {@code delay}
17221730
* @return a {@code Maybe} that emits {@code 0L} after a specified delay
1731+
* @throws NullPointerException if {@code unit} is {@code null}
17231732
* @see <a href="http://reactivex.io/documentation/operators/timer.html">ReactiveX operators documentation: Timer</a>
17241733
*/
17251734
@CheckReturnValue
@@ -2688,6 +2697,7 @@ public final Single<T> defaultIfEmpty(@NonNull T defaultItem) {
26882697
* @param unit
26892698
* the {@link TimeUnit} in which {@code period} is defined
26902699
* @return the new {@code Maybe} instance
2700+
* @throws NullPointerException if {@code unit} is {@code null}
26912701
* @see <a href="http://reactivex.io/documentation/operators/delay.html">ReactiveX operators documentation: Delay</a>
26922702
* @see #delay(long, TimeUnit, Scheduler)
26932703
*/
@@ -2799,6 +2809,7 @@ public final <U> Maybe<T> delaySubscription(@NonNull Publisher<U> subscriptionIn
27992809
* @param unit
28002810
* the time unit of {@code delay}
28012811
* @return a {@code Maybe} that delays the subscription to the source {@code Maybe} by the given amount
2812+
* @throws NullPointerException if {@code unit} is {@code null}
28022813
* @see <a href="http://reactivex.io/documentation/operators/delay.html">ReactiveX operators documentation: Delay</a>
28032814
* @see #delaySubscription(long, TimeUnit, Scheduler)
28042815
*/
@@ -2827,6 +2838,7 @@ public final Maybe<T> delaySubscription(long delay, @NonNull TimeUnit unit) {
28272838
* the {@code Scheduler} on which the waiting and subscription will happen
28282839
* @return a {@code Maybe} that delays the subscription to the source {@code Maybe} by a given
28292840
* amount, waiting and subscribing on the given {@code Scheduler}
2841+
* @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null}
28302842
* @see <a href="http://reactivex.io/documentation/operators/delay.html">ReactiveX operators documentation: Delay</a>
28312843
*/
28322844
@CheckReturnValue
@@ -4075,7 +4087,7 @@ public final Flowable<T> repeat() {
40754087
* @return a {@code Flowable} that repeats the sequence of items emitted by the source {@code Maybe} at most
40764088
* {@code count} times
40774089
* @throws IllegalArgumentException
4078-
* if {@code count} is less than zero
4090+
* if {@code times} is negative
40794091
* @see <a href="http://reactivex.io/documentation/operators/repeat.html">ReactiveX operators documentation: Repeat</a>
40804092
*/
40814093
@BackpressureSupport(BackpressureKind.FULL)
@@ -4134,6 +4146,7 @@ public final Flowable<T> repeatUntil(@NonNull BooleanSupplier stop) {
41344146
* @param handler
41354147
* receives a {@code Publisher} of notifications with which a user can complete or error, aborting the repeat.
41364148
* @return the source {@code Publisher} modified with repeat logic
4149+
* @throws NullPointerException if {@code handler} is {@code null}
41374150
* @see <a href="http://reactivex.io/documentation/operators/repeat.html">ReactiveX operators documentation: Repeat</a>
41384151
*/
41394152
@BackpressureSupport(BackpressureKind.FULL)
@@ -4181,6 +4194,7 @@ public final Maybe<T> retry() {
41814194
* the predicate that determines if a resubscription may happen in case of a specific exception
41824195
* and retry count
41834196
* @return the new {@code Maybe} instance
4197+
* @throws NullPointerException if {@code predicate} is {@code null}
41844198
* @see #retry()
41854199
* @see <a href="http://reactivex.io/documentation/operators/retry.html">ReactiveX operators documentation: Retry</a>
41864200
*/
@@ -4205,16 +4219,17 @@ public final Maybe<T> retry(@NonNull BiPredicate<? super Integer, ? super Throwa
42054219
* <dd>{@code retry} does not operate by default on a particular {@link Scheduler}.</dd>
42064220
* </dl>
42074221
*
4208-
* @param count
4222+
* @param times
42094223
* the number of times to resubscribe if the current {@code Maybe} fails
42104224
* @return the new {@code Maybe} instance
4225+
* @throws IllegalArgumentException if {@code times} is negative
42114226
* @see <a href="http://reactivex.io/documentation/operators/retry.html">ReactiveX operators documentation: Retry</a>
42124227
*/
42134228
@CheckReturnValue
42144229
@SchedulerSupport(SchedulerSupport.NONE)
42154230
@NonNull
4216-
public final Maybe<T> retry(long count) {
4217-
return retry(count, Functions.alwaysTrue());
4231+
public final Maybe<T> retry(long times) {
4232+
return retry(times, Functions.alwaysTrue());
42184233
}
42194234

42204235
/**
@@ -4227,6 +4242,8 @@ public final Maybe<T> retry(long count) {
42274242
* @param times the number of times to resubscribe if the current {@code Maybe} fails
42284243
* @param predicate the predicate called with the failure {@link Throwable} and should return {@code true} to trigger a retry.
42294244
* @return the new {@code Maybe} instance
4245+
* @throws NullPointerException if {@code predicate} is {@code null}
4246+
* @throws IllegalArgumentException if {@code times} is negative
42304247
*/
42314248
@CheckReturnValue
42324249
@SchedulerSupport(SchedulerSupport.NONE)
@@ -4244,6 +4261,7 @@ public final Maybe<T> retry(long times, @NonNull Predicate<? super Throwable> pr
42444261
*
42454262
* @param predicate the predicate that receives the failure {@link Throwable} and should return {@code true} to trigger a retry.
42464263
* @return the new {@code Maybe} instance
4264+
* @throws NullPointerException if {@code predicate} is {@code null}
42474265
*/
42484266
@CheckReturnValue
42494267
@SchedulerSupport(SchedulerSupport.NONE)
@@ -4341,6 +4359,7 @@ public final Maybe<T> retryUntil(@NonNull BooleanSupplier stop) {
43414359
* receives a {@code Publisher} of notifications with which a user can complete or error, aborting the
43424360
* retry
43434361
* @return the new {@code Maybe} instance
4362+
* @throws NullPointerException if {@code handler} is {@code null}
43444363
* @see <a href="http://reactivex.io/documentation/operators/retry.html">ReactiveX operators documentation: Retry</a>
43454364
*/
43464365
@CheckReturnValue
@@ -4665,16 +4684,17 @@ public final <U> Maybe<T> takeUntil(@NonNull Publisher<U> other) {
46654684
*
46664685
* @param timeout
46674686
* maximum duration between emitted items before a timeout occurs
4668-
* @param timeUnit
4687+
* @param unit
46694688
* the unit of time that applies to the {@code timeout} argument.
46704689
* @return the new {@code Maybe} instance
4690+
* @throws NullPointerException if {@code unit} is {@code null}
46714691
* @see <a href="http://reactivex.io/documentation/operators/timeout.html">ReactiveX operators documentation: Timeout</a>
46724692
*/
46734693
@CheckReturnValue
46744694
@SchedulerSupport(SchedulerSupport.COMPUTATION)
46754695
@NonNull
4676-
public final Maybe<T> timeout(long timeout, @NonNull TimeUnit timeUnit) {
4677-
return timeout(timeout, timeUnit, Schedulers.computation());
4696+
public final Maybe<T> timeout(long timeout, @NonNull TimeUnit unit) {
4697+
return timeout(timeout, unit, Schedulers.computation());
46784698
}
46794699

46804700
/**
@@ -4690,20 +4710,20 @@ public final Maybe<T> timeout(long timeout, @NonNull TimeUnit timeUnit) {
46904710
*
46914711
* @param timeout
46924712
* maximum duration between items before a timeout occurs
4693-
* @param timeUnit
4713+
* @param unit
46944714
* the unit of time that applies to the {@code timeout} argument
46954715
* @param fallback
46964716
* the fallback {@code MaybeSource} to use in case of a timeout
46974717
* @return the new {@code Maybe} instance
4698-
* @throws NullPointerException if {@code timeUnit} or {@code fallback} is {@code null}
4718+
* @throws NullPointerException if {@code unit} or {@code fallback} is {@code null}
46994719
* @see <a href="http://reactivex.io/documentation/operators/timeout.html">ReactiveX operators documentation: Timeout</a>
47004720
*/
47014721
@CheckReturnValue
47024722
@NonNull
47034723
@SchedulerSupport(SchedulerSupport.COMPUTATION)
4704-
public final Maybe<T> timeout(long timeout, @NonNull TimeUnit timeUnit, @NonNull MaybeSource<? extends T> fallback) {
4724+
public final Maybe<T> timeout(long timeout, @NonNull TimeUnit unit, @NonNull MaybeSource<? extends T> fallback) {
47054725
Objects.requireNonNull(fallback, "fallback is null");
4706-
return timeout(timeout, timeUnit, Schedulers.computation(), fallback);
4726+
return timeout(timeout, unit, Schedulers.computation(), fallback);
47074727
}
47084728

47094729
/**
@@ -4720,22 +4740,22 @@ public final Maybe<T> timeout(long timeout, @NonNull TimeUnit timeUnit, @NonNull
47204740
*
47214741
* @param timeout
47224742
* maximum duration between items before a timeout occurs
4723-
* @param timeUnit
4743+
* @param unit
47244744
* the unit of time that applies to the {@code timeout} argument
47254745
* @param fallback
47264746
* the {@code MaybeSource} to use as the fallback in case of a timeout
47274747
* @param scheduler
47284748
* the {@code Scheduler} to run the timeout timers on
47294749
* @return the new {@code Maybe} instance
4730-
* @throws NullPointerException if {@code fallback}, {@code timeUnit} or {@code scheduler} is {@code null}
4750+
* @throws NullPointerException if {@code fallback}, {@code unit} or {@code scheduler} is {@code null}
47314751
* @see <a href="http://reactivex.io/documentation/operators/timeout.html">ReactiveX operators documentation: Timeout</a>
47324752
*/
47334753
@CheckReturnValue
47344754
@NonNull
47354755
@SchedulerSupport(SchedulerSupport.CUSTOM)
4736-
public final Maybe<T> timeout(long timeout, @NonNull TimeUnit timeUnit, @NonNull Scheduler scheduler, @NonNull MaybeSource<? extends T> fallback) {
4756+
public final Maybe<T> timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull MaybeSource<? extends T> fallback) {
47374757
Objects.requireNonNull(fallback, "fallback is null");
4738-
return timeout(timer(timeout, timeUnit, scheduler), fallback);
4758+
return timeout(timer(timeout, unit, scheduler), fallback);
47394759
}
47404760

47414761
/**
@@ -4752,18 +4772,19 @@ public final Maybe<T> timeout(long timeout, @NonNull TimeUnit timeUnit, @NonNull
47524772
*
47534773
* @param timeout
47544774
* maximum duration between items before a timeout occurs
4755-
* @param timeUnit
4775+
* @param unit
47564776
* the unit of time that applies to the {@code timeout} argument
47574777
* @param scheduler
47584778
* the {@code Scheduler} to run the timeout timers on
47594779
* @return the new {@code Maybe} instance
47604780
* @see <a href="http://reactivex.io/documentation/operators/timeout.html">ReactiveX operators documentation: Timeout</a>
4781+
* @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null}
47614782
*/
47624783
@CheckReturnValue
47634784
@SchedulerSupport(SchedulerSupport.CUSTOM)
47644785
@NonNull
4765-
public final Maybe<T> timeout(long timeout, @NonNull TimeUnit timeUnit, @NonNull Scheduler scheduler) {
4766-
return timeout(timer(timeout, timeUnit, scheduler));
4786+
public final Maybe<T> timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
4787+
return timeout(timer(timeout, unit, scheduler));
47674788
}
47684789

47694790
/**
@@ -4909,7 +4930,7 @@ public final Maybe<T> unsubscribeOn(@NonNull Scheduler scheduler) {
49094930
* a function that combines the pairs of items from the two {@code MaybeSource}s to generate the items to
49104931
* be emitted by the resulting {@code Maybe}
49114932
* @return the new {@code Maybe} instance
4912-
* @throws NullPointerException if {@code other} is {@code null}
4933+
* @throws NullPointerException if {@code other} or {@code zipper} is {@code null}
49134934
* @see <a href="http://reactivex.io/documentation/operators/zip.html">ReactiveX operators documentation: Zip</a>
49144935
*/
49154936
@CheckReturnValue

0 commit comments

Comments
 (0)