Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.x: Widen functional interface throws, replace Callable with Supplier #6511

Merged
merged 3 commits into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/main/java/io/reactivex/Completable.java
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ public static Completable unsafeCreate(CompletableSource source) {
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static Completable defer(final Callable<? extends CompletableSource> completableSupplier) {
public static Completable defer(final Supplier<? extends CompletableSource> completableSupplier) {
ObjectHelper.requireNonNull(completableSupplier, "completableSupplier");
return RxJavaPlugins.onAssembly(new CompletableDefer(completableSupplier));
}
Expand All @@ -374,7 +374,7 @@ public static Completable defer(final Callable<? extends CompletableSource> comp
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static Completable error(final Callable<? extends Throwable> errorSupplier) {
public static Completable error(final Supplier<? extends Throwable> errorSupplier) {
ObjectHelper.requireNonNull(errorSupplier, "errorSupplier is null");
return RxJavaPlugins.onAssembly(new CompletableErrorSupplier(errorSupplier));
}
Expand Down Expand Up @@ -971,7 +971,7 @@ private static NullPointerException toNpe(Throwable ex) {
*/
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public static <R> Completable using(Callable<R> resourceSupplier,
public static <R> Completable using(Supplier<R> resourceSupplier,
Function<? super R, ? extends CompletableSource> completableFunction,
Consumer<? super R> disposer) {
return using(resourceSupplier, completableFunction, disposer, true);
Expand Down Expand Up @@ -1003,7 +1003,7 @@ public static <R> Completable using(Callable<R> resourceSupplier,
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <R> Completable using(
final Callable<R> resourceSupplier,
final Supplier<R> resourceSupplier,
final Function<? super R, ? extends CompletableSource> completableFunction,
final Consumer<? super R> disposer,
final boolean eager) {
Expand Down Expand Up @@ -2688,7 +2688,7 @@ public final <T> Observable<T> toObservable() {
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public final <T> Single<T> toSingle(final Callable<? extends T> completionValueSupplier) {
public final <T> Single<T> toSingle(final Supplier<? extends T> completionValueSupplier) {
ObjectHelper.requireNonNull(completionValueSupplier, "completionValueSupplier is null");
return RxJavaPlugins.onAssembly(new CompletableToSingle<T>(this, completionValueSupplier, null));
}
Expand Down
160 changes: 80 additions & 80 deletions src/main/java/io/reactivex/Flowable.java

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions src/main/java/io/reactivex/Maybe.java
Original file line number Diff line number Diff line change
Expand Up @@ -573,21 +573,21 @@ public static <T> Maybe<T> create(MaybeOnSubscribe<T> onSubscribe) {
}

/**
* Calls a Callable for each individual MaybeObserver to return the actual MaybeSource source to
* Calls a Supplier for each individual MaybeObserver to return the actual MaybeSource source to
* be subscribed to.
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code defer} does not operate by default on a particular {@link Scheduler}.</dd>
* </dl>
* @param <T> the value type
* @param maybeSupplier the Callable that is called for each individual MaybeObserver and
* @param maybeSupplier the Supplier that is called for each individual MaybeObserver and
* returns a MaybeSource instance to subscribe to
* @return the new Maybe instance
*/
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Maybe<T> defer(final Callable<? extends MaybeSource<? extends T>> maybeSupplier) {
public static <T> Maybe<T> defer(final Supplier<? extends MaybeSource<? extends T>> maybeSupplier) {
ObjectHelper.requireNonNull(maybeSupplier, "maybeSupplier is null");
return RxJavaPlugins.onAssembly(new MaybeDefer<T>(maybeSupplier));
}
Expand Down Expand Up @@ -648,7 +648,7 @@ public static <T> Maybe<T> error(Throwable exception) {
* </dl>
*
* @param supplier
* a Callable factory to return a Throwable for each individual MaybeObserver
* a Supplier factory to return a Throwable for each individual MaybeObserver
* @param <T>
* the type of the items (ostensibly) emitted by the Maybe
* @return a Maybe that invokes the {@link MaybeObserver}'s {@link MaybeObserver#onError onError} method when
Expand All @@ -658,7 +658,7 @@ public static <T> Maybe<T> error(Throwable exception) {
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Maybe<T> error(Callable<? extends Throwable> supplier) {
public static <T> Maybe<T> error(Supplier<? extends Throwable> supplier) {
ObjectHelper.requireNonNull(supplier, "errorSupplier is null");
return RxJavaPlugins.onAssembly(new MaybeErrorCallable<T>(supplier));
}
Expand Down Expand Up @@ -1689,7 +1689,7 @@ public static <T> Maybe<T> unsafeCreate(MaybeSource<T> onSubscribe) {
*/
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public static <T, D> Maybe<T> using(Callable<? extends D> resourceSupplier,
public static <T, D> Maybe<T> using(Supplier<? extends D> resourceSupplier,
Function<? super D, ? extends MaybeSource<? extends T>> sourceSupplier,
Consumer<? super D> resourceDisposer) {
return using(resourceSupplier, sourceSupplier, resourceDisposer, true);
Expand Down Expand Up @@ -1725,7 +1725,7 @@ public static <T, D> Maybe<T> using(Callable<? extends D> resourceSupplier,
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T, D> Maybe<T> using(Callable<? extends D> resourceSupplier,
public static <T, D> Maybe<T> using(Supplier<? extends D> resourceSupplier,
Function<? super D, ? extends MaybeSource<? extends T>> sourceSupplier,
Consumer<? super D> resourceDisposer, boolean eager) {
ObjectHelper.requireNonNull(resourceSupplier, "resourceSupplier is null");
Expand Down Expand Up @@ -3022,7 +3022,7 @@ public final <R> Maybe<R> flatMap(Function<? super T, ? extends MaybeSource<? ex
public final <R> Maybe<R> flatMap(
Function<? super T, ? extends MaybeSource<? extends R>> onSuccessMapper,
Function<? super Throwable, ? extends MaybeSource<? extends R>> onErrorMapper,
Callable<? extends MaybeSource<? extends R>> onCompleteSupplier) {
Supplier<? extends MaybeSource<? extends R>> onCompleteSupplier) {
ObjectHelper.requireNonNull(onSuccessMapper, "onSuccessMapper is null");
ObjectHelper.requireNonNull(onErrorMapper, "onErrorMapper is null");
ObjectHelper.requireNonNull(onCompleteSupplier, "onCompleteSupplier is null");
Expand Down
Loading