diff --git a/src/main/java/io/reactivex/Flowable.java b/src/main/java/io/reactivex/Flowable.java index a672d8fbd0..f939b8558f 100644 --- a/src/main/java/io/reactivex/Flowable.java +++ b/src/main/java/io/reactivex/Flowable.java @@ -23,8 +23,9 @@ import io.reactivex.flowables.*; import io.reactivex.functions.*; import io.reactivex.internal.functions.*; -import io.reactivex.internal.fuseable.ScalarCallable; +import io.reactivex.internal.fuseable.*; import io.reactivex.internal.operators.flowable.*; +import io.reactivex.internal.operators.flowable.FlowableStrict.StrictSubscriber; import io.reactivex.internal.operators.observable.ObservableFromPublisher; import io.reactivex.internal.schedulers.ImmediateThinScheduler; import io.reactivex.internal.subscribers.*; @@ -1557,7 +1558,7 @@ public static Flowable concatEager(Publisher Flowable concatEager(Publisher> sources, int maxConcurrency, int prefetch) { - return RxJavaPlugins.onAssembly(new FlowableConcatMapEager(sources, Functions.identity(), maxConcurrency, prefetch, ErrorMode.IMMEDIATE)); + return RxJavaPlugins.onAssembly(new FlowableConcatMapEagerPublisher(sources, Functions.identity(), maxConcurrency, prefetch, ErrorMode.IMMEDIATE)); } /** @@ -11679,7 +11680,7 @@ public final Flowable retryWhen( public final void safeSubscribe(Subscriber s) { ObjectHelper.requireNonNull(s, "s is null"); if (s instanceof SafeSubscriber) { - subscribe(s); + subscribe((SafeSubscriber)s); } else { subscribe(new SafeSubscriber(s)); } @@ -12713,13 +12714,15 @@ public final Flowable startWithArray(T... items) { * * @return the new Flowable instance * @since 2.0.5 - experimental + * @deprecated 2.0.7, will be removed in 2.1.0; by default, the Publisher interface is always strict */ @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) @Experimental @CheckReturnValue + @Deprecated public final Flowable strict() { - return RxJavaPlugins.onAssembly(new FlowableStrict(this)); + return this; } /** @@ -12892,13 +12895,61 @@ public final Disposable subscribe(Consumer onNext, Consumer s) { + if (s instanceof FlowableSubscriber) { + subscribe((FlowableSubscriber)s); + } else { + ObjectHelper.requireNonNull(s, "s is null"); + subscribe(new StrictSubscriber(s)); + } + } + + /** + * Establish a connection between this Flowable and the given FlowableSubscriber and + * start streaming events based on the demand of the FlowableSubscriber. + *

+ * This is a "factory method" and can be called multiple times, each time starting a new {@link Subscription}. + *

+ * Each {@link Subscription} will work for only a single {@link FlowableSubscriber}. + *

+ * If the same {@link FlowableSubscriber} instance is subscribed to multiple {@link Flowable}s and/or the + * same {@link Flowable} multiple times, it must ensure the serialization over its {@code onXXX} + * methods manually. + *

+ * If the {@link Flowable} rejects the subscription attempt or otherwise fails it will signal + * the error via {@link FlowableSubscriber#onError(Throwable)}. + *

+ * This subscribe method relaxes the following Reactive-Streams rules: + *

    + *
  • §1.3: onNext should not be called concurrently until onSubscribe returns. + * FlowableSubscriber.onSubscribe should make sure a sync or async call triggered by request() is safe.
  • + *
  • §2.3: onError or onComplete must not call cancel. + * Calling request() or cancel() is NOP at this point.
  • + *
  • §2.12: onSubscribe must be called at most once on the same instance. + * FlowableSubscriber reuse is not checked and if happens, it is the responsibility of + * the FlowableSubscriber to ensure proper serialization of its onXXX methods.
  • + *
  • §3.9: negative requests should emit an onError(IllegalArgumentException). + * Non-positive requests signal via RxJavaPlugins.onError and the stream is not affected.
  • + *
+ *
+ *
Backpressure:
+ *
The backpressure behavior/expectation is determined by the supplied {@code FlowableSubscriber}.
+ *
Scheduler:
+ *
{@code subscribe} does not operate by default on a particular {@link Scheduler}.
+ *
+ * @param s the FlowableSubscriber that will consume signals from this Flowable + * @since 2.0.7 - experimental + */ + @BackpressureSupport(BackpressureKind.SPECIAL) + @SchedulerSupport(SchedulerSupport.NONE) + @Experimental + public final void subscribe(FlowableSubscriber s) { ObjectHelper.requireNonNull(s, "s is null"); try { - s = RxJavaPlugins.onSubscribe(this, s); + Subscriber z = RxJavaPlugins.onSubscribe(this, s); - ObjectHelper.requireNonNull(s, "Plugin returned null Subscriber"); + ObjectHelper.requireNonNull(z, "Plugin returned null Subscriber"); - subscribeActual(s); + subscribeActual(z); } catch (NullPointerException e) { // NOPMD throw e; } catch (Throwable e) { diff --git a/src/main/java/io/reactivex/FlowableSubscriber.java b/src/main/java/io/reactivex/FlowableSubscriber.java new file mode 100644 index 0000000000..dabd898dae --- /dev/null +++ b/src/main/java/io/reactivex/FlowableSubscriber.java @@ -0,0 +1,41 @@ +/** + * 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; + +import org.reactivestreams.*; + +import io.reactivex.annotations.Experimental; + +/** + * Represents a Reactive-Streams inspired Subscriber that is RxJava 2 only + * and weakens rules §1.3 and §3.9 of the specification for gaining performance. + * + * @param the value type + * @since 2.0.7 - experimental + */ +@Experimental +public interface FlowableSubscriber extends Subscriber { + + /** + * Implementors of this method should make sure everything that needs + * to be visible in {@link #onNext(Object)} is established before + * calling {@link Subscription#request(long)}. In practice this means + * no initialization should happen after the {@code request()} call and + * additional behavior is thread safe in respect to {@code onNext}. + * + * {@inheritDoc} + */ + @Override + void onSubscribe(Subscription s); +} diff --git a/src/main/java/io/reactivex/Maybe.java b/src/main/java/io/reactivex/Maybe.java index dbb15efff4..06a1ede963 100644 --- a/src/main/java/io/reactivex/Maybe.java +++ b/src/main/java/io/reactivex/Maybe.java @@ -254,7 +254,7 @@ public static Flowable concat(Publisher Flowable concat(Publisher> sources, int prefetch) { ObjectHelper.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); - return RxJavaPlugins.onAssembly(new FlowableConcatMap(sources, MaybeToPublisher.instance(), prefetch, ErrorMode.IMMEDIATE)); + return RxJavaPlugins.onAssembly(new FlowableConcatMapPublisher(sources, MaybeToPublisher.instance(), prefetch, ErrorMode.IMMEDIATE)); } /** @@ -827,7 +827,7 @@ public static Flowable merge(Publisher @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings({ "unchecked", "rawtypes" }) public static Flowable merge(Publisher> sources, int maxConcurrency) { - return RxJavaPlugins.onAssembly(new FlowableFlatMap(sources, MaybeToPublisher.instance(), false, maxConcurrency, Flowable.bufferSize())); + return RxJavaPlugins.onAssembly(new FlowableFlatMapPublisher(sources, MaybeToPublisher.instance(), false, maxConcurrency, Flowable.bufferSize())); } /** diff --git a/src/main/java/io/reactivex/Single.java b/src/main/java/io/reactivex/Single.java index 683cbccf70..6bc59911d8 100644 --- a/src/main/java/io/reactivex/Single.java +++ b/src/main/java/io/reactivex/Single.java @@ -188,8 +188,9 @@ public static Flowable concat(Publisher Flowable concat(Publisher> sources, int prefetch) { + ObjectHelper.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); - return RxJavaPlugins.onAssembly(new FlowableConcatMap(sources, SingleInternalHelper.toFlowable(), prefetch, ErrorMode.IMMEDIATE)); + return RxJavaPlugins.onAssembly(new FlowableConcatMapPublisher(sources, SingleInternalHelper.toFlowable(), prefetch, ErrorMode.IMMEDIATE)); } /** @@ -684,7 +685,7 @@ public static Flowable merge(Iterable @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings({ "unchecked", "rawtypes" }) public static Flowable merge(Publisher> sources) { - return RxJavaPlugins.onAssembly(new FlowableFlatMap(sources, SingleInternalHelper.toFlowable(), false, Integer.MAX_VALUE, Flowable.bufferSize())); + return RxJavaPlugins.onAssembly(new FlowableFlatMapPublisher(sources, SingleInternalHelper.toFlowable(), false, Integer.MAX_VALUE, Flowable.bufferSize())); } /** diff --git a/src/main/java/io/reactivex/internal/fuseable/ConditionalSubscriber.java b/src/main/java/io/reactivex/internal/fuseable/ConditionalSubscriber.java index 0d99fa84d2..086e696571 100644 --- a/src/main/java/io/reactivex/internal/fuseable/ConditionalSubscriber.java +++ b/src/main/java/io/reactivex/internal/fuseable/ConditionalSubscriber.java @@ -13,7 +13,7 @@ package io.reactivex.internal.fuseable; -import org.reactivestreams.Subscriber; +import io.reactivex.FlowableSubscriber; /** * A Subscriber with an additional onNextIf(T) method that @@ -25,7 +25,7 @@ * * @param the value type */ -public interface ConditionalSubscriber extends Subscriber { +public interface ConditionalSubscriber extends FlowableSubscriber { /** * Conditionally takes the value. * @param t the value to deliver diff --git a/src/main/java/io/reactivex/internal/operators/completable/CompletableConcat.java b/src/main/java/io/reactivex/internal/operators/completable/CompletableConcat.java index c38ddb2068..fadf4b422e 100644 --- a/src/main/java/io/reactivex/internal/operators/completable/CompletableConcat.java +++ b/src/main/java/io/reactivex/internal/operators/completable/CompletableConcat.java @@ -42,7 +42,7 @@ public void subscribeActual(CompletableObserver s) { static final class CompletableConcatSubscriber extends AtomicInteger - implements Subscriber, Disposable { + implements FlowableSubscriber, Disposable { private static final long serialVersionUID = 9032184911934499404L; final CompletableObserver actual; diff --git a/src/main/java/io/reactivex/internal/operators/completable/CompletableFromPublisher.java b/src/main/java/io/reactivex/internal/operators/completable/CompletableFromPublisher.java index 75feca3031..4d0be70d35 100644 --- a/src/main/java/io/reactivex/internal/operators/completable/CompletableFromPublisher.java +++ b/src/main/java/io/reactivex/internal/operators/completable/CompletableFromPublisher.java @@ -32,7 +32,7 @@ protected void subscribeActual(final CompletableObserver cs) { flowable.subscribe(new FromPublisherSubscriber(cs)); } - static final class FromPublisherSubscriber implements Subscriber, Disposable { + static final class FromPublisherSubscriber implements FlowableSubscriber, Disposable { final CompletableObserver cs; diff --git a/src/main/java/io/reactivex/internal/operators/completable/CompletableMerge.java b/src/main/java/io/reactivex/internal/operators/completable/CompletableMerge.java index abbf9cda4f..fa59a499bd 100644 --- a/src/main/java/io/reactivex/internal/operators/completable/CompletableMerge.java +++ b/src/main/java/io/reactivex/internal/operators/completable/CompletableMerge.java @@ -43,7 +43,7 @@ public void subscribeActual(CompletableObserver s) { static final class CompletableMergeSubscriber extends AtomicInteger - implements Subscriber, Disposable { + implements FlowableSubscriber, Disposable { private static final long serialVersionUID = -2108443387387077490L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/AbstractFlowableWithUpstream.java b/src/main/java/io/reactivex/internal/operators/flowable/AbstractFlowableWithUpstream.java index 807d6f667e..2e6714196e 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/AbstractFlowableWithUpstream.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/AbstractFlowableWithUpstream.java @@ -31,14 +31,14 @@ abstract class AbstractFlowableWithUpstream extends Flowable implements /** * The upstream source Publisher. */ - protected final Publisher source; + protected final Flowable source; /** * Constructs a FlowableSource wrapping the given non-null (verified) * source Publisher. * @param source the source (upstream) Publisher instance, not null (verified) */ - AbstractFlowableWithUpstream(Publisher source) { + AbstractFlowableWithUpstream(Flowable source) { this.source = ObjectHelper.requireNonNull(source, "source is null"); } diff --git a/src/main/java/io/reactivex/internal/operators/flowable/BlockingFlowableIterable.java b/src/main/java/io/reactivex/internal/operators/flowable/BlockingFlowableIterable.java index e592436830..a38c9499d3 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/BlockingFlowableIterable.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/BlockingFlowableIterable.java @@ -17,8 +17,9 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.*; -import org.reactivestreams.*; +import org.reactivestreams.Subscription; +import io.reactivex.*; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.MissingBackpressureException; import io.reactivex.internal.queue.SpscArrayQueue; @@ -26,11 +27,11 @@ import io.reactivex.internal.util.*; public final class BlockingFlowableIterable implements Iterable { - final Publisher source; + final Flowable source; final int bufferSize; - public BlockingFlowableIterable(Publisher source, int bufferSize) { + public BlockingFlowableIterable(Flowable source, int bufferSize) { this.source = source; this.bufferSize = bufferSize; } @@ -44,7 +45,7 @@ public Iterator iterator() { static final class BlockingFlowableIterator extends AtomicReference - implements Subscriber, Iterator, Runnable, Disposable { + implements FlowableSubscriber, Iterator, Runnable, Disposable { private static final long serialVersionUID = 6695226475494099826L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/BlockingFlowableMostRecent.java b/src/main/java/io/reactivex/internal/operators/flowable/BlockingFlowableMostRecent.java index 12703a7cee..82c6022d90 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/BlockingFlowableMostRecent.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/BlockingFlowableMostRecent.java @@ -15,8 +15,7 @@ import java.util.*; -import org.reactivestreams.Publisher; - +import io.reactivex.Flowable; import io.reactivex.internal.util.*; import io.reactivex.subscribers.DefaultSubscriber; @@ -30,11 +29,11 @@ */ public final class BlockingFlowableMostRecent implements Iterable { - final Publisher source; + final Flowable source; final T initialValue; - public BlockingFlowableMostRecent(Publisher source, T initialValue) { + public BlockingFlowableMostRecent(Flowable source, T initialValue) { this.source = source; this.initialValue = initialValue; } diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableAll.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableAll.java index b480d99005..6d7faa61dd 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableAll.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableAll.java @@ -14,6 +14,7 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Predicate; import io.reactivex.internal.subscriptions.*; @@ -23,7 +24,7 @@ public final class FlowableAll extends AbstractFlowableWithUpstream predicate; - public FlowableAll(Publisher source, Predicate predicate) { + public FlowableAll(Flowable source, Predicate predicate) { super(source); this.predicate = predicate; } @@ -33,7 +34,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new AllSubscriber(s, predicate)); } - static final class AllSubscriber extends DeferredScalarSubscription implements Subscriber { + static final class AllSubscriber extends DeferredScalarSubscription implements FlowableSubscriber { private static final long serialVersionUID = -3521127104134758517L; final Predicate predicate; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableAllSingle.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableAllSingle.java index aa014813c0..9812961382 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableAllSingle.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableAllSingle.java @@ -24,11 +24,11 @@ public final class FlowableAllSingle extends Single implements FuseToFlowable { - final Publisher source; + final Flowable source; final Predicate predicate; - public FlowableAllSingle(Publisher source, Predicate predicate) { + public FlowableAllSingle(Flowable source, Predicate predicate) { this.source = source; this.predicate = predicate; } @@ -43,7 +43,7 @@ public Flowable fuseToFlowable() { return RxJavaPlugins.onAssembly(new FlowableAll(source, predicate)); } - static final class AllSubscriber implements Subscriber, Disposable { + static final class AllSubscriber implements FlowableSubscriber, Disposable { final SingleObserver actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableAmb.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableAmb.java index aa52e9b9d4..1e14453afa 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableAmb.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableAmb.java @@ -17,7 +17,7 @@ import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.internal.subscriptions.*; import io.reactivex.plugins.RxJavaPlugins; @@ -147,7 +147,7 @@ public void cancel() { } } - static final class AmbInnerSubscriber extends AtomicReference implements Subscriber, Subscription { + static final class AmbInnerSubscriber extends AtomicReference implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -1185974347409665484L; final AmbCoordinator parent; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableAny.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableAny.java index 85a0f9c287..39ed01534a 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableAny.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableAny.java @@ -12,16 +12,17 @@ */ package io.reactivex.internal.operators.flowable; -import io.reactivex.plugins.RxJavaPlugins; import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Predicate; import io.reactivex.internal.subscriptions.*; +import io.reactivex.plugins.RxJavaPlugins; public final class FlowableAny extends AbstractFlowableWithUpstream { final Predicate predicate; - public FlowableAny(Publisher source, Predicate predicate) { + public FlowableAny(Flowable source, Predicate predicate) { super(source); this.predicate = predicate; } @@ -31,7 +32,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new AnySubscriber(s, predicate)); } - static final class AnySubscriber extends DeferredScalarSubscription implements Subscriber { + static final class AnySubscriber extends DeferredScalarSubscription implements FlowableSubscriber { private static final long serialVersionUID = -2311252482644620661L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableAnySingle.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableAnySingle.java index 7278908030..94c0ab9a13 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableAnySingle.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableAnySingle.java @@ -23,11 +23,11 @@ import io.reactivex.plugins.RxJavaPlugins; public final class FlowableAnySingle extends Single implements FuseToFlowable { - final Publisher source; + final Flowable source; final Predicate predicate; - public FlowableAnySingle(Publisher source, Predicate predicate) { + public FlowableAnySingle(Flowable source, Predicate predicate) { this.source = source; this.predicate = predicate; } @@ -42,7 +42,7 @@ public Flowable fuseToFlowable() { return RxJavaPlugins.onAssembly(new FlowableAny(source, predicate)); } - static final class AnySubscriber implements Subscriber, Disposable { + static final class AnySubscriber implements FlowableSubscriber, Disposable { final SingleObserver actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableAutoConnect.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableAutoConnect.java index 54fea38ee5..65cd6bb6b5 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableAutoConnect.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableAutoConnect.java @@ -13,10 +13,10 @@ package io.reactivex.internal.operators.flowable; -import org.reactivestreams.Subscriber; - import java.util.concurrent.atomic.AtomicInteger; +import org.reactivestreams.Subscriber; + import io.reactivex.Flowable; import io.reactivex.disposables.Disposable; import io.reactivex.flowables.ConnectableFlowable; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableBuffer.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableBuffer.java index 38bdb0d86a..87b0d7331e 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableBuffer.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableBuffer.java @@ -13,15 +13,16 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.internal.functions.ObjectHelper; import java.util.*; import java.util.concurrent.Callable; import java.util.concurrent.atomic.*; import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.BooleanSupplier; +import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.*; import io.reactivex.plugins.RxJavaPlugins; @@ -33,7 +34,7 @@ public final class FlowableBuffer> extends Ab final Callable bufferSupplier; - public FlowableBuffer(Publisher source, int size, int skip, Callable bufferSupplier) { + public FlowableBuffer(Flowable source, int size, int skip, Callable bufferSupplier) { super(source); this.size = size; this.skip = skip; @@ -52,7 +53,7 @@ public void subscribeActual(Subscriber s) { } static final class PublisherBufferExactSubscriber> - implements Subscriber, Subscription { + implements FlowableSubscriber, Subscription { final Subscriber actual; @@ -156,7 +157,7 @@ public void onComplete() { static final class PublisherBufferSkipSubscriber> extends AtomicInteger - implements Subscriber, Subscription { + implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -5616169793639412593L; @@ -288,7 +289,7 @@ public void onComplete() { static final class PublisherBufferOverlappingSubscriber> extends AtomicLong - implements Subscriber, Subscription, BooleanSupplier { + implements FlowableSubscriber, Subscription, BooleanSupplier { private static final long serialVersionUID = -7370244972039324525L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferBoundary.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferBoundary.java index e3e4d24b9e..601024ff7e 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferBoundary.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferBoundary.java @@ -13,16 +13,17 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.internal.functions.ObjectHelper; import java.util.*; import java.util.concurrent.Callable; import java.util.concurrent.atomic.AtomicInteger; import org.reactivestreams.*; +import io.reactivex.Flowable; import io.reactivex.disposables.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Function; +import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.fuseable.SimpleQueue; import io.reactivex.internal.queue.MpscLinkedQueue; import io.reactivex.internal.subscribers.QueueDrainSubscriber; @@ -37,7 +38,7 @@ public final class FlowableBufferBoundary, Op final Publisher bufferOpen; final Function> bufferClose; - public FlowableBufferBoundary(Publisher source, Publisher bufferOpen, + public FlowableBufferBoundary(Flowable source, Publisher bufferOpen, Function> bufferClose, Callable bufferSupplier) { super(source); this.bufferOpen = bufferOpen; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferBoundarySupplier.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferBoundarySupplier.java index ac5d7af2eb..af98d86cfe 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferBoundarySupplier.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferBoundarySupplier.java @@ -13,16 +13,17 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.internal.functions.ObjectHelper; import java.util.Collection; import java.util.concurrent.Callable; import java.util.concurrent.atomic.AtomicReference; import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.Exceptions; -import io.reactivex.internal.disposables.*; +import io.reactivex.internal.disposables.DisposableHelper; +import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.queue.MpscLinkedQueue; import io.reactivex.internal.subscribers.QueueDrainSubscriber; import io.reactivex.internal.subscriptions.*; @@ -35,7 +36,7 @@ public final class FlowableBufferBoundarySupplier> boundarySupplier; final Callable bufferSupplier; - public FlowableBufferBoundarySupplier(Publisher source, Callable> boundarySupplier, Callable bufferSupplier) { + public FlowableBufferBoundarySupplier(Flowable source, Callable> boundarySupplier, Callable bufferSupplier) { super(source); this.boundarySupplier = boundarySupplier; this.bufferSupplier = bufferSupplier; @@ -47,7 +48,7 @@ protected void subscribeActual(Subscriber s) { } static final class BufferBoundarySupplierSubscriber, B> - extends QueueDrainSubscriber implements Subscriber, Subscription, Disposable { + extends QueueDrainSubscriber implements FlowableSubscriber, Subscription, Disposable { final Callable bufferSupplier; final Callable> boundarySupplier; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferExactBoundary.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferExactBoundary.java index 714a5bd3e3..5ed7f84b08 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferExactBoundary.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferExactBoundary.java @@ -13,14 +13,15 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.internal.functions.ObjectHelper; import java.util.Collection; import java.util.concurrent.Callable; import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.Exceptions; +import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.queue.MpscLinkedQueue; import io.reactivex.internal.subscribers.QueueDrainSubscriber; import io.reactivex.internal.subscriptions.*; @@ -32,7 +33,7 @@ public final class FlowableBufferExactBoundary boundary; final Callable bufferSupplier; - public FlowableBufferExactBoundary(Publisher source, Publisher boundary, Callable bufferSupplier) { + public FlowableBufferExactBoundary(Flowable source, Publisher boundary, Callable bufferSupplier) { super(source); this.boundary = boundary; this.bufferSupplier = bufferSupplier; @@ -44,7 +45,7 @@ protected void subscribeActual(Subscriber s) { } static final class BufferExactBoundarySubscriber, B> - extends QueueDrainSubscriber implements Subscriber, Subscription, Disposable { + extends QueueDrainSubscriber implements FlowableSubscriber, Subscription, Disposable { final Callable bufferSupplier; final Publisher boundary; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferTimed.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferTimed.java index a0d65953df..40810550ff 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferTimed.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferTimed.java @@ -13,18 +13,18 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.internal.functions.ObjectHelper; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicReference; import org.reactivestreams.*; -import io.reactivex.Scheduler; +import io.reactivex.*; import io.reactivex.Scheduler.Worker; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.Exceptions; -import io.reactivex.internal.disposables.*; +import io.reactivex.internal.disposables.DisposableHelper; +import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.queue.MpscLinkedQueue; import io.reactivex.internal.subscribers.QueueDrainSubscriber; import io.reactivex.internal.subscriptions.*; @@ -41,7 +41,7 @@ public final class FlowableBufferTimed> exten final int maxSize; final boolean restartTimerOnMaxSize; - public FlowableBufferTimed(Publisher source, long timespan, long timeskip, TimeUnit unit, Scheduler scheduler, Callable bufferSupplier, int maxSize, + public FlowableBufferTimed(Flowable source, long timespan, long timeskip, TimeUnit unit, Scheduler scheduler, Callable bufferSupplier, int maxSize, boolean restartTimerOnMaxSize) { super(source); this.timespan = timespan; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableCache.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableCache.java index ff8ef82da3..48b663473c 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableCache.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableCache.java @@ -17,7 +17,7 @@ import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.*; import io.reactivex.plugins.RxJavaPlugins; @@ -91,7 +91,7 @@ protected void subscribeActual(Subscriber t) { * * @param the value type of the cached items */ - static final class CacheState extends LinkedArrayList implements Subscriber { + static final class CacheState extends LinkedArrayList implements FlowableSubscriber { /** The source observable to connect to. */ final Flowable source; /** Holds onto the subscriber connected to source. */ diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableCollect.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableCollect.java index 485d33a923..750a3a5d30 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableCollect.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableCollect.java @@ -12,13 +12,14 @@ */ package io.reactivex.internal.operators.flowable; -import io.reactivex.internal.functions.ObjectHelper; import java.util.concurrent.Callable; import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.BiConsumer; +import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.subscriptions.*; import io.reactivex.plugins.RxJavaPlugins; @@ -27,7 +28,7 @@ public final class FlowableCollect extends AbstractFlowableWithUpstream initialSupplier; final BiConsumer collector; - public FlowableCollect(Publisher source, Callable initialSupplier, BiConsumer collector) { + public FlowableCollect(Flowable source, Callable initialSupplier, BiConsumer collector) { super(source); this.initialSupplier = initialSupplier; this.collector = collector; @@ -46,7 +47,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new CollectSubscriber(s, u, collector)); } - static final class CollectSubscriber extends DeferredScalarSubscription implements Subscriber { + static final class CollectSubscriber extends DeferredScalarSubscription implements FlowableSubscriber { private static final long serialVersionUID = -3589550218733891694L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableCollectSingle.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableCollectSingle.java index 85784033f5..aaab14bd23 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableCollectSingle.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableCollectSingle.java @@ -28,12 +28,12 @@ public final class FlowableCollectSingle extends Single implements FuseToFlowable { - final Publisher source; + final Flowable source; final Callable initialSupplier; final BiConsumer collector; - public FlowableCollectSingle(Publisher source, Callable initialSupplier, BiConsumer collector) { + public FlowableCollectSingle(Flowable source, Callable initialSupplier, BiConsumer collector) { this.source = source; this.initialSupplier = initialSupplier; this.collector = collector; @@ -57,7 +57,7 @@ public Flowable fuseToFlowable() { return RxJavaPlugins.onAssembly(new FlowableCollect(source, initialSupplier, collector)); } - static final class CollectSubscriber implements Subscriber, Disposable { + static final class CollectSubscriber implements FlowableSubscriber, Disposable { final SingleObserver actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableCombineLatest.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableCombineLatest.java index 07f7e8e7d4..976ee03ac6 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableCombineLatest.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableCombineLatest.java @@ -16,14 +16,14 @@ import java.util.Iterator; import java.util.concurrent.atomic.*; -import io.reactivex.annotations.NonNull; -import io.reactivex.annotations.Nullable; import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; +import io.reactivex.annotations.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Function; import io.reactivex.internal.functions.ObjectHelper; +import io.reactivex.internal.operators.flowable.FlowableMap.MapSubscriber; import io.reactivex.internal.queue.SpscLinkedArrayQueue; import io.reactivex.internal.subscriptions.*; import io.reactivex.internal.util.*; @@ -132,12 +132,12 @@ public void subscribeActual(Subscriber s) { return; } if (n == 1) { - new FlowableMap((Publisher)a[0], new Function() { + ((Publisher)a[0]).subscribe(new MapSubscriber(s, new Function() { @Override public R apply(T t) throws Exception { return combiner.apply(new Object[] { t }); } - }).subscribe(s); + })); return; } @@ -497,7 +497,7 @@ public boolean isEmpty() { static final class CombineLatestInnerSubscriber extends AtomicReference - implements Subscriber { + implements FlowableSubscriber { private static final long serialVersionUID = -8730235182291002949L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatArray.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatArray.java index 1846744060..c2ca5de3b3 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatArray.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatArray.java @@ -17,7 +17,7 @@ import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.exceptions.CompositeException; import io.reactivex.internal.subscriptions.SubscriptionArbiter; @@ -40,7 +40,7 @@ protected void subscribeActual(Subscriber s) { parent.onComplete(); } - static final class ConcatArraySubscriber extends SubscriptionArbiter implements Subscriber { + static final class ConcatArraySubscriber extends SubscriptionArbiter implements FlowableSubscriber { private static final long serialVersionUID = -8158322871608889516L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatMap.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatMap.java index 06d6fa7045..6aee2f7c80 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatMap.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatMap.java @@ -12,14 +12,15 @@ */ package io.reactivex.internal.operators.flowable; -import io.reactivex.internal.functions.ObjectHelper; import java.util.concurrent.Callable; -import java.util.concurrent.atomic.*; +import java.util.concurrent.atomic.AtomicInteger; import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Function; +import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.fuseable.*; import io.reactivex.internal.queue.SpscArrayQueue; import io.reactivex.internal.subscriptions.*; @@ -34,7 +35,7 @@ public final class FlowableConcatMap extends AbstractFlowableWithUpstream< final ErrorMode errorMode; - public FlowableConcatMap(Publisher source, + public FlowableConcatMap(Flowable source, Function> mapper, int prefetch, ErrorMode errorMode) { super(source); @@ -67,7 +68,7 @@ protected void subscribeActual(Subscriber s) { abstract static class BaseConcatMapSubscriber extends AtomicInteger - implements Subscriber, ConcatMapSupport, Subscription { + implements FlowableSubscriber, ConcatMapSupport, Subscription { private static final long serialVersionUID = -3511336836796789179L; @@ -567,7 +568,7 @@ interface ConcatMapSupport { static final class ConcatMapInner extends SubscriptionArbiter - implements Subscriber { + implements FlowableSubscriber { private static final long serialVersionUID = 897683679971470653L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatMapEager.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatMapEager.java index 3847690b94..6d1af9101a 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatMapEager.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatMapEager.java @@ -17,6 +17,7 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.*; import io.reactivex.functions.Function; import io.reactivex.internal.functions.ObjectHelper; @@ -37,12 +38,11 @@ public final class FlowableConcatMapEager extends AbstractFlowableWithUpst final ErrorMode errorMode; - public FlowableConcatMapEager(Publisher source, + public FlowableConcatMapEager(Flowable source, Function> mapper, int maxConcurrency, int prefetch, - ErrorMode errorMode - ) { + ErrorMode errorMode) { super(source); this.mapper = mapper; this.maxConcurrency = maxConcurrency; @@ -58,7 +58,7 @@ protected void subscribeActual(Subscriber s) { static final class ConcatMapEagerDelayErrorSubscriber extends AtomicInteger - implements Subscriber, Subscription, InnerQueuedSubscriberSupport { + implements FlowableSubscriber, Subscription, InnerQueuedSubscriberSupport { private static final long serialVersionUID = -4255299542215038287L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatMapEagerPublisher.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatMapEagerPublisher.java new file mode 100644 index 0000000000..a88e05953d --- /dev/null +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatMapEagerPublisher.java @@ -0,0 +1,58 @@ +/** + * 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.internal.operators.flowable; + +import org.reactivestreams.*; + +import io.reactivex.Flowable; +import io.reactivex.functions.Function; +import io.reactivex.internal.operators.flowable.FlowableConcatMapEager.ConcatMapEagerDelayErrorSubscriber; +import io.reactivex.internal.util.ErrorMode; + +/** + * ConcatMapEager which works with an arbitrary Publisher source. + * @param the input value type + * @param the output type + * @since 2.0.7 - experimental + */ +public final class FlowableConcatMapEagerPublisher extends Flowable { + + final Publisher source; + + final Function> mapper; + + final int maxConcurrency; + + final int prefetch; + + final ErrorMode errorMode; + + public FlowableConcatMapEagerPublisher(Publisher source, + Function> mapper, + int maxConcurrency, + int prefetch, + ErrorMode errorMode) { + this.source = source; + this.mapper = mapper; + this.maxConcurrency = maxConcurrency; + this.prefetch = prefetch; + this.errorMode = errorMode; + } + + @Override + protected void subscribeActual(Subscriber s) { + source.subscribe(new ConcatMapEagerDelayErrorSubscriber( + s, mapper, maxConcurrency, prefetch, errorMode)); + } +} diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatMapPublisher.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatMapPublisher.java new file mode 100644 index 0000000000..a5d1c3382a --- /dev/null +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableConcatMapPublisher.java @@ -0,0 +1,622 @@ +/** + * 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.internal.operators.flowable; + +import java.util.concurrent.Callable; +import java.util.concurrent.atomic.AtomicInteger; + +import org.reactivestreams.*; + +import io.reactivex.*; +import io.reactivex.exceptions.Exceptions; +import io.reactivex.functions.Function; +import io.reactivex.internal.functions.ObjectHelper; +import io.reactivex.internal.fuseable.*; +import io.reactivex.internal.queue.SpscArrayQueue; +import io.reactivex.internal.subscriptions.*; +import io.reactivex.internal.util.*; +import io.reactivex.plugins.RxJavaPlugins; + +public final class FlowableConcatMapPublisher extends Flowable { + + final Publisher source; + + final Function> mapper; + + final int prefetch; + + final ErrorMode errorMode; + + public FlowableConcatMapPublisher(Publisher source, + Function> mapper, + int prefetch, ErrorMode errorMode) { + this.source = source; + this.mapper = mapper; + this.prefetch = prefetch; + this.errorMode = errorMode; + } + + public static Subscriber subscribe(Subscriber s, Function> mapper, + int prefetch, ErrorMode errorMode) { + switch (errorMode) { + case BOUNDARY: + return new ConcatMapDelayed(s, mapper, prefetch, false); + case END: + return new ConcatMapDelayed(s, mapper, prefetch, true); + default: + return new ConcatMapImmediate(s, mapper, prefetch); + } + } + + @Override + protected void subscribeActual(Subscriber s) { + + if (FlowableScalarXMap.tryScalarXMapSubscribe(source, s, mapper)) { + return; + } + + source.subscribe(subscribe(s, mapper, prefetch, errorMode)); + } + + abstract static class BaseConcatMapSubscriber + extends AtomicInteger + implements FlowableSubscriber, ConcatMapSupport, Subscription { + + private static final long serialVersionUID = -3511336836796789179L; + + final ConcatMapInner inner; + + final Function> mapper; + + final int prefetch; + + final int limit; + + Subscription s; + + int consumed; + + SimpleQueue queue; + + volatile boolean done; + + volatile boolean cancelled; + + final AtomicThrowable errors; + + volatile boolean active; + + int sourceMode; + + BaseConcatMapSubscriber( + Function> mapper, + int prefetch) { + this.mapper = mapper; + this.prefetch = prefetch; + this.limit = prefetch - (prefetch >> 2); + this.inner = new ConcatMapInner(this); + this.errors = new AtomicThrowable(); + } + + @Override + public final void onSubscribe(Subscription s) { + if (SubscriptionHelper.validate(this.s, s)) { + this.s = s; + + if (s instanceof QueueSubscription) { + @SuppressWarnings("unchecked") QueueSubscription f = (QueueSubscription)s; + int m = f.requestFusion(QueueSubscription.ANY); + if (m == QueueSubscription.SYNC) { + sourceMode = m; + queue = f; + done = true; + + subscribeActual(); + + drain(); + return; + } + if (m == QueueSubscription.ASYNC) { + sourceMode = m; + queue = f; + + subscribeActual(); + + s.request(prefetch); + return; + } + } + + queue = new SpscArrayQueue(prefetch); + + subscribeActual(); + + s.request(prefetch); + } + } + + abstract void drain(); + + abstract void subscribeActual(); + + @Override + public final void onNext(T t) { + if (sourceMode != QueueSubscription.ASYNC) { + if (!queue.offer(t)) { + s.cancel(); + onError(new IllegalStateException("Queue full?!")); + return; + } + } + drain(); + } + + @Override + public final void onComplete() { + done = true; + drain(); + } + + @Override + public final void innerComplete() { + active = false; + drain(); + } + + } + + + static final class ConcatMapImmediate + extends BaseConcatMapSubscriber { + + + private static final long serialVersionUID = 7898995095634264146L; + + final Subscriber actual; + + final AtomicInteger wip; + + ConcatMapImmediate(Subscriber actual, + Function> mapper, + int prefetch) { + super(mapper, prefetch); + this.actual = actual; + this.wip = new AtomicInteger(); + } + + @Override + void subscribeActual() { + actual.onSubscribe(this); + } + + @Override + public void onError(Throwable t) { + if (errors.addThrowable(t)) { + inner.cancel(); + + if (getAndIncrement() == 0) { + actual.onError(errors.terminate()); + } + } else { + RxJavaPlugins.onError(t); + } + } + + @Override + public void innerNext(R value) { + if (get() == 0 && compareAndSet(0, 1)) { + actual.onNext(value); + if (compareAndSet(1, 0)) { + return; + } + actual.onError(errors.terminate()); + } + } + + @Override + public void innerError(Throwable e) { + if (errors.addThrowable(e)) { + s.cancel(); + + if (getAndIncrement() == 0) { + actual.onError(errors.terminate()); + } + } else { + RxJavaPlugins.onError(e); + } + } + + @Override + public void request(long n) { + inner.request(n); + } + + @Override + public void cancel() { + if (!cancelled) { + cancelled = true; + + inner.cancel(); + s.cancel(); + } + } + + @Override + void drain() { + if (wip.getAndIncrement() == 0) { + for (;;) { + if (cancelled) { + return; + } + + if (!active) { + boolean d = done; + + T v; + + try { + v = queue.poll(); + } catch (Throwable e) { + Exceptions.throwIfFatal(e); + s.cancel(); + errors.addThrowable(e); + actual.onError(errors.terminate()); + return; + } + + boolean empty = v == null; + + if (d && empty) { + actual.onComplete(); + return; + } + + if (!empty) { + Publisher p; + + try { + p = ObjectHelper.requireNonNull(mapper.apply(v), "The mapper returned a null Publisher"); + } catch (Throwable e) { + Exceptions.throwIfFatal(e); + + s.cancel(); + errors.addThrowable(e); + actual.onError(errors.terminate()); + return; + } + + if (sourceMode != QueueSubscription.SYNC) { + int c = consumed + 1; + if (c == limit) { + consumed = 0; + s.request(c); + } else { + consumed = c; + } + } + + + if (p instanceof Callable) { + @SuppressWarnings("unchecked") + Callable callable = (Callable) p; + + R vr; + + try { + vr = callable.call(); + } catch (Throwable e) { + Exceptions.throwIfFatal(e); + s.cancel(); + errors.addThrowable(e); + actual.onError(errors.terminate()); + return; + } + + + if (vr == null) { + continue; + } + + if (inner.isUnbounded()) { + if (get() == 0 && compareAndSet(0, 1)) { + actual.onNext(vr); + if (!compareAndSet(1, 0)) { + actual.onError(errors.terminate()); + return; + } + } + continue; + } else { + active = true; + inner.setSubscription(new WeakScalarSubscription(vr, inner)); + } + + } else { + active = true; + p.subscribe(inner); + } + } + } + if (wip.decrementAndGet() == 0) { + break; + } + } + } + } + } + + static final class WeakScalarSubscription implements Subscription { + final Subscriber actual; + final T value; + boolean once; + + WeakScalarSubscription(T value, Subscriber actual) { + this.value = value; + this.actual = actual; + } + + @Override + public void request(long n) { + if (n > 0 && !once) { + once = true; + Subscriber a = actual; + a.onNext(value); + a.onComplete(); + } + } + + @Override + public void cancel() { + + } + } + + static final class ConcatMapDelayed + extends BaseConcatMapSubscriber { + + + private static final long serialVersionUID = -2945777694260521066L; + + final Subscriber actual; + + final boolean veryEnd; + + ConcatMapDelayed(Subscriber actual, + Function> mapper, + int prefetch, boolean veryEnd) { + super(mapper, prefetch); + this.actual = actual; + this.veryEnd = veryEnd; + } + + @Override + void subscribeActual() { + actual.onSubscribe(this); + } + + @Override + public void onError(Throwable t) { + if (errors.addThrowable(t)) { + done = true; + drain(); + } else { + RxJavaPlugins.onError(t); + } + } + + @Override + public void innerNext(R value) { + actual.onNext(value); + } + + + @Override + public void innerError(Throwable e) { + if (errors.addThrowable(e)) { + if (!veryEnd) { + s.cancel(); + done = true; + } + active = false; + drain(); + } else { + RxJavaPlugins.onError(e); + } + } + + @Override + public void request(long n) { + inner.request(n); + } + + @Override + public void cancel() { + if (!cancelled) { + cancelled = true; + + inner.cancel(); + s.cancel(); + } + } + + @Override + void drain() { + if (getAndIncrement() == 0) { + + for (;;) { + if (cancelled) { + return; + } + + if (!active) { + + boolean d = done; + + if (d && !veryEnd) { + Throwable ex = errors.get(); + if (ex != null) { + actual.onError(errors.terminate()); + return; + } + } + + T v; + + try { + v = queue.poll(); + } catch (Throwable e) { + Exceptions.throwIfFatal(e); + s.cancel(); + errors.addThrowable(e); + actual.onError(errors.terminate()); + return; + } + + boolean empty = v == null; + + if (d && empty) { + Throwable ex = errors.terminate(); + if (ex != null) { + actual.onError(ex); + } else { + actual.onComplete(); + } + return; + } + + if (!empty) { + Publisher p; + + try { + p = ObjectHelper.requireNonNull(mapper.apply(v), "The mapper returned a null Publisher"); + } catch (Throwable e) { + Exceptions.throwIfFatal(e); + + s.cancel(); + errors.addThrowable(e); + actual.onError(errors.terminate()); + return; + } + + if (sourceMode != QueueSubscription.SYNC) { + int c = consumed + 1; + if (c == limit) { + consumed = 0; + s.request(c); + } else { + consumed = c; + } + } + + if (p instanceof Callable) { + @SuppressWarnings("unchecked") + Callable supplier = (Callable) p; + + R vr; + + try { + vr = supplier.call(); + } catch (Throwable e) { + Exceptions.throwIfFatal(e); + s.cancel(); + errors.addThrowable(e); + actual.onError(errors.terminate()); + return; + } + + if (vr == null) { + continue; + } + + if (inner.isUnbounded()) { + actual.onNext(vr); + continue; + } else { + active = true; + inner.setSubscription(new WeakScalarSubscription(vr, inner)); + } + } else { + active = true; + p.subscribe(inner); + } + } + } + if (decrementAndGet() == 0) { + break; + } + } + } + } + } + + interface ConcatMapSupport { + + void innerNext(T value); + + void innerComplete(); + + void innerError(Throwable e); + } + + static final class ConcatMapInner + extends SubscriptionArbiter + implements FlowableSubscriber { + + + private static final long serialVersionUID = 897683679971470653L; + + final ConcatMapSupport parent; + + long produced; + + ConcatMapInner(ConcatMapSupport parent) { + this.parent = parent; + } + + @Override + public void onSubscribe(Subscription s) { + setSubscription(s); + } + + @Override + public void onNext(R t) { + produced++; + + parent.innerNext(t); + } + + @Override + public void onError(Throwable t) { + long p = produced; + + if (p != 0L) { + produced = 0L; + produced(p); + } + + parent.innerError(t); + } + + @Override + public void onComplete() { + long p = produced; + + if (p != 0L) { + produced = 0L; + produced(p); + } + + parent.innerComplete(); + } + } +} diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableCount.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableCount.java index b8bd30434f..95bbfb0d2e 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableCount.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableCount.java @@ -15,11 +15,12 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.internal.subscriptions.*; public final class FlowableCount extends AbstractFlowableWithUpstream { - public FlowableCount(Publisher source) { + public FlowableCount(Flowable source) { super(source); } @@ -29,7 +30,7 @@ protected void subscribeActual(Subscriber s) { } static final class CountSubscriber extends DeferredScalarSubscription - implements Subscriber { + implements FlowableSubscriber { private static final long serialVersionUID = 4973004223787171406L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableCountSingle.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableCountSingle.java index 54da7e999f..97c4c08c49 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableCountSingle.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableCountSingle.java @@ -23,9 +23,9 @@ public final class FlowableCountSingle extends Single implements FuseToFlowable { - final Publisher source; + final Flowable source; - public FlowableCountSingle(Publisher source) { + public FlowableCountSingle(Flowable source) { this.source = source; } @@ -39,7 +39,7 @@ public Flowable fuseToFlowable() { return RxJavaPlugins.onAssembly(new FlowableCount(source)); } - static final class CountSubscriber implements Subscriber, Disposable { + static final class CountSubscriber implements FlowableSubscriber, Disposable { final SingleObserver actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDebounce.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDebounce.java index a4c7f680a0..34bc84c4c3 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDebounce.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDebounce.java @@ -17,6 +17,7 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.*; import io.reactivex.functions.Function; @@ -30,7 +31,7 @@ public final class FlowableDebounce extends AbstractFlowableWithUpstream { final Function> debounceSelector; - public FlowableDebounce(Publisher source, Function> debounceSelector) { + public FlowableDebounce(Flowable source, Function> debounceSelector) { super(source); this.debounceSelector = debounceSelector; } @@ -41,7 +42,7 @@ protected void subscribeActual(Subscriber s) { } static final class DebounceSubscriber extends AtomicLong - implements Subscriber, Subscription { + implements FlowableSubscriber, Subscription { private static final long serialVersionUID = 6725975399620862591L; final Subscriber actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDebounceTimed.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDebounceTimed.java index 7730144753..3f667dcb09 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDebounceTimed.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDebounceTimed.java @@ -18,7 +18,7 @@ import org.reactivestreams.*; -import io.reactivex.Scheduler; +import io.reactivex.*; import io.reactivex.Scheduler.Worker; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.MissingBackpressureException; @@ -33,7 +33,7 @@ public final class FlowableDebounceTimed extends AbstractFlowableWithUpstream final TimeUnit unit; final Scheduler scheduler; - public FlowableDebounceTimed(Publisher source, long timeout, TimeUnit unit, Scheduler scheduler) { + public FlowableDebounceTimed(Flowable source, long timeout, TimeUnit unit, Scheduler scheduler) { super(source); this.timeout = timeout; this.unit = unit; @@ -48,7 +48,7 @@ protected void subscribeActual(Subscriber s) { } static final class DebounceTimedSubscriber extends AtomicLong - implements Subscriber, Subscription { + implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -9102637559663639004L; final Subscriber actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDefer.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDefer.java index 153adf5ba0..8a44a0019e 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDefer.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDefer.java @@ -13,13 +13,13 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.internal.functions.ObjectHelper; import java.util.concurrent.Callable; import org.reactivestreams.*; import io.reactivex.Flowable; import io.reactivex.exceptions.Exceptions; +import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.subscriptions.EmptySubscription; public final class FlowableDefer extends Flowable { diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDelay.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDelay.java index d46aaad2dd..8241980eae 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDelay.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDelay.java @@ -28,7 +28,7 @@ public final class FlowableDelay extends AbstractFlowableWithUpstream { final Scheduler scheduler; final boolean delayError; - public FlowableDelay(Publisher source, long delay, TimeUnit unit, Scheduler scheduler, boolean delayError) { + public FlowableDelay(Flowable source, long delay, TimeUnit unit, Scheduler scheduler, boolean delayError) { super(source); this.delay = delay; this.unit = unit; @@ -50,7 +50,7 @@ protected void subscribeActual(Subscriber t) { source.subscribe(new DelaySubscriber(s, delay, unit, w, delayError)); } - static final class DelaySubscriber implements Subscriber, Subscription { + static final class DelaySubscriber implements FlowableSubscriber, Subscription { final Subscriber actual; final long delay; final TimeUnit unit; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDelaySubscriptionOther.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDelaySubscriptionOther.java index 695b68681b..deda0ecaa0 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDelaySubscriptionOther.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDelaySubscriptionOther.java @@ -14,7 +14,7 @@ import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.internal.subscriptions.SubscriptionArbiter; import io.reactivex.plugins.RxJavaPlugins; @@ -38,7 +38,7 @@ public void subscribeActual(final Subscriber child) { final SubscriptionArbiter serial = new SubscriptionArbiter(); child.onSubscribe(serial); - Subscriber otherSubscriber = new Subscriber() { + FlowableSubscriber otherSubscriber = new FlowableSubscriber() { boolean done; @Override @@ -79,7 +79,7 @@ public void onComplete() { } done = true; - main.subscribe(new Subscriber() { + main.subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { serial.setSubscription(s); diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDematerialize.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDematerialize.java index 28e61cfc87..5ce85197c3 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDematerialize.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDematerialize.java @@ -21,7 +21,7 @@ public final class FlowableDematerialize extends AbstractFlowableWithUpstream, T> { - public FlowableDematerialize(Publisher> source) { + public FlowableDematerialize(Flowable> source) { super(source); } @@ -30,7 +30,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new DematerializeSubscriber(s)); } - static final class DematerializeSubscriber implements Subscriber>, Subscription { + static final class DematerializeSubscriber implements FlowableSubscriber>, Subscription { final Subscriber actual; boolean done; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDetach.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDetach.java index 04eb2b78c5..de618949d4 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDetach.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDetach.java @@ -15,12 +15,13 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.EmptyComponent; public final class FlowableDetach extends AbstractFlowableWithUpstream { - public FlowableDetach(Publisher source) { + public FlowableDetach(Flowable source) { super(source); } @@ -29,7 +30,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new DetachSubscriber(s)); } - static final class DetachSubscriber implements Subscriber, Subscription { + static final class DetachSubscriber implements FlowableSubscriber, Subscription { Subscriber actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDistinct.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDistinct.java index 67e83448af..7072dd3e43 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDistinct.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDistinct.java @@ -16,9 +16,10 @@ import java.util.Collection; import java.util.concurrent.Callable; -import io.reactivex.annotations.Nullable; -import org.reactivestreams.*; +import org.reactivestreams.Subscriber; +import io.reactivex.Flowable; +import io.reactivex.annotations.Nullable; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Function; import io.reactivex.internal.functions.ObjectHelper; @@ -33,7 +34,7 @@ public final class FlowableDistinct extends AbstractFlowableWithUpstream> collectionSupplier; - public FlowableDistinct(Publisher source, Function keySelector, Callable> collectionSupplier) { + public FlowableDistinct(Flowable source, Function keySelector, Callable> collectionSupplier) { super(source); this.keySelector = keySelector; this.collectionSupplier = collectionSupplier; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDistinctUntilChanged.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDistinctUntilChanged.java index 6db754560e..9b1944977b 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDistinctUntilChanged.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDistinctUntilChanged.java @@ -13,9 +13,10 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.annotations.Nullable; -import org.reactivestreams.*; +import org.reactivestreams.Subscriber; +import io.reactivex.Flowable; +import io.reactivex.annotations.Nullable; import io.reactivex.functions.*; import io.reactivex.internal.fuseable.ConditionalSubscriber; import io.reactivex.internal.subscribers.*; @@ -26,7 +27,7 @@ public final class FlowableDistinctUntilChanged extends AbstractFlowableWi final BiPredicate comparer; - public FlowableDistinctUntilChanged(Publisher source, Function keySelector, BiPredicate comparer) { + public FlowableDistinctUntilChanged(Flowable source, Function keySelector, BiPredicate comparer) { super(source); this.keySelector = keySelector; this.comparer = comparer; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDoAfterNext.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDoAfterNext.java index 1960e246ef..039dd86311 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDoAfterNext.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDoAfterNext.java @@ -13,10 +13,10 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.annotations.Nullable; -import org.reactivestreams.*; +import org.reactivestreams.Subscriber; -import io.reactivex.annotations.Experimental; +import io.reactivex.Flowable; +import io.reactivex.annotations.*; import io.reactivex.functions.Consumer; import io.reactivex.internal.fuseable.ConditionalSubscriber; import io.reactivex.internal.subscribers.*; @@ -31,7 +31,7 @@ public final class FlowableDoAfterNext extends AbstractFlowableWithUpstream onAfterNext; - public FlowableDoAfterNext(Publisher source, Consumer onAfterNext) { + public FlowableDoAfterNext(Flowable source, Consumer onAfterNext) { super(source); this.onAfterNext = onAfterNext; } diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDoFinally.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDoFinally.java index e31ac375ae..e15faff21a 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDoFinally.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDoFinally.java @@ -13,10 +13,10 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.annotations.Nullable; import org.reactivestreams.*; -import io.reactivex.annotations.Experimental; +import io.reactivex.*; +import io.reactivex.annotations.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Action; import io.reactivex.internal.fuseable.*; @@ -34,7 +34,7 @@ public final class FlowableDoFinally extends AbstractFlowableWithUpstream source, Action onFinally) { + public FlowableDoFinally(Flowable source, Action onFinally) { super(source); this.onFinally = onFinally; } @@ -48,7 +48,7 @@ protected void subscribeActual(Subscriber s) { } } - static final class DoFinallySubscriber extends BasicIntQueueSubscription implements Subscriber { + static final class DoFinallySubscriber extends BasicIntQueueSubscription implements FlowableSubscriber { private static final long serialVersionUID = 4109457741734051389L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDoOnEach.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDoOnEach.java index b8a6b4f513..3f1e609eaa 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDoOnEach.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDoOnEach.java @@ -13,9 +13,10 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.annotations.Nullable; -import org.reactivestreams.*; +import org.reactivestreams.Subscriber; +import io.reactivex.Flowable; +import io.reactivex.annotations.Nullable; import io.reactivex.exceptions.*; import io.reactivex.functions.*; import io.reactivex.internal.fuseable.ConditionalSubscriber; @@ -28,7 +29,7 @@ public final class FlowableDoOnEach extends AbstractFlowableWithUpstream source, Consumer onNext, + public FlowableDoOnEach(Flowable source, Consumer onNext, Consumer onError, Action onComplete, Action onAfterTerminate) { diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDoOnLifecycle.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDoOnLifecycle.java index 5d43648839..e68f1a01e2 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableDoOnLifecycle.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableDoOnLifecycle.java @@ -14,7 +14,7 @@ import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.*; import io.reactivex.internal.subscriptions.*; @@ -38,7 +38,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new SubscriptionLambdaSubscriber(s, onSubscribe, onRequest, onCancel)); } - static final class SubscriptionLambdaSubscriber implements Subscriber, Subscription { + static final class SubscriptionLambdaSubscriber implements FlowableSubscriber, Subscription { final Subscriber actual; final Consumer onSubscribe; final LongConsumer onRequest; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableElementAt.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableElementAt.java index db1b24b3d0..261cbd88cf 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableElementAt.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableElementAt.java @@ -17,6 +17,7 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.internal.subscriptions.*; import io.reactivex.plugins.RxJavaPlugins; @@ -25,7 +26,7 @@ public final class FlowableElementAt extends AbstractFlowableWithUpstream source, long index, T defaultValue, boolean errorOnFewer) { + public FlowableElementAt(Flowable source, long index, T defaultValue, boolean errorOnFewer) { super(source); this.index = index; this.defaultValue = defaultValue; @@ -37,7 +38,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new ElementAtSubscriber(s, index, defaultValue, errorOnFewer)); } - static final class ElementAtSubscriber extends DeferredScalarSubscription implements Subscriber { + static final class ElementAtSubscriber extends DeferredScalarSubscription implements FlowableSubscriber { private static final long serialVersionUID = 4066607327284737757L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableElementAtMaybe.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableElementAtMaybe.java index d8e397f9dd..d8907aa310 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableElementAtMaybe.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableElementAtMaybe.java @@ -22,11 +22,11 @@ import io.reactivex.plugins.RxJavaPlugins; public final class FlowableElementAtMaybe extends Maybe implements FuseToFlowable { - final Publisher source; + final Flowable source; final long index; - public FlowableElementAtMaybe(Publisher source, long index) { + public FlowableElementAtMaybe(Flowable source, long index) { this.source = source; this.index = index; } @@ -41,7 +41,7 @@ public Flowable fuseToFlowable() { return RxJavaPlugins.onAssembly(new FlowableElementAt(source, index, null, false)); } - static final class ElementAtSubscriber implements Subscriber, Disposable { + static final class ElementAtSubscriber implements FlowableSubscriber, Disposable { final MaybeObserver actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableElementAtSingle.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableElementAtSingle.java index 39545ca39b..874f744010 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableElementAtSingle.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableElementAtSingle.java @@ -14,6 +14,7 @@ package io.reactivex.internal.operators.flowable; import java.util.NoSuchElementException; + import org.reactivestreams.*; import io.reactivex.*; @@ -23,13 +24,13 @@ import io.reactivex.plugins.RxJavaPlugins; public final class FlowableElementAtSingle extends Single implements FuseToFlowable { - final Publisher source; + final Flowable source; final long index; final T defaultValue; - public FlowableElementAtSingle(Publisher source, long index, T defaultValue) { + public FlowableElementAtSingle(Flowable source, long index, T defaultValue) { this.source = source; this.index = index; this.defaultValue = defaultValue; @@ -45,7 +46,7 @@ public Flowable fuseToFlowable() { return RxJavaPlugins.onAssembly(new FlowableElementAt(source, index, defaultValue, true)); } - static final class ElementAtSubscriber implements Subscriber, Disposable { + static final class ElementAtSubscriber implements FlowableSubscriber, Disposable { final SingleObserver actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableError.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableError.java index d16a053a65..b74ad1d871 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableError.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableError.java @@ -13,13 +13,13 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.internal.functions.ObjectHelper; import java.util.concurrent.Callable; import org.reactivestreams.Subscriber; import io.reactivex.Flowable; import io.reactivex.exceptions.Exceptions; +import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.subscriptions.EmptySubscription; public final class FlowableError extends Flowable { diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFilter.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFilter.java index c326e6e623..96b529f3f2 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFilter.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFilter.java @@ -13,16 +13,17 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.annotations.Nullable; -import org.reactivestreams.*; +import org.reactivestreams.Subscriber; +import io.reactivex.Flowable; +import io.reactivex.annotations.Nullable; import io.reactivex.functions.Predicate; import io.reactivex.internal.fuseable.*; import io.reactivex.internal.subscribers.*; public final class FlowableFilter extends AbstractFlowableWithUpstream { final Predicate predicate; - public FlowableFilter(Publisher source, Predicate predicate) { + public FlowableFilter(Flowable source, Predicate predicate) { super(source); this.predicate = predicate; } diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMap.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMap.java index b4ebd30747..bd5ad2f916 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMap.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMap.java @@ -18,6 +18,7 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.*; import io.reactivex.functions.Function; @@ -34,7 +35,7 @@ public final class FlowableFlatMap extends AbstractFlowableWithUpstream source, + public FlowableFlatMap(Flowable source, Function> mapper, boolean delayErrors, int maxConcurrency, int bufferSize) { super(source); @@ -52,13 +53,13 @@ protected void subscribeActual(Subscriber s) { source.subscribe(subscribe(s, mapper, delayErrors, maxConcurrency, bufferSize)); } - public static Subscriber subscribe(Subscriber s, + public static FlowableSubscriber subscribe(Subscriber s, Function> mapper, boolean delayErrors, int maxConcurrency, int bufferSize) { return new MergeSubscriber(s, mapper, delayErrors, maxConcurrency, bufferSize); } - static final class MergeSubscriber extends AtomicInteger implements Subscription, Subscriber { + static final class MergeSubscriber extends AtomicInteger implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -2117620485640801370L; @@ -581,7 +582,7 @@ void disposeAll() { } static final class InnerSubscriber extends AtomicReference - implements Subscriber, Disposable { + implements FlowableSubscriber, Disposable { private static final long serialVersionUID = -4606175640614850599L; final long id; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapCompletable.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapCompletable.java index 940180680c..e565eb6a1f 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapCompletable.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapCompletable.java @@ -15,10 +15,10 @@ import java.util.concurrent.atomic.AtomicReference; -import io.reactivex.annotations.Nullable; import org.reactivestreams.*; import io.reactivex.*; +import io.reactivex.annotations.Nullable; import io.reactivex.disposables.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Function; @@ -40,7 +40,7 @@ public final class FlowableFlatMapCompletable extends AbstractFlowableWithUps final boolean delayErrors; - public FlowableFlatMapCompletable(Publisher source, + public FlowableFlatMapCompletable(Flowable source, Function mapper, boolean delayErrors, int maxConcurrency) { super(source); @@ -55,7 +55,7 @@ protected void subscribeActual(Subscriber observer) { } static final class FlatMapCompletableMainSubscriber extends BasicIntQueueSubscription - implements Subscriber { + implements FlowableSubscriber { private static final long serialVersionUID = 8443155186132538303L; final Subscriber actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapCompletableCompletable.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapCompletableCompletable.java index d4f762930b..59d0380fbb 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapCompletableCompletable.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapCompletableCompletable.java @@ -34,7 +34,7 @@ */ public final class FlowableFlatMapCompletableCompletable extends Completable implements FuseToFlowable { - final Publisher source; + final Flowable source; final Function mapper; @@ -42,7 +42,7 @@ public final class FlowableFlatMapCompletableCompletable extends Completable final boolean delayErrors; - public FlowableFlatMapCompletableCompletable(Publisher source, + public FlowableFlatMapCompletableCompletable(Flowable source, Function mapper, boolean delayErrors, int maxConcurrency) { this.source = source; @@ -62,7 +62,7 @@ public Flowable fuseToFlowable() { } static final class FlatMapCompletableMainSubscriber extends AtomicInteger - implements Subscriber, Disposable { + implements FlowableSubscriber, Disposable { private static final long serialVersionUID = 8443155186132538303L; final CompletableObserver actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapMaybe.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapMaybe.java index 75e11b9f59..bf888da0c3 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapMaybe.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapMaybe.java @@ -41,7 +41,7 @@ public final class FlowableFlatMapMaybe extends AbstractFlowableWithUpstre final int maxConcurrency; - public FlowableFlatMapMaybe(Publisher source, Function> mapper, + public FlowableFlatMapMaybe(Flowable source, Function> mapper, boolean delayError, int maxConcurrency) { super(source); this.mapper = mapper; @@ -56,7 +56,7 @@ protected void subscribeActual(Subscriber s) { static final class FlatMapMaybeSubscriber extends AtomicInteger - implements Subscriber, Subscription { + implements FlowableSubscriber, Subscription { private static final long serialVersionUID = 8600231336733376951L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapPublisher.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapPublisher.java new file mode 100644 index 0000000000..b5e0f18fc0 --- /dev/null +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapPublisher.java @@ -0,0 +1,45 @@ +/** + * 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.internal.operators.flowable; + +import org.reactivestreams.*; + +import io.reactivex.Flowable; +import io.reactivex.functions.Function; + +public final class FlowableFlatMapPublisher extends Flowable { + final Publisher source; + final Function> mapper; + final boolean delayErrors; + final int maxConcurrency; + final int bufferSize; + + public FlowableFlatMapPublisher(Publisher source, + Function> mapper, + boolean delayErrors, int maxConcurrency, int bufferSize) { + this.source = source; + this.mapper = mapper; + this.delayErrors = delayErrors; + this.maxConcurrency = maxConcurrency; + this.bufferSize = bufferSize; + } + + @Override + protected void subscribeActual(Subscriber s) { + if (FlowableScalarXMap.tryScalarXMapSubscribe(source, s, mapper)) { + return; + } + source.subscribe(FlowableFlatMap.subscribe(s, mapper, delayErrors, maxConcurrency, bufferSize)); + } +} diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapSingle.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapSingle.java index de650eb630..a5c205cc2a 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapSingle.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlatMapSingle.java @@ -41,7 +41,7 @@ public final class FlowableFlatMapSingle extends AbstractFlowableWithUpstr final int maxConcurrency; - public FlowableFlatMapSingle(Publisher source, Function> mapper, + public FlowableFlatMapSingle(Flowable source, Function> mapper, boolean delayError, int maxConcurrency) { super(source); this.mapper = mapper; @@ -56,7 +56,7 @@ protected void subscribeActual(Subscriber s) { static final class FlatMapSingleSubscriber extends AtomicInteger - implements Subscriber, Subscription { + implements FlowableSubscriber, Subscription { private static final long serialVersionUID = 8600231336733376951L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlattenIterable.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlattenIterable.java index fd97b5bfcc..e2eda98644 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlattenIterable.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFlattenIterable.java @@ -17,9 +17,10 @@ import java.util.concurrent.Callable; import java.util.concurrent.atomic.*; -import io.reactivex.annotations.Nullable; import org.reactivestreams.*; +import io.reactivex.*; +import io.reactivex.annotations.Nullable; import io.reactivex.exceptions.*; import io.reactivex.functions.Function; import io.reactivex.internal.fuseable.*; @@ -34,7 +35,7 @@ public final class FlowableFlattenIterable extends AbstractFlowableWithUps final int prefetch; - public FlowableFlattenIterable(Publisher source, + public FlowableFlattenIterable(Flowable source, Function> mapper, int prefetch) { super(source); this.mapper = mapper; @@ -81,7 +82,7 @@ public void subscribeActual(Subscriber s) { static final class FlattenIterableSubscriber extends BasicIntQueueSubscription - implements Subscriber { + implements FlowableSubscriber { private static final long serialVersionUID = -3096000382929934955L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFromArray.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFromArray.java index 51886f8650..b6819d06d5 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFromArray.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFromArray.java @@ -13,10 +13,10 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.annotations.Nullable; import org.reactivestreams.Subscriber; import io.reactivex.Flowable; +import io.reactivex.annotations.Nullable; import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.fuseable.ConditionalSubscriber; import io.reactivex.internal.subscriptions.*; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFromIterable.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFromIterable.java index 56c4b6c05b..ac1b0238dc 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFromIterable.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFromIterable.java @@ -15,10 +15,10 @@ import java.util.Iterator; -import io.reactivex.annotations.Nullable; import org.reactivestreams.Subscriber; import io.reactivex.Flowable; +import io.reactivex.annotations.Nullable; import io.reactivex.exceptions.Exceptions; import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.fuseable.ConditionalSubscriber; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFromObservable.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFromObservable.java index 7dfee6e67b..7b24ab0ce1 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableFromObservable.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableFromObservable.java @@ -12,12 +12,10 @@ */ package io.reactivex.internal.operators.flowable; -import io.reactivex.Flowable; -import io.reactivex.Observable; -import io.reactivex.Observer; +import org.reactivestreams.*; + +import io.reactivex.*; import io.reactivex.disposables.Disposable; -import org.reactivestreams.Subscriber; -import org.reactivestreams.Subscription; public final class FlowableFromObservable extends Flowable { private final Observable upstream; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableGroupBy.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableGroupBy.java index 649d2b9d35..a89a47ff72 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableGroupBy.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableGroupBy.java @@ -17,9 +17,10 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.*; -import io.reactivex.annotations.Nullable; import org.reactivestreams.*; +import io.reactivex.*; +import io.reactivex.annotations.Nullable; import io.reactivex.exceptions.Exceptions; import io.reactivex.flowables.GroupedFlowable; import io.reactivex.functions.Function; @@ -35,7 +36,7 @@ public final class FlowableGroupBy extends AbstractFlowableWithUpstream final int bufferSize; final boolean delayError; - public FlowableGroupBy(Publisher source, Function keySelector, Function valueSelector, int bufferSize, boolean delayError) { + public FlowableGroupBy(Flowable source, Function keySelector, Function valueSelector, int bufferSize, boolean delayError) { super(source); this.keySelector = keySelector; this.valueSelector = valueSelector; @@ -50,7 +51,7 @@ protected void subscribeActual(Subscriber> s) { public static final class GroupBySubscriber extends BasicIntQueueSubscription> - implements Subscriber { + implements FlowableSubscriber { private static final long serialVersionUID = -3688291656102519502L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableGroupJoin.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableGroupJoin.java index 501ee53a77..499bc38ff7 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableGroupJoin.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableGroupJoin.java @@ -21,7 +21,7 @@ import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.disposables.*; import io.reactivex.exceptions.*; import io.reactivex.functions.*; @@ -44,7 +44,7 @@ public final class FlowableGroupJoin exte final BiFunction, ? extends R> resultSelector; public FlowableGroupJoin( - Publisher source, + Flowable source, Publisher other, Function> leftEnd, Function> rightEnd, @@ -392,7 +392,7 @@ public void innerCloseError(Throwable ex) { static final class LeftRightSubscriber extends AtomicReference - implements Subscriber, Disposable { + implements FlowableSubscriber, Disposable { private static final long serialVersionUID = 1883890389173668373L; @@ -441,7 +441,7 @@ public void onComplete() { static final class LeftRightEndSubscriber extends AtomicReference - implements Subscriber, Disposable { + implements FlowableSubscriber, Disposable { private static final long serialVersionUID = 1883890389173668373L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableHide.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableHide.java index 39d65ad176..a0d3a33467 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableHide.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableHide.java @@ -15,6 +15,7 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.internal.subscriptions.SubscriptionHelper; /** @@ -25,7 +26,7 @@ */ public final class FlowableHide extends AbstractFlowableWithUpstream { - public FlowableHide(Publisher source) { + public FlowableHide(Flowable source) { super(source); } @@ -34,7 +35,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new HideSubscriber(s)); } - static final class HideSubscriber implements Subscriber, Subscription { + static final class HideSubscriber implements FlowableSubscriber, Subscription { final Subscriber actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableIgnoreElements.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableIgnoreElements.java index d2d7979285..270f99e31f 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableIgnoreElements.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableIgnoreElements.java @@ -13,15 +13,16 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.annotations.Nullable; import org.reactivestreams.*; +import io.reactivex.*; +import io.reactivex.annotations.Nullable; import io.reactivex.internal.fuseable.QueueSubscription; import io.reactivex.internal.subscriptions.SubscriptionHelper; public final class FlowableIgnoreElements extends AbstractFlowableWithUpstream { - public FlowableIgnoreElements(Publisher source) { + public FlowableIgnoreElements(Flowable source) { super(source); } @@ -30,7 +31,7 @@ protected void subscribeActual(final Subscriber t) { source.subscribe(new IgnoreElementsSubscriber(t)); } - static final class IgnoreElementsSubscriber implements QueueSubscription, Subscriber { + static final class IgnoreElementsSubscriber implements FlowableSubscriber, QueueSubscription { final Subscriber actual; Subscription s; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableIgnoreElementsCompletable.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableIgnoreElementsCompletable.java index 0fdcb4696e..88e7577c5a 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableIgnoreElementsCompletable.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableIgnoreElementsCompletable.java @@ -23,9 +23,9 @@ public final class FlowableIgnoreElementsCompletable extends Completable implements FuseToFlowable { - final Publisher source; + final Flowable source; - public FlowableIgnoreElementsCompletable(Publisher source) { + public FlowableIgnoreElementsCompletable(Flowable source) { this.source = source; } @@ -39,7 +39,7 @@ public Flowable fuseToFlowable() { return RxJavaPlugins.onAssembly(new FlowableIgnoreElements(source)); } - static final class IgnoreElementsSubscriber implements Subscriber, Disposable { + static final class IgnoreElementsSubscriber implements FlowableSubscriber, Disposable { final CompletableObserver actual; Subscription s; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableInternalHelper.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableInternalHelper.java index 5d65104640..0f51ff48fe 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableInternalHelper.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableInternalHelper.java @@ -77,7 +77,7 @@ static final class ItemDelayFunction implements Function> @Override public Publisher apply(final T v) throws Exception { - return new FlowableTake(itemDelay.apply(v), 1).map(Functions.justFunction(v)).defaultIfEmpty(v); + return new FlowableTakePublisher(itemDelay.apply(v), 1).map(Functions.justFunction(v)).defaultIfEmpty(v); } } @@ -165,7 +165,7 @@ static final class FlatMapWithCombinerOuter implements Function apply(final T t) throws Exception { @SuppressWarnings("unchecked") Publisher u = (Publisher)mapper.apply(t); - return new FlowableMap(u, new FlatMapWithCombinerInner(combiner, t)); + return new FlowableMapPublisher(u, new FlatMapWithCombinerInner(combiner, t)); } } diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableInterval.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableInterval.java index 945687c2db..9d1cd21197 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableInterval.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableInterval.java @@ -21,7 +21,7 @@ import io.reactivex.*; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.MissingBackpressureException; -import io.reactivex.internal.disposables.*; +import io.reactivex.internal.disposables.DisposableHelper; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.BackpressureHelper; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableJoin.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableJoin.java index 7fe9bd3fbc..36674f13fd 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableJoin.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableJoin.java @@ -18,6 +18,7 @@ import org.reactivestreams.*; +import io.reactivex.Flowable; import io.reactivex.disposables.CompositeDisposable; import io.reactivex.exceptions.*; import io.reactivex.functions.*; @@ -40,7 +41,7 @@ public final class FlowableJoin extends A final BiFunction resultSelector; public FlowableJoin( - Publisher source, + Flowable source, Publisher other, Function> leftEnd, Function> rightEnd, diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableLastMaybe.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableLastMaybe.java index 9288ae5446..ef36a4bd80 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableLastMaybe.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableLastMaybe.java @@ -39,7 +39,7 @@ protected void subscribeActual(MaybeObserver observer) { source.subscribe(new LastSubscriber(observer)); } - static final class LastSubscriber implements Subscriber, Disposable { + static final class LastSubscriber implements FlowableSubscriber, Disposable { final MaybeObserver actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableLastSingle.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableLastSingle.java index e72eabfcf7..8c8a12ee05 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableLastSingle.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableLastSingle.java @@ -14,6 +14,7 @@ package io.reactivex.internal.operators.flowable; import java.util.NoSuchElementException; + import org.reactivestreams.*; import io.reactivex.*; @@ -44,7 +45,7 @@ protected void subscribeActual(SingleObserver observer) { source.subscribe(new LastSubscriber(observer, defaultItem)); } - static final class LastSubscriber implements Subscriber, Disposable { + static final class LastSubscriber implements FlowableSubscriber, Disposable { final SingleObserver actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableLift.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableLift.java index dc86c29ed7..5828b3d9e3 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableLift.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableLift.java @@ -13,9 +13,9 @@ package io.reactivex.internal.operators.flowable; -import org.reactivestreams.*; +import org.reactivestreams.Subscriber; -import io.reactivex.FlowableOperator; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.plugins.RxJavaPlugins; @@ -32,7 +32,7 @@ public final class FlowableLift extends AbstractFlowableWithUpstream /** The actual operator. */ final FlowableOperator operator; - public FlowableLift(Publisher source, FlowableOperator operator) { + public FlowableLift(Flowable source, FlowableOperator operator) { super(source); this.operator = operator; } diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableMap.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableMap.java index e168d84ecb..e9df5a6726 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableMap.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableMap.java @@ -14,9 +14,10 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.annotations.Nullable; -import org.reactivestreams.*; +import org.reactivestreams.Subscriber; +import io.reactivex.Flowable; +import io.reactivex.annotations.Nullable; import io.reactivex.functions.Function; import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.fuseable.ConditionalSubscriber; @@ -24,7 +25,7 @@ public final class FlowableMap extends AbstractFlowableWithUpstream { final Function mapper; - public FlowableMap(Publisher source, Function mapper) { + public FlowableMap(Flowable source, Function mapper) { super(source); this.mapper = mapper; } diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableMapNotification.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableMapNotification.java index 2ff29800d2..faca674aec 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableMapNotification.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableMapNotification.java @@ -15,8 +15,9 @@ import java.util.concurrent.Callable; -import org.reactivestreams.*; +import org.reactivestreams.Subscriber; +import io.reactivex.Flowable; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Function; import io.reactivex.internal.functions.ObjectHelper; @@ -29,7 +30,7 @@ public final class FlowableMapNotification extends AbstractFlowableWithUps final Callable onCompleteSupplier; public FlowableMapNotification( - Publisher source, + Flowable source, Function onNextMapper, Function onErrorMapper, Callable onCompleteSupplier) { diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableMapPublisher.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableMapPublisher.java new file mode 100644 index 0000000000..b23132b744 --- /dev/null +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableMapPublisher.java @@ -0,0 +1,49 @@ +/** + * 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.internal.operators.flowable; + +import org.reactivestreams.*; + +import io.reactivex.Flowable; +import io.reactivex.functions.Function; +import io.reactivex.internal.fuseable.ConditionalSubscriber; +import io.reactivex.internal.operators.flowable.FlowableMap.*; + +/** + * Map working with an arbitrary Publisher source. + * + * @param the input value type + * @param the output value type + * @since 2.0.7 - experimental + */ +public final class FlowableMapPublisher extends Flowable { + + final Publisher source; + + final Function mapper; + public FlowableMapPublisher(Publisher source, Function mapper) { + this.source = source; + this.mapper = mapper; + } + + @Override + protected void subscribeActual(Subscriber s) { + if (s instanceof ConditionalSubscriber) { + source.subscribe(new MapConditionalSubscriber((ConditionalSubscriber)s, mapper)); + } else { + source.subscribe(new MapSubscriber(s, mapper)); + } + } +} diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableMaterialize.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableMaterialize.java index ffbd4a858c..3bceba2dea 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableMaterialize.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableMaterialize.java @@ -13,15 +13,15 @@ package io.reactivex.internal.operators.flowable; -import org.reactivestreams.*; +import org.reactivestreams.Subscriber; -import io.reactivex.Notification; +import io.reactivex.*; import io.reactivex.internal.subscribers.SinglePostCompleteSubscriber; import io.reactivex.plugins.RxJavaPlugins; public final class FlowableMaterialize extends AbstractFlowableWithUpstream> { - public FlowableMaterialize(Publisher source) { + public FlowableMaterialize(Flowable source) { super(source); } diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableNever.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableNever.java index f1914a664f..2565fb396c 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableNever.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableNever.java @@ -12,9 +12,10 @@ */ package io.reactivex.internal.operators.flowable; +import org.reactivestreams.Subscriber; + import io.reactivex.Flowable; import io.reactivex.internal.subscriptions.EmptySubscription; -import org.reactivestreams.Subscriber; public final class FlowableNever extends Flowable { public static final Flowable INSTANCE = new FlowableNever(); diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableObserveOn.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableObserveOn.java index d50339b2be..aaf515bf77 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableObserveOn.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableObserveOn.java @@ -15,11 +15,11 @@ import java.util.concurrent.atomic.AtomicLong; -import io.reactivex.annotations.Nullable; import org.reactivestreams.*; -import io.reactivex.Scheduler; +import io.reactivex.*; import io.reactivex.Scheduler.Worker; +import io.reactivex.annotations.Nullable; import io.reactivex.exceptions.*; import io.reactivex.internal.fuseable.*; import io.reactivex.internal.queue.SpscArrayQueue; @@ -35,7 +35,7 @@ public final class FlowableObserveOn extends AbstractFlowableWithUpstream source, + Flowable source, Scheduler scheduler, boolean delayError, int prefetch) { @@ -59,7 +59,7 @@ public void subscribeActual(Subscriber s) { abstract static class BaseObserveOnSubscriber extends BasicIntQueueSubscription - implements Runnable, Subscriber { + implements FlowableSubscriber, Runnable { private static final long serialVersionUID = -8241002408341274697L; final Worker worker; @@ -240,7 +240,7 @@ public final boolean isEmpty() { } static final class ObserveOnSubscriber extends BaseObserveOnSubscriber - implements Subscriber { + implements FlowableSubscriber { private static final long serialVersionUID = -4547113800637756442L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureBuffer.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureBuffer.java index ec20946b85..341cda93c8 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureBuffer.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureBuffer.java @@ -15,12 +15,13 @@ import java.util.concurrent.atomic.AtomicLong; -import io.reactivex.annotations.Nullable; import org.reactivestreams.*; +import io.reactivex.*; +import io.reactivex.annotations.Nullable; import io.reactivex.exceptions.*; import io.reactivex.functions.Action; -import io.reactivex.internal.fuseable.*; +import io.reactivex.internal.fuseable.SimplePlainQueue; import io.reactivex.internal.queue.*; import io.reactivex.internal.subscriptions.*; import io.reactivex.internal.util.BackpressureHelper; @@ -31,7 +32,7 @@ public final class FlowableOnBackpressureBuffer extends AbstractFlowableWithU final boolean delayError; final Action onOverflow; - public FlowableOnBackpressureBuffer(Publisher source, int bufferSize, boolean unbounded, + public FlowableOnBackpressureBuffer(Flowable source, int bufferSize, boolean unbounded, boolean delayError, Action onOverflow) { super(source); this.bufferSize = bufferSize; @@ -45,7 +46,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new BackpressureBufferSubscriber(s, bufferSize, unbounded, delayError, onOverflow)); } - static final class BackpressureBufferSubscriber extends BasicIntQueueSubscription implements Subscriber { + static final class BackpressureBufferSubscriber extends BasicIntQueueSubscription implements FlowableSubscriber { private static final long serialVersionUID = -2514538129242366402L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureBufferStrategy.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureBufferStrategy.java index 9cd348c546..7f3cdf8017 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureBufferStrategy.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureBufferStrategy.java @@ -18,7 +18,7 @@ import org.reactivestreams.*; -import io.reactivex.BackpressureOverflowStrategy; +import io.reactivex.*; import io.reactivex.exceptions.*; import io.reactivex.functions.Action; import io.reactivex.internal.subscriptions.SubscriptionHelper; @@ -38,7 +38,7 @@ public final class FlowableOnBackpressureBufferStrategy extends AbstractFlowa final BackpressureOverflowStrategy strategy; - public FlowableOnBackpressureBufferStrategy(Publisher source, + public FlowableOnBackpressureBufferStrategy(Flowable source, long bufferSize, Action onOverflow, BackpressureOverflowStrategy strategy) { super(source); this.bufferSize = bufferSize; @@ -53,7 +53,7 @@ protected void subscribeActual(Subscriber s) { static final class OnBackpressureBufferStrategySubscriber extends AtomicInteger - implements Subscriber, Subscription { + implements FlowableSubscriber, Subscription { private static final long serialVersionUID = 3240706908776709697L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureDrop.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureDrop.java index 5c29a756dd..eb633af079 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureDrop.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureDrop.java @@ -13,26 +13,27 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.plugins.RxJavaPlugins; import java.util.concurrent.atomic.AtomicLong; import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Consumer; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.BackpressureHelper; +import io.reactivex.plugins.RxJavaPlugins; public final class FlowableOnBackpressureDrop extends AbstractFlowableWithUpstream implements Consumer { final Consumer onDrop; - public FlowableOnBackpressureDrop(Publisher source) { + public FlowableOnBackpressureDrop(Flowable source) { super(source); this.onDrop = this; } - public FlowableOnBackpressureDrop(Publisher source, Consumer onDrop) { + public FlowableOnBackpressureDrop(Flowable source, Consumer onDrop) { super(source); this.onDrop = onDrop; } @@ -48,7 +49,7 @@ protected void subscribeActual(Subscriber s) { } static final class BackpressureDropSubscriber - extends AtomicLong implements Subscriber, Subscription { + extends AtomicLong implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -6246093802440953054L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureError.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureError.java index 9ab63fc898..a40f92aefd 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureError.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureError.java @@ -13,20 +13,20 @@ package io.reactivex.internal.operators.flowable; +import java.util.concurrent.atomic.AtomicLong; + +import org.reactivestreams.*; + +import io.reactivex.*; import io.reactivex.exceptions.MissingBackpressureException; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.BackpressureHelper; import io.reactivex.plugins.RxJavaPlugins; -import org.reactivestreams.Publisher; -import org.reactivestreams.Subscriber; -import org.reactivestreams.Subscription; - -import java.util.concurrent.atomic.AtomicLong; public final class FlowableOnBackpressureError extends AbstractFlowableWithUpstream { - public FlowableOnBackpressureError(Publisher source) { + public FlowableOnBackpressureError(Flowable source) { super(source); } @@ -37,7 +37,7 @@ protected void subscribeActual(Subscriber s) { } static final class BackpressureErrorSubscriber - extends AtomicLong implements Subscriber, Subscription { + extends AtomicLong implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -3176480756392482682L; final Subscriber actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureLatest.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureLatest.java index 8c863bae1c..2cd36a6ef0 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureLatest.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnBackpressureLatest.java @@ -17,12 +17,13 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.BackpressureHelper; public final class FlowableOnBackpressureLatest extends AbstractFlowableWithUpstream { - public FlowableOnBackpressureLatest(Publisher source) { + public FlowableOnBackpressureLatest(Flowable source) { super(source); } @@ -31,7 +32,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new BackpressureLatestSubscriber(s)); } - static final class BackpressureLatestSubscriber extends AtomicInteger implements Subscriber, Subscription { + static final class BackpressureLatestSubscriber extends AtomicInteger implements FlowableSubscriber, Subscription { private static final long serialVersionUID = 163080509307634843L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnErrorNext.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnErrorNext.java index ac2e709280..dd1198d0a9 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnErrorNext.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnErrorNext.java @@ -15,6 +15,7 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.*; import io.reactivex.functions.Function; import io.reactivex.internal.subscriptions.SubscriptionArbiter; @@ -24,7 +25,7 @@ public final class FlowableOnErrorNext extends AbstractFlowableWithUpstream> nextSupplier; final boolean allowFatal; - public FlowableOnErrorNext(Publisher source, + public FlowableOnErrorNext(Flowable source, Function> nextSupplier, boolean allowFatal) { super(source); this.nextSupplier = nextSupplier; @@ -38,7 +39,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(parent); } - static final class OnErrorNextSubscriber implements Subscriber { + static final class OnErrorNextSubscriber implements FlowableSubscriber { final Subscriber actual; final Function> nextSupplier; final boolean allowFatal; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnErrorReturn.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnErrorReturn.java index 66017d168b..333aa1cb27 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnErrorReturn.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnErrorReturn.java @@ -13,8 +13,9 @@ package io.reactivex.internal.operators.flowable; -import org.reactivestreams.*; +import org.reactivestreams.Subscriber; +import io.reactivex.Flowable; import io.reactivex.exceptions.*; import io.reactivex.functions.Function; import io.reactivex.internal.functions.ObjectHelper; @@ -22,7 +23,7 @@ public final class FlowableOnErrorReturn extends AbstractFlowableWithUpstream { final Function valueSupplier; - public FlowableOnErrorReturn(Publisher source, Function valueSupplier) { + public FlowableOnErrorReturn(Flowable source, Function valueSupplier) { super(source); this.valueSupplier = valueSupplier; } diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowablePublish.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowablePublish.java index e6d45d1e4f..803b16fbc6 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowablePublish.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowablePublish.java @@ -17,7 +17,7 @@ import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.*; import io.reactivex.flowables.ConnectableFlowable; @@ -41,7 +41,7 @@ public final class FlowablePublish extends ConnectableFlowable implements static final long CANCELLED = Long.MIN_VALUE; /** The source observable. */ - final Publisher source; + final Flowable source; /** Holds the current subscriber that is, will be or just was subscribed to the source observable. */ final AtomicReference> current; @@ -128,7 +128,7 @@ public void subscribe(Subscriber child) { return RxJavaPlugins.onAssembly(new FlowablePublish(onSubscribe, source, curr, bufferSize)); } - private FlowablePublish(Publisher onSubscribe, Publisher source, + private FlowablePublish(Publisher onSubscribe, Flowable source, final AtomicReference> current, int bufferSize) { this.onSubscribe = onSubscribe; this.source = source; @@ -198,7 +198,7 @@ public void connect(Consumer connection) { @SuppressWarnings("rawtypes") static final class PublishSubscriber extends AtomicInteger - implements Subscriber, Disposable { + implements FlowableSubscriber, Disposable { private static final long serialVersionUID = -202316842419149694L; /** Indicates an empty array of inner subscribers. */ diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowablePublishMulticast.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowablePublishMulticast.java index e7ac5b8f42..ce12c45e9c 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowablePublishMulticast.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowablePublishMulticast.java @@ -20,7 +20,7 @@ import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.*; import io.reactivex.functions.Function; @@ -44,7 +44,7 @@ public final class FlowablePublishMulticast extends AbstractFlowableWithUp final boolean delayError; - public FlowablePublishMulticast(Publisher source, + public FlowablePublishMulticast(Flowable source, Function, ? extends Publisher> selector, int prefetch, boolean delayError) { super(source); @@ -74,7 +74,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(mp); } - static final class OutputCanceller implements Subscriber, Subscription { + static final class OutputCanceller implements FlowableSubscriber, Subscription { final Subscriber actual; final MulticastProcessor processor; @@ -124,7 +124,7 @@ public void cancel() { } } - static final class MulticastProcessor extends Flowable implements Subscriber, Disposable { + static final class MulticastProcessor extends Flowable implements FlowableSubscriber, Disposable { @SuppressWarnings("rawtypes") static final MulticastSubscription[] EMPTY = new MulticastSubscription[0]; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRange.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRange.java index 8811b899aa..71e50073b8 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRange.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRange.java @@ -13,10 +13,10 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.annotations.Nullable; import org.reactivestreams.Subscriber; import io.reactivex.Flowable; +import io.reactivex.annotations.Nullable; import io.reactivex.internal.fuseable.ConditionalSubscriber; import io.reactivex.internal.subscriptions.*; import io.reactivex.internal.util.BackpressureHelper; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRangeLong.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRangeLong.java index c2188e5603..e049feb815 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRangeLong.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRangeLong.java @@ -13,13 +13,13 @@ package io.reactivex.internal.operators.flowable; +import org.reactivestreams.Subscriber; + import io.reactivex.Flowable; import io.reactivex.annotations.Nullable; import io.reactivex.internal.fuseable.ConditionalSubscriber; -import io.reactivex.internal.subscriptions.BasicQueueSubscription; -import io.reactivex.internal.subscriptions.SubscriptionHelper; +import io.reactivex.internal.subscriptions.*; import io.reactivex.internal.util.BackpressureHelper; -import org.reactivestreams.Subscriber; /** * Emits a range of long values. diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableReduce.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableReduce.java index d2a5e3bb66..b83fffd4f6 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableReduce.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableReduce.java @@ -15,6 +15,7 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.BiFunction; import io.reactivex.internal.functions.ObjectHelper; @@ -31,7 +32,7 @@ public final class FlowableReduce extends AbstractFlowableWithUpstream final BiFunction reducer; - public FlowableReduce(Publisher source, BiFunction reducer) { + public FlowableReduce(Flowable source, BiFunction reducer) { super(source); this.reducer = reducer; } @@ -41,7 +42,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new ReduceSubscriber(s, reducer)); } - static final class ReduceSubscriber extends DeferredScalarSubscription implements Subscriber { + static final class ReduceSubscriber extends DeferredScalarSubscription implements FlowableSubscriber { private static final long serialVersionUID = -4663883003264602070L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableReduceMaybe.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableReduceMaybe.java index 11bc550fe6..d6d4781033 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableReduceMaybe.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableReduceMaybe.java @@ -57,7 +57,7 @@ protected void subscribeActual(MaybeObserver observer) { source.subscribe(new ReduceSubscriber(observer, reducer)); } - static final class ReduceSubscriber implements Subscriber, Disposable { + static final class ReduceSubscriber implements FlowableSubscriber, Disposable { final MaybeObserver actual; final BiFunction reducer; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableReduceSeedSingle.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableReduceSeedSingle.java index 858b8ff7c0..62e2259afb 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableReduceSeedSingle.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableReduceSeedSingle.java @@ -49,7 +49,7 @@ protected void subscribeActual(SingleObserver observer) { source.subscribe(new ReduceSeedObserver(observer, reducer, seed)); } - static final class ReduceSeedObserver implements Subscriber, Disposable { + static final class ReduceSeedObserver implements FlowableSubscriber, Disposable { final SingleObserver actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRefCount.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRefCount.java index f0e84f5e8a..318fc2546b 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRefCount.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRefCount.java @@ -18,6 +18,7 @@ import org.reactivestreams.*; +import io.reactivex.FlowableSubscriber; import io.reactivex.disposables.*; import io.reactivex.flowables.ConnectableFlowable; import io.reactivex.functions.Consumer; @@ -42,7 +43,7 @@ public final class FlowableRefCount extends AbstractFlowableWithUpstream - implements Subscriber, Subscription { + implements FlowableSubscriber, Subscription { private static final long serialVersionUID = 152064694420235350L; final Subscriber subscriber; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRepeat.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRepeat.java index 286ac8a33c..1c61800b97 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRepeat.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRepeat.java @@ -17,11 +17,12 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.internal.subscriptions.SubscriptionArbiter; public final class FlowableRepeat extends AbstractFlowableWithUpstream { final long count; - public FlowableRepeat(Publisher source, long count) { + public FlowableRepeat(Flowable source, long count) { super(source); this.count = count; } @@ -36,7 +37,7 @@ public void subscribeActual(Subscriber s) { } // FIXME update to a fresh Rsc algorithm - static final class RepeatSubscriber extends AtomicInteger implements Subscriber { + static final class RepeatSubscriber extends AtomicInteger implements FlowableSubscriber { private static final long serialVersionUID = -7098360935104053232L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRepeatUntil.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRepeatUntil.java index f705611641..4ae29226f0 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRepeatUntil.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRepeatUntil.java @@ -17,13 +17,14 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.BooleanSupplier; import io.reactivex.internal.subscriptions.SubscriptionArbiter; public final class FlowableRepeatUntil extends AbstractFlowableWithUpstream { final BooleanSupplier until; - public FlowableRepeatUntil(Publisher source, BooleanSupplier until) { + public FlowableRepeatUntil(Flowable source, BooleanSupplier until) { super(source); this.until = until; } @@ -38,7 +39,7 @@ public void subscribeActual(Subscriber s) { } // FIXME update to a fresh Rsc algorithm - static final class RepeatSubscriber extends AtomicInteger implements Subscriber { + static final class RepeatSubscriber extends AtomicInteger implements FlowableSubscriber { private static final long serialVersionUID = -7098360935104053232L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRepeatWhen.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRepeatWhen.java index 23ef2c2629..a95433a74d 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRepeatWhen.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRepeatWhen.java @@ -17,7 +17,7 @@ import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Function; import io.reactivex.internal.functions.ObjectHelper; @@ -28,7 +28,7 @@ public final class FlowableRepeatWhen extends AbstractFlowableWithUpstream { final Function, ? extends Publisher> handler; - public FlowableRepeatWhen(Publisher source, + public FlowableRepeatWhen(Flowable source, Function, ? extends Publisher> handler) { super(source); this.handler = handler; @@ -66,7 +66,7 @@ public void subscribeActual(Subscriber s) { static final class WhenReceiver extends AtomicInteger - implements Subscriber, Subscription { + implements FlowableSubscriber, Subscription { private static final long serialVersionUID = 2827772011130406689L; @@ -130,7 +130,7 @@ public void cancel() { } } - abstract static class WhenSourceSubscriber extends SubscriptionArbiter implements Subscriber { + abstract static class WhenSourceSubscriber extends SubscriptionArbiter implements FlowableSubscriber { private static final long serialVersionUID = -5604623027276966720L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableReplay.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableReplay.java index ce0c33054c..489e1df858 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableReplay.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableReplay.java @@ -13,7 +13,6 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.internal.functions.ObjectHelper; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; @@ -25,6 +24,7 @@ import io.reactivex.exceptions.Exceptions; import io.reactivex.flowables.ConnectableFlowable; import io.reactivex.functions.*; +import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.fuseable.HasUpstreamPublisher; import io.reactivex.internal.subscribers.SubscriberResourceWrapper; import io.reactivex.internal.subscriptions.*; @@ -34,7 +34,7 @@ public final class FlowableReplay extends ConnectableFlowable implements HasUpstreamPublisher { /** The source observable. */ - final Publisher source; + final Flowable source; /** Holds the current subscriber that is, will be or just was subscribed to the source observable. */ final AtomicReference> current; /** A factory that creates the appropriate buffer for the ReplaySubscriber. */ @@ -127,7 +127,7 @@ protected void subscribeActual(Subscriber s) { * @return the new ConnectableObservable instance */ @SuppressWarnings("unchecked") - public static ConnectableFlowable createFrom(Publisher source) { + public static ConnectableFlowable createFrom(Flowable source) { return create(source, DEFAULT_UNBOUNDED_FACTORY); } @@ -138,7 +138,7 @@ public static ConnectableFlowable createFrom(Publisher sourc * @param bufferSize the maximum number of elements to hold * @return the new ConnectableObservable instance */ - public static ConnectableFlowable create(Publisher source, + public static ConnectableFlowable create(Flowable source, final int bufferSize) { if (bufferSize == Integer.MAX_VALUE) { return createFrom(source); @@ -160,7 +160,7 @@ public ReplayBuffer call() { * @param scheduler the target scheduler providing the current time * @return the new ConnectableObservable instance */ - public static ConnectableFlowable create(Publisher source, + public static ConnectableFlowable create(Flowable source, long maxAge, TimeUnit unit, Scheduler scheduler) { return create(source, maxAge, unit, scheduler, Integer.MAX_VALUE); } @@ -175,7 +175,7 @@ public static ConnectableFlowable create(Publisher source, * @param bufferSize the maximum number of elements to hold * @return the new ConnectableFlowable instance */ - public static ConnectableFlowable create(Publisher source, + public static ConnectableFlowable create(Flowable source, final long maxAge, final TimeUnit unit, final Scheduler scheduler, final int bufferSize) { return create(source, new Callable>() { @Override @@ -191,7 +191,7 @@ public ReplayBuffer call() { * @param bufferFactory the factory to instantiate the appropriate buffer when the observable becomes active * @return the connectable observable */ - static ConnectableFlowable create(Publisher source, + static ConnectableFlowable create(Flowable source, final Callable> bufferFactory) { // the current connection to source needs to be shared between the operator and its onSubscribe call final AtomicReference> curr = new AtomicReference>(); @@ -254,7 +254,7 @@ public void subscribe(Subscriber child) { return RxJavaPlugins.onAssembly(new FlowableReplay(onSubscribe, source, curr, bufferFactory)); } - private FlowableReplay(Publisher onSubscribe, Publisher source, + private FlowableReplay(Publisher onSubscribe, Flowable source, final AtomicReference> current, final Callable> bufferFactory) { this.onSubscribe = onSubscribe; @@ -338,7 +338,7 @@ public void connect(Consumer connection) { @SuppressWarnings("rawtypes") static final class ReplaySubscriber extends AtomicReference - implements Subscriber, Disposable { + implements FlowableSubscriber, Disposable { private static final long serialVersionUID = 7224554242710036740L; /** Holds notifications from upstream. */ final ReplayBuffer buffer; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRetryBiPredicate.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRetryBiPredicate.java index 0be7a6e3bc..b478f408ea 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRetryBiPredicate.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRetryBiPredicate.java @@ -17,6 +17,7 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.*; import io.reactivex.functions.BiPredicate; import io.reactivex.internal.subscriptions.SubscriptionArbiter; @@ -24,7 +25,7 @@ public final class FlowableRetryBiPredicate extends AbstractFlowableWithUpstream { final BiPredicate predicate; public FlowableRetryBiPredicate( - Publisher source, + Flowable source, BiPredicate predicate) { super(source); this.predicate = predicate; @@ -40,7 +41,7 @@ public void subscribeActual(Subscriber s) { } // FIXME update to a fresh Rsc algorithm - static final class RetryBiSubscriber extends AtomicInteger implements Subscriber { + static final class RetryBiSubscriber extends AtomicInteger implements FlowableSubscriber { private static final long serialVersionUID = -7098360935104053232L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRetryPredicate.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRetryPredicate.java index 14257040f6..2b2c13f0a1 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRetryPredicate.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRetryPredicate.java @@ -17,6 +17,7 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.*; import io.reactivex.functions.Predicate; import io.reactivex.internal.subscriptions.SubscriptionArbiter; @@ -24,7 +25,7 @@ public final class FlowableRetryPredicate extends AbstractFlowableWithUpstream { final Predicate predicate; final long count; - public FlowableRetryPredicate(Publisher source, + public FlowableRetryPredicate(Flowable source, long count, Predicate predicate) { super(source); @@ -42,7 +43,7 @@ public void subscribeActual(Subscriber s) { } // FIXME update to a fresh Rsc algorithm - static final class RepeatSubscriber extends AtomicInteger implements Subscriber { + static final class RepeatSubscriber extends AtomicInteger implements FlowableSubscriber { private static final long serialVersionUID = -7098360935104053232L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRetryWhen.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRetryWhen.java index c0ea91984a..27785e5075 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableRetryWhen.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableRetryWhen.java @@ -27,7 +27,7 @@ public final class FlowableRetryWhen extends AbstractFlowableWithUpstream { final Function, ? extends Publisher> handler; - public FlowableRetryWhen(Publisher source, + public FlowableRetryWhen(Flowable source, Function, ? extends Publisher> handler) { super(source); this.handler = handler; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSamplePublisher.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSamplePublisher.java index 9ba694eb78..de9a71b223 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSamplePublisher.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSamplePublisher.java @@ -17,7 +17,7 @@ import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.exceptions.MissingBackpressureException; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.BackpressureHelper; @@ -45,7 +45,7 @@ protected void subscribeActual(Subscriber s) { } } - abstract static class SamplePublisherSubscriber extends AtomicReference implements Subscriber, Subscription { + abstract static class SamplePublisherSubscriber extends AtomicReference implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -3517602651313910099L; @@ -141,7 +141,7 @@ void emit() { abstract void run(); } - static final class SamplerSubscriber implements Subscriber { + static final class SamplerSubscriber implements FlowableSubscriber { final SamplePublisherSubscriber parent; SamplerSubscriber(SamplePublisherSubscriber parent) { this.parent = parent; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSampleTimed.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSampleTimed.java index 9452699d98..4308b99165 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSampleTimed.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSampleTimed.java @@ -18,7 +18,7 @@ import org.reactivestreams.*; -import io.reactivex.Scheduler; +import io.reactivex.*; import io.reactivex.exceptions.MissingBackpressureException; import io.reactivex.internal.disposables.*; import io.reactivex.internal.subscriptions.SubscriptionHelper; @@ -32,7 +32,7 @@ public final class FlowableSampleTimed extends AbstractFlowableWithUpstream source, long period, TimeUnit unit, Scheduler scheduler, boolean emitLast) { + public FlowableSampleTimed(Flowable source, long period, TimeUnit unit, Scheduler scheduler, boolean emitLast) { super(source); this.period = period; this.unit = unit; @@ -50,7 +50,7 @@ protected void subscribeActual(Subscriber s) { } } - abstract static class SampleTimedSubscriber extends AtomicReference implements Subscriber, Subscription, Runnable { + abstract static class SampleTimedSubscriber extends AtomicReference implements FlowableSubscriber, Subscription, Runnable { private static final long serialVersionUID = -3517602651313910099L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableScan.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableScan.java index bf084ae224..91bb5cc274 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableScan.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableScan.java @@ -13,17 +13,18 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.internal.functions.ObjectHelper; import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.BiFunction; +import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.plugins.RxJavaPlugins; public final class FlowableScan extends AbstractFlowableWithUpstream { final BiFunction accumulator; - public FlowableScan(Publisher source, BiFunction accumulator) { + public FlowableScan(Flowable source, BiFunction accumulator) { super(source); this.accumulator = accumulator; } @@ -33,7 +34,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new ScanSubscriber(s, accumulator)); } - static final class ScanSubscriber implements Subscriber, Subscription { + static final class ScanSubscriber implements FlowableSubscriber, Subscription { final Subscriber actual; final BiFunction accumulator; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableScanSeed.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableScanSeed.java index 60dc2f2ab7..19b4f3fc68 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableScanSeed.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableScanSeed.java @@ -17,6 +17,7 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.BiFunction; import io.reactivex.internal.functions.ObjectHelper; @@ -30,7 +31,7 @@ public final class FlowableScanSeed extends AbstractFlowableWithUpstream accumulator; final Callable seedSupplier; - public FlowableScanSeed(Publisher source, Callable seedSupplier, BiFunction accumulator) { + public FlowableScanSeed(Flowable source, Callable seedSupplier, BiFunction accumulator) { super(source); this.accumulator = accumulator; this.seedSupplier = seedSupplier; @@ -53,7 +54,7 @@ protected void subscribeActual(Subscriber s) { static final class ScanSeedSubscriber extends AtomicInteger - implements Subscriber, Subscription { + implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -1776795561228106469L; final Subscriber actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSequenceEqual.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSequenceEqual.java index 4df78af42e..be145c3499 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSequenceEqual.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSequenceEqual.java @@ -17,7 +17,7 @@ import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.exceptions.*; import io.reactivex.functions.BiPredicate; import io.reactivex.internal.fuseable.*; @@ -244,7 +244,7 @@ public void innerError(Throwable t) { static final class EqualSubscriber extends AtomicReference - implements Subscriber { + implements FlowableSubscriber { private static final long serialVersionUID = 4804128302091633067L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSerialized.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSerialized.java index 40066ec346..fc4832aeb7 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSerialized.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSerialized.java @@ -12,9 +12,10 @@ */ package io.reactivex.internal.operators.flowable; +import org.reactivestreams.Subscriber; + import io.reactivex.Flowable; import io.reactivex.subscribers.SerializedSubscriber; -import org.reactivestreams.Subscriber; public final class FlowableSerialized extends AbstractFlowableWithUpstream { public FlowableSerialized(Flowable source) { diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSingle.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSingle.java index 759bc442c5..a18505404f 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSingle.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSingle.java @@ -13,16 +13,17 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.plugins.RxJavaPlugins; import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.internal.subscriptions.*; +import io.reactivex.plugins.RxJavaPlugins; public final class FlowableSingle extends AbstractFlowableWithUpstream { final T defaultValue; - public FlowableSingle(Publisher source, T defaultValue) { + public FlowableSingle(Flowable source, T defaultValue) { super(source); this.defaultValue = defaultValue; } @@ -33,7 +34,7 @@ protected void subscribeActual(Subscriber s) { } static final class SingleElementSubscriber extends DeferredScalarSubscription - implements Subscriber { + implements FlowableSubscriber { private static final long serialVersionUID = -5526049321428043809L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSingleMaybe.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSingleMaybe.java index 9facb11b9c..20608cd430 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSingleMaybe.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSingleMaybe.java @@ -13,7 +13,7 @@ package io.reactivex.internal.operators.flowable; -import org.reactivestreams.*; +import org.reactivestreams.Subscription; import io.reactivex.*; import io.reactivex.disposables.Disposable; @@ -23,9 +23,9 @@ public final class FlowableSingleMaybe extends Maybe implements FuseToFlowable { - final Publisher source; + final Flowable source; - public FlowableSingleMaybe(Publisher source) { + public FlowableSingleMaybe(Flowable source) { this.source = source; } @@ -40,7 +40,7 @@ public Flowable fuseToFlowable() { } static final class SingleElementSubscriber - implements Subscriber, Disposable { + implements FlowableSubscriber, Disposable { final MaybeObserver actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSingleSingle.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSingleSingle.java index 65120a45b7..44df823067 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSingleSingle.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSingleSingle.java @@ -14,7 +14,8 @@ package io.reactivex.internal.operators.flowable; import java.util.NoSuchElementException; -import org.reactivestreams.*; + +import org.reactivestreams.Subscription; import io.reactivex.*; import io.reactivex.disposables.Disposable; @@ -24,11 +25,11 @@ public final class FlowableSingleSingle extends Single implements FuseToFlowable { - final Publisher source; + final Flowable source; final T defaultValue; - public FlowableSingleSingle(Publisher source, T defaultValue) { + public FlowableSingleSingle(Flowable source, T defaultValue) { this.source = source; this.defaultValue = defaultValue; } @@ -44,7 +45,7 @@ public Flowable fuseToFlowable() { } static final class SingleElementSubscriber - implements Subscriber, Disposable { + implements FlowableSubscriber, Disposable { final SingleObserver actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkip.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkip.java index 737017e6fc..6957ff66c3 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkip.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkip.java @@ -15,11 +15,12 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.internal.subscriptions.SubscriptionHelper; public final class FlowableSkip extends AbstractFlowableWithUpstream { final long n; - public FlowableSkip(Publisher source, long n) { + public FlowableSkip(Flowable source, long n) { super(source); this.n = n; } @@ -29,7 +30,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new SkipSubscriber(s, n)); } - static final class SkipSubscriber implements Subscriber, Subscription { + static final class SkipSubscriber implements FlowableSubscriber, Subscription { final Subscriber actual; long remaining; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkipLast.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkipLast.java index a73551aa43..a0ed02a567 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkipLast.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkipLast.java @@ -17,12 +17,13 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.internal.subscriptions.SubscriptionHelper; public final class FlowableSkipLast extends AbstractFlowableWithUpstream { final int skip; - public FlowableSkipLast(Publisher source, int skip) { + public FlowableSkipLast(Flowable source, int skip) { super(source); this.skip = skip; } @@ -32,7 +33,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new SkipLastSubscriber(s, skip)); } - static final class SkipLastSubscriber extends ArrayDeque implements Subscriber, Subscription { + static final class SkipLastSubscriber extends ArrayDeque implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -3807491841935125653L; final Subscriber actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkipLastTimed.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkipLastTimed.java index 00b0d7dda2..5cad43dd87 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkipLastTimed.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkipLastTimed.java @@ -30,7 +30,7 @@ public final class FlowableSkipLastTimed extends AbstractFlowableWithUpstream final int bufferSize; final boolean delayError; - public FlowableSkipLastTimed(Publisher source, long time, TimeUnit unit, Scheduler scheduler, int bufferSize, boolean delayError) { + public FlowableSkipLastTimed(Flowable source, long time, TimeUnit unit, Scheduler scheduler, int bufferSize, boolean delayError) { super(source); this.time = time; this.unit = unit; @@ -44,7 +44,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new SkipLastTimedSubscriber(s, time, unit, scheduler, bufferSize, delayError)); } - static final class SkipLastTimedSubscriber extends AtomicInteger implements Subscriber, Subscription { + static final class SkipLastTimedSubscriber extends AtomicInteger implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -5677354903406201275L; final Subscriber actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkipUntil.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkipUntil.java index 102998a03c..857623d1ac 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkipUntil.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkipUntil.java @@ -17,13 +17,14 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.internal.fuseable.ConditionalSubscriber; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.*; public final class FlowableSkipUntil extends AbstractFlowableWithUpstream { final Publisher other; - public FlowableSkipUntil(Publisher source, Publisher other) { + public FlowableSkipUntil(Flowable source, Publisher other) { super(source); this.other = other; } @@ -107,7 +108,7 @@ public void cancel() { } final class OtherSubscriber extends AtomicReference - implements Subscriber { + implements FlowableSubscriber { private static final long serialVersionUID = -5592042965931999169L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkipWhile.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkipWhile.java index 9d2c8bd0d6..3a2ba35df3 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkipWhile.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSkipWhile.java @@ -15,13 +15,14 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Predicate; import io.reactivex.internal.subscriptions.SubscriptionHelper; public final class FlowableSkipWhile extends AbstractFlowableWithUpstream { final Predicate predicate; - public FlowableSkipWhile(Publisher source, Predicate predicate) { + public FlowableSkipWhile(Flowable source, Predicate predicate) { super(source); this.predicate = predicate; } @@ -31,7 +32,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new SkipWhileSubscriber(s, predicate)); } - static final class SkipWhileSubscriber implements Subscriber, Subscription { + static final class SkipWhileSubscriber implements FlowableSubscriber, Subscription { final Subscriber actual; final Predicate predicate; Subscription s; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableStrict.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableStrict.java index 2bffcac558..0300558bf3 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableStrict.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableStrict.java @@ -17,6 +17,7 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.*; @@ -35,7 +36,7 @@ */ public final class FlowableStrict extends AbstractFlowableWithUpstream { - public FlowableStrict(Publisher source) { + public FlowableStrict(Flowable source) { super(source); } @@ -44,9 +45,9 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new StrictSubscriber(s)); } - static final class StrictSubscriber + public static final class StrictSubscriber extends AtomicInteger - implements Subscriber, Subscription { + implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -4945028590049415624L; @@ -62,7 +63,7 @@ static final class StrictSubscriber volatile boolean done; - StrictSubscriber(Subscriber actual) { + public StrictSubscriber(Subscriber actual) { this.actual = actual; this.error = new AtomicThrowable(); this.requested = new AtomicLong(); diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSubscribeOn.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSubscribeOn.java index 7aa0b9c139..c99f7ffa1a 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSubscribeOn.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSubscribeOn.java @@ -33,7 +33,7 @@ public final class FlowableSubscribeOn extends AbstractFlowableWithUpstream source, Scheduler scheduler, boolean nonScheduledRequests) { + public FlowableSubscribeOn(Flowable source, Scheduler scheduler, boolean nonScheduledRequests) { super(source); this.scheduler = scheduler; this.nonScheduledRequests = nonScheduledRequests; @@ -49,7 +49,7 @@ public void subscribeActual(final Subscriber s) { } static final class SubscribeOnSubscriber extends AtomicReference - implements Subscriber, Subscription, Runnable { + implements FlowableSubscriber, Subscription, Runnable { private static final long serialVersionUID = 8094547886072529208L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSwitchIfEmpty.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSwitchIfEmpty.java index fc833d46b5..33f215bf3d 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSwitchIfEmpty.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSwitchIfEmpty.java @@ -15,11 +15,12 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.internal.subscriptions.SubscriptionArbiter; public final class FlowableSwitchIfEmpty extends AbstractFlowableWithUpstream { final Publisher other; - public FlowableSwitchIfEmpty(Publisher source, Publisher other) { + public FlowableSwitchIfEmpty(Flowable source, Publisher other) { super(source); this.other = other; } @@ -31,7 +32,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(parent); } - static final class SwitchIfEmptySubscriber implements Subscriber { + static final class SwitchIfEmptySubscriber implements FlowableSubscriber { final Subscriber actual; final Publisher other; final SubscriptionArbiter arbiter; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSwitchMap.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSwitchMap.java index 3cea71d9bb..03ddb6c0ce 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableSwitchMap.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableSwitchMap.java @@ -17,6 +17,7 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.*; import io.reactivex.functions.Function; import io.reactivex.internal.functions.ObjectHelper; @@ -31,7 +32,7 @@ public final class FlowableSwitchMap extends AbstractFlowableWithUpstream< final int bufferSize; final boolean delayErrors; - public FlowableSwitchMap(Publisher source, + public FlowableSwitchMap(Flowable source, Function> mapper, int bufferSize, boolean delayErrors) { super(source); @@ -48,7 +49,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new SwitchMapSubscriber(s, mapper, bufferSize, delayErrors)); } - static final class SwitchMapSubscriber extends AtomicInteger implements Subscriber, Subscription { + static final class SwitchMapSubscriber extends AtomicInteger implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -3491074160481096299L; final Subscriber actual; @@ -332,7 +333,7 @@ void drain() { } static final class SwitchMapInnerSubscriber - extends AtomicReference implements Subscriber { + extends AtomicReference implements FlowableSubscriber { private static final long serialVersionUID = 3837284832786408377L; final SwitchMapSubscriber parent; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTake.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTake.java index 446165e3eb..67c2a49c21 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTake.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTake.java @@ -17,11 +17,12 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.internal.subscriptions.*; public final class FlowableTake extends AbstractFlowableWithUpstream { final long limit; - public FlowableTake(Publisher source, long limit) { + public FlowableTake(Flowable source, long limit) { super(source); this.limit = limit; } @@ -31,7 +32,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new TakeSubscriber(s, limit)); } - static final class TakeSubscriber extends AtomicBoolean implements Subscriber, Subscription { + static final class TakeSubscriber extends AtomicBoolean implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -5636543848937116287L; boolean done; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeLast.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeLast.java index 8c9ddb9993..4ff36f5c56 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeLast.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeLast.java @@ -18,13 +18,14 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.BackpressureHelper; public final class FlowableTakeLast extends AbstractFlowableWithUpstream { final int count; - public FlowableTakeLast(Publisher source, int count) { + public FlowableTakeLast(Flowable source, int count) { super(source); this.count = count; } @@ -34,7 +35,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new TakeLastSubscriber(s, count)); } - static final class TakeLastSubscriber extends ArrayDeque implements Subscriber, Subscription { + static final class TakeLastSubscriber extends ArrayDeque implements FlowableSubscriber, Subscription { private static final long serialVersionUID = 7240042530241604978L; final Subscriber actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeLastOne.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeLastOne.java index f83f97f61b..1372bd874e 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeLastOne.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeLastOne.java @@ -14,11 +14,12 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.internal.subscriptions.*; public final class FlowableTakeLastOne extends AbstractFlowableWithUpstream { - public FlowableTakeLastOne(Publisher source) { + public FlowableTakeLastOne(Flowable source) { super(source); } @@ -28,7 +29,7 @@ protected void subscribeActual(Subscriber s) { } static final class TakeLastOneSubscriber extends DeferredScalarSubscription - implements Subscriber { + implements FlowableSubscriber { private static final long serialVersionUID = -5467847744262967226L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeLastTimed.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeLastTimed.java index fbe58eccf8..b139d31995 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeLastTimed.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeLastTimed.java @@ -31,7 +31,7 @@ public final class FlowableTakeLastTimed extends AbstractFlowableWithUpstream final int bufferSize; final boolean delayError; - public FlowableTakeLastTimed(Publisher source, + public FlowableTakeLastTimed(Flowable source, long count, long time, TimeUnit unit, Scheduler scheduler, int bufferSize, boolean delayError) { super(source); @@ -48,7 +48,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new TakeLastTimedSubscriber(s, count, time, unit, scheduler, bufferSize, delayError)); } - static final class TakeLastTimedSubscriber extends AtomicInteger implements Subscriber, Subscription { + static final class TakeLastTimedSubscriber extends AtomicInteger implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -5677354903406201275L; final Subscriber actual; diff --git a/src/test/java/io/reactivex/tck/FlowableTck.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakePublisher.java similarity index 50% rename from src/test/java/io/reactivex/tck/FlowableTck.java rename to src/main/java/io/reactivex/internal/operators/flowable/FlowableTakePublisher.java index d3ec12533e..c1f52d22a8 100644 --- a/src/test/java/io/reactivex/tck/FlowableTck.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakePublisher.java @@ -11,23 +11,30 @@ * the License for the specific language governing permissions and limitations under the License. */ -package io.reactivex.tck; +package io.reactivex.internal.operators.flowable; + +import org.reactivestreams.*; import io.reactivex.Flowable; +import io.reactivex.internal.operators.flowable.FlowableTake.TakeSubscriber; + +/** + * Take with a generic Publisher source. + * + * @param the value type + * @since 2.0.7 - experimental + */ +public final class FlowableTakePublisher extends Flowable { -public final class FlowableTck { - /** Utility class (remnant).*/ - private FlowableTck() { - throw new IllegalStateException("No instances!"); + final Publisher source; + final long limit; + public FlowableTakePublisher(Publisher source, long limit) { + this.source = source; + this.limit = limit; } - /** - * Enable strict mode. - * @param the value type - * @param f the input Flowable - * @return the output Flowable - */ - public static Flowable wrap(Flowable f) { - return f.strict(); + @Override + protected void subscribeActual(Subscriber s) { + source.subscribe(new TakeSubscriber(s, limit)); } } diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeUntil.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeUntil.java index f65a884f22..c5352264ff 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeUntil.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeUntil.java @@ -17,12 +17,13 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.*; public final class FlowableTakeUntil extends AbstractFlowableWithUpstream { final Publisher other; - public FlowableTakeUntil(Publisher source, Publisher other) { + public FlowableTakeUntil(Flowable source, Publisher other) { super(source); this.other = other; } @@ -37,7 +38,7 @@ protected void subscribeActual(Subscriber child) { source.subscribe(parent); } - static final class TakeUntilMainSubscriber extends AtomicInteger implements Subscriber, Subscription { + static final class TakeUntilMainSubscriber extends AtomicInteger implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -4945480365982832967L; @@ -92,7 +93,7 @@ public void cancel() { SubscriptionHelper.cancel(other); } - final class OtherSubscriber extends AtomicReference implements Subscriber { + final class OtherSubscriber extends AtomicReference implements FlowableSubscriber { private static final long serialVersionUID = -3592821756711087922L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeUntilPredicate.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeUntilPredicate.java index abed93bee7..790800dc9d 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeUntilPredicate.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeUntilPredicate.java @@ -15,6 +15,7 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Predicate; import io.reactivex.internal.subscriptions.SubscriptionHelper; @@ -22,7 +23,7 @@ public final class FlowableTakeUntilPredicate extends AbstractFlowableWithUpstream { final Predicate predicate; - public FlowableTakeUntilPredicate(Publisher source, Predicate predicate) { + public FlowableTakeUntilPredicate(Flowable source, Predicate predicate) { super(source); this.predicate = predicate; } @@ -32,7 +33,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new InnerSubscriber(s, predicate)); } - static final class InnerSubscriber implements Subscriber, Subscription { + static final class InnerSubscriber implements FlowableSubscriber, Subscription { final Subscriber actual; final Predicate predicate; Subscription s; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeWhile.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeWhile.java index e24850dd0a..2190f0518c 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeWhile.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTakeWhile.java @@ -13,16 +13,17 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.plugins.RxJavaPlugins; import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Predicate; import io.reactivex.internal.subscriptions.SubscriptionHelper; +import io.reactivex.plugins.RxJavaPlugins; public final class FlowableTakeWhile extends AbstractFlowableWithUpstream { final Predicate predicate; - public FlowableTakeWhile(Publisher source, Predicate predicate) { + public FlowableTakeWhile(Flowable source, Predicate predicate) { super(source); this.predicate = predicate; } @@ -32,7 +33,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new TakeWhileSubscriber(s, predicate)); } - static final class TakeWhileSubscriber implements Subscriber, Subscription { + static final class TakeWhileSubscriber implements FlowableSubscriber, Subscription { final Subscriber actual; final Predicate predicate; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableThrottleFirstTimed.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableThrottleFirstTimed.java index 43e4dd2e9e..fd6b821609 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableThrottleFirstTimed.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableThrottleFirstTimed.java @@ -18,11 +18,11 @@ import org.reactivestreams.*; -import io.reactivex.Scheduler; +import io.reactivex.*; import io.reactivex.Scheduler.Worker; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.MissingBackpressureException; -import io.reactivex.internal.disposables.*; +import io.reactivex.internal.disposables.SequentialDisposable; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.BackpressureHelper; import io.reactivex.plugins.RxJavaPlugins; @@ -33,7 +33,7 @@ public final class FlowableThrottleFirstTimed extends AbstractFlowableWithUps final TimeUnit unit; final Scheduler scheduler; - public FlowableThrottleFirstTimed(Publisher source, long timeout, TimeUnit unit, Scheduler scheduler) { + public FlowableThrottleFirstTimed(Flowable source, long timeout, TimeUnit unit, Scheduler scheduler) { super(source); this.timeout = timeout; this.unit = unit; @@ -49,7 +49,7 @@ protected void subscribeActual(Subscriber s) { static final class DebounceTimedSubscriber extends AtomicLong - implements Subscriber, Subscription, Runnable { + implements FlowableSubscriber, Subscription, Runnable { private static final long serialVersionUID = -9102637559663639004L; final Subscriber actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTimeInterval.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTimeInterval.java index 4bef3690f6..e578736192 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTimeInterval.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTimeInterval.java @@ -25,7 +25,7 @@ public final class FlowableTimeInterval extends AbstractFlowableWithUpstream< final Scheduler scheduler; final TimeUnit unit; - public FlowableTimeInterval(Publisher source, TimeUnit unit, Scheduler scheduler) { + public FlowableTimeInterval(Flowable source, TimeUnit unit, Scheduler scheduler) { super(source); this.scheduler = scheduler; this.unit = unit; @@ -37,7 +37,7 @@ protected void subscribeActual(Subscriber> s) { source.subscribe(new TimeIntervalSubscriber(s, unit, scheduler)); } - static final class TimeIntervalSubscriber implements Subscriber, Subscription { + static final class TimeIntervalSubscriber implements FlowableSubscriber, Subscription { final Subscriber> actual; final TimeUnit unit; final Scheduler scheduler; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTimeout.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTimeout.java index c2dd98319c..7f9e7568eb 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTimeout.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTimeout.java @@ -13,16 +13,17 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.internal.functions.ObjectHelper; -import java.util.concurrent.*; +import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicReference; import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Function; import io.reactivex.internal.disposables.DisposableHelper; +import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.subscribers.FullArbiterSubscriber; import io.reactivex.internal.subscriptions.*; import io.reactivex.plugins.RxJavaPlugins; @@ -34,7 +35,7 @@ public final class FlowableTimeout extends AbstractFlowableWithUpstream final Publisher other; public FlowableTimeout( - Publisher source, + Flowable source, Publisher firstTimeoutIndicator, Function> itemTimeoutIndicator, Publisher other) { @@ -56,7 +57,7 @@ protected void subscribeActual(Subscriber s) { } } - static final class TimeoutSubscriber implements Subscriber, Subscription, OnTimeout { + static final class TimeoutSubscriber implements FlowableSubscriber, Subscription, OnTimeout { final Subscriber actual; final Publisher firstTimeoutIndicator; final Function> itemTimeoutIndicator; @@ -214,7 +215,7 @@ public void onComplete() { } } - static final class TimeoutOtherSubscriber implements Subscriber, Disposable, OnTimeout { + static final class TimeoutOtherSubscriber implements FlowableSubscriber, Disposable, OnTimeout { final Subscriber actual; final Publisher firstTimeoutIndicator; final Function> itemTimeoutIndicator; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTimeoutTimed.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTimeoutTimed.java index 9619e245a1..557b115b10 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableTimeoutTimed.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableTimeoutTimed.java @@ -43,7 +43,7 @@ public boolean isDisposed() { } }; - public FlowableTimeoutTimed(Publisher source, + public FlowableTimeoutTimed(Flowable source, long timeout, TimeUnit unit, Scheduler scheduler, Publisher other) { super(source); this.timeout = timeout; @@ -65,7 +65,7 @@ protected void subscribeActual(Subscriber s) { } } - static final class TimeoutTimedOtherSubscriber implements Subscriber, Disposable { + static final class TimeoutTimedOtherSubscriber implements FlowableSubscriber, Disposable { final Subscriber actual; final long timeout; final TimeUnit unit; @@ -180,7 +180,7 @@ public boolean isDisposed() { } } - static final class TimeoutTimedSubscriber implements Subscriber, Disposable, Subscription { + static final class TimeoutTimedSubscriber implements FlowableSubscriber, Disposable, Subscription { final Subscriber actual; final long timeout; final TimeUnit unit; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableToList.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableToList.java index f544587b37..8ed41afff9 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableToList.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableToList.java @@ -13,19 +13,20 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.internal.functions.ObjectHelper; import java.util.Collection; import java.util.concurrent.Callable; import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; +import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.subscriptions.*; public final class FlowableToList> extends AbstractFlowableWithUpstream { final Callable collectionSupplier; - public FlowableToList(Publisher source, Callable collectionSupplier) { + public FlowableToList(Flowable source, Callable collectionSupplier) { super(source); this.collectionSupplier = collectionSupplier; } @@ -46,7 +47,7 @@ protected void subscribeActual(Subscriber s) { static final class ToListSubscriber> extends DeferredScalarSubscription - implements Subscriber, Subscription { + implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -8134157938864266736L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableToListSingle.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableToListSingle.java index 6206daba85..365e9762cd 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableToListSingle.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableToListSingle.java @@ -13,16 +13,16 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.internal.functions.ObjectHelper; import java.util.Collection; import java.util.concurrent.Callable; -import org.reactivestreams.*; +import org.reactivestreams.Subscription; import io.reactivex.*; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.Exceptions; import io.reactivex.internal.disposables.EmptyDisposable; +import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.fuseable.FuseToFlowable; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.ArrayListSupplier; @@ -30,16 +30,16 @@ public final class FlowableToListSingle> extends Single implements FuseToFlowable { - final Publisher source; + final Flowable source; final Callable collectionSupplier; @SuppressWarnings("unchecked") - public FlowableToListSingle(Publisher source) { + public FlowableToListSingle(Flowable source) { this(source, (Callable)ArrayListSupplier.asCallable()); } - public FlowableToListSingle(Publisher source, Callable collectionSupplier) { + public FlowableToListSingle(Flowable source, Callable collectionSupplier) { this.source = source; this.collectionSupplier = collectionSupplier; } @@ -63,7 +63,7 @@ public Flowable fuseToFlowable() { } static final class ToListSubscriber> - implements Subscriber, Disposable { + implements FlowableSubscriber, Disposable { final SingleObserver actual; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableUnsubscribeOn.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableUnsubscribeOn.java index 44ea441fc2..f2158eb027 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableUnsubscribeOn.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableUnsubscribeOn.java @@ -17,13 +17,13 @@ import org.reactivestreams.*; -import io.reactivex.Scheduler; +import io.reactivex.*; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.plugins.RxJavaPlugins; public final class FlowableUnsubscribeOn extends AbstractFlowableWithUpstream { final Scheduler scheduler; - public FlowableUnsubscribeOn(Publisher source, Scheduler scheduler) { + public FlowableUnsubscribeOn(Flowable source, Scheduler scheduler) { super(source); this.scheduler = scheduler; } @@ -33,7 +33,7 @@ protected void subscribeActual(Subscriber s) { source.subscribe(new UnsubscribeSubscriber(s, scheduler)); } - static final class UnsubscribeSubscriber extends AtomicBoolean implements Subscriber, Subscription { + static final class UnsubscribeSubscriber extends AtomicBoolean implements FlowableSubscriber, Subscription { private static final long serialVersionUID = 1015244841293359600L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableUsing.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableUsing.java index 83bbb1ab54..2a50f50b3c 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableUsing.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableUsing.java @@ -18,7 +18,7 @@ import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.exceptions.*; import io.reactivex.functions.*; import io.reactivex.internal.subscriptions.*; @@ -73,7 +73,7 @@ public void subscribeActual(Subscriber s) { source.subscribe(us); } - static final class UsingSubscriber extends AtomicBoolean implements Subscriber, Subscription { + static final class UsingSubscriber extends AtomicBoolean implements FlowableSubscriber, Subscription { private static final long serialVersionUID = 5904473792286235046L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindow.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindow.java index cc78b06a91..96b565e97f 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindow.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindow.java @@ -18,7 +18,7 @@ import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.internal.queue.SpscLinkedArrayQueue; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.BackpressureHelper; @@ -32,7 +32,7 @@ public final class FlowableWindow extends AbstractFlowableWithUpstream source, long size, long skip, int bufferSize) { + public FlowableWindow(Flowable source, long size, long skip, int bufferSize) { super(source); this.size = size; this.skip = skip; @@ -53,7 +53,7 @@ public void subscribeActual(Subscriber> s) { static final class WindowExactSubscriber extends AtomicInteger - implements Subscriber, Subscription, Runnable { + implements FlowableSubscriber, Subscription, Runnable { private static final long serialVersionUID = -2365647875069161133L; @@ -176,7 +176,7 @@ public void run() { static final class WindowSkipSubscriber extends AtomicInteger - implements Subscriber, Subscription, Runnable { + implements FlowableSubscriber, Subscription, Runnable { private static final long serialVersionUID = -8792836352386833856L; @@ -318,7 +318,7 @@ public void run() { static final class WindowOverlapSubscriber extends AtomicInteger - implements Subscriber, Subscription, Runnable { + implements FlowableSubscriber, Subscription, Runnable { private static final long serialVersionUID = 2428527070996323976L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowBoundary.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowBoundary.java index 8e258ead3f..9cf1b1100c 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowBoundary.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowBoundary.java @@ -34,7 +34,7 @@ public final class FlowableWindowBoundary extends AbstractFlowableWithUpst final Publisher other; final int bufferSize; - public FlowableWindowBoundary(Publisher source, Publisher other, int bufferSize) { + public FlowableWindowBoundary(Flowable source, Publisher other, int bufferSize) { super(source); this.other = other; this.bufferSize = bufferSize; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowBoundarySelector.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowBoundarySelector.java index 43f3828254..50c7e45dfb 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowBoundarySelector.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowBoundarySelector.java @@ -39,7 +39,7 @@ public final class FlowableWindowBoundarySelector extends AbstractFlowa final int bufferSize; public FlowableWindowBoundarySelector( - Publisher source, + Flowable source, Publisher open, Function> close, int bufferSize) { super(source); diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowBoundarySupplier.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowBoundarySupplier.java index 1dd62a393b..5286407e7d 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowBoundarySupplier.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowBoundarySupplier.java @@ -36,7 +36,7 @@ public final class FlowableWindowBoundarySupplier extends AbstractFlowable final Callable> other; final int bufferSize; - public FlowableWindowBoundarySupplier(Publisher source, + public FlowableWindowBoundarySupplier(Flowable source, Callable> other, int bufferSize) { super(source); this.other = other; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowTimed.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowTimed.java index f955dc524a..0e99732b1f 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowTimed.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowTimed.java @@ -40,7 +40,7 @@ public final class FlowableWindowTimed extends AbstractFlowableWithUpstream source, + public FlowableWindowTimed(Flowable source, long timespan, long timeskip, TimeUnit unit, Scheduler scheduler, long maxSize, int bufferSize, boolean restartTimerOnMaxSize) { super(source); @@ -76,7 +76,7 @@ protected void subscribeActual(Subscriber> s) { static final class WindowExactUnboundedSubscriber extends QueueDrainSubscriber> - implements Subscriber, Subscription, Runnable { + implements FlowableSubscriber, Subscription, Runnable { final long timespan; final TimeUnit unit; final Scheduler scheduler; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableWithLatestFrom.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableWithLatestFrom.java index 5a501f10bc..3d78461d50 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableWithLatestFrom.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableWithLatestFrom.java @@ -17,6 +17,7 @@ import org.reactivestreams.*; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.BiFunction; import io.reactivex.internal.functions.ObjectHelper; @@ -26,7 +27,7 @@ public final class FlowableWithLatestFrom extends AbstractFlowableWithUpstream { final BiFunction combiner; final Publisher other; - public FlowableWithLatestFrom(Publisher source, BiFunction combiner, Publisher other) { + public FlowableWithLatestFrom(Flowable source, BiFunction combiner, Publisher other) { super(source); this.combiner = combiner; this.other = other; @@ -39,7 +40,7 @@ protected void subscribeActual(Subscriber s) { serial.onSubscribe(wlf); - other.subscribe(new Subscriber() { + other.subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { if (wlf.setOther(s)) { @@ -66,7 +67,7 @@ public void onComplete() { source.subscribe(wlf); } - static final class WithLatestFromSubscriber extends AtomicReference implements Subscriber, Subscription { + static final class WithLatestFromSubscriber extends AtomicReference implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -312246233408980075L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableWithLatestFromMany.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableWithLatestFromMany.java index e130c7e775..be514a6e84 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableWithLatestFromMany.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableWithLatestFromMany.java @@ -15,10 +15,10 @@ import java.util.Arrays; import java.util.concurrent.atomic.*; -import io.reactivex.annotations.NonNull; -import io.reactivex.annotations.Nullable; import org.reactivestreams.*; +import io.reactivex.*; +import io.reactivex.annotations.*; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Function; @@ -43,14 +43,14 @@ public final class FlowableWithLatestFromMany extends AbstractFlowableWith final Function combiner; - public FlowableWithLatestFromMany(@NonNull Publisher source, @NonNull Publisher[] otherArray, Function combiner) { + public FlowableWithLatestFromMany(@NonNull Flowable source, @NonNull Publisher[] otherArray, Function combiner) { super(source); this.otherArray = otherArray; this.otherIterable = null; this.combiner = combiner; } - public FlowableWithLatestFromMany(@NonNull Publisher source, @NonNull Iterable> otherIterable, @NonNull Function combiner) { + public FlowableWithLatestFromMany(@NonNull Flowable source, @NonNull Iterable> otherIterable, @NonNull Function combiner) { super(source); this.otherArray = null; this.otherIterable = otherIterable; @@ -100,7 +100,7 @@ public R apply(T t) throws Exception { static final class WithLatestFromSubscriber extends AtomicInteger - implements Subscriber, Subscription { + implements FlowableSubscriber, Subscription { private static final long serialVersionUID = 1577321883966341961L; @@ -248,7 +248,7 @@ void cancelAllBut(int index) { static final class WithLatestInnerSubscriber extends AtomicReference - implements Subscriber, Disposable { + implements FlowableSubscriber, Disposable { private static final long serialVersionUID = 3256684027868224024L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableZip.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableZip.java index c01ea6ef20..d4f52ee0fb 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableZip.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableZip.java @@ -18,7 +18,7 @@ import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Function; import io.reactivex.internal.functions.ObjectHelper; @@ -323,7 +323,7 @@ void drain() { } - static final class ZipSubscriber extends AtomicReference implements Subscriber, Subscription { + static final class ZipSubscriber extends AtomicReference implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -4627193790118206028L; diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableZipIterable.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableZipIterable.java index 017a93f89d..ffec85365d 100644 --- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableZipIterable.java +++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableZipIterable.java @@ -13,26 +13,25 @@ package io.reactivex.internal.operators.flowable; -import io.reactivex.internal.functions.ObjectHelper; import java.util.Iterator; import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.BiFunction; +import io.reactivex.internal.functions.ObjectHelper; import io.reactivex.internal.subscriptions.*; import io.reactivex.plugins.RxJavaPlugins; -public final class FlowableZipIterable extends Flowable { - final Publisher source; +public final class FlowableZipIterable extends AbstractFlowableWithUpstream { final Iterable other; final BiFunction zipper; public FlowableZipIterable( - Publisher source, + Flowable source, Iterable other, BiFunction zipper) { - this.source = source; + super(source); this.other = other; this.zipper = zipper; } @@ -67,7 +66,7 @@ public void subscribeActual(Subscriber t) { source.subscribe(new ZipIterableSubscriber(t, it, zipper)); } - static final class ZipIterableSubscriber implements Subscriber, Subscription { + static final class ZipIterableSubscriber implements FlowableSubscriber, Subscription { final Subscriber actual; final Iterator iterator; final BiFunction zipper; diff --git a/src/main/java/io/reactivex/internal/operators/maybe/MaybeDelayOtherPublisher.java b/src/main/java/io/reactivex/internal/operators/maybe/MaybeDelayOtherPublisher.java index e6a20ce6ef..b14b17a671 100644 --- a/src/main/java/io/reactivex/internal/operators/maybe/MaybeDelayOtherPublisher.java +++ b/src/main/java/io/reactivex/internal/operators/maybe/MaybeDelayOtherPublisher.java @@ -104,7 +104,7 @@ void subscribeNext() { static final class OtherSubscriber extends AtomicReference - implements Subscriber { + implements FlowableSubscriber { private static final long serialVersionUID = -1215060610805418006L; diff --git a/src/main/java/io/reactivex/internal/operators/maybe/MaybeDelaySubscriptionOtherPublisher.java b/src/main/java/io/reactivex/internal/operators/maybe/MaybeDelaySubscriptionOtherPublisher.java index c9351c489c..9a52d4af7c 100644 --- a/src/main/java/io/reactivex/internal/operators/maybe/MaybeDelaySubscriptionOtherPublisher.java +++ b/src/main/java/io/reactivex/internal/operators/maybe/MaybeDelaySubscriptionOtherPublisher.java @@ -43,7 +43,7 @@ protected void subscribeActual(MaybeObserver observer) { other.subscribe(new OtherSubscriber(observer, source)); } - static final class OtherSubscriber implements Subscriber, Disposable { + static final class OtherSubscriber implements FlowableSubscriber, Disposable { final DelayMaybeObserver main; MaybeSource source; diff --git a/src/main/java/io/reactivex/internal/operators/maybe/MaybeTakeUntilPublisher.java b/src/main/java/io/reactivex/internal/operators/maybe/MaybeTakeUntilPublisher.java index b183942730..3ddd26d570 100644 --- a/src/main/java/io/reactivex/internal/operators/maybe/MaybeTakeUntilPublisher.java +++ b/src/main/java/io/reactivex/internal/operators/maybe/MaybeTakeUntilPublisher.java @@ -120,7 +120,7 @@ void otherComplete() { } static final class TakeUntilOtherMaybeObserver - extends AtomicReference implements Subscriber { + extends AtomicReference implements FlowableSubscriber { private static final long serialVersionUID = -1266041316834525931L; diff --git a/src/main/java/io/reactivex/internal/operators/maybe/MaybeTimeoutPublisher.java b/src/main/java/io/reactivex/internal/operators/maybe/MaybeTimeoutPublisher.java index 10a43e07f1..79c2aea625 100644 --- a/src/main/java/io/reactivex/internal/operators/maybe/MaybeTimeoutPublisher.java +++ b/src/main/java/io/reactivex/internal/operators/maybe/MaybeTimeoutPublisher.java @@ -142,7 +142,7 @@ public void otherComplete() { static final class TimeoutOtherMaybeObserver extends AtomicReference - implements Subscriber { + implements FlowableSubscriber { private static final long serialVersionUID = 8663801314800248617L; diff --git a/src/main/java/io/reactivex/internal/operators/observable/ObservableFromPublisher.java b/src/main/java/io/reactivex/internal/operators/observable/ObservableFromPublisher.java index a48bd32ebf..3de1735670 100644 --- a/src/main/java/io/reactivex/internal/operators/observable/ObservableFromPublisher.java +++ b/src/main/java/io/reactivex/internal/operators/observable/ObservableFromPublisher.java @@ -32,7 +32,7 @@ protected void subscribeActual(final Observer o) { } static final class PublisherSubscriber - implements Subscriber, Disposable { + implements FlowableSubscriber, Disposable { final Observer actual; Subscription s; diff --git a/src/main/java/io/reactivex/internal/operators/parallel/ParallelFlatMap.java b/src/main/java/io/reactivex/internal/operators/parallel/ParallelFlatMap.java index a52aca0ea8..0c2e47a72b 100644 --- a/src/main/java/io/reactivex/internal/operators/parallel/ParallelFlatMap.java +++ b/src/main/java/io/reactivex/internal/operators/parallel/ParallelFlatMap.java @@ -13,10 +13,9 @@ package io.reactivex.internal.operators.parallel; -import io.reactivex.functions.Function; - import org.reactivestreams.*; +import io.reactivex.functions.Function; import io.reactivex.internal.operators.flowable.FlowableFlatMap; import io.reactivex.parallel.ParallelFlowable; diff --git a/src/main/java/io/reactivex/internal/operators/parallel/ParallelFromArray.java b/src/main/java/io/reactivex/internal/operators/parallel/ParallelFromArray.java index a41939b92a..9831380834 100644 --- a/src/main/java/io/reactivex/internal/operators/parallel/ParallelFromArray.java +++ b/src/main/java/io/reactivex/internal/operators/parallel/ParallelFromArray.java @@ -13,8 +13,7 @@ package io.reactivex.internal.operators.parallel; -import org.reactivestreams.Publisher; -import org.reactivestreams.Subscriber; +import org.reactivestreams.*; import io.reactivex.parallel.ParallelFlowable; diff --git a/src/main/java/io/reactivex/internal/operators/parallel/ParallelFromPublisher.java b/src/main/java/io/reactivex/internal/operators/parallel/ParallelFromPublisher.java index fb624f40e0..de0289843e 100644 --- a/src/main/java/io/reactivex/internal/operators/parallel/ParallelFromPublisher.java +++ b/src/main/java/io/reactivex/internal/operators/parallel/ParallelFromPublisher.java @@ -17,6 +17,7 @@ import org.reactivestreams.*; +import io.reactivex.FlowableSubscriber; import io.reactivex.exceptions.*; import io.reactivex.internal.fuseable.*; import io.reactivex.internal.queue.SpscArrayQueue; @@ -59,7 +60,7 @@ public void subscribe(Subscriber[] subscribers) { static final class ParallelDispatcher extends AtomicInteger - implements Subscriber { + implements FlowableSubscriber { private static final long serialVersionUID = -4470634016609963609L; diff --git a/src/main/java/io/reactivex/internal/operators/parallel/ParallelJoin.java b/src/main/java/io/reactivex/internal/operators/parallel/ParallelJoin.java index f94636e3c7..7f44e8c5ae 100644 --- a/src/main/java/io/reactivex/internal/operators/parallel/ParallelJoin.java +++ b/src/main/java/io/reactivex/internal/operators/parallel/ParallelJoin.java @@ -17,7 +17,7 @@ import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.exceptions.MissingBackpressureException; import io.reactivex.internal.fuseable.*; import io.reactivex.internal.queue.SpscArrayQueue; @@ -290,7 +290,7 @@ void drainLoop() { static final class JoinInnerSubscriber extends AtomicReference - implements Subscriber { + implements FlowableSubscriber { private static final long serialVersionUID = 8410034718427740355L; diff --git a/src/main/java/io/reactivex/internal/operators/parallel/ParallelMap.java b/src/main/java/io/reactivex/internal/operators/parallel/ParallelMap.java index bfaabd484a..6786621f5f 100644 --- a/src/main/java/io/reactivex/internal/operators/parallel/ParallelMap.java +++ b/src/main/java/io/reactivex/internal/operators/parallel/ParallelMap.java @@ -15,6 +15,7 @@ import org.reactivestreams.*; +import io.reactivex.FlowableSubscriber; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Function; import io.reactivex.internal.functions.ObjectHelper; @@ -67,7 +68,7 @@ public int parallelism() { return source.parallelism(); } - static final class ParallelMapSubscriber implements Subscriber, Subscription { + static final class ParallelMapSubscriber implements FlowableSubscriber, Subscription { final Subscriber actual; diff --git a/src/main/java/io/reactivex/internal/operators/parallel/ParallelPeek.java b/src/main/java/io/reactivex/internal/operators/parallel/ParallelPeek.java index 541e5b7345..8f2ed9af7a 100644 --- a/src/main/java/io/reactivex/internal/operators/parallel/ParallelPeek.java +++ b/src/main/java/io/reactivex/internal/operators/parallel/ParallelPeek.java @@ -15,6 +15,7 @@ import org.reactivestreams.*; +import io.reactivex.FlowableSubscriber; import io.reactivex.exceptions.*; import io.reactivex.functions.*; import io.reactivex.internal.functions.ObjectHelper; @@ -84,7 +85,7 @@ public int parallelism() { return source.parallelism(); } - static final class ParallelPeekSubscriber implements Subscriber, Subscription { + static final class ParallelPeekSubscriber implements FlowableSubscriber, Subscription { final Subscriber actual; diff --git a/src/main/java/io/reactivex/internal/operators/parallel/ParallelReduceFull.java b/src/main/java/io/reactivex/internal/operators/parallel/ParallelReduceFull.java index 1fe262630a..98d536045c 100644 --- a/src/main/java/io/reactivex/internal/operators/parallel/ParallelReduceFull.java +++ b/src/main/java/io/reactivex/internal/operators/parallel/ParallelReduceFull.java @@ -17,7 +17,7 @@ import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.BiFunction; import io.reactivex.internal.functions.ObjectHelper; @@ -161,7 +161,7 @@ void innerComplete(T value) { static final class ParallelReduceFullInnerSubscriber extends AtomicReference - implements Subscriber { + implements FlowableSubscriber { private static final long serialVersionUID = -7954444275102466525L; diff --git a/src/main/java/io/reactivex/internal/operators/parallel/ParallelRunOn.java b/src/main/java/io/reactivex/internal/operators/parallel/ParallelRunOn.java index 30a5398833..3281a20b9d 100644 --- a/src/main/java/io/reactivex/internal/operators/parallel/ParallelRunOn.java +++ b/src/main/java/io/reactivex/internal/operators/parallel/ParallelRunOn.java @@ -17,7 +17,7 @@ import org.reactivestreams.*; -import io.reactivex.Scheduler; +import io.reactivex.*; import io.reactivex.Scheduler.Worker; import io.reactivex.exceptions.MissingBackpressureException; import io.reactivex.internal.fuseable.ConditionalSubscriber; @@ -82,7 +82,7 @@ public int parallelism() { } abstract static class BaseRunOnSubscriber extends AtomicInteger - implements Subscriber, Subscription, Runnable { + implements FlowableSubscriber, Subscription, Runnable { private static final long serialVersionUID = 9222303586456402150L; diff --git a/src/main/java/io/reactivex/internal/operators/parallel/ParallelSortedJoin.java b/src/main/java/io/reactivex/internal/operators/parallel/ParallelSortedJoin.java index 1cf5048fd4..33abbd132f 100644 --- a/src/main/java/io/reactivex/internal/operators/parallel/ParallelSortedJoin.java +++ b/src/main/java/io/reactivex/internal/operators/parallel/ParallelSortedJoin.java @@ -18,10 +18,10 @@ import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.exceptions.Exceptions; import io.reactivex.internal.subscriptions.SubscriptionHelper; -import io.reactivex.internal.util.*; +import io.reactivex.internal.util.BackpressureHelper; import io.reactivex.parallel.ParallelFlowable; import io.reactivex.plugins.RxJavaPlugins; @@ -264,7 +264,7 @@ void drain() { static final class SortedJoinInnerSubscriber extends AtomicReference - implements Subscriber> { + implements FlowableSubscriber> { private static final long serialVersionUID = 6751017204873808094L; diff --git a/src/main/java/io/reactivex/internal/operators/single/SingleDelayWithPublisher.java b/src/main/java/io/reactivex/internal/operators/single/SingleDelayWithPublisher.java index 486200224f..88bd1f8085 100644 --- a/src/main/java/io/reactivex/internal/operators/single/SingleDelayWithPublisher.java +++ b/src/main/java/io/reactivex/internal/operators/single/SingleDelayWithPublisher.java @@ -42,7 +42,7 @@ protected void subscribeActual(SingleObserver subscriber) { static final class OtherSubscriber extends AtomicReference - implements Subscriber, Disposable { + implements FlowableSubscriber, Disposable { private static final long serialVersionUID = -8565274649390031272L; diff --git a/src/main/java/io/reactivex/internal/operators/single/SingleFromPublisher.java b/src/main/java/io/reactivex/internal/operators/single/SingleFromPublisher.java index 1eaa83e6cd..ecc69b7e92 100644 --- a/src/main/java/io/reactivex/internal/operators/single/SingleFromPublisher.java +++ b/src/main/java/io/reactivex/internal/operators/single/SingleFromPublisher.java @@ -35,7 +35,7 @@ protected void subscribeActual(final SingleObserver s) { publisher.subscribe(new ToSingleObserver(s)); } - static final class ToSingleObserver implements Subscriber, Disposable { + static final class ToSingleObserver implements FlowableSubscriber, Disposable { final SingleObserver actual; Subscription s; diff --git a/src/main/java/io/reactivex/internal/operators/single/SingleTakeUntil.java b/src/main/java/io/reactivex/internal/operators/single/SingleTakeUntil.java index d8a9761feb..8c340e4edf 100644 --- a/src/main/java/io/reactivex/internal/operators/single/SingleTakeUntil.java +++ b/src/main/java/io/reactivex/internal/operators/single/SingleTakeUntil.java @@ -127,7 +127,7 @@ void otherError(Throwable e) { static final class TakeUntilOtherSubscriber extends AtomicReference - implements Subscriber { + implements FlowableSubscriber { private static final long serialVersionUID = 5170026210238877381L; diff --git a/src/main/java/io/reactivex/internal/subscribers/BasicFuseableSubscriber.java b/src/main/java/io/reactivex/internal/subscribers/BasicFuseableSubscriber.java index d7b14d0527..6af9b49fc1 100644 --- a/src/main/java/io/reactivex/internal/subscribers/BasicFuseableSubscriber.java +++ b/src/main/java/io/reactivex/internal/subscribers/BasicFuseableSubscriber.java @@ -15,6 +15,7 @@ import org.reactivestreams.*; +import io.reactivex.FlowableSubscriber; import io.reactivex.exceptions.Exceptions; import io.reactivex.internal.fuseable.QueueSubscription; import io.reactivex.internal.subscriptions.SubscriptionHelper; @@ -25,7 +26,7 @@ * @param the upstream value type * @param the downstream value type */ -public abstract class BasicFuseableSubscriber implements Subscriber, QueueSubscription { +public abstract class BasicFuseableSubscriber implements FlowableSubscriber, QueueSubscription { /** The downstream subscriber. */ protected final Subscriber actual; diff --git a/src/main/java/io/reactivex/internal/subscribers/BlockingBaseSubscriber.java b/src/main/java/io/reactivex/internal/subscribers/BlockingBaseSubscriber.java index 33023306c6..6ab208cc27 100644 --- a/src/main/java/io/reactivex/internal/subscribers/BlockingBaseSubscriber.java +++ b/src/main/java/io/reactivex/internal/subscribers/BlockingBaseSubscriber.java @@ -14,13 +14,14 @@ import java.util.concurrent.CountDownLatch; -import org.reactivestreams.*; +import org.reactivestreams.Subscription; +import io.reactivex.FlowableSubscriber; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.*; public abstract class BlockingBaseSubscriber extends CountDownLatch -implements Subscriber { +implements FlowableSubscriber { T value; Throwable error; diff --git a/src/main/java/io/reactivex/internal/subscribers/BlockingSubscriber.java b/src/main/java/io/reactivex/internal/subscribers/BlockingSubscriber.java index 68ff5c61e2..5f84aefd87 100644 --- a/src/main/java/io/reactivex/internal/subscribers/BlockingSubscriber.java +++ b/src/main/java/io/reactivex/internal/subscribers/BlockingSubscriber.java @@ -16,12 +16,13 @@ import java.util.Queue; import java.util.concurrent.atomic.AtomicReference; -import org.reactivestreams.*; +import org.reactivestreams.Subscription; +import io.reactivex.FlowableSubscriber; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.NotificationLite; -public final class BlockingSubscriber extends AtomicReference implements Subscriber, Subscription { +public final class BlockingSubscriber extends AtomicReference implements FlowableSubscriber, Subscription { private static final long serialVersionUID = -4875965440900746268L; diff --git a/src/main/java/io/reactivex/internal/subscribers/DeferredScalarSubscriber.java b/src/main/java/io/reactivex/internal/subscribers/DeferredScalarSubscriber.java index 58ad6aa8b4..910a898214 100644 --- a/src/main/java/io/reactivex/internal/subscribers/DeferredScalarSubscriber.java +++ b/src/main/java/io/reactivex/internal/subscribers/DeferredScalarSubscriber.java @@ -15,6 +15,7 @@ import org.reactivestreams.*; +import io.reactivex.FlowableSubscriber; import io.reactivex.internal.subscriptions.*; /** @@ -24,7 +25,7 @@ * @param the output value type */ public abstract class DeferredScalarSubscriber extends DeferredScalarSubscription -implements Subscriber { +implements FlowableSubscriber { private static final long serialVersionUID = 2984505488220891551L; diff --git a/src/main/java/io/reactivex/internal/subscribers/ForEachWhileSubscriber.java b/src/main/java/io/reactivex/internal/subscribers/ForEachWhileSubscriber.java index a06c178cbb..812a0d601e 100644 --- a/src/main/java/io/reactivex/internal/subscribers/ForEachWhileSubscriber.java +++ b/src/main/java/io/reactivex/internal/subscribers/ForEachWhileSubscriber.java @@ -15,8 +15,9 @@ import java.util.concurrent.atomic.AtomicReference; -import org.reactivestreams.*; +import org.reactivestreams.Subscription; +import io.reactivex.FlowableSubscriber; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.*; import io.reactivex.functions.*; @@ -25,7 +26,7 @@ public final class ForEachWhileSubscriber extends AtomicReference -implements Subscriber, Disposable { +implements FlowableSubscriber, Disposable { private static final long serialVersionUID = -4403180040475402120L; diff --git a/src/main/java/io/reactivex/internal/subscribers/FullArbiterSubscriber.java b/src/main/java/io/reactivex/internal/subscribers/FullArbiterSubscriber.java index f3ff754c85..e145489296 100644 --- a/src/main/java/io/reactivex/internal/subscribers/FullArbiterSubscriber.java +++ b/src/main/java/io/reactivex/internal/subscribers/FullArbiterSubscriber.java @@ -13,8 +13,9 @@ package io.reactivex.internal.subscribers; -import org.reactivestreams.*; +import org.reactivestreams.Subscription; +import io.reactivex.FlowableSubscriber; import io.reactivex.internal.subscriptions.*; /** @@ -22,7 +23,7 @@ * * @param the value type */ -public final class FullArbiterSubscriber implements Subscriber { +public final class FullArbiterSubscriber implements FlowableSubscriber { final FullArbiter arbiter; Subscription s; diff --git a/src/main/java/io/reactivex/internal/subscribers/FutureSubscriber.java b/src/main/java/io/reactivex/internal/subscribers/FutureSubscriber.java index f6b0760540..b2a06f53e6 100644 --- a/src/main/java/io/reactivex/internal/subscribers/FutureSubscriber.java +++ b/src/main/java/io/reactivex/internal/subscribers/FutureSubscriber.java @@ -17,8 +17,9 @@ import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicReference; -import org.reactivestreams.*; +import org.reactivestreams.Subscription; +import io.reactivex.FlowableSubscriber; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.BlockingHelper; import io.reactivex.plugins.RxJavaPlugins; @@ -30,7 +31,7 @@ * @param the value type */ public final class FutureSubscriber extends CountDownLatch -implements Subscriber, Future, Subscription { +implements FlowableSubscriber, Future, Subscription { T value; Throwable error; diff --git a/src/main/java/io/reactivex/internal/subscribers/InnerQueuedSubscriber.java b/src/main/java/io/reactivex/internal/subscribers/InnerQueuedSubscriber.java index 8d6db3f42e..fc6647a83b 100644 --- a/src/main/java/io/reactivex/internal/subscribers/InnerQueuedSubscriber.java +++ b/src/main/java/io/reactivex/internal/subscribers/InnerQueuedSubscriber.java @@ -15,8 +15,9 @@ import java.util.concurrent.atomic.AtomicReference; -import org.reactivestreams.*; +import org.reactivestreams.Subscription; +import io.reactivex.FlowableSubscriber; import io.reactivex.internal.fuseable.*; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.QueueDrainHelper; @@ -29,7 +30,7 @@ */ public final class InnerQueuedSubscriber extends AtomicReference -implements Subscriber, Subscription { +implements FlowableSubscriber, Subscription { private static final long serialVersionUID = 22876611072430776L; diff --git a/src/main/java/io/reactivex/internal/subscribers/LambdaSubscriber.java b/src/main/java/io/reactivex/internal/subscribers/LambdaSubscriber.java index ae9da9c0a2..0d9d0b1cf9 100644 --- a/src/main/java/io/reactivex/internal/subscribers/LambdaSubscriber.java +++ b/src/main/java/io/reactivex/internal/subscribers/LambdaSubscriber.java @@ -15,15 +15,16 @@ import java.util.concurrent.atomic.AtomicReference; -import org.reactivestreams.*; +import org.reactivestreams.Subscription; +import io.reactivex.FlowableSubscriber; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.*; import io.reactivex.functions.*; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.plugins.RxJavaPlugins; -public final class LambdaSubscriber extends AtomicReference implements Subscriber, Subscription, Disposable { +public final class LambdaSubscriber extends AtomicReference implements FlowableSubscriber, Subscription, Disposable { private static final long serialVersionUID = -7251123623727029452L; final Consumer onNext; diff --git a/src/main/java/io/reactivex/internal/subscribers/QueueDrainSubscriber.java b/src/main/java/io/reactivex/internal/subscribers/QueueDrainSubscriber.java index cd149c43f3..18970951b7 100644 --- a/src/main/java/io/reactivex/internal/subscribers/QueueDrainSubscriber.java +++ b/src/main/java/io/reactivex/internal/subscribers/QueueDrainSubscriber.java @@ -17,6 +17,7 @@ import org.reactivestreams.Subscriber; +import io.reactivex.FlowableSubscriber; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.MissingBackpressureException; import io.reactivex.internal.fuseable.*; @@ -31,7 +32,7 @@ * @param the value type in the queue * @param the value type the child subscriber accepts */ -public abstract class QueueDrainSubscriber extends QueueDrainSubscriberPad4 implements Subscriber, QueueDrain { +public abstract class QueueDrainSubscriber extends QueueDrainSubscriberPad4 implements FlowableSubscriber, QueueDrain { protected final Subscriber actual; protected final SimplePlainQueue queue; diff --git a/src/main/java/io/reactivex/internal/subscribers/SinglePostCompleteSubscriber.java b/src/main/java/io/reactivex/internal/subscribers/SinglePostCompleteSubscriber.java index 6d13e9a984..8d7efc37aa 100644 --- a/src/main/java/io/reactivex/internal/subscribers/SinglePostCompleteSubscriber.java +++ b/src/main/java/io/reactivex/internal/subscribers/SinglePostCompleteSubscriber.java @@ -17,6 +17,7 @@ import org.reactivestreams.*; +import io.reactivex.FlowableSubscriber; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.BackpressureHelper; @@ -27,7 +28,7 @@ * @param the input value type * @param the output value type */ -public abstract class SinglePostCompleteSubscriber extends AtomicLong implements Subscriber, Subscription { +public abstract class SinglePostCompleteSubscriber extends AtomicLong implements FlowableSubscriber, Subscription { private static final long serialVersionUID = 7917814472626990048L; /** The downstream consumer. */ diff --git a/src/main/java/io/reactivex/internal/subscribers/SubscriberResourceWrapper.java b/src/main/java/io/reactivex/internal/subscribers/SubscriberResourceWrapper.java index 649d9ce6e8..6656cbd5cf 100644 --- a/src/main/java/io/reactivex/internal/subscribers/SubscriberResourceWrapper.java +++ b/src/main/java/io/reactivex/internal/subscribers/SubscriberResourceWrapper.java @@ -17,11 +17,12 @@ import org.reactivestreams.*; +import io.reactivex.FlowableSubscriber; import io.reactivex.disposables.Disposable; import io.reactivex.internal.disposables.DisposableHelper; import io.reactivex.internal.subscriptions.SubscriptionHelper; -public final class SubscriberResourceWrapper extends AtomicReference implements Subscriber, Disposable, Subscription { +public final class SubscriberResourceWrapper extends AtomicReference implements FlowableSubscriber, Disposable, Subscription { private static final long serialVersionUID = -8612022020200669122L; diff --git a/src/main/java/io/reactivex/internal/util/EmptyComponent.java b/src/main/java/io/reactivex/internal/util/EmptyComponent.java index 351b1e695f..348813cb9e 100644 --- a/src/main/java/io/reactivex/internal/util/EmptyComponent.java +++ b/src/main/java/io/reactivex/internal/util/EmptyComponent.java @@ -22,7 +22,7 @@ /** * Singleton implementing many interfaces as empty. */ -public enum EmptyComponent implements Subscriber, Observer, MaybeObserver, +public enum EmptyComponent implements FlowableSubscriber, Observer, MaybeObserver, SingleObserver, CompletableObserver, Subscription, Disposable { INSTANCE; diff --git a/src/main/java/io/reactivex/processors/FlowableProcessor.java b/src/main/java/io/reactivex/processors/FlowableProcessor.java index 5533f1742c..80699926a3 100644 --- a/src/main/java/io/reactivex/processors/FlowableProcessor.java +++ b/src/main/java/io/reactivex/processors/FlowableProcessor.java @@ -15,7 +15,7 @@ import org.reactivestreams.Processor; -import io.reactivex.Flowable; +import io.reactivex.*; /** * Represents a Subscriber and a Flowable (Publisher) at the same time, allowing @@ -25,7 +25,7 @@ * * @param the item value type */ -public abstract class FlowableProcessor extends Flowable implements Processor { +public abstract class FlowableProcessor extends Flowable implements Processor, FlowableSubscriber { /** * Returns true if the subject has subscribers. diff --git a/src/main/java/io/reactivex/subscribers/DefaultSubscriber.java b/src/main/java/io/reactivex/subscribers/DefaultSubscriber.java index 036dc7cdc5..dbe04d6723 100644 --- a/src/main/java/io/reactivex/subscribers/DefaultSubscriber.java +++ b/src/main/java/io/reactivex/subscribers/DefaultSubscriber.java @@ -13,8 +13,9 @@ package io.reactivex.subscribers; -import org.reactivestreams.*; +import org.reactivestreams.Subscription; +import io.reactivex.FlowableSubscriber; import io.reactivex.internal.subscriptions.SubscriptionHelper; /** @@ -25,7 +26,7 @@ * * @param the value type */ -public abstract class DefaultSubscriber implements Subscriber { +public abstract class DefaultSubscriber implements FlowableSubscriber { private Subscription s; @Override public final void onSubscribe(Subscription s) { diff --git a/src/main/java/io/reactivex/subscribers/DisposableSubscriber.java b/src/main/java/io/reactivex/subscribers/DisposableSubscriber.java index 07dd392b7e..2ccb433b89 100644 --- a/src/main/java/io/reactivex/subscribers/DisposableSubscriber.java +++ b/src/main/java/io/reactivex/subscribers/DisposableSubscriber.java @@ -15,8 +15,9 @@ import java.util.concurrent.atomic.AtomicReference; -import org.reactivestreams.*; +import org.reactivestreams.Subscription; +import io.reactivex.FlowableSubscriber; import io.reactivex.disposables.Disposable; import io.reactivex.internal.subscriptions.SubscriptionHelper; @@ -25,7 +26,7 @@ * * @param the received value type. */ -public abstract class DisposableSubscriber implements Subscriber, Disposable { +public abstract class DisposableSubscriber implements FlowableSubscriber, Disposable { final AtomicReference s = new AtomicReference(); @Override diff --git a/src/main/java/io/reactivex/subscribers/ResourceSubscriber.java b/src/main/java/io/reactivex/subscribers/ResourceSubscriber.java index b4589024b9..0f960bc523 100644 --- a/src/main/java/io/reactivex/subscribers/ResourceSubscriber.java +++ b/src/main/java/io/reactivex/subscribers/ResourceSubscriber.java @@ -13,12 +13,11 @@ package io.reactivex.subscribers; -import org.reactivestreams.Subscriber; -import org.reactivestreams.Subscription; +import java.util.concurrent.atomic.*; -import java.util.concurrent.atomic.AtomicLong; -import java.util.concurrent.atomic.AtomicReference; +import org.reactivestreams.Subscription; +import io.reactivex.FlowableSubscriber; import io.reactivex.disposables.Disposable; import io.reactivex.internal.disposables.ListCompositeDisposable; import io.reactivex.internal.functions.ObjectHelper; @@ -34,7 +33,7 @@ * * @param the value type */ -public abstract class ResourceSubscriber implements Subscriber, Disposable { +public abstract class ResourceSubscriber implements FlowableSubscriber, Disposable { /** The active subscription. */ private final AtomicReference s = new AtomicReference(); diff --git a/src/main/java/io/reactivex/subscribers/SafeSubscriber.java b/src/main/java/io/reactivex/subscribers/SafeSubscriber.java index 8259eb09e5..7c17a472d2 100644 --- a/src/main/java/io/reactivex/subscribers/SafeSubscriber.java +++ b/src/main/java/io/reactivex/subscribers/SafeSubscriber.java @@ -14,6 +14,7 @@ import org.reactivestreams.*; +import io.reactivex.FlowableSubscriber; import io.reactivex.exceptions.*; import io.reactivex.internal.subscriptions.*; import io.reactivex.plugins.RxJavaPlugins; @@ -24,7 +25,7 @@ * * @param the value type */ -public final class SafeSubscriber implements Subscriber, Subscription { +public final class SafeSubscriber implements FlowableSubscriber, Subscription { /** The actual Subscriber. */ final Subscriber actual; /** The subscription. */ diff --git a/src/main/java/io/reactivex/subscribers/SerializedSubscriber.java b/src/main/java/io/reactivex/subscribers/SerializedSubscriber.java index e72738b28c..dd9f4d78c0 100644 --- a/src/main/java/io/reactivex/subscribers/SerializedSubscriber.java +++ b/src/main/java/io/reactivex/subscribers/SerializedSubscriber.java @@ -14,6 +14,7 @@ import org.reactivestreams.*; +import io.reactivex.FlowableSubscriber; import io.reactivex.internal.subscriptions.SubscriptionHelper; import io.reactivex.internal.util.*; import io.reactivex.plugins.RxJavaPlugins; @@ -28,7 +29,7 @@ * * @param the value type */ -public final class SerializedSubscriber implements Subscriber, Subscription { +public final class SerializedSubscriber implements FlowableSubscriber, Subscription { final Subscriber actual; final boolean delayError; diff --git a/src/main/java/io/reactivex/subscribers/TestSubscriber.java b/src/main/java/io/reactivex/subscribers/TestSubscriber.java index 91e3cef7f8..0a90beb500 100644 --- a/src/main/java/io/reactivex/subscribers/TestSubscriber.java +++ b/src/main/java/io/reactivex/subscribers/TestSubscriber.java @@ -16,6 +16,7 @@ import org.reactivestreams.*; +import io.reactivex.FlowableSubscriber; import io.reactivex.annotations.Experimental; import io.reactivex.disposables.Disposable; import io.reactivex.functions.Consumer; @@ -39,7 +40,7 @@ */ public class TestSubscriber extends BaseTestConsumer> -implements Subscriber, Subscription, Disposable { +implements FlowableSubscriber, Subscription, Disposable { /** The actual subscriber to forward events to. */ private final Subscriber actual; @@ -419,7 +420,7 @@ public final TestSubscriber requestMore(long n) { /** * A subscriber that ignores all events and does not report errors. */ - enum EmptySubscriber implements Subscriber { + enum EmptySubscriber implements FlowableSubscriber { INSTANCE; @Override diff --git a/src/perf/java/io/reactivex/InputWithIncrementingInteger.java b/src/perf/java/io/reactivex/InputWithIncrementingInteger.java index e94e93b1b9..2b5ebbc720 100644 --- a/src/perf/java/io/reactivex/InputWithIncrementingInteger.java +++ b/src/perf/java/io/reactivex/InputWithIncrementingInteger.java @@ -82,7 +82,7 @@ public PerfSubscriber newLatchedObserver() { return new PerfSubscriber(bh); } - public Subscriber newSubscriber() { + public FlowableSubscriber newSubscriber() { return new DefaultSubscriber() { @Override diff --git a/src/perf/java/io/reactivex/PerfAsyncConsumer.java b/src/perf/java/io/reactivex/PerfAsyncConsumer.java index 549c9da973..8db609b4b5 100644 --- a/src/perf/java/io/reactivex/PerfAsyncConsumer.java +++ b/src/perf/java/io/reactivex/PerfAsyncConsumer.java @@ -23,7 +23,7 @@ /** * A multi-type asynchronous consumer. */ -public final class PerfAsyncConsumer extends CountDownLatch implements Subscriber, Observer, +public final class PerfAsyncConsumer extends CountDownLatch implements FlowableSubscriber, Observer, SingleObserver, CompletableObserver, MaybeObserver { final Blackhole bh; diff --git a/src/perf/java/io/reactivex/PerfConsumer.java b/src/perf/java/io/reactivex/PerfConsumer.java index 8140d1c8b4..a25ec1f0a2 100644 --- a/src/perf/java/io/reactivex/PerfConsumer.java +++ b/src/perf/java/io/reactivex/PerfConsumer.java @@ -14,14 +14,14 @@ package io.reactivex; import org.openjdk.jmh.infra.Blackhole; -import org.reactivestreams.*; +import org.reactivestreams.Subscription; import io.reactivex.disposables.Disposable; /** * A multi-type synchronous consumer. */ -public final class PerfConsumer implements Subscriber, Observer, +public final class PerfConsumer implements FlowableSubscriber, Observer, SingleObserver, CompletableObserver, MaybeObserver { final Blackhole bh; diff --git a/src/perf/java/io/reactivex/PerfSubscriber.java b/src/perf/java/io/reactivex/PerfSubscriber.java index 3afb4fe699..6e9a5cfde0 100644 --- a/src/perf/java/io/reactivex/PerfSubscriber.java +++ b/src/perf/java/io/reactivex/PerfSubscriber.java @@ -16,9 +16,9 @@ import java.util.concurrent.CountDownLatch; import org.openjdk.jmh.infra.Blackhole; -import org.reactivestreams.*; +import org.reactivestreams.Subscription; -public class PerfSubscriber implements Subscriber { +public class PerfSubscriber implements FlowableSubscriber { public CountDownLatch latch = new CountDownLatch(1); private final Blackhole bh; diff --git a/src/test/java/io/reactivex/InternalWrongNaming.java b/src/test/java/io/reactivex/InternalWrongNaming.java index 6b77f78427..846a1d08e0 100644 --- a/src/test/java/io/reactivex/InternalWrongNaming.java +++ b/src/test/java/io/reactivex/InternalWrongNaming.java @@ -123,7 +123,7 @@ public void observableNoPublisher() throws Exception { @Test public void observableNoFlowable() throws Exception { - checkInternalOperatorNaming("Observable", "Flowable"); + checkInternalOperatorNaming("Observable", "Flowable", "ObservableFromPublisher"); } @Test diff --git a/src/test/java/io/reactivex/TestHelper.java b/src/test/java/io/reactivex/TestHelper.java index ff78cf47b3..65471700bd 100644 --- a/src/test/java/io/reactivex/TestHelper.java +++ b/src/test/java/io/reactivex/TestHelper.java @@ -55,8 +55,8 @@ public enum TestHelper { * @return the mocked subscriber */ @SuppressWarnings("unchecked") - public static Subscriber mockSubscriber() { - Subscriber w = mock(Subscriber.class); + public static FlowableSubscriber mockSubscriber() { + FlowableSubscriber w = mock(FlowableSubscriber.class); Mockito.doAnswer(new Answer() { @Override @@ -295,7 +295,7 @@ public static void assertBadRequestReported(Publisher source) { try { final CountDownLatch cdl = new CountDownLatch(1); - source.subscribe(new Subscriber() { + source.subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { @@ -646,7 +646,7 @@ public static void doubleOnSubscribe(MaybeObserver subscriber) { */ public static void checkDisposed(Flowable source) { final TestSubscriber ts = new TestSubscriber(0L); - source.subscribe(new Subscriber() { + source.subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { ts.onSubscribe(new BooleanSubscription()); @@ -870,7 +870,7 @@ public void onComplete() { /** * Consumer for all base reactive types. */ - enum NoOpConsumer implements Subscriber, Observer, MaybeObserver, SingleObserver, CompletableObserver { + enum NoOpConsumer implements FlowableSubscriber, Observer, MaybeObserver, SingleObserver, CompletableObserver { INSTANCE; @Override @@ -2237,7 +2237,7 @@ public static void checkFusedIsEmptyClear(Flowable source) { final Boolean[] state = { null, null, null, null }; - source.subscribe(new Subscriber() { + source.subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription d) { try { diff --git a/src/test/java/io/reactivex/completable/CompletableTest.java b/src/test/java/io/reactivex/completable/CompletableTest.java index 5630b84b0c..8c9327ea13 100644 --- a/src/test/java/io/reactivex/completable/CompletableTest.java +++ b/src/test/java/io/reactivex/completable/CompletableTest.java @@ -4291,7 +4291,7 @@ public void accept(Throwable e) { public void safeOnCompleteThrowsRegularSubscriber() { /* try { - normal.completable.subscribe(new Subscriber() { + normal.completable.subscribe(new FlowableSubscriber() { @Override public void onComplete() { @@ -4323,7 +4323,7 @@ public void onNext(Object t) { public void safeOnErrorThrowsRegularSubscriber() { /* try { - error.completable.subscribe(new Subscriber() { + error.completable.subscribe(new FlowableSubscriber() { @Override public void onComplete() { diff --git a/src/test/java/io/reactivex/exceptions/ExceptionsTest.java b/src/test/java/io/reactivex/exceptions/ExceptionsTest.java index 090a64e099..efa24e3b02 100644 --- a/src/test/java/io/reactivex/exceptions/ExceptionsTest.java +++ b/src/test/java/io/reactivex/exceptions/ExceptionsTest.java @@ -388,7 +388,7 @@ public void subscribe(final SingleObserver s1) { public void subscribe(SingleObserver s2) { throw new IllegalArgumentException("original exception"); } - }).toFlowable().subscribe(new Subscriber() { + }).toFlowable().subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { diff --git a/src/test/java/io/reactivex/flowable/FlowableConversionTest.java b/src/test/java/io/reactivex/flowable/FlowableConversionTest.java index 441b9a2b58..946a3b4742 100644 --- a/src/test/java/io/reactivex/flowable/FlowableConversionTest.java +++ b/src/test/java/io/reactivex/flowable/FlowableConversionTest.java @@ -76,11 +76,11 @@ public CylonDetectorObservable compose(Function beep(Predicate predicate) { - return new CylonDetectorObservable(new FlowableFilter(onSubscribe, predicate)); + return new CylonDetectorObservable(new FlowableFilter(Flowable.fromPublisher(onSubscribe), predicate)); } public final CylonDetectorObservable boop(Function func) { - return new CylonDetectorObservable(new FlowableMap(onSubscribe, func)); + return new CylonDetectorObservable(new FlowableMap(Flowable.fromPublisher(onSubscribe), func)); } public CylonDetectorObservable DESTROY() { diff --git a/src/test/java/io/reactivex/flowable/FlowableNullTests.java b/src/test/java/io/reactivex/flowable/FlowableNullTests.java index e8ef83e584..497abc21ef 100644 --- a/src/test/java/io/reactivex/flowable/FlowableNullTests.java +++ b/src/test/java/io/reactivex/flowable/FlowableNullTests.java @@ -2155,6 +2155,11 @@ public void subscribeNull() { just1.subscribe((Subscriber)null); } + @Test(expected = NullPointerException.class) + public void subscribeNull2() { + just1.subscribe((FlowableSubscriber)null); + } + @Test(expected = NullPointerException.class) public void subscribeOnNull() { just1.subscribeOn(null); @@ -2820,7 +2825,7 @@ public Object apply(Integer a, Integer b) { @Test(expected = NullPointerException.class) public void unsafeSubscribeNull() { - just1.subscribe((Subscriber)null); + just1.subscribe((FlowableSubscriber)null); } @SuppressWarnings("unchecked") diff --git a/src/test/java/io/reactivex/flowable/FlowableSubscriberTest.java b/src/test/java/io/reactivex/flowable/FlowableSubscriberTest.java index 8bf2effaea..e9e0da5159 100644 --- a/src/test/java/io/reactivex/flowable/FlowableSubscriberTest.java +++ b/src/test/java/io/reactivex/flowable/FlowableSubscriberTest.java @@ -88,7 +88,7 @@ public void testRequestFromChainedOperator() throws Exception { FlowableOperator o = new FlowableOperator() { @Override public Subscriber apply(final Subscriber s1) { - return new Subscriber() { + return new FlowableSubscriber() { @Override public void onSubscribe(Subscription a) { @@ -140,7 +140,7 @@ public void testRequestFromDecoupledOperator() throws Exception { FlowableOperator o = new FlowableOperator() { @Override public Subscriber apply(final Subscriber s1) { - return new Subscriber() { + return new FlowableSubscriber() { @Override public void onSubscribe(Subscription a) { diff --git a/src/test/java/io/reactivex/flowable/FlowableTests.java b/src/test/java/io/reactivex/flowable/FlowableTests.java index 435f0e6ede..219a36efac 100644 --- a/src/test/java/io/reactivex/flowable/FlowableTests.java +++ b/src/test/java/io/reactivex/flowable/FlowableTests.java @@ -808,7 +808,7 @@ public void testOfTypeWithPolymorphism() { public void testContainsFlowable() { Flowable observable = Flowable.just("a", "b", "c").contains("b").toFlowable(); - Subscriber observer = TestHelper.mockSubscriber(); + FlowableSubscriber observer = TestHelper.mockSubscriber(); observable.subscribe(observer); @@ -854,7 +854,7 @@ public void testContainsWithNullFlowable() { public void testContainsWithEmptyObservableFlowable() { Flowable observable = Flowable. empty().contains("a").toFlowable(); - Subscriber observer = TestHelper.mockSubscriber(); + FlowableSubscriber observer = TestHelper.mockSubscriber(); observable.subscribe(observer); diff --git a/src/test/java/io/reactivex/internal/operators/flowable/FlowableBlockingTest.java b/src/test/java/io/reactivex/internal/operators/flowable/FlowableBlockingTest.java index f5de20dcb4..cd4aa269d3 100644 --- a/src/test/java/io/reactivex/internal/operators/flowable/FlowableBlockingTest.java +++ b/src/test/java/io/reactivex/internal/operators/flowable/FlowableBlockingTest.java @@ -127,7 +127,7 @@ public void blockingSubscribeObserver() { Flowable.range(1, 5) .subscribeOn(Schedulers.computation()) - .blockingSubscribe(new Subscriber() { + .blockingSubscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription d) { @@ -162,7 +162,7 @@ public void blockingSubscribeObserverError() { Flowable.range(1, 5).concatWith(Flowable.error(ex)) .subscribeOn(Schedulers.computation()) - .blockingSubscribe(new Subscriber() { + .blockingSubscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription d) { diff --git a/src/test/java/io/reactivex/internal/operators/flowable/FlowableCreateTest.java b/src/test/java/io/reactivex/internal/operators/flowable/FlowableCreateTest.java index f95f2dfbe8..29f8e14679 100644 --- a/src/test/java/io/reactivex/internal/operators/flowable/FlowableCreateTest.java +++ b/src/test/java/io/reactivex/internal/operators/flowable/FlowableCreateTest.java @@ -673,7 +673,7 @@ public void subscribe(FlowableEmitter e) throws Exception { assertTrue(d.isDisposed()); } }, m) - .subscribe(new Subscriber() { + .subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription d) { } @@ -711,7 +711,7 @@ public void subscribe(FlowableEmitter e) throws Exception { assertTrue(d.isDisposed()); } }, m) - .subscribe(new Subscriber() { + .subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription d) { } diff --git a/src/test/java/io/reactivex/internal/operators/flowable/FlowableDistinctTest.java b/src/test/java/io/reactivex/internal/operators/flowable/FlowableDistinctTest.java index 422a0f6397..0404682e9d 100644 --- a/src/test/java/io/reactivex/internal/operators/flowable/FlowableDistinctTest.java +++ b/src/test/java/io/reactivex/internal/operators/flowable/FlowableDistinctTest.java @@ -173,7 +173,7 @@ public void fusedAsync() { public void fusedClear() { Flowable.just(1, 1, 2, 1, 3, 2, 4, 5, 4) .distinct() - .subscribe(new Subscriber() { + .subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription d) { QueueSubscription qd = (QueueSubscription)d; diff --git a/src/test/java/io/reactivex/internal/operators/flowable/FlowableDoFinallyTest.java b/src/test/java/io/reactivex/internal/operators/flowable/FlowableDoFinallyTest.java index b564ff81f5..8a775ea310 100644 --- a/src/test/java/io/reactivex/internal/operators/flowable/FlowableDoFinallyTest.java +++ b/src/test/java/io/reactivex/internal/operators/flowable/FlowableDoFinallyTest.java @@ -350,7 +350,7 @@ public void run() throws Exception { public void clearIsEmpty() { Flowable.range(1, 5) .doFinally(this) - .subscribe(new Subscriber() { + .subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { @@ -397,7 +397,7 @@ public void clearIsEmptyConditional() { Flowable.range(1, 5) .doFinally(this) .filter(Functions.alwaysTrue()) - .subscribe(new Subscriber() { + .subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { diff --git a/src/test/java/io/reactivex/internal/operators/flowable/FlowableDoOnRequestTest.java b/src/test/java/io/reactivex/internal/operators/flowable/FlowableDoOnRequestTest.java index 390c6b3f18..1d30f4663c 100644 --- a/src/test/java/io/reactivex/internal/operators/flowable/FlowableDoOnRequestTest.java +++ b/src/test/java/io/reactivex/internal/operators/flowable/FlowableDoOnRequestTest.java @@ -105,7 +105,7 @@ public void dontRequestIfDownstreamRequestsLate() { // } // }); // } -// }).doOnRequest(empty).subscribe(new Subscriber() { +// }).doOnRequest(empty).subscribe(new FlowableSubscriber() { // @Override // public void onNext(Object t) { // diff --git a/src/test/java/io/reactivex/internal/operators/flowable/FlowableFlatMapCompletableTest.java b/src/test/java/io/reactivex/internal/operators/flowable/FlowableFlatMapCompletableTest.java index c01ff13be7..c91e7b8ef9 100644 --- a/src/test/java/io/reactivex/internal/operators/flowable/FlowableFlatMapCompletableTest.java +++ b/src/test/java/io/reactivex/internal/operators/flowable/FlowableFlatMapCompletableTest.java @@ -419,7 +419,7 @@ public CompletableSource apply(Integer v) throws Exception { } }) .toFlowable() - .subscribe(new Subscriber() { + .subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription d) { QueueSubscription qd = (QueueSubscription)d; diff --git a/src/test/java/io/reactivex/internal/operators/flowable/FlowableFlattenIterableTest.java b/src/test/java/io/reactivex/internal/operators/flowable/FlowableFlattenIterableTest.java index 30c928f7ff..51de692dff 100644 --- a/src/test/java/io/reactivex/internal/operators/flowable/FlowableFlattenIterableTest.java +++ b/src/test/java/io/reactivex/internal/operators/flowable/FlowableFlattenIterableTest.java @@ -609,7 +609,7 @@ public Object call() throws Exception { public void fusionMethods() { Flowable.just(1, 2) .flatMapIterable(Functions.justFunction(Arrays.asList(1, 2, 3))) - .subscribe(new Subscriber() { + .subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { @SuppressWarnings("unchecked") @@ -737,7 +737,7 @@ public Iterable apply(Integer v) throws Exception { return Arrays.asList(v); } }) - .subscribe(new Subscriber() { + .subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { @SuppressWarnings("unchecked") diff --git a/src/test/java/io/reactivex/internal/operators/flowable/FlowableFromIterableTest.java b/src/test/java/io/reactivex/internal/operators/flowable/FlowableFromIterableTest.java index 570e4d50af..877222aca3 100644 --- a/src/test/java/io/reactivex/internal/operators/flowable/FlowableFromIterableTest.java +++ b/src/test/java/io/reactivex/internal/operators/flowable/FlowableFromIterableTest.java @@ -569,7 +569,7 @@ public Flowable apply(Integer v) { @Test public void fusedAPICalls() { Flowable.fromIterable(Arrays.asList(1, 2, 3)) - .subscribe(new Subscriber() { + .subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { @@ -880,7 +880,7 @@ public void fusionRejected() { @Test public void fusionClear() { Flowable.fromIterable(Arrays.asList(1, 2, 3)) - .subscribe(new Subscriber() { + .subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription d) { @SuppressWarnings("unchecked") diff --git a/src/test/java/io/reactivex/internal/operators/flowable/FlowableFromSourceTest.java b/src/test/java/io/reactivex/internal/operators/flowable/FlowableFromSourceTest.java index d3992c2013..2aa29ffca8 100644 --- a/src/test/java/io/reactivex/internal/operators/flowable/FlowableFromSourceTest.java +++ b/src/test/java/io/reactivex/internal/operators/flowable/FlowableFromSourceTest.java @@ -620,7 +620,7 @@ public void onNext(Integer t) { ts1.assertNotComplete(); } - static final class PublishAsyncEmitter implements FlowableOnSubscribe, Subscriber { + static final class PublishAsyncEmitter implements FlowableOnSubscribe, FlowableSubscriber { final PublishProcessor subject; @@ -689,7 +689,7 @@ public void onComplete() { } } - static final class PublishAsyncEmitterNoCancel implements FlowableOnSubscribe, Subscriber { + static final class PublishAsyncEmitterNoCancel implements FlowableOnSubscribe, FlowableSubscriber { final PublishProcessor subject; @@ -700,7 +700,7 @@ static final class PublishAsyncEmitterNoCancel implements FlowableOnSubscribe t) { - subject.subscribe(new Subscriber() { + subject.subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { diff --git a/src/test/java/io/reactivex/internal/operators/flowable/FlowableGroupJoinTest.java b/src/test/java/io/reactivex/internal/operators/flowable/FlowableGroupJoinTest.java index 5d6ad27dfe..4407dceb07 100644 --- a/src/test/java/io/reactivex/internal/operators/flowable/FlowableGroupJoinTest.java +++ b/src/test/java/io/reactivex/internal/operators/flowable/FlowableGroupJoinTest.java @@ -172,7 +172,7 @@ public PPF apply(Person t1, Flowable t2) { }); q.subscribe( - new Subscriber() { + new FlowableSubscriber() { @Override public void onNext(final PPF ppf) { ppf.fruits.filter(new Predicate() { diff --git a/src/test/java/io/reactivex/internal/operators/flowable/FlowableIgnoreElementsTest.java b/src/test/java/io/reactivex/internal/operators/flowable/FlowableIgnoreElementsTest.java index 1f746b4b66..514ab24b27 100644 --- a/src/test/java/io/reactivex/internal/operators/flowable/FlowableIgnoreElementsTest.java +++ b/src/test/java/io/reactivex/internal/operators/flowable/FlowableIgnoreElementsTest.java @@ -273,7 +273,7 @@ public void fused() { @Test public void fusedAPICalls() { Flowable.just(1).hide().ignoreElements().toFlowable() - .subscribe(new Subscriber() { + .subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { diff --git a/src/test/java/io/reactivex/internal/operators/flowable/FlowableMergeTest.java b/src/test/java/io/reactivex/internal/operators/flowable/FlowableMergeTest.java index fe9736d374..607c461443 100644 --- a/src/test/java/io/reactivex/internal/operators/flowable/FlowableMergeTest.java +++ b/src/test/java/io/reactivex/internal/operators/flowable/FlowableMergeTest.java @@ -516,7 +516,7 @@ private Flowable createFlowableOf5IntervalsOf1SecondIncrementsWithSubscrip public void subscribe(final Subscriber child) { Flowable.interval(1, TimeUnit.SECONDS, scheduler) .take(5) - .subscribe(new Subscriber() { + .subscribe(new FlowableSubscriber() { @Override public void onSubscribe(final Subscription s) { child.onSubscribe(new Subscription() { diff --git a/src/test/java/io/reactivex/internal/operators/flowable/FlowableObserveOnTest.java b/src/test/java/io/reactivex/internal/operators/flowable/FlowableObserveOnTest.java index 3052240fd7..77bdf9e8b3 100644 --- a/src/test/java/io/reactivex/internal/operators/flowable/FlowableObserveOnTest.java +++ b/src/test/java/io/reactivex/internal/operators/flowable/FlowableObserveOnTest.java @@ -1306,7 +1306,7 @@ public void outputFusedCancelReentrant() throws Exception { final CountDownLatch cdl = new CountDownLatch(1); us.observeOn(Schedulers.single()) - .subscribe(new Subscriber() { + .subscribe(new FlowableSubscriber() { Subscription d; int count; @Override diff --git a/src/test/java/io/reactivex/internal/operators/flowable/FlowableOnErrorResumeNextViaFunctionTest.java b/src/test/java/io/reactivex/internal/operators/flowable/FlowableOnErrorResumeNextViaFunctionTest.java index dcb053605e..68f7737943 100644 --- a/src/test/java/io/reactivex/internal/operators/flowable/FlowableOnErrorResumeNextViaFunctionTest.java +++ b/src/test/java/io/reactivex/internal/operators/flowable/FlowableOnErrorResumeNextViaFunctionTest.java @@ -190,7 +190,7 @@ public void testOnErrorResumeReceivesErrorFromPreviousNonProtectedOperatorOnNext @Override public Subscriber apply(final Subscriber t1) { - return new Subscriber() { + return new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { diff --git a/src/test/java/io/reactivex/internal/operators/flowable/FlowableRefCountTest.java b/src/test/java/io/reactivex/internal/operators/flowable/FlowableRefCountTest.java index 7ac949af2c..ae4c38cfef 100644 --- a/src/test/java/io/reactivex/internal/operators/flowable/FlowableRefCountTest.java +++ b/src/test/java/io/reactivex/internal/operators/flowable/FlowableRefCountTest.java @@ -577,7 +577,7 @@ public void accept(String t1) { assertEquals(6, intervalSubscribed.get()); } - private enum CancelledSubscriber implements Subscriber { + private enum CancelledSubscriber implements FlowableSubscriber { INSTANCE; @Override public void onSubscribe(Subscription s) { diff --git a/src/test/java/io/reactivex/internal/operators/flowable/FlowableStrictTest.java b/src/test/java/io/reactivex/internal/operators/flowable/FlowableStrictTest.java index 0f4d631925..8234807216 100644 --- a/src/test/java/io/reactivex/internal/operators/flowable/FlowableStrictTest.java +++ b/src/test/java/io/reactivex/internal/operators/flowable/FlowableStrictTest.java @@ -21,12 +21,13 @@ import org.junit.Test; import org.reactivestreams.*; -import io.reactivex.Flowable; +import io.reactivex.*; import io.reactivex.exceptions.TestException; import io.reactivex.internal.subscriptions.BooleanSubscription; import io.reactivex.schedulers.Schedulers; import io.reactivex.subscribers.TestSubscriber; +@Deprecated public class FlowableStrictTest { @Test @@ -136,7 +137,9 @@ public void doubleOnSubscribe() { final BooleanSubscription bs1 = new BooleanSubscription(); final BooleanSubscription bs2 = new BooleanSubscription(); - TestSubscriber ts = Flowable.fromPublisher(new Publisher() { + final TestSubscriber ts = TestSubscriber.create(); + + Flowable.fromPublisher(new Publisher() { @Override public void subscribe(Subscriber p) { p.onSubscribe(bs1); @@ -144,8 +147,30 @@ public void subscribe(Subscriber p) { } }) .strict() - .test() - .assertFailure(IllegalStateException.class); + .subscribe(new Subscriber() { + + @Override + public void onSubscribe(Subscription s) { + ts.onSubscribe(s); + } + + @Override + public void onNext(Object t) { + ts.onNext(t); + } + + @Override + public void onError(Throwable t) { + ts.onError(t); + } + + @Override + public void onComplete() { + ts.onComplete(); + } + }); + + ts.assertFailure(IllegalStateException.class); assertTrue(bs1.isCancelled()); assertTrue(bs2.isCancelled()); diff --git a/src/test/java/io/reactivex/internal/operators/maybe/MaybeFlatMapIterableFlowableTest.java b/src/test/java/io/reactivex/internal/operators/maybe/MaybeFlatMapIterableFlowableTest.java index 5e815c580a..60b270ec28 100644 --- a/src/test/java/io/reactivex/internal/operators/maybe/MaybeFlatMapIterableFlowableTest.java +++ b/src/test/java/io/reactivex/internal/operators/maybe/MaybeFlatMapIterableFlowableTest.java @@ -298,7 +298,7 @@ public void fusedEmptyCheck() { public Iterable apply(Object v) throws Exception { return Arrays.asList(1, 2, 3); } - }).subscribe(new Subscriber() { + }).subscribe(new FlowableSubscriber() { QueueSubscription qd; @SuppressWarnings("unchecked") @Override diff --git a/src/test/java/io/reactivex/internal/operators/maybe/MaybeMergeArrayTest.java b/src/test/java/io/reactivex/internal/operators/maybe/MaybeMergeArrayTest.java index 3711130e11..61dc02da35 100644 --- a/src/test/java/io/reactivex/internal/operators/maybe/MaybeMergeArrayTest.java +++ b/src/test/java/io/reactivex/internal/operators/maybe/MaybeMergeArrayTest.java @@ -62,7 +62,7 @@ public void fusedPollMixed() { @Test public void fusedEmptyCheck() { Maybe.mergeArray(Maybe.just(1), Maybe.empty(), Maybe.just(2)) - .subscribe(new Subscriber() { + .subscribe(new FlowableSubscriber() { QueueSubscription qd; @Override public void onSubscribe(Subscription d) { @@ -192,7 +192,7 @@ protected void subscribeActual(MaybeObserver observer) { @Test public void smallOffer2Throws() { Maybe.mergeArray(Maybe.never(), Maybe.never()) - .subscribe(new Subscriber() { + .subscribe(new FlowableSubscriber() { @SuppressWarnings("rawtypes") @Override @@ -227,7 +227,7 @@ public void largeOffer2Throws() { Maybe[] a = new Maybe[1024]; Arrays.fill(a, Maybe.never()); Maybe.mergeArray(a) - .subscribe(new Subscriber() { + .subscribe(new FlowableSubscriber() { @SuppressWarnings("rawtypes") @Override diff --git a/src/test/java/io/reactivex/internal/operators/single/SingleFlatMapIterableFlowableTest.java b/src/test/java/io/reactivex/internal/operators/single/SingleFlatMapIterableFlowableTest.java index 5b27656476..959c3f3ff5 100644 --- a/src/test/java/io/reactivex/internal/operators/single/SingleFlatMapIterableFlowableTest.java +++ b/src/test/java/io/reactivex/internal/operators/single/SingleFlatMapIterableFlowableTest.java @@ -285,7 +285,7 @@ public void fusedEmptyCheck() { public Iterable apply(Object v) throws Exception { return Arrays.asList(1, 2, 3); } - }).subscribe(new Subscriber() { + }).subscribe(new FlowableSubscriber() { QueueSubscription qd; @SuppressWarnings("unchecked") @Override diff --git a/src/test/java/io/reactivex/internal/util/HalfSerializerSubscriberTest.java b/src/test/java/io/reactivex/internal/util/HalfSerializerSubscriberTest.java index 4a3a894513..4a3adf662f 100644 --- a/src/test/java/io/reactivex/internal/util/HalfSerializerSubscriberTest.java +++ b/src/test/java/io/reactivex/internal/util/HalfSerializerSubscriberTest.java @@ -12,7 +12,7 @@ */ package io.reactivex.internal.util; -import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; import java.io.IOException; import java.util.concurrent.atomic.AtomicInteger; @@ -20,7 +20,7 @@ import org.junit.Test; import org.reactivestreams.*; -import io.reactivex.TestHelper; +import io.reactivex.*; import io.reactivex.exceptions.TestException; import io.reactivex.internal.subscriptions.BooleanSubscription; import io.reactivex.schedulers.Schedulers; @@ -43,7 +43,7 @@ public void reentrantOnNextOnNext() { final TestSubscriber ts = new TestSubscriber(); - Subscriber s = new Subscriber() { + FlowableSubscriber s = new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { ts.onSubscribe(s); @@ -87,7 +87,7 @@ public void reentrantOnNextOnError() { final TestSubscriber ts = new TestSubscriber(); - Subscriber s = new Subscriber() { + FlowableSubscriber s = new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { ts.onSubscribe(s); @@ -131,7 +131,7 @@ public void reentrantOnNextOnComplete() { final TestSubscriber ts = new TestSubscriber(); - Subscriber s = new Subscriber() { + FlowableSubscriber s = new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { ts.onSubscribe(s); @@ -175,7 +175,7 @@ public void reentrantErrorOnError() { final TestSubscriber ts = new TestSubscriber(); - Subscriber s = new Subscriber() { + FlowableSubscriber s = new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { ts.onSubscribe(s); diff --git a/src/test/java/io/reactivex/processors/PublishProcessorTest.java b/src/test/java/io/reactivex/processors/PublishProcessorTest.java index bc85a56d69..82e7ed7ac8 100644 --- a/src/test/java/io/reactivex/processors/PublishProcessorTest.java +++ b/src/test/java/io/reactivex/processors/PublishProcessorTest.java @@ -13,27 +13,23 @@ package io.reactivex.processors; -import io.reactivex.Flowable; -import io.reactivex.TestHelper; -import io.reactivex.exceptions.MissingBackpressureException; -import io.reactivex.exceptions.TestException; -import io.reactivex.functions.Consumer; -import io.reactivex.functions.Function; -import io.reactivex.schedulers.Schedulers; -import io.reactivex.subscribers.DefaultSubscriber; -import io.reactivex.subscribers.TestSubscriber; -import org.junit.Test; -import org.mockito.InOrder; -import org.mockito.Mockito; -import org.reactivestreams.Subscriber; -import org.reactivestreams.Subscription; +import static org.junit.Assert.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; import java.util.ArrayList; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; +import org.junit.Test; +import org.mockito.*; +import org.reactivestreams.*; + +import io.reactivex.*; +import io.reactivex.exceptions.*; +import io.reactivex.functions.*; +import io.reactivex.schedulers.Schedulers; +import io.reactivex.subscribers.*; public class PublishProcessorTest extends FlowableProcessorTest { @@ -548,7 +544,7 @@ public void onSubscribeCancelsImmediately() { TestSubscriber ts = pp.test(); - pp.subscribe(new Subscriber() { + pp.subscribe(new FlowableSubscriber() { @Override public void onSubscribe(Subscription s) { diff --git a/src/test/java/io/reactivex/subscribers/SafeSubscriberTest.java b/src/test/java/io/reactivex/subscribers/SafeSubscriberTest.java index 9686476fc3..a57aaf6a4a 100644 --- a/src/test/java/io/reactivex/subscribers/SafeSubscriberTest.java +++ b/src/test/java/io/reactivex/subscribers/SafeSubscriberTest.java @@ -720,7 +720,7 @@ public void onNextNormal() { ts.assertResult(1); } - static final class CrashDummy implements Subscriber, Subscription { + static final class CrashDummy implements FlowableSubscriber, Subscription { final boolean crashOnSubscribe; int crashOnNext; diff --git a/src/test/java/io/reactivex/subscribers/TestSubscriberTest.java b/src/test/java/io/reactivex/subscribers/TestSubscriberTest.java index a33af16881..710ba9760a 100644 --- a/src/test/java/io/reactivex/subscribers/TestSubscriberTest.java +++ b/src/test/java/io/reactivex/subscribers/TestSubscriberTest.java @@ -1539,7 +1539,7 @@ public void completeWithoutOnSubscribe() { @Test public void completeDelegateThrows() { - TestSubscriber ts = new TestSubscriber(new Subscriber() { + TestSubscriber ts = new TestSubscriber(new FlowableSubscriber() { @Override public void onSubscribe(Subscription d) { @@ -1575,7 +1575,7 @@ public void onComplete() { @Test public void errorDelegateThrows() { - TestSubscriber ts = new TestSubscriber(new Subscriber() { + TestSubscriber ts = new TestSubscriber(new FlowableSubscriber() { @Override public void onSubscribe(Subscription d) { diff --git a/src/test/java/io/reactivex/tck/AllTckTest.java b/src/test/java/io/reactivex/tck/AllTckTest.java index 27dad77c3d..d2308015e1 100644 --- a/src/test/java/io/reactivex/tck/AllTckTest.java +++ b/src/test/java/io/reactivex/tck/AllTckTest.java @@ -24,14 +24,14 @@ public class AllTckTest extends BaseTck { @Override public Publisher createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.range(1, 1000).all(new Predicate() { @Override public boolean test(Integer e) throws Exception { return e < 800; } }).toFlowable() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/AmbArrayTckTest.java b/src/test/java/io/reactivex/tck/AmbArrayTckTest.java index 673f602dfc..944fdc628e 100644 --- a/src/test/java/io/reactivex/tck/AmbArrayTckTest.java +++ b/src/test/java/io/reactivex/tck/AmbArrayTckTest.java @@ -24,11 +24,11 @@ public class AmbArrayTckTest extends BaseTck { @SuppressWarnings("unchecked") @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.ambArray( Flowable.fromIterable(iterate(elements)), Flowable.never() ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/AmbTckTest.java b/src/test/java/io/reactivex/tck/AmbTckTest.java index 75d9ac0b43..0b71748e2d 100644 --- a/src/test/java/io/reactivex/tck/AmbTckTest.java +++ b/src/test/java/io/reactivex/tck/AmbTckTest.java @@ -26,12 +26,12 @@ public class AmbTckTest extends BaseTck { @SuppressWarnings("unchecked") @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.amb(Arrays.asList( Flowable.fromIterable(iterate(elements)), Flowable.never() ) ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/AnyTckTest.java b/src/test/java/io/reactivex/tck/AnyTckTest.java index 46e8a7b054..b1d636fe99 100644 --- a/src/test/java/io/reactivex/tck/AnyTckTest.java +++ b/src/test/java/io/reactivex/tck/AnyTckTest.java @@ -24,14 +24,14 @@ public class AnyTckTest extends BaseTck { @Override public Publisher createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.range(1, 1000).any(new Predicate() { @Override public boolean test(Integer e) throws Exception { return e == 500; } }).toFlowable() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/BufferBoundaryTckTest.java b/src/test/java/io/reactivex/tck/BufferBoundaryTckTest.java index 721e4d11f1..1c53878850 100644 --- a/src/test/java/io/reactivex/tck/BufferBoundaryTckTest.java +++ b/src/test/java/io/reactivex/tck/BufferBoundaryTckTest.java @@ -25,11 +25,11 @@ public class BufferBoundaryTckTest extends BaseTck> { @Override public Publisher> createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.fromIterable(iterate(elements)) .buffer(Flowable.just(1).concatWith(Flowable.never())) .onBackpressureLatest() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/BufferExactSizeTckTest.java b/src/test/java/io/reactivex/tck/BufferExactSizeTckTest.java index dc5ca81e03..cc9430e609 100644 --- a/src/test/java/io/reactivex/tck/BufferExactSizeTckTest.java +++ b/src/test/java/io/reactivex/tck/BufferExactSizeTckTest.java @@ -25,9 +25,9 @@ public class BufferExactSizeTckTest extends BaseTck> { @Override public Publisher> createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.fromIterable(iterate(elements * 2)) .buffer(2) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/CacheTckTest.java b/src/test/java/io/reactivex/tck/CacheTckTest.java index b555ceb5ec..1b2a2c6bf6 100644 --- a/src/test/java/io/reactivex/tck/CacheTckTest.java +++ b/src/test/java/io/reactivex/tck/CacheTckTest.java @@ -23,8 +23,8 @@ public class CacheTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.fromIterable(iterate(elements)).cache() - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/CollectTckTest.java b/src/test/java/io/reactivex/tck/CollectTckTest.java index 2d52e0bdc4..76a208e74e 100644 --- a/src/test/java/io/reactivex/tck/CollectTckTest.java +++ b/src/test/java/io/reactivex/tck/CollectTckTest.java @@ -27,14 +27,14 @@ public class CollectTckTest extends BaseTck> { @Override public Publisher> createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.range(1, 1000).collect(Functions.createArrayList(128), new BiConsumer, Integer>() { @Override public void accept(List a, Integer b) throws Exception { a.add(b); } }).toFlowable() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/CombineLatestArrayDelayErrorTckTest.java b/src/test/java/io/reactivex/tck/CombineLatestArrayDelayErrorTckTest.java index 4d09a47633..bc989a6241 100644 --- a/src/test/java/io/reactivex/tck/CombineLatestArrayDelayErrorTckTest.java +++ b/src/test/java/io/reactivex/tck/CombineLatestArrayDelayErrorTckTest.java @@ -25,7 +25,7 @@ public class CombineLatestArrayDelayErrorTckTest extends BaseTck { @SuppressWarnings("unchecked") @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.combineLatestDelayError( new Function() { @Override @@ -36,6 +36,6 @@ public Long apply(Object[] a) throws Exception { Flowable.just(1L), Flowable.fromIterable(iterate(elements)) ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/CombineLatestArrayTckTest.java b/src/test/java/io/reactivex/tck/CombineLatestArrayTckTest.java index e3ace457f1..051076f442 100644 --- a/src/test/java/io/reactivex/tck/CombineLatestArrayTckTest.java +++ b/src/test/java/io/reactivex/tck/CombineLatestArrayTckTest.java @@ -25,7 +25,7 @@ public class CombineLatestArrayTckTest extends BaseTck { @SuppressWarnings("unchecked") @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.combineLatest( new Function() { @Override @@ -36,6 +36,6 @@ public Long apply(Object[] a) throws Exception { Flowable.just(1L), Flowable.fromIterable(iterate(elements)) ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/CombineLatestIterableDelayErrorTckTest.java b/src/test/java/io/reactivex/tck/CombineLatestIterableDelayErrorTckTest.java index 6327d45a64..3446af1dd9 100644 --- a/src/test/java/io/reactivex/tck/CombineLatestIterableDelayErrorTckTest.java +++ b/src/test/java/io/reactivex/tck/CombineLatestIterableDelayErrorTckTest.java @@ -27,7 +27,7 @@ public class CombineLatestIterableDelayErrorTckTest extends BaseTck { @SuppressWarnings("unchecked") @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.combineLatestDelayError(Arrays.asList( Flowable.just(1L), Flowable.fromIterable(iterate(elements)) @@ -39,6 +39,6 @@ public Long apply(Object[] a) throws Exception { } } ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/CombineLatestIterableTckTest.java b/src/test/java/io/reactivex/tck/CombineLatestIterableTckTest.java index 0a9a44303c..7ae9a7add1 100644 --- a/src/test/java/io/reactivex/tck/CombineLatestIterableTckTest.java +++ b/src/test/java/io/reactivex/tck/CombineLatestIterableTckTest.java @@ -27,7 +27,7 @@ public class CombineLatestIterableTckTest extends BaseTck { @SuppressWarnings("unchecked") @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.combineLatest(Arrays.asList( Flowable.just(1L), Flowable.fromIterable(iterate(elements)) @@ -39,6 +39,6 @@ public Long apply(Object[] a) throws Exception { } } ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/ConcatArrayEagerTckTest.java b/src/test/java/io/reactivex/tck/ConcatArrayEagerTckTest.java index 72be6af0b3..598e15189a 100644 --- a/src/test/java/io/reactivex/tck/ConcatArrayEagerTckTest.java +++ b/src/test/java/io/reactivex/tck/ConcatArrayEagerTckTest.java @@ -26,12 +26,12 @@ public class ConcatArrayEagerTckTest extends BaseTck { @SuppressWarnings("unchecked") @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.concatEager(Arrays.asList( Flowable.fromIterable(iterate(elements / 2)), Flowable.fromIterable(iterate(elements - elements / 2)) ) ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/ConcatIterableEagerTckTest.java b/src/test/java/io/reactivex/tck/ConcatIterableEagerTckTest.java index 6d27a5679d..9d739e1675 100644 --- a/src/test/java/io/reactivex/tck/ConcatIterableEagerTckTest.java +++ b/src/test/java/io/reactivex/tck/ConcatIterableEagerTckTest.java @@ -24,11 +24,11 @@ public class ConcatIterableEagerTckTest extends BaseTck { @SuppressWarnings("unchecked") @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.concatArrayEager( Flowable.fromIterable(iterate(elements / 2)), Flowable.fromIterable(iterate(elements - elements / 2)) ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/ConcatMapIterableTckTest.java b/src/test/java/io/reactivex/tck/ConcatMapIterableTckTest.java index 82f8ef8d5b..d7b0f1ea74 100644 --- a/src/test/java/io/reactivex/tck/ConcatMapIterableTckTest.java +++ b/src/test/java/io/reactivex/tck/ConcatMapIterableTckTest.java @@ -26,7 +26,7 @@ public class ConcatMapIterableTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements) .concatMapIterable(new Function>() { @Override @@ -34,6 +34,6 @@ public Iterable apply(Integer v) throws Exception { return Collections.singletonList(v); } }) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/ConcatMapTckTest.java b/src/test/java/io/reactivex/tck/ConcatMapTckTest.java index 64b6eec122..6d77df3c75 100644 --- a/src/test/java/io/reactivex/tck/ConcatMapTckTest.java +++ b/src/test/java/io/reactivex/tck/ConcatMapTckTest.java @@ -24,7 +24,7 @@ public class ConcatMapTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements) .concatMap(new Function>() { @Override @@ -32,6 +32,6 @@ public Publisher apply(Integer v) throws Exception { return Flowable.just(v); } }) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/ConcatPublisherEagerTckTest.java b/src/test/java/io/reactivex/tck/ConcatPublisherEagerTckTest.java index 35baad524f..8303f0103b 100644 --- a/src/test/java/io/reactivex/tck/ConcatPublisherEagerTckTest.java +++ b/src/test/java/io/reactivex/tck/ConcatPublisherEagerTckTest.java @@ -23,12 +23,12 @@ public class ConcatPublisherEagerTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.concatEager(Flowable.just( Flowable.fromIterable(iterate(elements / 2)), Flowable.fromIterable(iterate(elements - elements / 2)) ) ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/ConcatPublisherTckTest.java b/src/test/java/io/reactivex/tck/ConcatPublisherTckTest.java index 03f9d18e76..62e6f7e8f9 100644 --- a/src/test/java/io/reactivex/tck/ConcatPublisherTckTest.java +++ b/src/test/java/io/reactivex/tck/ConcatPublisherTckTest.java @@ -23,12 +23,12 @@ public class ConcatPublisherTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.concat(Flowable.just( Flowable.fromIterable(iterate(elements / 2)), Flowable.fromIterable(iterate(elements - elements / 2)) ) ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/ConcatTckTest.java b/src/test/java/io/reactivex/tck/ConcatTckTest.java index 68cd202fa6..6b886b7cea 100644 --- a/src/test/java/io/reactivex/tck/ConcatTckTest.java +++ b/src/test/java/io/reactivex/tck/ConcatTckTest.java @@ -23,11 +23,11 @@ public class ConcatTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.concat( Flowable.fromIterable(iterate(elements / 2)), Flowable.fromIterable(iterate(elements - elements / 2)) ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/CreateTckTest.java b/src/test/java/io/reactivex/tck/CreateTckTest.java index 31794a9fea..abad05b789 100644 --- a/src/test/java/io/reactivex/tck/CreateTckTest.java +++ b/src/test/java/io/reactivex/tck/CreateTckTest.java @@ -23,7 +23,7 @@ public class CreateTckTest extends BaseTck { @Override public Publisher createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.create(new FlowableOnSubscribe() { @Override public void subscribe(FlowableEmitter e) throws Exception { @@ -33,6 +33,6 @@ public void subscribe(FlowableEmitter e) throws Exception { e.onComplete(); } }, BackpressureStrategy.BUFFER) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/DefaultIfEmptyTckTest.java b/src/test/java/io/reactivex/tck/DefaultIfEmptyTckTest.java index 9e592d7d33..0febc42545 100644 --- a/src/test/java/io/reactivex/tck/DefaultIfEmptyTckTest.java +++ b/src/test/java/io/reactivex/tck/DefaultIfEmptyTckTest.java @@ -23,8 +23,8 @@ public class DefaultIfEmptyTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(1, (int)elements).defaultIfEmpty(0) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/DeferTckTest.java b/src/test/java/io/reactivex/tck/DeferTckTest.java index 78ffe6581d..87301df0e3 100644 --- a/src/test/java/io/reactivex/tck/DeferTckTest.java +++ b/src/test/java/io/reactivex/tck/DeferTckTest.java @@ -25,7 +25,7 @@ public class DeferTckTest extends BaseTck { @Override public Publisher createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.defer(new Callable>() { @Override public Publisher call() throws Exception { @@ -33,6 +33,6 @@ public Publisher call() throws Exception { } } ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/DelaySubscriptionTckTest.java b/src/test/java/io/reactivex/tck/DelaySubscriptionTckTest.java index 875dafc515..7cb581485c 100644 --- a/src/test/java/io/reactivex/tck/DelaySubscriptionTckTest.java +++ b/src/test/java/io/reactivex/tck/DelaySubscriptionTckTest.java @@ -29,8 +29,8 @@ public DelaySubscriptionTckTest() { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).delaySubscription(1, TimeUnit.MILLISECONDS) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/DelayTckTest.java b/src/test/java/io/reactivex/tck/DelayTckTest.java index 41a02046e7..a0e0231f57 100644 --- a/src/test/java/io/reactivex/tck/DelayTckTest.java +++ b/src/test/java/io/reactivex/tck/DelayTckTest.java @@ -23,10 +23,14 @@ @Test public class DelayTckTest extends BaseTck { + public DelayTckTest() { + super(100L); + } + @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).delay(1, TimeUnit.MILLISECONDS) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/DistinctTckTest.java b/src/test/java/io/reactivex/tck/DistinctTckTest.java index f15e9f942c..adb070bf98 100644 --- a/src/test/java/io/reactivex/tck/DistinctTckTest.java +++ b/src/test/java/io/reactivex/tck/DistinctTckTest.java @@ -23,10 +23,10 @@ public class DistinctTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements) .concatWith(Flowable.range(0, (int)elements)) .distinct() - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/DistinctUntilChangedTckTest.java b/src/test/java/io/reactivex/tck/DistinctUntilChangedTckTest.java index f1da664757..1227021e91 100644 --- a/src/test/java/io/reactivex/tck/DistinctUntilChangedTckTest.java +++ b/src/test/java/io/reactivex/tck/DistinctUntilChangedTckTest.java @@ -23,9 +23,9 @@ public class DistinctUntilChangedTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements) .distinctUntilChanged() - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/DoAfterNextTckTest.java b/src/test/java/io/reactivex/tck/DoAfterNextTckTest.java index 1313af83ff..e6e76780e2 100644 --- a/src/test/java/io/reactivex/tck/DoAfterNextTckTest.java +++ b/src/test/java/io/reactivex/tck/DoAfterNextTckTest.java @@ -24,8 +24,8 @@ public class DoAfterNextTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).doAfterNext(Functions.emptyConsumer()) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/DoFinallyTckTest.java b/src/test/java/io/reactivex/tck/DoFinallyTckTest.java index 1e137047dc..b6b3ae89ad 100644 --- a/src/test/java/io/reactivex/tck/DoFinallyTckTest.java +++ b/src/test/java/io/reactivex/tck/DoFinallyTckTest.java @@ -24,8 +24,8 @@ public class DoFinallyTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).doFinally(Functions.EMPTY_ACTION) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/DoOnNextTckTest.java b/src/test/java/io/reactivex/tck/DoOnNextTckTest.java index 14a420fb43..78bf7a6c11 100644 --- a/src/test/java/io/reactivex/tck/DoOnNextTckTest.java +++ b/src/test/java/io/reactivex/tck/DoOnNextTckTest.java @@ -24,8 +24,8 @@ public class DoOnNextTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).doOnNext(Functions.emptyConsumer()) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/ElementAtTckTest.java b/src/test/java/io/reactivex/tck/ElementAtTckTest.java index be993d68eb..2b2859b844 100644 --- a/src/test/java/io/reactivex/tck/ElementAtTckTest.java +++ b/src/test/java/io/reactivex/tck/ElementAtTckTest.java @@ -23,9 +23,9 @@ public class ElementAtTckTest extends BaseTck { @Override public Publisher createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.range(1, 10).elementAt(5).toFlowable() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/EmptyTckTest.java b/src/test/java/io/reactivex/tck/EmptyTckTest.java index 0a31e0eff7..0fb5acad78 100644 --- a/src/test/java/io/reactivex/tck/EmptyTckTest.java +++ b/src/test/java/io/reactivex/tck/EmptyTckTest.java @@ -23,8 +23,7 @@ public class EmptyTckTest extends BaseTck { @Override public Publisher createPublisher(final long elements) { - return FlowableTck.wrap( - Flowable.empty()); + return Flowable.empty(); } @Override diff --git a/src/test/java/io/reactivex/tck/FilterTckTest.java b/src/test/java/io/reactivex/tck/FilterTckTest.java index bcab3510ca..f1c4edcb4f 100644 --- a/src/test/java/io/reactivex/tck/FilterTckTest.java +++ b/src/test/java/io/reactivex/tck/FilterTckTest.java @@ -24,13 +24,13 @@ public class FilterTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements * 2).filter(new Predicate() { @Override public boolean test(Integer v) throws Exception { return (v & 1) == 0; } }) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/FirstTckTest.java b/src/test/java/io/reactivex/tck/FirstTckTest.java index efa5644d74..1062370486 100644 --- a/src/test/java/io/reactivex/tck/FirstTckTest.java +++ b/src/test/java/io/reactivex/tck/FirstTckTest.java @@ -23,9 +23,9 @@ public class FirstTckTest extends BaseTck { @Override public Publisher createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.range(1, 10).firstElement().toFlowable() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/FlatMapTckTest.java b/src/test/java/io/reactivex/tck/FlatMapTckTest.java index 934ae7ea60..f8677a6d2d 100644 --- a/src/test/java/io/reactivex/tck/FlatMapTckTest.java +++ b/src/test/java/io/reactivex/tck/FlatMapTckTest.java @@ -24,7 +24,7 @@ public class FlatMapTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements) .flatMap(new Function>() { @Override @@ -32,6 +32,6 @@ public Publisher apply(Integer v) throws Exception { return Flowable.just(v); } }) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/FromArrayTckTest.java b/src/test/java/io/reactivex/tck/FromArrayTckTest.java index 70857f1800..284362fb98 100644 --- a/src/test/java/io/reactivex/tck/FromArrayTckTest.java +++ b/src/test/java/io/reactivex/tck/FromArrayTckTest.java @@ -23,9 +23,9 @@ public class FromArrayTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.fromArray(array(elements)) - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/FromCallableTckTest.java b/src/test/java/io/reactivex/tck/FromCallableTckTest.java index e4829c33b9..7131e0f88c 100644 --- a/src/test/java/io/reactivex/tck/FromCallableTckTest.java +++ b/src/test/java/io/reactivex/tck/FromCallableTckTest.java @@ -25,7 +25,7 @@ public class FromCallableTckTest extends BaseTck { @Override public Publisher createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.fromCallable(new Callable() { @Override public Long call() throws Exception { @@ -33,7 +33,7 @@ public Long call() throws Exception { } } ) - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/FromFutureTckTest.java b/src/test/java/io/reactivex/tck/FromFutureTckTest.java index af242264cb..6fc3b09cb8 100644 --- a/src/test/java/io/reactivex/tck/FromFutureTckTest.java +++ b/src/test/java/io/reactivex/tck/FromFutureTckTest.java @@ -33,9 +33,7 @@ public Long call() throws Exception { }); ft.run(); - return FlowableTck.wrap( - Flowable.fromFuture(ft) - ); + return Flowable.fromFuture(ft); } @Override diff --git a/src/test/java/io/reactivex/tck/FromIterableTckTest.java b/src/test/java/io/reactivex/tck/FromIterableTckTest.java index 1593438a23..cafa1a8de6 100644 --- a/src/test/java/io/reactivex/tck/FromIterableTckTest.java +++ b/src/test/java/io/reactivex/tck/FromIterableTckTest.java @@ -23,8 +23,6 @@ public class FromIterableTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( - Flowable.fromIterable(iterate(elements)) - ); + return Flowable.fromIterable(iterate(elements)); } } diff --git a/src/test/java/io/reactivex/tck/GenerateTckTest.java b/src/test/java/io/reactivex/tck/GenerateTckTest.java index d836c5216e..3bff69e248 100644 --- a/src/test/java/io/reactivex/tck/GenerateTckTest.java +++ b/src/test/java/io/reactivex/tck/GenerateTckTest.java @@ -25,7 +25,7 @@ public class GenerateTckTest extends BaseTck { @Override public Publisher createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.generate(Functions.justCallable(0L), new BiFunction, Long>() { @Override @@ -37,6 +37,6 @@ public Long apply(Long s, Emitter e) throws Exception { return s; } }, Functions.emptyConsumer()) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/GroupByTckTest.java b/src/test/java/io/reactivex/tck/GroupByTckTest.java index db819f82c8..06217db206 100644 --- a/src/test/java/io/reactivex/tck/GroupByTckTest.java +++ b/src/test/java/io/reactivex/tck/GroupByTckTest.java @@ -26,7 +26,7 @@ public class GroupByTckTest extends BaseTck { @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).groupBy(new Function() { @Override public Integer apply(Integer v) throws Exception { @@ -34,6 +34,6 @@ public Integer apply(Integer v) throws Exception { } }) .flatMap((Function)Functions.identity()) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/HideTckTest.java b/src/test/java/io/reactivex/tck/HideTckTest.java index c82f191b78..59714e5cef 100644 --- a/src/test/java/io/reactivex/tck/HideTckTest.java +++ b/src/test/java/io/reactivex/tck/HideTckTest.java @@ -23,8 +23,6 @@ public class HideTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( - Flowable.range(0, (int)elements).hide() - ); + return Flowable.range(0, (int)elements).hide(); } } diff --git a/src/test/java/io/reactivex/tck/IgnoreElementsTckTest.java b/src/test/java/io/reactivex/tck/IgnoreElementsTckTest.java index d8d07420a1..c6937cb638 100644 --- a/src/test/java/io/reactivex/tck/IgnoreElementsTckTest.java +++ b/src/test/java/io/reactivex/tck/IgnoreElementsTckTest.java @@ -23,9 +23,9 @@ public class IgnoreElementsTckTest extends BaseTck { @Override public Publisher createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.range(1, 1000).ignoreElements().toFlowable() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/IntervalRangeTckTest.java b/src/test/java/io/reactivex/tck/IntervalRangeTckTest.java index 674c71b56d..910bebfc93 100644 --- a/src/test/java/io/reactivex/tck/IntervalRangeTckTest.java +++ b/src/test/java/io/reactivex/tck/IntervalRangeTckTest.java @@ -25,9 +25,9 @@ public class IntervalRangeTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.intervalRange(0, elements, 0, 1, TimeUnit.MILLISECONDS) .onBackpressureBuffer() - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/IntervalTckTest.java b/src/test/java/io/reactivex/tck/IntervalTckTest.java index bf3e60245d..cee8bf0415 100644 --- a/src/test/java/io/reactivex/tck/IntervalTckTest.java +++ b/src/test/java/io/reactivex/tck/IntervalTckTest.java @@ -25,9 +25,9 @@ public class IntervalTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.interval(0, 1, TimeUnit.MILLISECONDS).take(elements) .onBackpressureBuffer() - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/IsEmptyTckTest.java b/src/test/java/io/reactivex/tck/IsEmptyTckTest.java index 509a0b8913..4d0489648d 100644 --- a/src/test/java/io/reactivex/tck/IsEmptyTckTest.java +++ b/src/test/java/io/reactivex/tck/IsEmptyTckTest.java @@ -23,9 +23,9 @@ public class IsEmptyTckTest extends BaseTck { @Override public Publisher createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.range(1, 10).isEmpty().toFlowable() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/JustTckTest.java b/src/test/java/io/reactivex/tck/JustTckTest.java index 7b87fe1753..76c9765984 100644 --- a/src/test/java/io/reactivex/tck/JustTckTest.java +++ b/src/test/java/io/reactivex/tck/JustTckTest.java @@ -23,9 +23,9 @@ public class JustTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.just(0L) - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/LastTckTest.java b/src/test/java/io/reactivex/tck/LastTckTest.java index 9fed5b6ac6..0ae2e698a8 100644 --- a/src/test/java/io/reactivex/tck/LastTckTest.java +++ b/src/test/java/io/reactivex/tck/LastTckTest.java @@ -23,9 +23,9 @@ public class LastTckTest extends BaseTck { @Override public Publisher createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.range(1, 10).lastElement().toFlowable() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/MapTckTest.java b/src/test/java/io/reactivex/tck/MapTckTest.java index 885e8b0958..a9123bbd60 100644 --- a/src/test/java/io/reactivex/tck/MapTckTest.java +++ b/src/test/java/io/reactivex/tck/MapTckTest.java @@ -24,8 +24,8 @@ public class MapTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).map(Functions.identity()) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/MergeIterableTckTest.java b/src/test/java/io/reactivex/tck/MergeIterableTckTest.java index e44aa9923a..84b537b8c3 100644 --- a/src/test/java/io/reactivex/tck/MergeIterableTckTest.java +++ b/src/test/java/io/reactivex/tck/MergeIterableTckTest.java @@ -26,12 +26,12 @@ public class MergeIterableTckTest extends BaseTck { @SuppressWarnings("unchecked") @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.merge(Arrays.asList( Flowable.fromIterable(iterate(elements / 2)), Flowable.fromIterable(iterate(elements - elements / 2)) ) ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/MergePublisherTckTest.java b/src/test/java/io/reactivex/tck/MergePublisherTckTest.java index ca4a0c3511..ea1b1a6c26 100644 --- a/src/test/java/io/reactivex/tck/MergePublisherTckTest.java +++ b/src/test/java/io/reactivex/tck/MergePublisherTckTest.java @@ -23,12 +23,12 @@ public class MergePublisherTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.merge(Flowable.just( Flowable.fromIterable(iterate(elements / 2)), Flowable.fromIterable(iterate(elements - elements / 2)) ) ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/MergeTckTest.java b/src/test/java/io/reactivex/tck/MergeTckTest.java index 2017159efe..4e9a592931 100644 --- a/src/test/java/io/reactivex/tck/MergeTckTest.java +++ b/src/test/java/io/reactivex/tck/MergeTckTest.java @@ -23,11 +23,11 @@ public class MergeTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.merge( Flowable.fromIterable(iterate(elements / 2)), Flowable.fromIterable(iterate(elements - elements / 2)) ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/ObserveOnTckTest.java b/src/test/java/io/reactivex/tck/ObserveOnTckTest.java index b4794e2f6e..354962f81b 100644 --- a/src/test/java/io/reactivex/tck/ObserveOnTckTest.java +++ b/src/test/java/io/reactivex/tck/ObserveOnTckTest.java @@ -28,8 +28,8 @@ public ObserveOnTckTest() { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).observeOn(Schedulers.single()) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/OnBackpressureBufferTckTest.java b/src/test/java/io/reactivex/tck/OnBackpressureBufferTckTest.java index 7b6d4ef1f2..75f8ae607a 100644 --- a/src/test/java/io/reactivex/tck/OnBackpressureBufferTckTest.java +++ b/src/test/java/io/reactivex/tck/OnBackpressureBufferTckTest.java @@ -23,8 +23,8 @@ public class OnBackpressureBufferTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).onBackpressureBuffer() - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/OnErrorResumeNextTckTest.java b/src/test/java/io/reactivex/tck/OnErrorResumeNextTckTest.java index 3c0795ac72..745ca85af8 100644 --- a/src/test/java/io/reactivex/tck/OnErrorResumeNextTckTest.java +++ b/src/test/java/io/reactivex/tck/OnErrorResumeNextTckTest.java @@ -23,8 +23,8 @@ public class OnErrorResumeNextTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).onErrorResumeNext(Flowable.never()) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/OnErrorReturnItemTckTest.java b/src/test/java/io/reactivex/tck/OnErrorReturnItemTckTest.java index 2a3a2260f0..02a6f3b767 100644 --- a/src/test/java/io/reactivex/tck/OnErrorReturnItemTckTest.java +++ b/src/test/java/io/reactivex/tck/OnErrorReturnItemTckTest.java @@ -23,8 +23,8 @@ public class OnErrorReturnItemTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).onErrorReturnItem(0) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/PublishSelectorTckTest.java b/src/test/java/io/reactivex/tck/PublishSelectorTckTest.java index 747ec13bb4..457d26f748 100644 --- a/src/test/java/io/reactivex/tck/PublishSelectorTckTest.java +++ b/src/test/java/io/reactivex/tck/PublishSelectorTckTest.java @@ -26,8 +26,8 @@ public class PublishSelectorTckTest extends BaseTck { @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).publish((Function)Functions.identity()) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/PublishTckTest.java b/src/test/java/io/reactivex/tck/PublishTckTest.java index de2b1a3938..b0bf3a46ad 100644 --- a/src/test/java/io/reactivex/tck/PublishTckTest.java +++ b/src/test/java/io/reactivex/tck/PublishTckTest.java @@ -23,8 +23,8 @@ public class PublishTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).publish().autoConnect() - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/RangeTckTest.java b/src/test/java/io/reactivex/tck/RangeTckTest.java index 0f75726a48..8e221603ad 100644 --- a/src/test/java/io/reactivex/tck/RangeTckTest.java +++ b/src/test/java/io/reactivex/tck/RangeTckTest.java @@ -23,8 +23,8 @@ public class RangeTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/RebatchRequestsTckTest.java b/src/test/java/io/reactivex/tck/RebatchRequestsTckTest.java index 82e3be5d5d..b0bb4e4739 100644 --- a/src/test/java/io/reactivex/tck/RebatchRequestsTckTest.java +++ b/src/test/java/io/reactivex/tck/RebatchRequestsTckTest.java @@ -23,8 +23,8 @@ public class RebatchRequestsTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).rebatchRequests(2) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/ReduceTckTest.java b/src/test/java/io/reactivex/tck/ReduceTckTest.java index 12e592906c..6e638319d8 100644 --- a/src/test/java/io/reactivex/tck/ReduceTckTest.java +++ b/src/test/java/io/reactivex/tck/ReduceTckTest.java @@ -24,14 +24,14 @@ public class ReduceTckTest extends BaseTck { @Override public Publisher createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.range(1, 1000).reduce(new BiFunction() { @Override public Integer apply(Integer a, Integer b) throws Exception { return a + b; } }).toFlowable() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/ReduceWithTckTest.java b/src/test/java/io/reactivex/tck/ReduceWithTckTest.java index 6f9873cde1..c3899641df 100644 --- a/src/test/java/io/reactivex/tck/ReduceWithTckTest.java +++ b/src/test/java/io/reactivex/tck/ReduceWithTckTest.java @@ -25,7 +25,7 @@ public class ReduceWithTckTest extends BaseTck { @Override public Publisher createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.range(1, 1000).reduceWith(Functions.justCallable(0), new BiFunction() { @Override @@ -33,7 +33,7 @@ public Integer apply(Integer a, Integer b) throws Exception { return a + b; } }).toFlowable() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/RepeatTckTest.java b/src/test/java/io/reactivex/tck/RepeatTckTest.java index 8d47eea25d..731f491904 100644 --- a/src/test/java/io/reactivex/tck/RepeatTckTest.java +++ b/src/test/java/io/reactivex/tck/RepeatTckTest.java @@ -23,8 +23,6 @@ public class RepeatTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( - Flowable.just(1).repeat(elements) - ); + return Flowable.just(1).repeat(elements); } } diff --git a/src/test/java/io/reactivex/tck/ReplaySelectorTckTest.java b/src/test/java/io/reactivex/tck/ReplaySelectorTckTest.java index a7199d29c1..6dbef9c762 100644 --- a/src/test/java/io/reactivex/tck/ReplaySelectorTckTest.java +++ b/src/test/java/io/reactivex/tck/ReplaySelectorTckTest.java @@ -26,8 +26,8 @@ public class ReplaySelectorTckTest extends BaseTck { @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).replay((Function)Functions.identity()) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/ReplayTckTest.java b/src/test/java/io/reactivex/tck/ReplayTckTest.java index 63516a76bf..8f7110cd82 100644 --- a/src/test/java/io/reactivex/tck/ReplayTckTest.java +++ b/src/test/java/io/reactivex/tck/ReplayTckTest.java @@ -23,8 +23,8 @@ public class ReplayTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).replay().autoConnect() - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/RetryTckTest.java b/src/test/java/io/reactivex/tck/RetryTckTest.java index 6da7fe568e..022e4cedb1 100644 --- a/src/test/java/io/reactivex/tck/RetryTckTest.java +++ b/src/test/java/io/reactivex/tck/RetryTckTest.java @@ -23,8 +23,8 @@ public class RetryTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).retry(1) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/ScanTckTest.java b/src/test/java/io/reactivex/tck/ScanTckTest.java index d4526508e8..9015e9c7a9 100644 --- a/src/test/java/io/reactivex/tck/ScanTckTest.java +++ b/src/test/java/io/reactivex/tck/ScanTckTest.java @@ -24,13 +24,13 @@ public class ScanTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).scan(new BiFunction() { @Override public Integer apply(Integer a, Integer b) throws Exception { return a + b; } }) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/SequenceEqualTckTest.java b/src/test/java/io/reactivex/tck/SequenceEqualTckTest.java index 4e12322c3e..1183cbb157 100644 --- a/src/test/java/io/reactivex/tck/SequenceEqualTckTest.java +++ b/src/test/java/io/reactivex/tck/SequenceEqualTckTest.java @@ -23,12 +23,12 @@ public class SequenceEqualTckTest extends BaseTck { @Override public Publisher createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.sequenceEqual( Flowable.range(1, 1000), Flowable.range(1, 1001)) .toFlowable() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/ShareTckTest.java b/src/test/java/io/reactivex/tck/ShareTckTest.java index 68f780f7cc..a5204e99f9 100644 --- a/src/test/java/io/reactivex/tck/ShareTckTest.java +++ b/src/test/java/io/reactivex/tck/ShareTckTest.java @@ -23,8 +23,8 @@ public class ShareTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).share() - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/SingleTckTest.java b/src/test/java/io/reactivex/tck/SingleTckTest.java index 06543c0e47..5580b5f306 100644 --- a/src/test/java/io/reactivex/tck/SingleTckTest.java +++ b/src/test/java/io/reactivex/tck/SingleTckTest.java @@ -23,9 +23,9 @@ public class SingleTckTest extends BaseTck { @Override public Publisher createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.just(1).singleElement().toFlowable() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/SkipLastTckTest.java b/src/test/java/io/reactivex/tck/SkipLastTckTest.java index 7f7f0def02..9ff5ab25e0 100644 --- a/src/test/java/io/reactivex/tck/SkipLastTckTest.java +++ b/src/test/java/io/reactivex/tck/SkipLastTckTest.java @@ -23,8 +23,8 @@ public class SkipLastTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements * 2).skipLast((int)elements) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/SkipTckTest.java b/src/test/java/io/reactivex/tck/SkipTckTest.java index 8fcb0de32e..13fa65fa9d 100644 --- a/src/test/java/io/reactivex/tck/SkipTckTest.java +++ b/src/test/java/io/reactivex/tck/SkipTckTest.java @@ -23,8 +23,8 @@ public class SkipTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements * 2).skip(elements) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/SkipUntilTckTest.java b/src/test/java/io/reactivex/tck/SkipUntilTckTest.java index 8c239f3e3e..6c781b3a6d 100644 --- a/src/test/java/io/reactivex/tck/SkipUntilTckTest.java +++ b/src/test/java/io/reactivex/tck/SkipUntilTckTest.java @@ -23,8 +23,8 @@ public class SkipUntilTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).skipUntil(Flowable.just(1)) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/SkipWhileTckTest.java b/src/test/java/io/reactivex/tck/SkipWhileTckTest.java index 45ce108a2d..f6c5fa62f8 100644 --- a/src/test/java/io/reactivex/tck/SkipWhileTckTest.java +++ b/src/test/java/io/reactivex/tck/SkipWhileTckTest.java @@ -24,8 +24,8 @@ public class SkipWhileTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).skipWhile(Functions.alwaysFalse()) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/SortedTckTest.java b/src/test/java/io/reactivex/tck/SortedTckTest.java index 58dd272b7c..d66431b49b 100644 --- a/src/test/java/io/reactivex/tck/SortedTckTest.java +++ b/src/test/java/io/reactivex/tck/SortedTckTest.java @@ -23,8 +23,8 @@ public class SortedTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).sorted() - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/SubscribeOnTckTest.java b/src/test/java/io/reactivex/tck/SubscribeOnTckTest.java index be404be13c..8e0840f444 100644 --- a/src/test/java/io/reactivex/tck/SubscribeOnTckTest.java +++ b/src/test/java/io/reactivex/tck/SubscribeOnTckTest.java @@ -24,8 +24,8 @@ public class SubscribeOnTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).subscribeOn(Schedulers.single()) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/SwitchIfEmptyTckTest.java b/src/test/java/io/reactivex/tck/SwitchIfEmptyTckTest.java index a8e4d685f5..2b2208f830 100644 --- a/src/test/java/io/reactivex/tck/SwitchIfEmptyTckTest.java +++ b/src/test/java/io/reactivex/tck/SwitchIfEmptyTckTest.java @@ -23,8 +23,8 @@ public class SwitchIfEmptyTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.empty().switchIfEmpty(Flowable.range(1, (int)elements)) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/SwitchMapDelayErrorTckTest.java b/src/test/java/io/reactivex/tck/SwitchMapDelayErrorTckTest.java index 4e2663d2fe..f4d963836a 100644 --- a/src/test/java/io/reactivex/tck/SwitchMapDelayErrorTckTest.java +++ b/src/test/java/io/reactivex/tck/SwitchMapDelayErrorTckTest.java @@ -24,10 +24,10 @@ public class SwitchMapDelayErrorTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.just(1).switchMapDelayError(Functions.justFunction( Flowable.fromIterable(iterate(elements))) ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/SwitchMapTckTest.java b/src/test/java/io/reactivex/tck/SwitchMapTckTest.java index 50c9ba6967..e2593903db 100644 --- a/src/test/java/io/reactivex/tck/SwitchMapTckTest.java +++ b/src/test/java/io/reactivex/tck/SwitchMapTckTest.java @@ -24,10 +24,10 @@ public class SwitchMapTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.just(1).switchMap(Functions.justFunction( Flowable.fromIterable(iterate(elements))) ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/SwitchOnNextTckTest.java b/src/test/java/io/reactivex/tck/SwitchOnNextTckTest.java index 1056043a14..2828c92a7d 100644 --- a/src/test/java/io/reactivex/tck/SwitchOnNextTckTest.java +++ b/src/test/java/io/reactivex/tck/SwitchOnNextTckTest.java @@ -23,10 +23,10 @@ public class SwitchOnNextTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.switchOnNext(Flowable.just( Flowable.fromIterable(iterate(elements))) ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/TakeLastTckTest.java b/src/test/java/io/reactivex/tck/TakeLastTckTest.java index 7ef6eb1c5e..6e8260ff14 100644 --- a/src/test/java/io/reactivex/tck/TakeLastTckTest.java +++ b/src/test/java/io/reactivex/tck/TakeLastTckTest.java @@ -23,8 +23,8 @@ public class TakeLastTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements * 2).takeLast((int)elements) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/TakeTckTest.java b/src/test/java/io/reactivex/tck/TakeTckTest.java index faf321056a..bcc8682a7e 100644 --- a/src/test/java/io/reactivex/tck/TakeTckTest.java +++ b/src/test/java/io/reactivex/tck/TakeTckTest.java @@ -23,8 +23,8 @@ public class TakeTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements * 2).take(elements) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/TakeUntilTckTest.java b/src/test/java/io/reactivex/tck/TakeUntilTckTest.java index f5c76147b8..7c17861425 100644 --- a/src/test/java/io/reactivex/tck/TakeUntilTckTest.java +++ b/src/test/java/io/reactivex/tck/TakeUntilTckTest.java @@ -23,8 +23,8 @@ public class TakeUntilTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).takeUntil(Flowable.never()) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/TakeWhileTckTest.java b/src/test/java/io/reactivex/tck/TakeWhileTckTest.java index 6aaced69be..511b403a6d 100644 --- a/src/test/java/io/reactivex/tck/TakeWhileTckTest.java +++ b/src/test/java/io/reactivex/tck/TakeWhileTckTest.java @@ -24,8 +24,8 @@ public class TakeWhileTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).takeWhile(Functions.alwaysTrue()) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/TimeIntervalTckTest.java b/src/test/java/io/reactivex/tck/TimeIntervalTckTest.java index 8e186cfeb6..524d08ebac 100644 --- a/src/test/java/io/reactivex/tck/TimeIntervalTckTest.java +++ b/src/test/java/io/reactivex/tck/TimeIntervalTckTest.java @@ -24,8 +24,8 @@ public class TimeIntervalTckTest extends BaseTck> { @Override public Publisher> createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).timeInterval() - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/TimeoutTckTest.java b/src/test/java/io/reactivex/tck/TimeoutTckTest.java index 94f256cbda..e7229347ed 100644 --- a/src/test/java/io/reactivex/tck/TimeoutTckTest.java +++ b/src/test/java/io/reactivex/tck/TimeoutTckTest.java @@ -25,8 +25,8 @@ public class TimeoutTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).timeout(1, TimeUnit.DAYS) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/TimerTckTest.java b/src/test/java/io/reactivex/tck/TimerTckTest.java index 715b06d2bc..2b64b957a6 100644 --- a/src/test/java/io/reactivex/tck/TimerTckTest.java +++ b/src/test/java/io/reactivex/tck/TimerTckTest.java @@ -25,10 +25,10 @@ public class TimerTckTest extends BaseTck { @Override public Publisher createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.timer(1, TimeUnit.MILLISECONDS) .onBackpressureLatest() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/TimestampTckTest.java b/src/test/java/io/reactivex/tck/TimestampTckTest.java index 02ecac3092..1c2886712a 100644 --- a/src/test/java/io/reactivex/tck/TimestampTckTest.java +++ b/src/test/java/io/reactivex/tck/TimestampTckTest.java @@ -24,8 +24,8 @@ public class TimestampTckTest extends BaseTck> { @Override public Publisher> createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements).timestamp() - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/ToListTckTest.java b/src/test/java/io/reactivex/tck/ToListTckTest.java index 39d71a3f8a..95988ef08d 100644 --- a/src/test/java/io/reactivex/tck/ToListTckTest.java +++ b/src/test/java/io/reactivex/tck/ToListTckTest.java @@ -25,9 +25,9 @@ public class ToListTckTest extends BaseTck> { @Override public Publisher> createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.range(1, 1000).toList().toFlowable() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/ToMapTckTest.java b/src/test/java/io/reactivex/tck/ToMapTckTest.java index e189e0e710..15fbb94a6f 100644 --- a/src/test/java/io/reactivex/tck/ToMapTckTest.java +++ b/src/test/java/io/reactivex/tck/ToMapTckTest.java @@ -26,9 +26,9 @@ public class ToMapTckTest extends BaseTck> { @Override public Publisher> createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.range(1, 1000).toMap(Functions.identity()).toFlowable() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/ToMultimapTckTest.java b/src/test/java/io/reactivex/tck/ToMultimapTckTest.java index abf93b06b4..4216b9e34c 100644 --- a/src/test/java/io/reactivex/tck/ToMultimapTckTest.java +++ b/src/test/java/io/reactivex/tck/ToMultimapTckTest.java @@ -26,9 +26,9 @@ public class ToMultimapTckTest extends BaseTck> @Override public Publisher>> createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.range(1, 1000).toMultimap(Functions.identity()).toFlowable() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/ToSortedListTckTest.java b/src/test/java/io/reactivex/tck/ToSortedListTckTest.java index 84182c0ef1..84688d6b15 100644 --- a/src/test/java/io/reactivex/tck/ToSortedListTckTest.java +++ b/src/test/java/io/reactivex/tck/ToSortedListTckTest.java @@ -25,9 +25,9 @@ public class ToSortedListTckTest extends BaseTck> { @Override public Publisher> createPublisher(final long elements) { - return FlowableTck.wrap( + return Flowable.range(1, 1000).toSortedList().toFlowable() - ); + ; } @Override diff --git a/src/test/java/io/reactivex/tck/UnsubscribeOnTckTest.java b/src/test/java/io/reactivex/tck/UnsubscribeOnTckTest.java index 77e937dea2..9884b1573d 100644 --- a/src/test/java/io/reactivex/tck/UnsubscribeOnTckTest.java +++ b/src/test/java/io/reactivex/tck/UnsubscribeOnTckTest.java @@ -24,10 +24,10 @@ public class UnsubscribeOnTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements * 2) .unsubscribeOn(Schedulers.single()) .take(elements) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/UsingTckTest.java b/src/test/java/io/reactivex/tck/UsingTckTest.java index 2b89a3ea46..ad40263c97 100644 --- a/src/test/java/io/reactivex/tck/UsingTckTest.java +++ b/src/test/java/io/reactivex/tck/UsingTckTest.java @@ -24,11 +24,11 @@ public class UsingTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.using(Functions.justCallable(1), Functions.justFunction(Flowable.fromIterable(iterate(elements))), Functions.emptyConsumer() ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/WindowBoundaryTckTest.java b/src/test/java/io/reactivex/tck/WindowBoundaryTckTest.java index fbbc450b71..396444a82e 100644 --- a/src/test/java/io/reactivex/tck/WindowBoundaryTckTest.java +++ b/src/test/java/io/reactivex/tck/WindowBoundaryTckTest.java @@ -28,11 +28,11 @@ public class WindowBoundaryTckTest extends BaseTck> { @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Publisher> createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.fromIterable(iterate(elements)) .window(Flowable.just(1).concatWith(Flowable.never())) .onBackpressureBuffer() .flatMap((Function)Functions.identity()) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/WindowExactSizeTckTest.java b/src/test/java/io/reactivex/tck/WindowExactSizeTckTest.java index 1f3e717789..46b9d55188 100644 --- a/src/test/java/io/reactivex/tck/WindowExactSizeTckTest.java +++ b/src/test/java/io/reactivex/tck/WindowExactSizeTckTest.java @@ -28,10 +28,10 @@ public class WindowExactSizeTckTest extends BaseTck> { @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Publisher> createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.fromIterable(iterate(elements)) .window(2) .flatMap((Function)Functions.identity()) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/WithLatestFromTckTest.java b/src/test/java/io/reactivex/tck/WithLatestFromTckTest.java index 6267d0f7e5..5f119fa4db 100644 --- a/src/test/java/io/reactivex/tck/WithLatestFromTckTest.java +++ b/src/test/java/io/reactivex/tck/WithLatestFromTckTest.java @@ -24,7 +24,7 @@ public class WithLatestFromTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements) .withLatestFrom(Flowable.just(1), new BiFunction() { @Override @@ -32,6 +32,6 @@ public Integer apply(Integer a, Integer b) throws Exception { return a + b; } }) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/ZipIterableTckTest.java b/src/test/java/io/reactivex/tck/ZipIterableTckTest.java index 11c84432c4..df287543f0 100644 --- a/src/test/java/io/reactivex/tck/ZipIterableTckTest.java +++ b/src/test/java/io/reactivex/tck/ZipIterableTckTest.java @@ -27,7 +27,7 @@ public class ZipIterableTckTest extends BaseTck { @SuppressWarnings("unchecked") @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.zip(Arrays.asList( Flowable.fromIterable(iterate(elements)), Flowable.fromIterable(iterate(elements)) @@ -39,6 +39,6 @@ public Long apply(Object[] a) throws Exception { } } ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/ZipTckTest.java b/src/test/java/io/reactivex/tck/ZipTckTest.java index 3f703088a3..7aa98c1a47 100644 --- a/src/test/java/io/reactivex/tck/ZipTckTest.java +++ b/src/test/java/io/reactivex/tck/ZipTckTest.java @@ -24,7 +24,7 @@ public class ZipTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.zip( Flowable.fromIterable(iterate(elements)), Flowable.fromIterable(iterate(elements)), @@ -35,6 +35,6 @@ public Long apply(Long a, Long b) throws Exception { } } ) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/ZipWithIterableTckTest.java b/src/test/java/io/reactivex/tck/ZipWithIterableTckTest.java index 226c1b0c4d..b0bb8bfef9 100644 --- a/src/test/java/io/reactivex/tck/ZipWithIterableTckTest.java +++ b/src/test/java/io/reactivex/tck/ZipWithIterableTckTest.java @@ -24,7 +24,7 @@ public class ZipWithIterableTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements) .zipWith(iterate(elements), new BiFunction() { @Override @@ -32,6 +32,6 @@ public Integer apply(Integer a, Long b) throws Exception { return a + b.intValue(); } }) - ); + ; } } diff --git a/src/test/java/io/reactivex/tck/ZipWithTckTest.java b/src/test/java/io/reactivex/tck/ZipWithTckTest.java index 9f6a58bbfa..7a7ac71bcd 100644 --- a/src/test/java/io/reactivex/tck/ZipWithTckTest.java +++ b/src/test/java/io/reactivex/tck/ZipWithTckTest.java @@ -24,7 +24,7 @@ public class ZipWithTckTest extends BaseTck { @Override public Publisher createPublisher(long elements) { - return FlowableTck.wrap( + return Flowable.range(0, (int)elements) .zipWith(Flowable.range((int)elements, (int)elements), new BiFunction() { @Override @@ -32,6 +32,6 @@ public Integer apply(Integer a, Integer b) throws Exception { return a + b; } }) - ); + ; } }