Skip to content

Commit cb03724

Browse files
authored
3.x: Widen functional interface throws, replace Callable with Supplier (#6511)
* 3.x: Widen functional interface throws, replace Callable with Supplier * Fix typo and wrong link in Supplier, some style cleanup * Some cleanup
1 parent 2bed8c1 commit cb03724

File tree

221 files changed

+2018
-2043
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+2018
-2043
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ public static Completable unsafeCreate(CompletableSource source) {
350350
@CheckReturnValue
351351
@NonNull
352352
@SchedulerSupport(SchedulerSupport.NONE)
353-
public static Completable defer(final Callable<? extends CompletableSource> completableSupplier) {
353+
public static Completable defer(final Supplier<? extends CompletableSource> completableSupplier) {
354354
ObjectHelper.requireNonNull(completableSupplier, "completableSupplier");
355355
return RxJavaPlugins.onAssembly(new CompletableDefer(completableSupplier));
356356
}
@@ -374,7 +374,7 @@ public static Completable defer(final Callable<? extends CompletableSource> comp
374374
@CheckReturnValue
375375
@NonNull
376376
@SchedulerSupport(SchedulerSupport.NONE)
377-
public static Completable error(final Callable<? extends Throwable> errorSupplier) {
377+
public static Completable error(final Supplier<? extends Throwable> errorSupplier) {
378378
ObjectHelper.requireNonNull(errorSupplier, "errorSupplier is null");
379379
return RxJavaPlugins.onAssembly(new CompletableErrorSupplier(errorSupplier));
380380
}
@@ -971,7 +971,7 @@ private static NullPointerException toNpe(Throwable ex) {
971971
*/
972972
@CheckReturnValue
973973
@SchedulerSupport(SchedulerSupport.NONE)
974-
public static <R> Completable using(Callable<R> resourceSupplier,
974+
public static <R> Completable using(Supplier<R> resourceSupplier,
975975
Function<? super R, ? extends CompletableSource> completableFunction,
976976
Consumer<? super R> disposer) {
977977
return using(resourceSupplier, completableFunction, disposer, true);
@@ -1003,7 +1003,7 @@ public static <R> Completable using(Callable<R> resourceSupplier,
10031003
@NonNull
10041004
@SchedulerSupport(SchedulerSupport.NONE)
10051005
public static <R> Completable using(
1006-
final Callable<R> resourceSupplier,
1006+
final Supplier<R> resourceSupplier,
10071007
final Function<? super R, ? extends CompletableSource> completableFunction,
10081008
final Consumer<? super R> disposer,
10091009
final boolean eager) {
@@ -2688,7 +2688,7 @@ public final <T> Observable<T> toObservable() {
26882688
@CheckReturnValue
26892689
@NonNull
26902690
@SchedulerSupport(SchedulerSupport.NONE)
2691-
public final <T> Single<T> toSingle(final Callable<? extends T> completionValueSupplier) {
2691+
public final <T> Single<T> toSingle(final Supplier<? extends T> completionValueSupplier) {
26922692
ObjectHelper.requireNonNull(completionValueSupplier, "completionValueSupplier is null");
26932693
return RxJavaPlugins.onAssembly(new CompletableToSingle<T>(this, completionValueSupplier, null));
26942694
}

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

Lines changed: 80 additions & 80 deletions
Large diffs are not rendered by default.

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -573,21 +573,21 @@ public static <T> Maybe<T> create(MaybeOnSubscribe<T> onSubscribe) {
573573
}
574574

575575
/**
576-
* Calls a Callable for each individual MaybeObserver to return the actual MaybeSource source to
576+
* Calls a Supplier for each individual MaybeObserver to return the actual MaybeSource source to
577577
* be subscribed to.
578578
* <dl>
579579
* <dt><b>Scheduler:</b></dt>
580580
* <dd>{@code defer} does not operate by default on a particular {@link Scheduler}.</dd>
581581
* </dl>
582582
* @param <T> the value type
583-
* @param maybeSupplier the Callable that is called for each individual MaybeObserver and
583+
* @param maybeSupplier the Supplier that is called for each individual MaybeObserver and
584584
* returns a MaybeSource instance to subscribe to
585585
* @return the new Maybe instance
586586
*/
587587
@CheckReturnValue
588588
@NonNull
589589
@SchedulerSupport(SchedulerSupport.NONE)
590-
public static <T> Maybe<T> defer(final Callable<? extends MaybeSource<? extends T>> maybeSupplier) {
590+
public static <T> Maybe<T> defer(final Supplier<? extends MaybeSource<? extends T>> maybeSupplier) {
591591
ObjectHelper.requireNonNull(maybeSupplier, "maybeSupplier is null");
592592
return RxJavaPlugins.onAssembly(new MaybeDefer<T>(maybeSupplier));
593593
}
@@ -648,7 +648,7 @@ public static <T> Maybe<T> error(Throwable exception) {
648648
* </dl>
649649
*
650650
* @param supplier
651-
* a Callable factory to return a Throwable for each individual MaybeObserver
651+
* a Supplier factory to return a Throwable for each individual MaybeObserver
652652
* @param <T>
653653
* the type of the items (ostensibly) emitted by the Maybe
654654
* @return a Maybe that invokes the {@link MaybeObserver}'s {@link MaybeObserver#onError onError} method when
@@ -658,7 +658,7 @@ public static <T> Maybe<T> error(Throwable exception) {
658658
@CheckReturnValue
659659
@NonNull
660660
@SchedulerSupport(SchedulerSupport.NONE)
661-
public static <T> Maybe<T> error(Callable<? extends Throwable> supplier) {
661+
public static <T> Maybe<T> error(Supplier<? extends Throwable> supplier) {
662662
ObjectHelper.requireNonNull(supplier, "errorSupplier is null");
663663
return RxJavaPlugins.onAssembly(new MaybeErrorCallable<T>(supplier));
664664
}
@@ -1689,7 +1689,7 @@ public static <T> Maybe<T> unsafeCreate(MaybeSource<T> onSubscribe) {
16891689
*/
16901690
@CheckReturnValue
16911691
@SchedulerSupport(SchedulerSupport.NONE)
1692-
public static <T, D> Maybe<T> using(Callable<? extends D> resourceSupplier,
1692+
public static <T, D> Maybe<T> using(Supplier<? extends D> resourceSupplier,
16931693
Function<? super D, ? extends MaybeSource<? extends T>> sourceSupplier,
16941694
Consumer<? super D> resourceDisposer) {
16951695
return using(resourceSupplier, sourceSupplier, resourceDisposer, true);
@@ -1725,7 +1725,7 @@ public static <T, D> Maybe<T> using(Callable<? extends D> resourceSupplier,
17251725
@CheckReturnValue
17261726
@NonNull
17271727
@SchedulerSupport(SchedulerSupport.NONE)
1728-
public static <T, D> Maybe<T> using(Callable<? extends D> resourceSupplier,
1728+
public static <T, D> Maybe<T> using(Supplier<? extends D> resourceSupplier,
17291729
Function<? super D, ? extends MaybeSource<? extends T>> sourceSupplier,
17301730
Consumer<? super D> resourceDisposer, boolean eager) {
17311731
ObjectHelper.requireNonNull(resourceSupplier, "resourceSupplier is null");
@@ -3022,7 +3022,7 @@ public final <R> Maybe<R> flatMap(Function<? super T, ? extends MaybeSource<? ex
30223022
public final <R> Maybe<R> flatMap(
30233023
Function<? super T, ? extends MaybeSource<? extends R>> onSuccessMapper,
30243024
Function<? super Throwable, ? extends MaybeSource<? extends R>> onErrorMapper,
3025-
Callable<? extends MaybeSource<? extends R>> onCompleteSupplier) {
3025+
Supplier<? extends MaybeSource<? extends R>> onCompleteSupplier) {
30263026
ObjectHelper.requireNonNull(onSuccessMapper, "onSuccessMapper is null");
30273027
ObjectHelper.requireNonNull(onErrorMapper, "onErrorMapper is null");
30283028
ObjectHelper.requireNonNull(onCompleteSupplier, "onCompleteSupplier is null");

0 commit comments

Comments
 (0)