From 155df9a282afb37f00babb8e568a3e59a1b10adb Mon Sep 17 00:00:00 2001 From: akarnokd Date: Tue, 21 Jan 2020 12:54:14 +0100 Subject: [PATCH 1/2] 3.x: Fix method argument naming across types --- .../reactivex/rxjava3/core/Completable.java | 152 +++++----- .../io/reactivex/rxjava3/core/Flowable.java | 148 +++++----- .../java/io/reactivex/rxjava3/core/Maybe.java | 111 ++++---- .../io/reactivex/rxjava3/core/Observable.java | 269 +++++++++--------- .../io/reactivex/rxjava3/core/Single.java | 154 +++++----- .../internal/util/OperatorArgumentNaming.java | 169 +++++++++++ .../ParamValidationCheckerTest.java | 6 - .../validators/ParamValidationNaming.java | 2 +- 8 files changed, 591 insertions(+), 420 deletions(-) create mode 100644 src/test/java/io/reactivex/rxjava3/internal/util/OperatorArgumentNaming.java diff --git a/src/main/java/io/reactivex/rxjava3/core/Completable.java b/src/main/java/io/reactivex/rxjava3/core/Completable.java index ee3af955a9..1266255315 100644 --- a/src/main/java/io/reactivex/rxjava3/core/Completable.java +++ b/src/main/java/io/reactivex/rxjava3/core/Completable.java @@ -332,21 +332,21 @@ public static Completable create(@NonNull CompletableOnSubscribe source) { *
Scheduler:
*
{@code unsafeCreate} does not operate by default on a particular {@link Scheduler}.
* - * @param source the callback which will receive the {@link CompletableObserver} instances + * @param onSubscribe the callback which will receive the {@link CompletableObserver} instances * when the {@code Completable} is subscribed to. * @return the new {@code Completable} instance - * @throws NullPointerException if {@code source} is {@code null} + * @throws NullPointerException if {@code onSubscribe} is {@code null} * @throws IllegalArgumentException if {@code source} is a {@code Completable} */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Completable unsafeCreate(@NonNull CompletableSource source) { - Objects.requireNonNull(source, "source is null"); - if (source instanceof Completable) { + public static Completable unsafeCreate(@NonNull CompletableSource onSubscribe) { + Objects.requireNonNull(onSubscribe, "onSubscribe is null"); + if (onSubscribe instanceof Completable) { throw new IllegalArgumentException("Use of unsafeCreate(Completable)!"); } - return RxJavaPlugins.onAssembly(new CompletableFromUnsafeSource(source)); + return RxJavaPlugins.onAssembly(new CompletableFromUnsafeSource(onSubscribe)); } /** @@ -357,16 +357,16 @@ public static Completable unsafeCreate(@NonNull CompletableSource source) { *
Scheduler:
*
{@code defer} does not operate by default on a particular {@link Scheduler}.
* - * @param completableSupplier the supplier that returns the {@code Completable} that will be subscribed to. + * @param supplier the supplier that returns the {@code Completable} that will be subscribed to. * @return the new {@code Completable} instance - * @throws NullPointerException if {@code completableSupplier} is {@code null} + * @throws NullPointerException if {@code supplier} is {@code null} */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Completable defer(@NonNull Supplier completableSupplier) { - Objects.requireNonNull(completableSupplier, "completableSupplier is null"); - return RxJavaPlugins.onAssembly(new CompletableDefer(completableSupplier)); + public static Completable defer(@NonNull Supplier supplier) { + Objects.requireNonNull(supplier, "supplier is null"); + return RxJavaPlugins.onAssembly(new CompletableDefer(supplier)); } /** @@ -381,16 +381,16 @@ public static Completable defer(@NonNull Supplier c *
Scheduler:
*
{@code error} does not operate by default on a particular {@link Scheduler}.
* - * @param errorSupplier the error supplier, not {@code null} + * @param supplier the error supplier, not {@code null} * @return the new {@code Completable} instance - * @throws NullPointerException if {@code errorSupplier} is {@code null} + * @throws NullPointerException if {@code supplier} is {@code null} */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Completable error(@NonNull Supplier errorSupplier) { - Objects.requireNonNull(errorSupplier, "errorSupplier is null"); - return RxJavaPlugins.onAssembly(new CompletableErrorSupplier(errorSupplier)); + public static Completable error(@NonNull Supplier supplier) { + Objects.requireNonNull(supplier, "supplier is null"); + return RxJavaPlugins.onAssembly(new CompletableErrorSupplier(supplier)); } /** @@ -401,16 +401,16 @@ public static Completable error(@NonNull Supplier errorSupp *
Scheduler:
*
{@code error} does not operate by default on a particular {@link Scheduler}.
* - * @param error the {@code Throwable} instance to emit, not {@code null} + * @param throwable the {@code Throwable} instance to emit, not {@code null} * @return the new {@code Completable} instance - * @throws NullPointerException if {@code error} is {@code null} + * @throws NullPointerException if {@code throwable} is {@code null} */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Completable error(@NonNull Throwable error) { - Objects.requireNonNull(error, "error is null"); - return RxJavaPlugins.onAssembly(new CompletableError(error)); + public static Completable error(@NonNull Throwable throwable) { + Objects.requireNonNull(throwable, "throwable is null"); + return RxJavaPlugins.onAssembly(new CompletableError(throwable)); } /** @@ -429,16 +429,16 @@ public static Completable error(@NonNull Throwable error) { * {@link RxJavaPlugins#onError(Throwable)} as an {@link io.reactivex.rxjava3.exceptions.UndeliverableException UndeliverableException}. * * - * @param run the {@code Action} to run for each subscribing {@link CompletableObserver} + * @param action the {@code Action} to run for each subscribing {@link CompletableObserver} * @return the new {@code Completable} instance - * @throws NullPointerException if {@code run} is {@code null} + * @throws NullPointerException if {@code action} is {@code null} */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Completable fromAction(@NonNull Action run) { - Objects.requireNonNull(run, "run is null"); - return RxJavaPlugins.onAssembly(new CompletableFromAction(run)); + public static Completable fromAction(@NonNull Action action) { + Objects.requireNonNull(action, "action is null"); + return RxJavaPlugins.onAssembly(new CompletableFromAction(action)); } /** @@ -1029,19 +1029,19 @@ private static NullPointerException toNpe(Throwable ex) { * * @param the resource type * @param resourceSupplier the {@link Supplier} that returns a resource to be managed. - * @param completableFunction the {@link Function} that given a resource returns a {@code CompletableSource} instance that will be subscribed to - * @param disposer the {@link Consumer} that disposes the resource created by the resource supplier + * @param sourceSupplier the {@link Function} that given a resource returns a {@code CompletableSource} instance that will be subscribed to + * @param resourceCleanup the {@link Consumer} that disposes the resource created by the resource supplier * @return the new {@code Completable} instance - * @throws NullPointerException if {@code resourceSupplier}, {@code completableFunction} - * or {@code disposer} is {@code null} + * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} + * or {@code resourceCleanup} is {@code null} */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull public static Completable using(@NonNull Supplier resourceSupplier, - @NonNull Function completableFunction, - @NonNull Consumer disposer) { - return using(resourceSupplier, completableFunction, disposer, true); + @NonNull Function sourceSupplier, + @NonNull Consumer resourceCleanup) { + return using(resourceSupplier, sourceSupplier, resourceCleanup, true); } /** @@ -1059,31 +1059,31 @@ public static Completable using(@NonNull Supplier resourceSupplier, * * @param the resource type * @param resourceSupplier the {@link Supplier} that returns a resource to be managed - * @param completableFunction the {@link Function} that given a resource returns a non-{@code null} + * @param sourceSupplier the {@link Function} that given a resource returns a non-{@code null} * {@code CompletableSource} instance that will be subscribed to - * @param disposer the {@link Consumer} that disposes the resource created by the resource supplier + * @param resourceCleanup the {@link Consumer} that disposes the resource created by the resource supplier * @param eager * If {@code true} then resource disposal will happen either on a {@code dispose()} call before the upstream is disposed * or just before the emission of a terminal event ({@code onComplete} or {@code onError}). * If {@code false} the resource disposal will happen either on a {@code dispose()} call after the upstream is disposed * or just after the emission of a terminal event ({@code onComplete} or {@code onError}). * @return the new {@code Completable} instance - * @throws NullPointerException if {@code resourceSupplier}, {@code completableFunction} - * or {@code disposer} is {@code null} + * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} + * or {@code resourceCleanup} is {@code null} */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) public static Completable using( @NonNull Supplier resourceSupplier, - @NonNull Function completableFunction, - @NonNull Consumer disposer, + @NonNull Function sourceSupplier, + @NonNull Consumer resourceCleanup, boolean eager) { Objects.requireNonNull(resourceSupplier, "resourceSupplier is null"); - Objects.requireNonNull(completableFunction, "completableFunction is null"); - Objects.requireNonNull(disposer, "disposer is null"); + Objects.requireNonNull(sourceSupplier, "sourceSupplier is null"); + Objects.requireNonNull(resourceCleanup, "resourceCleanup is null"); - return RxJavaPlugins.onAssembly(new CompletableUsing<>(resourceSupplier, completableFunction, disposer, eager)); + return RxJavaPlugins.onAssembly(new CompletableUsing<>(resourceSupplier, sourceSupplier, resourceCleanup, eager)); } /** @@ -1390,7 +1390,7 @@ public final Completable concatWith(@NonNull CompletableSource other) { *
Scheduler:
*
{@code delay} does operate by default on the {@code computation} {@link Scheduler}.
* - * @param delay the delay time + * @param time the delay time * @param unit the delay unit * @return the new {@code Completable} instance * @throws NullPointerException if {@code unit} is {@code null} @@ -1398,8 +1398,8 @@ public final Completable concatWith(@NonNull CompletableSource other) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.COMPUTATION) @NonNull - public final Completable delay(long delay, @NonNull TimeUnit unit) { - return delay(delay, unit, Schedulers.computation(), false); + public final Completable delay(long time, @NonNull TimeUnit unit) { + return delay(time, unit, Schedulers.computation(), false); } /** @@ -1411,7 +1411,7 @@ public final Completable delay(long delay, @NonNull TimeUnit unit) { *
Scheduler:
*
{@code delay} operates on the {@code Scheduler} you specify.
* - * @param delay the delay time + * @param time the delay time * @param unit the delay unit * @param scheduler the {@code Scheduler} to run the delayed completion on * @return the new {@code Completable} instance @@ -1420,8 +1420,8 @@ public final Completable delay(long delay, @NonNull TimeUnit unit) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull - public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { - return delay(delay, unit, scheduler, false); + public final Completable delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { + return delay(time, unit, scheduler, false); } /** @@ -1433,7 +1433,7 @@ public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Sche *
Scheduler:
*
{@code delay} operates on the {@code Scheduler} you specify.
* - * @param delay the delay time + * @param time the delay time * @param unit the delay unit * @param scheduler the {@code Scheduler} to run the delayed completion on * @param delayError delay the error emission as well? @@ -1443,10 +1443,10 @@ public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Sche @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.CUSTOM) - public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean delayError) { + public final Completable delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean delayError) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new CompletableDelay(this, delay, unit, scheduler, delayError)); + return RxJavaPlugins.onAssembly(new CompletableDelay(this, time, unit, scheduler, delayError)); } /** @@ -1459,7 +1459,7 @@ public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Sche * *

History: 2.2.3 - experimental * - * @param delay the time to delay the subscription + * @param time the time to delay the subscription * @param unit the time unit of {@code delay} * @return the new {@code Completable} instance * @throws NullPointerException if {@code unit} is {@code null} @@ -1469,8 +1469,8 @@ public final Completable delay(long delay, @NonNull TimeUnit unit, @NonNull Sche @CheckReturnValue @SchedulerSupport(SchedulerSupport.COMPUTATION) @NonNull - public final Completable delaySubscription(long delay, @NonNull TimeUnit unit) { - return delaySubscription(delay, unit, Schedulers.computation()); + public final Completable delaySubscription(long time, @NonNull TimeUnit unit) { + return delaySubscription(time, unit, Schedulers.computation()); } /** @@ -1483,7 +1483,7 @@ public final Completable delaySubscription(long delay, @NonNull TimeUnit unit) { *

You specify which {@code Scheduler} this operator will use.
* *

History: 2.2.3 - experimental - * @param delay the time to delay the subscription + * @param time the time to delay the subscription * @param unit the time unit of {@code delay} * @param scheduler the {@code Scheduler} on which the waiting and subscription will happen * @return the new {@code Completable} instance @@ -1494,8 +1494,8 @@ public final Completable delaySubscription(long delay, @NonNull TimeUnit unit) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull - public final Completable delaySubscription(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { - return Completable.timer(delay, unit, scheduler).andThen(this); + public final Completable delaySubscription(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { + return Completable.timer(time, unit, scheduler).andThen(this); } /** @@ -1974,17 +1974,17 @@ public final Completable onErrorComplete(@NonNull Predicate p *

Scheduler:
*
{@code onErrorResumeNext} does not operate by default on a particular {@link Scheduler}.
* - * @param errorMapper the {@code mapper} {@code Function} that takes the error and should return a {@code CompletableSource} as + * @param fallbackSupplier the {@code mapper} {@code Function} that takes the error and should return a {@code CompletableSource} as * continuation. * @return the new {@code Completable} instance - * @throws NullPointerException if {@code errorMapper} is {@code null} + * @throws NullPointerException if {@code fallbackSupplier} is {@code null} */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Completable onErrorResumeNext(@NonNull Function errorMapper) { - Objects.requireNonNull(errorMapper, "errorMapper is null"); - return RxJavaPlugins.onAssembly(new CompletableResumeNext(this, errorMapper)); + public final Completable onErrorResumeNext(@NonNull Function fallbackSupplier) { + Objects.requireNonNull(fallbackSupplier, "fallbackSupplier is null"); + return RxJavaPlugins.onAssembly(new CompletableResumeNext(this, fallbackSupplier)); } /** @@ -2544,16 +2544,16 @@ public final Completable timeout(long timeout, @NonNull TimeUnit unit) { * * @param timeout the timeout value * @param unit the unit of {@code timeout} - * @param other the other {@code CompletableSource} instance to switch to in case of a timeout + * @param fallback the other {@code CompletableSource} instance to switch to in case of a timeout * @return the new {@code Completable} instance - * @throws NullPointerException if {@code unit} or {@code other} is {@code null} + * @throws NullPointerException if {@code unit} or {@code fallback} is {@code null} */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.COMPUTATION) - public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull CompletableSource other) { - Objects.requireNonNull(other, "other is null"); - return timeout0(timeout, unit, Schedulers.computation(), other); + public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull CompletableSource fallback) { + Objects.requireNonNull(fallback, "fallback is null"); + return timeout0(timeout, unit, Schedulers.computation(), fallback); } /** @@ -2593,16 +2593,16 @@ public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull * @param timeout the timeout value * @param unit the unit of {@code timeout} * @param scheduler the {@code Scheduler} to use to wait for completion - * @param other the other {@code Completable} instance to switch to in case of a timeout + * @param fallback the other {@code Completable} instance to switch to in case of a timeout * @return the new {@code Completable} instance - * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code other} is {@code null} + * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code fallback} is {@code null} */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.CUSTOM) - public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull CompletableSource other) { - Objects.requireNonNull(other, "other is null"); - return timeout0(timeout, unit, scheduler, other); + public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull CompletableSource fallback) { + Objects.requireNonNull(fallback, "fallback is null"); + return timeout0(timeout, unit, scheduler, fallback); } /** @@ -2616,18 +2616,18 @@ public final Completable timeout(long timeout, @NonNull TimeUnit unit, @NonNull * @param timeout the timeout value * @param unit the unit of {@code timeout} * @param scheduler the {@code Scheduler} to use to wait for completion - * @param other the other {@code Completable} instance to switch to in case of a timeout, + * @param fallback the other {@code Completable} instance to switch to in case of a timeout, * if {@code null} a {@link TimeoutException} is emitted instead * @return the new {@code Completable} instance - * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code other} is {@code null} + * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code fallback} is {@code null} */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.CUSTOM) - private Completable timeout0(long timeout, TimeUnit unit, Scheduler scheduler, CompletableSource other) { + private Completable timeout0(long timeout, TimeUnit unit, Scheduler scheduler, CompletableSource fallback) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new CompletableTimeout(this, timeout, unit, scheduler, other)); + return RxJavaPlugins.onAssembly(new CompletableTimeout(this, timeout, unit, scheduler, fallback)); } /** diff --git a/src/main/java/io/reactivex/rxjava3/core/Flowable.java b/src/main/java/io/reactivex/rxjava3/core/Flowable.java index 54bc24fca0..038c3f680b 100644 --- a/src/main/java/io/reactivex/rxjava3/core/Flowable.java +++ b/src/main/java/io/reactivex/rxjava3/core/Flowable.java @@ -2178,9 +2178,9 @@ public static Flowable error(@NonNull Throwable throwable) { *
{@code fromPublisher} does not operate by default on a particular {@link Scheduler}.
* * @param the value type of the flow - * @param source the {@code Publisher} to convert + * @param publisher the {@code Publisher} to convert * @return the new {@code Flowable} instance - * @throws NullPointerException if the {@code source} {@code Publisher} is {@code null} + * @throws NullPointerException if {@code publisher} is {@code null} * @see #create(FlowableOnSubscribe, BackpressureStrategy) */ @CheckReturnValue @@ -2188,13 +2188,13 @@ public static Flowable error(@NonNull Throwable throwable) { @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings("unchecked") - public static Flowable fromPublisher(@NonNull Publisher<@NonNull ? extends T> source) { - if (source instanceof Flowable) { - return RxJavaPlugins.onAssembly((Flowable)source); + public static Flowable fromPublisher(@NonNull Publisher<@NonNull ? extends T> publisher) { + if (publisher instanceof Flowable) { + return RxJavaPlugins.onAssembly((Flowable)publisher); } - Objects.requireNonNull(source, "source is null"); + Objects.requireNonNull(publisher, "publisher is null"); - return RxJavaPlugins.onAssembly(new FlowableFromPublisher<>(source)); + return RxJavaPlugins.onAssembly(new FlowableFromPublisher<>(publisher)); } /** @@ -4514,10 +4514,10 @@ public static Flowable unsafeCreate(@NonNull Publisher onSubscribe) { * the factory function to create a resource object that depends on the {@code Publisher} * @param sourceSupplier * the factory function to create a {@code Publisher} - * @param resourceDisposer + * @param resourceCleanup * the function that will dispose of the resource * @return the new {@code Flowable} instance - * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceDisposer} is {@code null} + * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceCleanup} is {@code null} * @see ReactiveX operators documentation: Using */ @CheckReturnValue @@ -4527,8 +4527,8 @@ public static Flowable unsafeCreate(@NonNull Publisher onSubscribe) { public static Flowable using( @NonNull Supplier resourceSupplier, @NonNull Function> sourceSupplier, - @NonNull Consumer resourceDisposer) { - return using(resourceSupplier, sourceSupplier, resourceDisposer, true); + @NonNull Consumer resourceCleanup) { + return using(resourceSupplier, sourceSupplier, resourceCleanup, true); } /** @@ -4551,7 +4551,7 @@ public static Flowable using( * the factory function to create a resource object that depends on the {@code Publisher} * @param sourceSupplier * the factory function to create a {@code Publisher} - * @param resourceDisposer + * @param resourceCleanup * the function that will dispose of the resource * @param eager * If {@code true}, the resource disposal will happen either on a {@code cancel()} call before the upstream is disposed @@ -4559,7 +4559,7 @@ public static Flowable using( * If {@code false} the resource disposal will happen either on a {@code cancel()} call after the upstream is disposed * or just after the emission of a terminal event ({@code onComplete} or {@code onError}). * @return the new {@code Flowable} instance - * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceDisposer} is {@code null} + * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceCleanup} is {@code null} * @see ReactiveX operators documentation: Using * @since 2.0 */ @@ -4570,12 +4570,12 @@ public static Flowable using( public static Flowable using( @NonNull Supplier resourceSupplier, @NonNull Function> sourceSupplier, - @NonNull Consumer resourceDisposer, + @NonNull Consumer resourceCleanup, boolean eager) { Objects.requireNonNull(resourceSupplier, "resourceSupplier is null"); Objects.requireNonNull(sourceSupplier, "sourceSupplier is null"); - Objects.requireNonNull(resourceDisposer, "resourceDisposer is null"); - return RxJavaPlugins.onAssembly(new FlowableUsing(resourceSupplier, sourceSupplier, resourceDisposer, eager)); + Objects.requireNonNull(resourceCleanup, "resourceCleanup is null"); + return RxJavaPlugins.onAssembly(new FlowableUsing(resourceSupplier, sourceSupplier, resourceCleanup, eager)); } /** @@ -5944,6 +5944,7 @@ public final Iterable blockingLatest() { * the initial item that the {@code Iterable} sequence will yield if this * {@code Flowable} has not yet emitted an item * @return the new {@code Iterable} instance + * @throws NullPointerException if {@code initialItem} is {@code null} * @see ReactiveX documentation: First */ @CheckReturnValue @@ -5951,6 +5952,7 @@ public final Iterable blockingLatest() { @SchedulerSupport(SchedulerSupport.NONE) @NonNull public final Iterable blockingMostRecent(@NonNull T initialItem) { + Objects.requireNonNull(initialItem, "initialItem is null"); return new BlockingFlowableMostRecent<>(this, initialItem); } @@ -8616,7 +8618,7 @@ public final Flowable delay(@NonNull FunctionThis version of {@code delay} operates by default on the {@code computation} {@link Scheduler}. * * - * @param delay + * @param time * the delay to shift the source by * @param unit * the {@link TimeUnit} in which {@code period} is defined @@ -8628,8 +8630,8 @@ public final Flowable delay(@NonNull Function delay(long delay, @NonNull TimeUnit unit) { - return delay(delay, unit, Schedulers.computation(), false); + public final Flowable delay(long time, @NonNull TimeUnit unit) { + return delay(time, unit, Schedulers.computation(), false); } /** @@ -8644,7 +8646,7 @@ public final Flowable delay(long delay, @NonNull TimeUnit unit) { *
This version of {@code delay} operates by default on the {@code computation} {@link Scheduler}.
* * - * @param delay + * @param time * the delay to shift the source by * @param unit * the {@link TimeUnit} in which {@code period} is defined @@ -8659,8 +8661,8 @@ public final Flowable delay(long delay, @NonNull TimeUnit unit) { @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.COMPUTATION) @NonNull - public final Flowable delay(long delay, @NonNull TimeUnit unit, boolean delayError) { - return delay(delay, unit, Schedulers.computation(), delayError); + public final Flowable delay(long time, @NonNull TimeUnit unit, boolean delayError) { + return delay(time, unit, Schedulers.computation(), delayError); } /** @@ -8675,7 +8677,7 @@ public final Flowable delay(long delay, @NonNull TimeUnit unit, boolean delay *
You specify which {@link Scheduler} this operator will use.
* * - * @param delay + * @param time * the delay to shift the source by * @param unit * the time unit of {@code delay} @@ -8689,8 +8691,8 @@ public final Flowable delay(long delay, @NonNull TimeUnit unit, boolean delay @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull - public final Flowable delay(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { - return delay(delay, unit, scheduler, false); + public final Flowable delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { + return delay(time, unit, scheduler, false); } /** @@ -8705,7 +8707,7 @@ public final Flowable delay(long delay, @NonNull TimeUnit unit, @NonNull Sche *
You specify which {@link Scheduler} this operator will use.
* * - * @param delay + * @param time * the delay to shift the source by * @param unit * the time unit of {@code delay} @@ -8722,11 +8724,11 @@ public final Flowable delay(long delay, @NonNull TimeUnit unit, @NonNull Sche @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.CUSTOM) - public final Flowable delay(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean delayError) { + public final Flowable delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean delayError) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new FlowableDelay<>(this, Math.max(0L, delay), unit, scheduler, delayError)); + return RxJavaPlugins.onAssembly(new FlowableDelay<>(this, Math.max(0L, time), unit, scheduler, delayError)); } /** @@ -8807,7 +8809,7 @@ public final Flowable delaySubscription(@NonNull Publisher subscriptio *
This version of {@code delaySubscription} operates by default on the {@code computation} {@link Scheduler}.
* * - * @param delay + * @param time * the time to delay the subscription * @param unit * the time unit of {@code delay} @@ -8819,8 +8821,8 @@ public final Flowable delaySubscription(@NonNull Publisher subscriptio @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.COMPUTATION) @NonNull - public final Flowable delaySubscription(long delay, @NonNull TimeUnit unit) { - return delaySubscription(delay, unit, Schedulers.computation()); + public final Flowable delaySubscription(long time, @NonNull TimeUnit unit) { + return delaySubscription(time, unit, Schedulers.computation()); } /** @@ -8835,7 +8837,7 @@ public final Flowable delaySubscription(long delay, @NonNull TimeUnit unit) { *
You specify which {@code Scheduler} this operator will use.
* * - * @param delay + * @param time * the time to delay the subscription * @param unit * the time unit of {@code delay} @@ -8849,8 +8851,8 @@ public final Flowable delaySubscription(long delay, @NonNull TimeUnit unit) { @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull - public final Flowable delaySubscription(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { - return delaySubscription(timer(delay, unit, scheduler)); + public final Flowable delaySubscription(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { + return delaySubscription(timer(time, unit, scheduler)); } /** @@ -12334,20 +12336,20 @@ public final Flowable onBackpressureLatest() { *
{@code onErrorResumeNext} does not operate by default on a particular {@link Scheduler}.
* * - * @param resumeFunction + * @param fallbackSupplier * a function that returns a {@code Publisher} that will take over if the current {@code Flowable} encounters * an error * @return the new {@code Flowable} instance - * @throws NullPointerException if {@code resumeFunction} is {@code null} + * @throws NullPointerException if {@code fallbackSupplier} is {@code null} * @see ReactiveX operators documentation: Catch */ @CheckReturnValue @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable onErrorResumeNext(@NonNull Function> resumeFunction) { - Objects.requireNonNull(resumeFunction, "resumeFunction is null"); - return RxJavaPlugins.onAssembly(new FlowableOnErrorNext<>(this, resumeFunction)); + public final Flowable onErrorResumeNext(@NonNull Function> fallbackSupplier) { + Objects.requireNonNull(fallbackSupplier, "fallbackSupplier is null"); + return RxJavaPlugins.onAssembly(new FlowableOnErrorNext<>(this, fallbackSupplier)); } /** @@ -12379,20 +12381,20 @@ public final Flowable onErrorResumeNext(@NonNull Function{@code onErrorResumeWith} does not operate by default on a particular {@link Scheduler}. * * - * @param next + * @param fallback * the next {@code Publisher} source that will take over if the current {@code Flowable} encounters * an error * @return the new {@code Flowable} instance - * @throws NullPointerException if {@code next} is {@code null} + * @throws NullPointerException if {@code fallback} is {@code null} * @see ReactiveX operators documentation: Catch */ @CheckReturnValue @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable onErrorResumeWith(@NonNull Publisher<@NonNull ? extends T> next) { - Objects.requireNonNull(next, "next is null"); - return onErrorResumeNext(Functions.justFunction(next)); + public final Flowable onErrorResumeWith(@NonNull Publisher<@NonNull ? extends T> fallback) { + Objects.requireNonNull(fallback, "fallback is null"); + return onErrorResumeNext(Functions.justFunction(fallback)); } /** @@ -12420,20 +12422,20 @@ public final Flowable onErrorResumeWith(@NonNull Publisher<@NonNull ? extends *
{@code onErrorReturn} does not operate by default on a particular {@link Scheduler}.
* * - * @param valueSupplier + * @param itemSupplier * a function that returns a single value that will be emitted along with a regular {@code onComplete} in case * the current {@code Flowable} signals an {@code onError} event * @return the new {@code Flowable} instance - * @throws NullPointerException if {@code valueSupplier} is {@code null} + * @throws NullPointerException if {@code itemSupplier} is {@code null} * @see ReactiveX operators documentation: Catch */ @CheckReturnValue @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable onErrorReturn(@NonNull Function valueSupplier) { - Objects.requireNonNull(valueSupplier, "valueSupplier is null"); - return RxJavaPlugins.onAssembly(new FlowableOnErrorReturn<>(this, valueSupplier)); + public final Flowable onErrorReturn(@NonNull Function itemSupplier) { + Objects.requireNonNull(itemSupplier, "itemSupplier is null"); + return RxJavaPlugins.onAssembly(new FlowableOnErrorReturn<>(this, itemSupplier)); } /** @@ -16918,19 +16920,19 @@ public final Flowable timeout(@NonNull FunctionReactiveX operators documentation: Timeout */ @CheckReturnValue @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) - public final Flowable timeout(@NonNull Function> itemTimeoutIndicator, @NonNull Publisher<@NonNull ? extends T> other) { - Objects.requireNonNull(other, "other is null"); - return timeout0(null, itemTimeoutIndicator, other); + public final Flowable timeout(@NonNull Function> itemTimeoutIndicator, @NonNull Publisher<@NonNull ? extends T> fallback) { + Objects.requireNonNull(fallback, "fallback is null"); + return timeout0(null, itemTimeoutIndicator, fallback); } /** @@ -16983,19 +16985,19 @@ public final Flowable timeout(long timeout, @NonNull TimeUnit unit) { * maximum duration between items before a timeout occurs * @param unit * the unit of time that applies to the {@code timeout} argument - * @param other + * @param fallback * the fallback {@code Publisher} to use in case of a timeout * @return the new {@code Flowable} instance - * @throws NullPointerException if {@code unit} or {@code other} is {@code null} + * @throws NullPointerException if {@code unit} or {@code fallback} is {@code null} * @see ReactiveX operators documentation: Timeout */ @CheckReturnValue @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.COMPUTATION) - public final Flowable timeout(long timeout, @NonNull TimeUnit unit, @NonNull Publisher<@NonNull ? extends T> other) { - Objects.requireNonNull(other, "other is null"); - return timeout0(timeout, unit, other, Schedulers.computation()); + public final Flowable timeout(long timeout, @NonNull TimeUnit unit, @NonNull Publisher<@NonNull ? extends T> fallback) { + Objects.requireNonNull(fallback, "fallback is null"); + return timeout0(timeout, unit, fallback, Schedulers.computation()); } /** @@ -17021,19 +17023,19 @@ public final Flowable timeout(long timeout, @NonNull TimeUnit unit, @NonNull * the unit of time that applies to the {@code timeout} argument * @param scheduler * the {@code Scheduler} to run the timeout timers on - * @param other + * @param fallback * the {@code Publisher} to use as the fallback in case of a timeout * @return the new {@code Flowable} instance - * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code other} is {@code null} + * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code fallback} is {@code null} * @see ReactiveX operators documentation: Timeout */ @CheckReturnValue @NonNull @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.CUSTOM) - public final Flowable timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull Publisher<@NonNull ? extends T> other) { - Objects.requireNonNull(other, "other is null"); - return timeout0(timeout, unit, other, scheduler); + public final Flowable timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull Publisher<@NonNull ? extends T> fallback) { + Objects.requireNonNull(fallback, "fallback is null"); + return timeout0(timeout, unit, fallback, scheduler); } /** @@ -17136,10 +17138,10 @@ public final Flowable timeout(@NonNull Publisher firstTimeoutIndica * a function that returns a {@code Publisher} for each item emitted by the current {@code Flowable} and that * determines the timeout window in which the subsequent source item must arrive in order to * continue the sequence - * @param other + * @param fallback * the fallback {@code Publisher} to switch to if the current {@code Flowable} times out * @return the new {@code Flowable} instance - * @throws NullPointerException if {@code firstTimeoutIndicator}, {@code itemTimeoutIndicator} or {@code other} is {@code null} + * @throws NullPointerException if {@code firstTimeoutIndicator}, {@code itemTimeoutIndicator} or {@code fallback} is {@code null} * @see ReactiveX operators documentation: Timeout */ @CheckReturnValue @@ -17149,25 +17151,25 @@ public final Flowable timeout(@NonNull Publisher firstTimeoutIndica public final Flowable timeout( @NonNull Publisher firstTimeoutIndicator, @NonNull Function> itemTimeoutIndicator, - @NonNull Publisher<@NonNull ? extends T> other) { + @NonNull Publisher<@NonNull ? extends T> fallback) { Objects.requireNonNull(firstTimeoutIndicator, "firstTimeoutIndicator is null"); - Objects.requireNonNull(other, "other is null"); - return timeout0(firstTimeoutIndicator, itemTimeoutIndicator, other); + Objects.requireNonNull(fallback, "fallback is null"); + return timeout0(firstTimeoutIndicator, itemTimeoutIndicator, fallback); } - private Flowable timeout0(long timeout, TimeUnit unit, Publisher<@NonNull ? extends T> other, + private Flowable timeout0(long timeout, TimeUnit unit, Publisher<@NonNull ? extends T> fallback, Scheduler scheduler) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new FlowableTimeoutTimed<>(this, timeout, unit, scheduler, other)); + return RxJavaPlugins.onAssembly(new FlowableTimeoutTimed<>(this, timeout, unit, scheduler, fallback)); } private Flowable timeout0( Publisher firstTimeoutIndicator, Function> itemTimeoutIndicator, - Publisher<@NonNull ? extends T> other) { + Publisher<@NonNull ? extends T> fallback) { Objects.requireNonNull(itemTimeoutIndicator, "itemTimeoutIndicator is null"); - return RxJavaPlugins.onAssembly(new FlowableTimeout<>(this, firstTimeoutIndicator, itemTimeoutIndicator, other)); + return RxJavaPlugins.onAssembly(new FlowableTimeout<>(this, firstTimeoutIndicator, itemTimeoutIndicator, fallback)); } /** diff --git a/src/main/java/io/reactivex/rxjava3/core/Maybe.java b/src/main/java/io/reactivex/rxjava3/core/Maybe.java index 82cb7545c2..4322afaa93 100644 --- a/src/main/java/io/reactivex/rxjava3/core/Maybe.java +++ b/src/main/java/io/reactivex/rxjava3/core/Maybe.java @@ -620,17 +620,17 @@ public static Maybe create(@NonNull MaybeOnSubscribe onSubscribe) { *
{@code defer} does not operate by default on a particular {@link Scheduler}.
* * @param the value type - * @param maybeSupplier the {@code Supplier} that is called for each individual {@code MaybeObserver} and + * @param supplier the {@code Supplier} that is called for each individual {@code MaybeObserver} and * returns a {@code MaybeSource} instance to subscribe to * @return the new {@code Maybe} instance - * @throws NullPointerException if {@code maybeSupplier} is {@code null} + * @throws NullPointerException if {@code supplier} is {@code null} */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe defer(@NonNull Supplier> maybeSupplier) { - Objects.requireNonNull(maybeSupplier, "maybeSupplier is null"); - return RxJavaPlugins.onAssembly(new MaybeDefer<>(maybeSupplier)); + public static Maybe defer(@NonNull Supplier> supplier) { + Objects.requireNonNull(supplier, "supplier is null"); + return RxJavaPlugins.onAssembly(new MaybeDefer<>(supplier)); } /** @@ -663,20 +663,20 @@ public static Maybe empty() { *
{@code error} does not operate by default on a particular {@link Scheduler}.
* * - * @param error + * @param throwable * the particular {@link Throwable} to pass to {@link MaybeObserver#onError onError} * @param * the type of the item (ostensibly) emitted by the {@code Maybe} * @return the new {@code Maybe} instance - * @throws NullPointerException if {@code error} is {@code null} + * @throws NullPointerException if {@code throwable} is {@code null} * @see ReactiveX operators documentation: Throw */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe error(@NonNull Throwable error) { - Objects.requireNonNull(error, "error is null"); - return RxJavaPlugins.onAssembly(new MaybeError<>(error)); + public static Maybe error(@NonNull Throwable throwable) { + Objects.requireNonNull(throwable, "throwable is null"); + return RxJavaPlugins.onAssembly(new MaybeError<>(throwable)); } /** @@ -760,16 +760,16 @@ public static Maybe fromCompletable(@NonNull CompletableSource completabl *
{@code fromSingle} does not operate by default on a particular {@link Scheduler}.
* * @param the target type - * @param singleSource the {@code SingleSource} to convert from + * @param single the {@code SingleSource} to convert from * @return the new {@code Maybe} instance - * @throws NullPointerException if {@code singleSource} is {@code null} + * @throws NullPointerException if {@code single} is {@code null} */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Maybe fromSingle(@NonNull SingleSource singleSource) { - Objects.requireNonNull(singleSource, "singleSource is null"); - return RxJavaPlugins.onAssembly(new MaybeFromSingle<>(singleSource)); + public static Maybe fromSingle(@NonNull SingleSource single) { + Objects.requireNonNull(single, "single is null"); + return RxJavaPlugins.onAssembly(new MaybeFromSingle<>(single)); } /** @@ -1799,9 +1799,10 @@ public static Maybe unsafeCreate(@NonNull MaybeSource onSubscribe) { * the factory function to create a resource object that depends on the {@code Maybe} * @param sourceSupplier * the factory function to create a {@code MaybeSource} - * @param resourceDisposer + * @param resourceCleanup * the function that will dispose of the resource * @return the new {@code Maybe} instance + * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceCleanup} is {@code null} * @see ReactiveX operators documentation: Using */ @CheckReturnValue @@ -1809,8 +1810,8 @@ public static Maybe unsafeCreate(@NonNull MaybeSource onSubscribe) { @NonNull public static Maybe using(@NonNull Supplier resourceSupplier, @NonNull Function> sourceSupplier, - @NonNull Consumer resourceDisposer) { - return using(resourceSupplier, sourceSupplier, resourceDisposer, true); + @NonNull Consumer resourceCleanup) { + return using(resourceSupplier, sourceSupplier, resourceCleanup, true); } /** @@ -1832,7 +1833,7 @@ public static Maybe using(@NonNull Supplier resourceSuppl * the factory function to create a resource object that depends on the {@code Maybe} * @param sourceSupplier * the factory function to create a {@code MaybeSource} - * @param resourceDisposer + * @param resourceCleanup * the function that will dispose of the resource * @param eager * If {@code true} then resource disposal will happen either on a {@code dispose()} call before the upstream is disposed @@ -1840,7 +1841,7 @@ public static Maybe using(@NonNull Supplier resourceSuppl * If {@code false} the resource disposal will happen either on a {@code dispose()} call after the upstream is disposed * or just after the emission of a terminal event ({@code onSuccess}, {@code onComplete} or {@code onError}). * @return the new {@code Maybe} instance - * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceDisposer} is {@code null} + * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceCleanup} is {@code null} * @see ReactiveX operators documentation: Using */ @CheckReturnValue @@ -1848,11 +1849,11 @@ public static Maybe using(@NonNull Supplier resourceSuppl @SchedulerSupport(SchedulerSupport.NONE) public static Maybe using(@NonNull Supplier resourceSupplier, @NonNull Function> sourceSupplier, - @NonNull Consumer resourceDisposer, boolean eager) { + @NonNull Consumer resourceCleanup, boolean eager) { Objects.requireNonNull(resourceSupplier, "resourceSupplier is null"); Objects.requireNonNull(sourceSupplier, "sourceSupplier is null"); - Objects.requireNonNull(resourceDisposer, "resourceDisposer is null"); - return RxJavaPlugins.onAssembly(new MaybeUsing(resourceSupplier, sourceSupplier, resourceDisposer, eager)); + Objects.requireNonNull(resourceCleanup, "resourceCleanup is null"); + return RxJavaPlugins.onAssembly(new MaybeUsing(resourceSupplier, sourceSupplier, resourceCleanup, eager)); } /** @@ -2678,7 +2679,7 @@ public final Single defaultIfEmpty(@NonNull T defaultItem) { *
This version of {@code delay} operates by default on the {@code computation} {@link Scheduler}.
* * - * @param delay + * @param time * the delay to shift the source by * @param unit * the {@link TimeUnit} in which {@code period} is defined @@ -2690,8 +2691,8 @@ public final Single defaultIfEmpty(@NonNull T defaultItem) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.COMPUTATION) @NonNull - public final Maybe delay(long delay, @NonNull TimeUnit unit) { - return delay(delay, unit, Schedulers.computation()); + public final Maybe delay(long time, @NonNull TimeUnit unit) { + return delay(time, unit, Schedulers.computation()); } /** @@ -2704,7 +2705,7 @@ public final Maybe delay(long delay, @NonNull TimeUnit unit) { *
you specify which {@code Scheduler} this operator will use.
* * - * @param delay + * @param time * the delay to shift the source by * @param unit * the time unit of {@code delay} @@ -2717,10 +2718,10 @@ public final Maybe delay(long delay, @NonNull TimeUnit unit) { @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.CUSTOM) - public final Maybe delay(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { + public final Maybe delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new MaybeDelay<>(this, Math.max(0L, delay), unit, scheduler)); + return RxJavaPlugins.onAssembly(new MaybeDelay<>(this, Math.max(0L, time), unit, scheduler)); } /** @@ -2789,7 +2790,7 @@ public final Maybe delaySubscription(@NonNull Publisher subscriptionIn *
This version of {@code delaySubscription} operates by default on the {@code computation} {@link Scheduler}.
* * - * @param delay + * @param time * the time to delay the subscription * @param unit * the time unit of {@code delay} @@ -2801,8 +2802,8 @@ public final Maybe delaySubscription(@NonNull Publisher subscriptionIn @CheckReturnValue @SchedulerSupport(SchedulerSupport.COMPUTATION) @NonNull - public final Maybe delaySubscription(long delay, @NonNull TimeUnit unit) { - return delaySubscription(delay, unit, Schedulers.computation()); + public final Maybe delaySubscription(long time, @NonNull TimeUnit unit) { + return delaySubscription(time, unit, Schedulers.computation()); } /** @@ -2815,7 +2816,7 @@ public final Maybe delaySubscription(long delay, @NonNull TimeUnit unit) { *
You specify which {@code Scheduler} this operator will use.
* * - * @param delay + * @param time * the time to delay the subscription * @param unit * the time unit of {@code delay} @@ -2828,8 +2829,8 @@ public final Maybe delaySubscription(long delay, @NonNull TimeUnit unit) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull - public final Maybe delaySubscription(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { - return delaySubscription(Flowable.timer(delay, unit, scheduler)); + public final Maybe delaySubscription(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { + return delaySubscription(Flowable.timer(time, unit, scheduler)); } /** @@ -3198,21 +3199,21 @@ public final Maybe flatMap( * the type of items emitted by the resulting {@code Maybe} * @param mapper * a function that returns a {@code MaybeSource} for the item emitted by the current {@code Maybe} - * @param resultSelector + * @param combiner * a function that combines one item emitted by each of the source and collection {@code MaybeSource} and * returns an item to be emitted by the resulting {@code MaybeSource} * @return the new {@code Maybe} instance - * @throws NullPointerException if {@code mapper} or {@code resultSelector} is {@code null} + * @throws NullPointerException if {@code mapper} or {@code combiner} is {@code null} * @see ReactiveX operators documentation: FlatMap */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) public final Maybe flatMap(@NonNull Function> mapper, - @NonNull BiFunction resultSelector) { + @NonNull BiFunction combiner) { Objects.requireNonNull(mapper, "mapper is null"); - Objects.requireNonNull(resultSelector, "resultSelector is null"); - return RxJavaPlugins.onAssembly(new MaybeFlatMapBiSelector<>(this, mapper, resultSelector)); + Objects.requireNonNull(combiner, "combiner is null"); + return RxJavaPlugins.onAssembly(new MaybeFlatMapBiSelector<>(this, mapper, combiner)); } /** @@ -3880,19 +3881,19 @@ public final Maybe onErrorComplete(@NonNull Predicate pred *
{@code onErrorResumeWith} does not operate by default on a particular {@link Scheduler}.
* * - * @param next + * @param fallback * the next {@code MaybeSource} that will take over if the current {@code Maybe} encounters * an error * @return the new {@code Maybe} instance - * @throws NullPointerException if {@code next} is {@code null} + * @throws NullPointerException if {@code fallback} is {@code null} * @see ReactiveX operators documentation: Catch */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe onErrorResumeWith(@NonNull MaybeSource next) { - Objects.requireNonNull(next, "next is null"); - return onErrorResumeNext(Functions.justFunction(next)); + public final Maybe onErrorResumeWith(@NonNull MaybeSource fallback) { + Objects.requireNonNull(fallback, "fallback is null"); + return onErrorResumeNext(Functions.justFunction(fallback)); } /** @@ -3908,19 +3909,19 @@ public final Maybe onErrorResumeWith(@NonNull MaybeSource next) *
{@code onErrorResumeNext} does not operate by default on a particular {@link Scheduler}.
* * - * @param resumeFunction + * @param fallbackSupplier * a function that returns a {@code MaybeSource} that will take over if the current {@code Maybe} encounters * an error * @return the new {@code Maybe} instance - * @throws NullPointerException if {@code resumeFunction} is {@code null} + * @throws NullPointerException if {@code fallbackSupplier} is {@code null} * @see ReactiveX operators documentation: Catch */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe onErrorResumeNext(@NonNull Function> resumeFunction) { - Objects.requireNonNull(resumeFunction, "resumeFunction is null"); - return RxJavaPlugins.onAssembly(new MaybeOnErrorNext<>(this, resumeFunction)); + public final Maybe onErrorResumeNext(@NonNull Function> fallbackSupplier) { + Objects.requireNonNull(fallbackSupplier, "fallbackSupplier is null"); + return RxJavaPlugins.onAssembly(new MaybeOnErrorNext<>(this, fallbackSupplier)); } /** @@ -3936,19 +3937,19 @@ public final Maybe onErrorResumeNext(@NonNull Function{@code onErrorReturn} does not operate by default on a particular {@link Scheduler}. * * - * @param valueSupplier + * @param itemSupplier * a function that returns a single value that will be emitted as success value * the current {@code Maybe} signals an {@code onError} event * @return the new {@code Maybe} instance - * @throws NullPointerException if {@code valueSupplier} is {@code null} + * @throws NullPointerException if {@code itemSupplier} is {@code null} * @see ReactiveX operators documentation: Catch */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Maybe onErrorReturn(@NonNull Function valueSupplier) { - Objects.requireNonNull(valueSupplier, "valueSupplier is null"); - return RxJavaPlugins.onAssembly(new MaybeOnErrorReturn<>(this, valueSupplier)); + public final Maybe onErrorReturn(@NonNull Function itemSupplier) { + Objects.requireNonNull(itemSupplier, "itemSupplier is null"); + return RxJavaPlugins.onAssembly(new MaybeOnErrorReturn<>(this, itemSupplier)); } /** diff --git a/src/main/java/io/reactivex/rxjava3/core/Observable.java b/src/main/java/io/reactivex/rxjava3/core/Observable.java index 0ea4c18b47..57456a9545 100644 --- a/src/main/java/io/reactivex/rxjava3/core/Observable.java +++ b/src/main/java/io/reactivex/rxjava3/core/Observable.java @@ -1692,20 +1692,20 @@ public static Observable empty() { *
{@code error} does not operate by default on a particular {@link Scheduler}.
* * - * @param errorSupplier + * @param supplier * a {@link Supplier} factory to return a {@link Throwable} for each individual {@code Observer} * @param * the type of the items (ostensibly) emitted by the {@code Observable} * @return the new {@code Observable} instance - * @throws NullPointerException if {@code errorSupplier} is {@code null} + * @throws NullPointerException if {@code supplier} is {@code null} * @see ReactiveX operators documentation: Throw */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable error(@NonNull Supplier errorSupplier) { - Objects.requireNonNull(errorSupplier, "errorSupplier is null"); - return RxJavaPlugins.onAssembly(new ObservableError<>(errorSupplier)); + public static Observable error(@NonNull Supplier supplier) { + Objects.requireNonNull(supplier, "supplier is null"); + return RxJavaPlugins.onAssembly(new ObservableError<>(supplier)); } /** @@ -1718,20 +1718,20 @@ public static Observable error(@NonNull Supplier err *
{@code error} does not operate by default on a particular {@link Scheduler}.
* * - * @param exception + * @param throwable * the particular {@link Throwable} to pass to {@link Observer#onError onError} * @param * the type of the items (ostensibly) emitted by the {@code Observable} * @return the new {@code Observable} instance - * @throws NullPointerException if {@code exception} is {@code null} + * @throws NullPointerException if {@code throwable} is {@code null} * @see ReactiveX operators documentation: Throw */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Observable error(@NonNull Throwable exception) { - Objects.requireNonNull(exception, "exception is null"); - return error(Functions.justSupplier(exception)); + public static Observable error(@NonNull Throwable throwable) { + Objects.requireNonNull(throwable, "throwable is null"); + return error(Functions.justSupplier(throwable)); } /** @@ -4082,9 +4082,10 @@ public static Observable unsafeCreate(@NonNull ObservableSource onSubs * the factory function to create a resource object that depends on the {@code ObservableSource} * @param sourceSupplier * the factory function to create an {@code ObservableSource} - * @param resourceDisposer + * @param resourceCleanup * the function that will dispose of the resource * @return the new {@code Observable} instance + * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceCleanup} is {@code null} * @see ReactiveX operators documentation: Using */ @CheckReturnValue @@ -4093,8 +4094,8 @@ public static Observable unsafeCreate(@NonNull ObservableSource onSubs public static Observable using( @NonNull Supplier resourceSupplier, @NonNull Function> sourceSupplier, - @NonNull Consumer resourceDisposer) { - return using(resourceSupplier, sourceSupplier, resourceDisposer, true); + @NonNull Consumer resourceCleanup) { + return using(resourceSupplier, sourceSupplier, resourceCleanup, true); } /** @@ -4114,7 +4115,7 @@ public static Observable using( * the factory function to create a resource object that depends on the {@code ObservableSource} * @param sourceSupplier * the factory function to create an {@code ObservableSource} - * @param resourceDisposer + * @param resourceCleanup * the function that will dispose of the resource * @param eager * If {@code true}, the resource disposal will happen either on a {@code dispose()} call before the upstream is disposed @@ -4122,7 +4123,7 @@ public static Observable using( * If {@code false}, the resource disposal will happen either on a {@code dispose()} call after the upstream is disposed * or just after the emission of a terminal event ({@code onComplete} or {@code onError}). * @return the new {@code Observable} instance - * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} and {@code resourceDisposer} is {@code null} + * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} and {@code resourceCleanup} is {@code null} * @see ReactiveX operators documentation: Using * @since 2.0 */ @@ -4132,11 +4133,11 @@ public static Observable using( public static Observable using( @NonNull Supplier resourceSupplier, @NonNull Function> sourceSupplier, - @NonNull Consumer resourceDisposer, boolean eager) { + @NonNull Consumer resourceCleanup, boolean eager) { Objects.requireNonNull(resourceSupplier, "resourceSupplier is null"); Objects.requireNonNull(sourceSupplier, "sourceSupplier is null"); - Objects.requireNonNull(resourceDisposer, "resourceDisposer is null"); - return RxJavaPlugins.onAssembly(new ObservableUsing(resourceSupplier, sourceSupplier, resourceDisposer, eager)); + Objects.requireNonNull(resourceCleanup, "resourceCleanup is null"); + return RxJavaPlugins.onAssembly(new ObservableUsing(resourceSupplier, sourceSupplier, resourceCleanup, eager)); } /** @@ -5428,17 +5429,19 @@ public final Iterable blockingLatest() { *
{@code blockingMostRecent} does not operate by default on a particular {@link Scheduler}.
* * - * @param initialValue + * @param initialItem * the initial value that the {@code Iterable} sequence will yield if the current * {@code Observable} has not yet emitted an item * @return the new {@code Iterable} instance + * @throws NullPointerException if {@code initialItem} is {@code null} * @see ReactiveX documentation: First */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Iterable blockingMostRecent(@NonNull T initialValue) { - return new BlockingObservableMostRecent<>(this, initialValue); + public final Iterable blockingMostRecent(@NonNull T initialItem) { + Objects.requireNonNull(initialItem, "initialItem is null"); + return new BlockingObservableMostRecent<>(this, initialItem); } /** @@ -6236,23 +6239,23 @@ public final > Observable buffer(int count, i * @param the collection subclass type to buffer into * @param * the boundary value type (ignored) - * @param boundary + * @param boundaryIndicator * the boundary {@code ObservableSource} * @param bufferSupplier * a factory function that returns an instance of the collection subclass to be used and returned * as the buffer * @return the new {@code Observable} instance - * @throws NullPointerException if {@code boundary} or {@code bufferSupplier} is {@code null} + * @throws NullPointerException if {@code boundaryIndicator} or {@code bufferSupplier} is {@code null} * @see #buffer(ObservableSource, int) * @see ReactiveX operators documentation: Buffer */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final > Observable buffer(@NonNull ObservableSource boundary, @NonNull Supplier bufferSupplier) { - Objects.requireNonNull(boundary, "boundary is null"); + public final > Observable buffer(@NonNull ObservableSource boundaryIndicator, @NonNull Supplier bufferSupplier) { + Objects.requireNonNull(boundaryIndicator, "boundaryIndicator is null"); Objects.requireNonNull(bufferSupplier, "bufferSupplier is null"); - return RxJavaPlugins.onAssembly(new ObservableBufferExactBoundary<>(this, boundary, bufferSupplier)); + return RxJavaPlugins.onAssembly(new ObservableBufferExactBoundary<>(this, boundaryIndicator, bufferSupplier)); } /** @@ -6416,22 +6419,22 @@ public final Observable cast(@NonNull Class clazz) { * * * @param the accumulator and output type - * @param initialValueSupplier + * @param initialItemSupplier * the mutable data structure that will collect the items * @param collector * a function that accepts the {@code state} and an emitted item, and modifies the accumulator accordingly * accordingly * @return the new {@code Single} instance - * @throws NullPointerException if {@code initialValueSupplier} or {@code collector} is {@code null} + * @throws NullPointerException if {@code initialItemSupplier} or {@code collector} is {@code null} * @see ReactiveX operators documentation: Reduce */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single collect(@NonNull Supplier initialValueSupplier, @NonNull BiConsumer collector) { - Objects.requireNonNull(initialValueSupplier, "initialValueSupplier is null"); + public final Single collect(@NonNull Supplier initialItemSupplier, @NonNull BiConsumer collector) { + Objects.requireNonNull(initialItemSupplier, "initialItemSupplier is null"); Objects.requireNonNull(collector, "collector is null"); - return RxJavaPlugins.onAssembly(new ObservableCollectSingle<>(this, initialValueSupplier, collector)); + return RxJavaPlugins.onAssembly(new ObservableCollectSingle<>(this, initialItemSupplier, collector)); } /** @@ -6451,21 +6454,21 @@ public final Single collect(@NonNull Supplier initialValueSu * * * @param the accumulator and output type - * @param initialValue + * @param initialItem * the mutable data structure that will collect the items * @param collector * a function that accepts the {@code state} and an emitted item, and modifies the accumulator accordingly * accordingly * @return the new {@code Single} instance - * @throws NullPointerException if {@code initialValue} or {@code collector} is {@code null} + * @throws NullPointerException if {@code initialItem} or {@code collector} is {@code null} * @see ReactiveX operators documentation: Reduce */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single collectInto(@NonNull U initialValue, @NonNull BiConsumer collector) { - Objects.requireNonNull(initialValue, "initialValue is null"); - return collect(Functions.justSupplier(initialValue), collector); + public final Single collectInto(@NonNull U initialItem, @NonNull BiConsumer collector) { + Objects.requireNonNull(initialItem, "initialItem is null"); + return collect(Functions.justSupplier(initialItem), collector); } /** @@ -7454,18 +7457,18 @@ public final Observable concatWith(@NonNull CompletableSource other) { *
{@code contains} does not operate by default on a particular {@link Scheduler}.
* * - * @param element + * @param item * the item to search for in the emissions from the current {@code Observable} * @return the new {@code Single} instance - * @throws NullPointerException if {@code element} is {@code null} + * @throws NullPointerException if {@code item} is {@code null} * @see ReactiveX operators documentation: Contains */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single contains(@NonNull Object element) { - Objects.requireNonNull(element, "element is null"); - return any(Functions.equalsWith(element)); + public final Single contains(@NonNull Object item) { + Objects.requireNonNull(item, "item is null"); + return any(Functions.equalsWith(item)); } /** @@ -7509,18 +7512,18 @@ public final Single count() { * * @param * the debounce value type (ignored) - * @param debounceSelector + * @param debounceIndicator * function to return a sequence that indicates the throttle duration for each item via its own emission or completion * @return the new {@code Observable} instance - * @throws NullPointerException if {@code debounceSelector} is {@code null} + * @throws NullPointerException if {@code debounceIndicator} is {@code null} * @see ReactiveX operators documentation: Debounce */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable debounce(@NonNull Function> debounceSelector) { - Objects.requireNonNull(debounceSelector, "debounceSelector is null"); - return RxJavaPlugins.onAssembly(new ObservableDebounce<>(this, debounceSelector)); + public final Observable debounce(@NonNull Function> debounceIndicator) { + Objects.requireNonNull(debounceIndicator, "debounceIndicator is null"); + return RxJavaPlugins.onAssembly(new ObservableDebounce<>(this, debounceIndicator)); } /** @@ -7644,20 +7647,20 @@ public final Observable defaultIfEmpty(@NonNull T defaultItem) { * * @param * the item delay value type (ignored) - * @param itemDelay + * @param itemDelayIndicator * a function that returns an {@code ObservableSource} for each item emitted by the current {@code Observable}, which is * then used to delay the emission of that item by the resulting {@code Observable} until the {@code ObservableSource} * returned from {@code itemDelay} emits an item * @return the new {@code Observable} instance - * @throws NullPointerException if {@code itemDelay} is {@code null} + * @throws NullPointerException if {@code itemDelayIndicator} is {@code null} * @see ReactiveX operators documentation: Delay */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable delay(@NonNull Function> itemDelay) { - Objects.requireNonNull(itemDelay, "itemDelay is null"); - return flatMap(ObservableInternalHelper.itemDelay(itemDelay)); + public final Observable delay(@NonNull Function> itemDelayIndicator) { + Objects.requireNonNull(itemDelayIndicator, "itemDelayIndicator is null"); + return flatMap(ObservableInternalHelper.itemDelay(itemDelayIndicator)); } /** @@ -7670,7 +7673,7 @@ public final Observable delay(@NonNull FunctionThis version of {@code delay} operates by default on the {@code computation} {@link Scheduler}. * * - * @param delay + * @param time * the delay to shift the source by * @param unit * the {@link TimeUnit} in which {@code period} is defined @@ -7683,8 +7686,8 @@ public final Observable delay(@NonNull Function delay(long delay, @NonNull TimeUnit unit) { - return delay(delay, unit, Schedulers.computation(), false); + public final Observable delay(long time, @NonNull TimeUnit unit) { + return delay(time, unit, Schedulers.computation(), false); } /** @@ -7697,7 +7700,7 @@ public final Observable delay(long delay, @NonNull TimeUnit unit) { *
This version of {@code delay} operates by default on the {@code computation} {@link Scheduler}.
* * - * @param delay + * @param time * the delay to shift the source by * @param unit * the {@link TimeUnit} in which {@code period} is defined @@ -7712,8 +7715,8 @@ public final Observable delay(long delay, @NonNull TimeUnit unit) { @CheckReturnValue @SchedulerSupport(SchedulerSupport.COMPUTATION) @NonNull - public final Observable delay(long delay, @NonNull TimeUnit unit, boolean delayError) { - return delay(delay, unit, Schedulers.computation(), delayError); + public final Observable delay(long time, @NonNull TimeUnit unit, boolean delayError) { + return delay(time, unit, Schedulers.computation(), delayError); } /** @@ -7726,7 +7729,7 @@ public final Observable delay(long delay, @NonNull TimeUnit unit, boolean del *
You specify which {@link Scheduler} this operator will use.
* * - * @param delay + * @param time * the delay to shift the source by * @param unit * the time unit of {@code delay} @@ -7739,8 +7742,8 @@ public final Observable delay(long delay, @NonNull TimeUnit unit, boolean del @CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull - public final Observable delay(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { - return delay(delay, unit, scheduler, false); + public final Observable delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { + return delay(time, unit, scheduler, false); } /** @@ -7753,7 +7756,7 @@ public final Observable delay(long delay, @NonNull TimeUnit unit, @NonNull Sc *
You specify which {@link Scheduler} this operator will use.
* * - * @param delay + * @param time * the delay to shift the source by * @param unit * the time unit of {@code delay} @@ -7769,11 +7772,11 @@ public final Observable delay(long delay, @NonNull TimeUnit unit, @NonNull Sc @CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull - public final Observable delay(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean delayError) { + public final Observable delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean delayError) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new ObservableDelay<>(this, delay, unit, scheduler, delayError)); + return RxJavaPlugins.onAssembly(new ObservableDelay<>(this, time, unit, scheduler, delayError)); } /** @@ -7793,23 +7796,23 @@ public final Observable delay(long delay, @NonNull TimeUnit unit, @NonNull Sc * the subscription delay value type (ignored) * @param * the item delay value type (ignored) - * @param subscriptionDelay + * @param subscriptionIndicator * a function that returns an {@code ObservableSource} that triggers the subscription to the current {@code Observable} * once it emits any item - * @param itemDelay + * @param itemDelayIndicator * a function that returns an {@code ObservableSource} for each item emitted by the current {@code Observable}, which is * then used to delay the emission of that item by the resulting {@code Observable} until the {@code ObservableSource} * returned from {@code itemDelay} emits an item * @return the new {@code Observable} instance - * @throws NullPointerException if {@code subscriptionDelay} or {@code itemDelay} is {@code null} + * @throws NullPointerException if {@code subscriptionIndicator} or {@code itemDelayIndicator} is {@code null} * @see ReactiveX operators documentation: Delay */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable delay(@NonNull ObservableSource subscriptionDelay, - @NonNull Function> itemDelay) { - return delaySubscription(subscriptionDelay).delay(itemDelay); + public final Observable delay(@NonNull ObservableSource subscriptionIndicator, + @NonNull Function> itemDelayIndicator) { + return delaySubscription(subscriptionIndicator).delay(itemDelayIndicator); } /** @@ -7823,18 +7826,18 @@ public final Observable delay(@NonNull ObservableSource subscriptio * * * @param the value type of the other {@code Observable}, irrelevant - * @param other the other {@code ObservableSource} that should trigger the subscription + * @param subscriptionIndicator the other {@code ObservableSource} that should trigger the subscription * to the current {@code Observable}. * @return the new {@code Observable} instance - * @throws NullPointerException if {@code other} is {@code null} + * @throws NullPointerException if {@code subscriptionIndicator} is {@code null} * @since 2.0 */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable delaySubscription(@NonNull ObservableSource other) { - Objects.requireNonNull(other, "other is null"); - return RxJavaPlugins.onAssembly(new ObservableDelaySubscriptionOther<>(this, other)); + public final Observable delaySubscription(@NonNull ObservableSource subscriptionIndicator) { + Objects.requireNonNull(subscriptionIndicator, "subscriptionIndicator is null"); + return RxJavaPlugins.onAssembly(new ObservableDelaySubscriptionOther<>(this, subscriptionIndicator)); } /** @@ -7846,7 +7849,7 @@ public final Observable delaySubscription(@NonNull ObservableSource ot *
This version of {@code delaySubscription} operates by default on the {@code computation} {@link Scheduler}.
* * - * @param delay + * @param time * the time to delay the subscription * @param unit * the time unit of {@code delay} @@ -7857,8 +7860,8 @@ public final Observable delaySubscription(@NonNull ObservableSource ot @CheckReturnValue @SchedulerSupport(SchedulerSupport.COMPUTATION) @NonNull - public final Observable delaySubscription(long delay, @NonNull TimeUnit unit) { - return delaySubscription(delay, unit, Schedulers.computation()); + public final Observable delaySubscription(long time, @NonNull TimeUnit unit) { + return delaySubscription(time, unit, Schedulers.computation()); } /** @@ -7871,7 +7874,7 @@ public final Observable delaySubscription(long delay, @NonNull TimeUnit unit) *
You specify which {@code Scheduler} this operator will use.
* * - * @param delay + * @param time * the time to delay the subscription * @param unit * the time unit of {@code delay} @@ -7884,8 +7887,8 @@ public final Observable delaySubscription(long delay, @NonNull TimeUnit unit) @CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull - public final Observable delaySubscription(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { - return delaySubscription(timer(delay, unit, scheduler)); + public final Observable delaySubscription(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) { + return delaySubscription(timer(time, unit, scheduler)); } /** @@ -10366,19 +10369,19 @@ public final Observable ofType(@NonNull Class clazz) { *
{@code onErrorResumeNext} does not operate by default on a particular {@link Scheduler}.
* * - * @param resumeFunction + * @param fallbackSupplier * a function that returns an {@code ObservableSource} that will take over if the current {@code Observable} encounters * an error * @return the new {@code Observable} instance - * @throws NullPointerException if {@code resumeFunction} is {@code null} + * @throws NullPointerException if {@code fallbackSupplier} is {@code null} * @see ReactiveX operators documentation: Catch */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable onErrorResumeNext(@NonNull Function> resumeFunction) { - Objects.requireNonNull(resumeFunction, "resumeFunction is null"); - return RxJavaPlugins.onAssembly(new ObservableOnErrorNext<>(this, resumeFunction)); + public final Observable onErrorResumeNext(@NonNull Function> fallbackSupplier) { + Objects.requireNonNull(fallbackSupplier, "fallbackSupplier is null"); + return RxJavaPlugins.onAssembly(new ObservableOnErrorNext<>(this, fallbackSupplier)); } /** @@ -10404,19 +10407,19 @@ public final Observable onErrorResumeNext(@NonNull Function{@code onErrorResumeWith} does not operate by default on a particular {@link Scheduler}. * * - * @param next + * @param fallback * the next {@code ObservableSource} source that will take over if the current {@code Observable} encounters * an error * @return the new {@code Observable} instance - * @throws NullPointerException if {@code next} is {@code null} + * @throws NullPointerException if {@code fallback} is {@code null} * @see ReactiveX operators documentation: Catch */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable onErrorResumeWith(@NonNull ObservableSource next) { - Objects.requireNonNull(next, "next is null"); - return onErrorResumeNext(Functions.justFunction(next)); + public final Observable onErrorResumeWith(@NonNull ObservableSource fallback) { + Objects.requireNonNull(fallback, "fallback is null"); + return onErrorResumeNext(Functions.justFunction(fallback)); } /** @@ -10439,19 +10442,19 @@ public final Observable onErrorResumeWith(@NonNull ObservableSource{@code onErrorReturn} does not operate by default on a particular {@link Scheduler}. * * - * @param valueSupplier + * @param itemSupplier * a function that returns a single value that will be emitted along with a regular {@code onComplete} in case * the current {@code Observable} signals an {@code onError} event * @return the new {@code Observable} instance - * @throws NullPointerException if {@code valueSupplier} is {@code null} + * @throws NullPointerException if {@code itemSupplier} is {@code null} * @see ReactiveX operators documentation: Catch */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable onErrorReturn(@NonNull Function valueSupplier) { - Objects.requireNonNull(valueSupplier, "valueSupplier is null"); - return RxJavaPlugins.onAssembly(new ObservableOnErrorReturn<>(this, valueSupplier)); + public final Observable onErrorReturn(@NonNull Function itemSupplier) { + Objects.requireNonNull(itemSupplier, "itemSupplier is null"); + return RxJavaPlugins.onAssembly(new ObservableOnErrorReturn<>(this, itemSupplier)); } /** @@ -12488,18 +12491,18 @@ public final Observable sorted() { *
{@code sorted} does not operate by default on a particular {@link Scheduler}.
* * - * @param sortFunction + * @param comparator * a function that compares two items emitted by the current {@code Observable} and returns an {@code int} * that indicates their sort order - * @throws NullPointerException if {@code sortFunction} is {@code null} + * @throws NullPointerException if {@code comparator} is {@code null} * @return the new {@code Observable} instance */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable sorted(@NonNull Comparator sortFunction) { - Objects.requireNonNull(sortFunction, "sortFunction is null"); - return toList().toObservable().map(Functions.listSorter(sortFunction)).flatMapIterable(Functions.identity()); + public final Observable sorted(@NonNull Comparator comparator) { + Objects.requireNonNull(comparator, "comparator is null"); + return toList().toObservable().map(Functions.listSorter(comparator)).flatMapIterable(Functions.identity()); } /** @@ -14130,19 +14133,19 @@ public final Observable timeout(@NonNull FunctionReactiveX operators documentation: Timeout */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull public final Observable timeout(@NonNull Function> itemTimeoutIndicator, - @NonNull ObservableSource other) { - Objects.requireNonNull(other, "other is null"); - return timeout0(null, itemTimeoutIndicator, other); + @NonNull ObservableSource fallback) { + Objects.requireNonNull(fallback, "fallback is null"); + return timeout0(null, itemTimeoutIndicator, fallback); } /** @@ -14187,18 +14190,18 @@ public final Observable timeout(long timeout, @NonNull TimeUnit unit) { * maximum duration between items before a timeout occurs * @param unit * the unit of time that applies to the {@code timeout} argument - * @param other + * @param fallback * the fallback {@code ObservableSource} to use in case of a timeout * @return the new {@code Observable} instance - * @throws NullPointerException if {@code unit} or {@code other} is {@code null} + * @throws NullPointerException if {@code unit} or {@code fallback} is {@code null} * @see ReactiveX operators documentation: Timeout */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.COMPUTATION) @NonNull - public final Observable timeout(long timeout, @NonNull TimeUnit unit, @NonNull ObservableSource other) { - Objects.requireNonNull(other, "other is null"); - return timeout0(timeout, unit, other, Schedulers.computation()); + public final Observable timeout(long timeout, @NonNull TimeUnit unit, @NonNull ObservableSource fallback) { + Objects.requireNonNull(fallback, "fallback is null"); + return timeout0(timeout, unit, fallback, Schedulers.computation()); } /** @@ -14219,18 +14222,18 @@ public final Observable timeout(long timeout, @NonNull TimeUnit unit, @NonNul * the unit of time that applies to the {@code timeout} argument * @param scheduler * the {@code Scheduler} to run the timeout timers on - * @param other + * @param fallback * the {@code ObservableSource} to use as the fallback in case of a timeout * @return the new {@code Observable} instance - * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code other} is {@code null} + * @throws NullPointerException if {@code unit}, {@code scheduler} or {@code fallback} is {@code null} * @see ReactiveX operators documentation: Timeout */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) @NonNull - public final Observable timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull ObservableSource other) { - Objects.requireNonNull(other, "other is null"); - return timeout0(timeout, unit, other, scheduler); + public final Observable timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull ObservableSource fallback) { + Objects.requireNonNull(fallback, "fallback is null"); + return timeout0(timeout, unit, fallback, scheduler); } /** @@ -14319,11 +14322,11 @@ public final Observable timeout(@NonNull ObservableSource firstTime * a function that returns an {@code ObservableSource} for each item emitted by the current {@code Observable} and that * determines the timeout window in which the subsequent source item must arrive in order to * continue the sequence - * @param other + * @param fallback * the fallback {@code ObservableSource} to switch to if the current {@code Observable} times out * @return the new {@code Observable} instance * @throws NullPointerException - * if {@code firstTimeoutIndicator}, {@code itemTimeoutIndicator} or {@code other} is {@code null} + * if {@code firstTimeoutIndicator}, {@code itemTimeoutIndicator} or {@code fallback} is {@code null} * @see ReactiveX operators documentation: Timeout */ @CheckReturnValue @@ -14332,28 +14335,28 @@ public final Observable timeout(@NonNull ObservableSource firstTime public final Observable timeout( @NonNull ObservableSource firstTimeoutIndicator, @NonNull Function> itemTimeoutIndicator, - @NonNull ObservableSource other) { + @NonNull ObservableSource fallback) { Objects.requireNonNull(firstTimeoutIndicator, "firstTimeoutIndicator is null"); - Objects.requireNonNull(other, "other is null"); - return timeout0(firstTimeoutIndicator, itemTimeoutIndicator, other); + Objects.requireNonNull(fallback, "fallback is null"); + return timeout0(firstTimeoutIndicator, itemTimeoutIndicator, fallback); } @NonNull private Observable timeout0(long timeout, @NonNull TimeUnit unit, - @Nullable ObservableSource other, + @Nullable ObservableSource fallback, @NonNull Scheduler scheduler) { Objects.requireNonNull(unit, "unit is null"); Objects.requireNonNull(scheduler, "scheduler is null"); - return RxJavaPlugins.onAssembly(new ObservableTimeoutTimed<>(this, timeout, unit, scheduler, other)); + return RxJavaPlugins.onAssembly(new ObservableTimeoutTimed<>(this, timeout, unit, scheduler, fallback)); } @NonNull private Observable timeout0( @NonNull ObservableSource firstTimeoutIndicator, @NonNull Function> itemTimeoutIndicator, - @Nullable ObservableSource other) { + @Nullable ObservableSource fallback) { Objects.requireNonNull(itemTimeoutIndicator, "itemTimeoutIndicator is null"); - return RxJavaPlugins.onAssembly(new ObservableTimeout<>(this, firstTimeoutIndicator, itemTimeoutIndicator, other)); + return RxJavaPlugins.onAssembly(new ObservableTimeout<>(this, firstTimeoutIndicator, itemTimeoutIndicator, fallback)); } /** @@ -15538,17 +15541,17 @@ public final Observable> window( * * @param * the window element type (ignored) - * @param boundary + * @param boundaryIndicator * an {@code ObservableSource} whose emitted items close and open windows * @return the new {@code Observable} instance - * @throws NullPointerException if {@code boundary} is {@code null} + * @throws NullPointerException if {@code boundaryIndicator} is {@code null} * @see ReactiveX operators documentation: Window */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable> window(@NonNull ObservableSource boundary) { - return window(boundary, bufferSize()); + public final Observable> window(@NonNull ObservableSource boundaryIndicator) { + return window(boundaryIndicator, bufferSize()); } /** @@ -15569,22 +15572,22 @@ public final Observable> window(@NonNull ObservableSource b * * @param * the window element type (ignored) - * @param boundary + * @param boundaryIndicator * an {@code ObservableSource} whose emitted items close and open windows * @param bufferSize * the capacity hint for the buffer in the inner windows * @return the new {@code Observable} instance - * @throws NullPointerException if {@code boundary} is {@code null} + * @throws NullPointerException if {@code boundaryIndicator} is {@code null} * @throws IllegalArgumentException if {@code bufferSize} is non-positive * @see ReactiveX operators documentation: Window */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Observable> window(@NonNull ObservableSource boundary, int bufferSize) { - Objects.requireNonNull(boundary, "boundary is null"); + public final Observable> window(@NonNull ObservableSource boundaryIndicator, int bufferSize) { + Objects.requireNonNull(boundaryIndicator, "boundaryIndicator is null"); ObjectHelper.verifyPositive(bufferSize, "bufferSize"); - return RxJavaPlugins.onAssembly(new ObservableWindowBoundary<>(this, boundary, bufferSize)); + return RxJavaPlugins.onAssembly(new ObservableWindowBoundary<>(this, boundaryIndicator, bufferSize)); } /** diff --git a/src/main/java/io/reactivex/rxjava3/core/Single.java b/src/main/java/io/reactivex/rxjava3/core/Single.java index eb90b83fcb..0541ce8657 100644 --- a/src/main/java/io/reactivex/rxjava3/core/Single.java +++ b/src/main/java/io/reactivex/rxjava3/core/Single.java @@ -557,17 +557,17 @@ public static Flowable concatEager(@NonNull Iterable<@NonNull ? extends S *
{@code defer} does not operate by default on a particular {@link Scheduler}.
* * @param the value type - * @param singleSupplier the {@code Supplier} that is called for each individual {@code SingleObserver} and + * @param supplier the {@code Supplier} that is called for each individual {@code SingleObserver} and * returns a {@code SingleSource} instance to subscribe to - * @throws NullPointerException if {@code singleSupplier} is {@code null} + * @throws NullPointerException if {@code supplier} is {@code null} * @return the new {@code Single} instance */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single defer(@NonNull Supplier> singleSupplier) { - Objects.requireNonNull(singleSupplier, "singleSupplier is null"); - return RxJavaPlugins.onAssembly(new SingleDefer<>(singleSupplier)); + public static Single defer(@NonNull Supplier> supplier) { + Objects.requireNonNull(supplier, "supplier is null"); + return RxJavaPlugins.onAssembly(new SingleDefer<>(supplier)); } /** @@ -579,17 +579,17 @@ public static Single defer(@NonNull Supplier{@code error} does not operate by default on a particular {@link Scheduler}. * * @param the value type - * @param errorSupplier the {@link Supplier} that is called for each individual {@code SingleObserver} and + * @param supplier the {@link Supplier} that is called for each individual {@code SingleObserver} and * returns a {@code Throwable} instance to be emitted. - * @throws NullPointerException if {@code errorSupplier} is {@code null} + * @throws NullPointerException if {@code supplier} is {@code null} * @return the new {@code Single} instance */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single error(@NonNull Supplier errorSupplier) { - Objects.requireNonNull(errorSupplier, "errorSupplier is null"); - return RxJavaPlugins.onAssembly(new SingleError<>(errorSupplier)); + public static Single error(@NonNull Supplier supplier) { + Objects.requireNonNull(supplier, "supplier is null"); + return RxJavaPlugins.onAssembly(new SingleError<>(supplier)); } /** @@ -602,21 +602,21 @@ public static Single error(@NonNull Supplier errorSu *
{@code error} does not operate by default on a particular {@link Scheduler}.
* * - * @param exception + * @param throwable * the particular {@link Throwable} to pass to {@link SingleObserver#onError onError} * @param * the type of the item (ostensibly) emitted by the {@code Single} * @return the new {@code Single} that invokes the subscriber's {@link SingleObserver#onError onError} method when * the subscriber subscribes to it - * @throws NullPointerException if {@code exception} is {@code null} + * @throws NullPointerException if {@code throwable} is {@code null} * @see ReactiveX operators documentation: Throw */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single error(@NonNull Throwable exception) { - Objects.requireNonNull(exception, "exception is null"); - return error(Functions.justSupplier(exception)); + public static Single error(@NonNull Throwable throwable) { + Objects.requireNonNull(throwable, "throwable is null"); + return error(Functions.justSupplier(throwable)); } /** @@ -782,18 +782,18 @@ public static Single fromPublisher(@NonNull Publisher<@NonNull ? extends *
{@code fromObservable} does not operate by default on a particular {@link Scheduler}.
* * - * @param observableSource the source sequence to wrap, not {@code null} + * @param observable the source sequence to wrap, not {@code null} * @param * the type of the item emitted by the {@code Single}. * @return the new {@code Single} instance - * @throws NullPointerException if {@code observableSource} is {@code null} + * @throws NullPointerException if {@code observable} is {@code null} */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public static Single fromObservable(@NonNull ObservableSource observableSource) { - Objects.requireNonNull(observableSource, "observableSource is null"); - return RxJavaPlugins.onAssembly(new ObservableSingleSingle<>(observableSource, null)); + public static Single fromObservable(@NonNull ObservableSource observable) { + Objects.requireNonNull(observable, "observable is null"); + return RxJavaPlugins.onAssembly(new ObservableSingleSingle<>(observable, null)); } /** @@ -1446,22 +1446,23 @@ public static Single unsafeCreate(@NonNull SingleSource onSubscribe) { * @param the value type of the {@code SingleSource} generated * @param the resource type * @param resourceSupplier the {@link Supplier} called for each {@link SingleObserver} to generate a resource object - * @param singleFunction the function called with the returned resource + * @param sourceSupplier the function called with the returned resource * object from {@code resourceSupplier} and should return a {@code SingleSource} instance * to be run by the operator - * @param disposer the consumer of the generated resource that is called exactly once for + * @param resourceCleanup the consumer of the generated resource that is called exactly once for * that particular resource when the generated {@code SingleSource} terminates * (successfully or with an error) or gets disposed. * @return the new {@code Single} instance + * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} and {@code resourceCleanup} is {@code null} * @since 2.0 */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull public static Single using(@NonNull Supplier resourceSupplier, - @NonNull Function> singleFunction, - @NonNull Consumer disposer) { - return using(resourceSupplier, singleFunction, disposer, true); + @NonNull Function> sourceSupplier, + @NonNull Consumer resourceCleanup) { + return using(resourceSupplier, sourceSupplier, resourceCleanup, true); } /** @@ -1476,10 +1477,10 @@ public static Single using(@NonNull Supplier resourceSupplier, * @param the value type of the {@code SingleSource} generated * @param the resource type * @param resourceSupplier the {@link Supplier} called for each {@link SingleObserver} to generate a resource object - * @param singleFunction the function called with the returned resource + * @param sourceSupplier the function called with the returned resource * object from {@code resourceSupplier} and should return a {@code SingleSource} instance * to be run by the operator - * @param disposer the consumer of the generated resource that is called exactly once for + * @param resourceCleanup the consumer of the generated resource that is called exactly once for * that particular resource when the generated {@code SingleSource} terminates * (successfully or with an error) or gets disposed. * @param eager @@ -1488,7 +1489,7 @@ public static Single using(@NonNull Supplier resourceSupplier, * If {@code false} the resource disposal will happen either on a {@code dispose()} call after the upstream is disposed * or just after the emission of a terminal event ({@code onSuccess} or {@code onError}). * @return the new {@code Single} instance - * @throws NullPointerException if {@code resourceSupplier}, {@code singleFunction} or {@code disposer} is {@code null} + * @throws NullPointerException if {@code resourceSupplier}, {@code sourceSupplier} or {@code resourceCleanup} is {@code null} * @since 2.0 */ @CheckReturnValue @@ -1496,14 +1497,14 @@ public static Single using(@NonNull Supplier resourceSupplier, @SchedulerSupport(SchedulerSupport.NONE) public static Single using( @NonNull Supplier resourceSupplier, - @NonNull Function> singleFunction, - @NonNull Consumer disposer, + @NonNull Function> sourceSupplier, + @NonNull Consumer resourceCleanup, boolean eager) { Objects.requireNonNull(resourceSupplier, "resourceSupplier is null"); - Objects.requireNonNull(singleFunction, "singleFunction is null"); - Objects.requireNonNull(disposer, "disposer is null"); + Objects.requireNonNull(sourceSupplier, "sourceSupplier is null"); + Objects.requireNonNull(resourceCleanup, "resourceCleanup is null"); - return RxJavaPlugins.onAssembly(new SingleUsing<>(resourceSupplier, singleFunction, disposer, eager)); + return RxJavaPlugins.onAssembly(new SingleUsing<>(resourceSupplier, sourceSupplier, resourceCleanup, eager)); } /** @@ -2297,18 +2298,18 @@ public final Single delay(long time, @NonNull TimeUnit unit, @NonNull Schedul *
Scheduler:
*
{@code delaySubscription} does not operate by default on a particular {@link Scheduler}.
* - * @param other the {@code CompletableSource} that has to complete before the subscription to the + * @param subscriptionIndicator the {@code CompletableSource} that has to complete before the subscription to the * current {@code Single} happens * @return the new {@code Single} instance - * @throws NullPointerException if {@code other} is {@code null} + * @throws NullPointerException if {@code subscriptionIndicator} is {@code null} * @since 2.0 */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Single delaySubscription(@NonNull CompletableSource other) { - Objects.requireNonNull(other, "other is null"); - return RxJavaPlugins.onAssembly(new SingleDelayWithCompletable<>(this, other)); + public final Single delaySubscription(@NonNull CompletableSource subscriptionIndicator) { + Objects.requireNonNull(subscriptionIndicator, "subscriptionIndicator is null"); + return RxJavaPlugins.onAssembly(new SingleDelayWithCompletable<>(this, subscriptionIndicator)); } /** @@ -2323,18 +2324,18 @@ public final Single delaySubscription(@NonNull CompletableSource other) { *
{@code delaySubscription} does not operate by default on a particular {@link Scheduler}.
* * @param the element type of the other source - * @param other the {@code SingleSource} that has to complete before the subscription to the + * @param subscriptionIndicator the {@code SingleSource} that has to complete before the subscription to the * current {@code Single} happens * @return the new {@code Single} instance - * @throws NullPointerException if {@code other} is {@code null} + * @throws NullPointerException if {@code subscriptionIndicator} is {@code null} * @since 2.0 */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Single delaySubscription(@NonNull SingleSource other) { - Objects.requireNonNull(other, "other is null"); - return RxJavaPlugins.onAssembly(new SingleDelayWithSingle<>(this, other)); + public final Single delaySubscription(@NonNull SingleSource subscriptionIndicator) { + Objects.requireNonNull(subscriptionIndicator, "subscriptionIndicator is null"); + return RxJavaPlugins.onAssembly(new SingleDelayWithSingle<>(this, subscriptionIndicator)); } /** @@ -2349,18 +2350,18 @@ public final Single delaySubscription(@NonNull SingleSource other) { *
{@code delaySubscription} does not operate by default on a particular {@link Scheduler}.
* * @param the element type of the other source - * @param other the {@code ObservableSource} that has to signal a value or complete before the + * @param subscriptionIndicator the {@code ObservableSource} that has to signal a value or complete before the * subscription to the current {@code Single} happens * @return the new {@code Single} instance - * @throws NullPointerException if {@code other} is {@code null} + * @throws NullPointerException if {@code subscriptionIndicator} is {@code null} * @since 2.0 */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Single delaySubscription(@NonNull ObservableSource other) { - Objects.requireNonNull(other, "other is null"); - return RxJavaPlugins.onAssembly(new SingleDelayWithObservable<>(this, other)); + public final Single delaySubscription(@NonNull ObservableSource subscriptionIndicator) { + Objects.requireNonNull(subscriptionIndicator, "subscriptionIndicator is null"); + return RxJavaPlugins.onAssembly(new SingleDelayWithObservable<>(this, subscriptionIndicator)); } /** @@ -2379,19 +2380,19 @@ public final Single delaySubscription(@NonNull ObservableSource other) *
{@code delaySubscription} does not operate by default on a particular {@link Scheduler}.
* * @param the element type of the other source - * @param other the {@code Publisher} that has to signal a value or complete before the + * @param subscriptionIndicator the {@code Publisher} that has to signal a value or complete before the * subscription to the current {@code Single} happens * @return the new {@code Single} instance - * @throws NullPointerException if {@code other} is {@code null} + * @throws NullPointerException if {@code subscriptionIndicator} is {@code null} * @since 2.0 */ @BackpressureSupport(BackpressureKind.FULL) @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Single delaySubscription(@NonNull Publisher other) { - Objects.requireNonNull(other, "other is null"); - return RxJavaPlugins.onAssembly(new SingleDelayWithPublisher<>(this, other)); + public final Single delaySubscription(@NonNull Publisher subscriptionIndicator) { + Objects.requireNonNull(subscriptionIndicator, "subscriptionIndicator is null"); + return RxJavaPlugins.onAssembly(new SingleDelayWithPublisher<>(this, subscriptionIndicator)); } /** @@ -3154,15 +3155,16 @@ public final Single> materialize() { *
Scheduler:
*
{@code contains} does not operate by default on a particular {@link Scheduler}.
* - * @param value the value to compare against the success value of this {@code Single} + * @param item the value to compare against the success value of this {@code Single} * @return the new {@code Single} instance + * @throws NullPointerException if {@code item} is {@code null} * @since 2.0 */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @NonNull - public final Single contains(@NonNull Object value) { - return contains(value, ObjectHelper.equalsPredicate()); + public final Single contains(@NonNull Object item) { + return contains(item, ObjectHelper.equalsPredicate()); } /** @@ -3174,20 +3176,20 @@ public final Single contains(@NonNull Object value) { *
Scheduler:
*
{@code contains} does not operate by default on a particular {@link Scheduler}.
* - * @param value the value to compare against the success value of this {@code Single} + * @param item the value to compare against the success value of this {@code Single} * @param comparer the function that receives the success value of this {@code Single}, the value provided * and should return {@code true} if they are considered equal * @return the new {@code Single} instance - * @throws NullPointerException if {@code value} or {@code comparer} is {@code null} + * @throws NullPointerException if {@code item} or {@code comparer} is {@code null} * @since 2.0 */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Single contains(@NonNull Object value, @NonNull BiPredicate comparer) { - Objects.requireNonNull(value, "value is null"); + public final Single contains(@NonNull Object item, @NonNull BiPredicate comparer) { + Objects.requireNonNull(item, "item is null"); Objects.requireNonNull(comparer, "comparer is null"); - return RxJavaPlugins.onAssembly(new SingleContains<>(this, value, comparer)); + return RxJavaPlugins.onAssembly(new SingleContains<>(this, item, comparer)); } /** @@ -3264,19 +3266,19 @@ public final Single observeOn(@NonNull Scheduler scheduler) { *
{@code onErrorReturn} does not operate by default on a particular {@link Scheduler}.
* * - * @param resumeFunction + * @param itemSupplier * a function that returns an item that the new {@code Single} will emit if the current {@code Single} encounters * an error * @return the new {@code Single} instance - * @throws NullPointerException if {@code resumeFunction} is {@code null} + * @throws NullPointerException if {@code itemSupplier} is {@code null} * @see ReactiveX operators documentation: Catch */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Single onErrorReturn(@NonNull Function resumeFunction) { - Objects.requireNonNull(resumeFunction, "resumeFunction is null"); - return RxJavaPlugins.onAssembly(new SingleOnErrorReturn<>(this, resumeFunction, null)); + public final Single onErrorReturn(@NonNull Function itemSupplier) { + Objects.requireNonNull(itemSupplier, "itemSupplier is null"); + return RxJavaPlugins.onAssembly(new SingleOnErrorReturn<>(this, itemSupplier, null)); } /** @@ -3287,17 +3289,17 @@ public final Single onErrorReturn(@NonNull Function r *
Scheduler:
*
{@code onErrorReturnItem} does not operate by default on a particular {@link Scheduler}.
* - * @param value the value to signal if the current {@code Single} fails + * @param item the value to signal if the current {@code Single} fails * @return the new {@code Single} instance - * @throws NullPointerException if {@code value} is {@code null} + * @throws NullPointerException if {@code item} is {@code null} * @since 2.0 */ @CheckReturnValue @NonNull @SchedulerSupport(SchedulerSupport.NONE) - public final Single onErrorReturnItem(@NonNull T value) { - Objects.requireNonNull(value, "value is null"); - return RxJavaPlugins.onAssembly(new SingleOnErrorReturn<>(this, null, value)); + public final Single onErrorReturnItem(@NonNull T item) { + Objects.requireNonNull(item, "item is null"); + return RxJavaPlugins.onAssembly(new SingleOnErrorReturn<>(this, null, item)); } /** @@ -3359,9 +3361,9 @@ public final Single onErrorResumeWith(@NonNull SingleSource fall *
{@code onErrorResumeNext} does not operate by default on a particular {@link Scheduler}.
* * - * @param fallback a function that returns a {@code Single} that will take control if source {@code Single} encounters an error. + * @param fallbackSupplier a function that returns a {@code SingleSource} that will take control if source {@code Single} encounters an error. * @return the new {@code Single} instance - * @throws NullPointerException if {@code fallback} is {@code null} + * @throws NullPointerException if {@code fallbackSupplier} is {@code null} * @see ReactiveX operators documentation: Catch * @since .20 */ @@ -3369,9 +3371,9 @@ public final Single onErrorResumeWith(@NonNull SingleSource fall @NonNull @SchedulerSupport(SchedulerSupport.NONE) public final Single onErrorResumeNext( - @NonNull Function> fallback) { - Objects.requireNonNull(fallback, "fallback is null"); - return RxJavaPlugins.onAssembly(new SingleResumeNext<>(this, fallback)); + @NonNull Function> fallbackSupplier) { + Objects.requireNonNull(fallbackSupplier, "fallbackSupplier is null"); + return RxJavaPlugins.onAssembly(new SingleResumeNext<>(this, fallbackSupplier)); } /** diff --git a/src/test/java/io/reactivex/rxjava3/internal/util/OperatorArgumentNaming.java b/src/test/java/io/reactivex/rxjava3/internal/util/OperatorArgumentNaming.java new file mode 100644 index 0000000000..727b522d05 --- /dev/null +++ b/src/test/java/io/reactivex/rxjava3/internal/util/OperatorArgumentNaming.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) 2016-present, RxJava Contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is + * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See + * the License for the specific language governing permissions and limitations under the License. + */ + +package io.reactivex.rxjava3.internal.util; + +import java.lang.reflect.*; +import java.util.*; + +import org.reactivestreams.*; + +import com.google.common.base.Strings; + +import io.reactivex.rxjava3.core.*; +import io.reactivex.rxjava3.core.Observer; +import io.reactivex.rxjava3.core.Observable; + +/** + * Compare method argument naming across base classes. + * This is not a full test because some naming mismatch is legitimate, such as singular in Maybe/Single and + * plural in Flowable/Observable + */ +public final class OperatorArgumentNaming { + + private OperatorArgumentNaming() { + throw new IllegalStateException("No instances!"); + } + + /** Classes to compare with each other. */ + static final Class[] CLASSES = { Flowable.class, Observable.class, Maybe.class, Single.class, Completable.class }; + + /** Types that refer to a reactive type and is generally matching the parent class; for comparison, these have to be unified. */ + static final Set> BASE_TYPE_SET = new HashSet<>(Arrays.asList( + Flowable.class, Publisher.class, Subscriber.class, FlowableSubscriber.class, + Observable.class, ObservableSource.class, Observer.class, + Maybe.class, MaybeSource.class, MaybeObserver.class, + Single.class, SingleSource.class, SingleObserver.class, + Completable.class, CompletableSource.class, CompletableObserver.class + )); + + public static void main(String[] args) { + // className -> methodName -> overloads -> arguments + Map>>> map = new HashMap<>(); + + for (Class clazz : CLASSES) { + Map>> classMethods = map.computeIfAbsent(clazz.getSimpleName(), v -> new HashMap<>()); + for (Method method : clazz.getDeclaredMethods()) { + if (method.getDeclaringClass() == clazz && method.getParameterCount() != 0) { + List> overloads = classMethods.computeIfAbsent(method.getName(), v -> new ArrayList<>()); + + List overload = new ArrayList<>(); + overloads.add(overload); + + for (Parameter param : method.getParameters()) { + String typeName; + Class type = param.getType(); + if (type.isArray()) { + Class componentType = type.getComponentType(); + if (BASE_TYPE_SET.contains(componentType)) { + typeName = "BaseType"; + } else { + typeName = type.getComponentType().getSimpleName() + "[]"; + } + } else + if (BASE_TYPE_SET.contains(type)) { + typeName = "BaseType"; + } else { + typeName = type.getSimpleName(); + } + String name = param.getName(); + if (name.equals("bufferSize") || name.equals("prefetch") || name.equals("capacityHint")) { + name = "bufferSize|prefetch|capacityHint"; + } + if (name.equals("subscriber") || name.equals("observer")) { + name = "subscriber|observer"; + } + if (name.contains("onNext")) { + name = name.replace("onNext", "onNext|onSuccess"); + } else + if (name.contains("onSuccess")) { + name = name.replace("onSuccess", "onNext|onSuccess"); + } + overload.add(new ArgumentNameAndType(typeName, name)); + } + } + } + } + + int counter = 0; + + for (int i = 0; i < CLASSES.length - 1; i++) { + String firstName = CLASSES[i].getSimpleName(); + Map>> firstClassMethods = map.get(firstName); + for (int j = i + 1; j < CLASSES.length; j++) { + String secondName = CLASSES[j].getSimpleName(); + Map>> secondClassMethods = map.get(secondName); + + for (Map.Entry>> methodOverloadsFirst : firstClassMethods.entrySet()) { + + List> methodOverloadsSecond = secondClassMethods.get(methodOverloadsFirst.getKey()); + + if (methodOverloadsSecond != null) { + for (List overloadFirst : methodOverloadsFirst.getValue()) { + for (List overloadSecond : methodOverloadsSecond) { + if (overloadFirst.size() == overloadSecond.size()) { + // Argument types match? + boolean match = true; + for (int k = 0; k < overloadFirst.size(); k++) { + if (!overloadFirst.get(k).type.equals(overloadSecond.get(k).type)) { + match = false; + break; + } + } + // Argument names match? + if (match) { + for (int k = 0; k < overloadFirst.size(); k++) { + if (!overloadFirst.get(k).name.equals(overloadSecond.get(k).name)) { + System.out.print("Argument naming mismatch #"); + System.out.println(++counter); + + System.out.print(" "); + System.out.print(Strings.padEnd(firstName, Math.max(firstName.length(), secondName.length()) + 1, ' ')); + System.out.print(methodOverloadsFirst.getKey()); + System.out.print(" "); + System.out.println(overloadFirst); + + System.out.print(" "); + System.out.print(Strings.padEnd(secondName, Math.max(firstName.length(), secondName.length()) + 1, ' ')); + System.out.print(methodOverloadsFirst.getKey()); + System.out.print(" "); + System.out.println(overloadSecond); + System.out.println(); + break; + } + } + } + } + } + } + } + } + } + } + } + + static final class ArgumentNameAndType { + final String type; + final String name; + + ArgumentNameAndType(String type, String name) { + this.type = type; + this.name = name; + } + + @Override + public String toString() { + return type + " " + name; + } + } +} diff --git a/src/test/java/io/reactivex/rxjava3/validators/ParamValidationCheckerTest.java b/src/test/java/io/reactivex/rxjava3/validators/ParamValidationCheckerTest.java index f9becca37c..403a83964a 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/ParamValidationCheckerTest.java +++ b/src/test/java/io/reactivex/rxjava3/validators/ParamValidationCheckerTest.java @@ -142,9 +142,6 @@ public void checkParallelFlowable() { addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class)); addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); - // null default is allowed - addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "blockingMostRecent", Object.class)); - // negative time is considered as zero time addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class)); addOverride(new ParamOverride(Flowable.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class, Scheduler.class)); @@ -390,9 +387,6 @@ public void checkParallelFlowable() { addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class)); addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "delay", Long.TYPE, TimeUnit.class, Scheduler.class, Boolean.TYPE)); - // null default is allowed - addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "blockingMostRecent", Object.class)); - // negative time is considered as zero time addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class)); addOverride(new ParamOverride(Observable.class, 0, ParamMode.ANY, "delaySubscription", Long.TYPE, TimeUnit.class, Scheduler.class)); diff --git a/src/test/java/io/reactivex/rxjava3/validators/ParamValidationNaming.java b/src/test/java/io/reactivex/rxjava3/validators/ParamValidationNaming.java index fe6d215165..ba307d394d 100644 --- a/src/test/java/io/reactivex/rxjava3/validators/ParamValidationNaming.java +++ b/src/test/java/io/reactivex/rxjava3/validators/ParamValidationNaming.java @@ -203,7 +203,7 @@ static void processFile(Class clazz) throws Exception { int quote = line.indexOf('"', comma); - String message = line.substring(quote + 1, quote + 2 + paramName.length()); + String message = line.substring(quote + 1, Math.min(line.length(), quote + 2 + paramName.length())); if (line.contains("\"A Disposable")) { continue; From 4ed4635c516499c03213b7a1b114424f8d7425dd Mon Sep 17 00:00:00 2001 From: akarnokd Date: Tue, 21 Jan 2020 13:49:55 +0100 Subject: [PATCH 2/2] Remove outdated null-test of blockingMostRecent --- .../operators/flowable/BlockingFlowableMostRecentTest.java | 4 ---- .../observable/BlockingObservableMostRecentTest.java | 4 ---- 2 files changed, 8 deletions(-) diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableMostRecentTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableMostRecentTest.java index f652e9fbf6..82ae58730f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableMostRecentTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableMostRecentTest.java @@ -26,10 +26,6 @@ import io.reactivex.rxjava3.schedulers.TestScheduler; public class BlockingFlowableMostRecentTest extends RxJavaTest { - @Test - public void mostRecentNull() { - assertNull(Flowable.never().blockingMostRecent(null).iterator().next()); - } @Test public void mostRecent() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableMostRecentTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableMostRecentTest.java index 6ffd920f24..cc04638ee7 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableMostRecentTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableMostRecentTest.java @@ -27,10 +27,6 @@ import io.reactivex.rxjava3.subjects.*; public class BlockingObservableMostRecentTest extends RxJavaTest { - @Test - public void mostRecentNull() { - assertNull(Observable.never().blockingMostRecent(null).iterator().next()); - } static Iterable mostRecent(Observable source, T initialValue) { return source.blockingMostRecent(initialValue);