-
Notifications
You must be signed in to change notification settings - Fork 7.6k
2.0 Design: support current Observer? #2798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
In my experimenting I kept the We need this not just for |
That makes sense, but now we can extend Subscriber and use a default method to request max and there is no need to support overloads tailored for Observer. |
How has your thinking on this evolved? I don't think we need a concrete The I think it might then make sense to also have an |
If one needs an interface Observer, it is quite easy to implement: interface MyObserver<T> extends Subscriber<T> {
default void onSubscribe(Subscription s) {
s.request(Long.MAX_VALUE);
}
} The reason this isn't the one in 2.x because I've been trying to avoid |
RetroLambda won't be useful for v2 because we're not just using lambdas, but we're using JDK 8 APIs. So don't make design decisions based on that. This version won't be usable on Android until it supports JDK 8 APIs. |
Yeah, even if you won't use JDK 8 APIs but will target JDK 8 — bytecode won't be compatible with Android build tools :(
Retrolambda can handle default methods, but since you're going to target Java 8, I guess, you can use default methods in v2 without worries about Android :) Though it's possible to apply Retrolambda on a jar (manually or RxJava has to ship v2 jar already retrolamded), but anyway, if you will use at least one JDK 8 API — it won't help. |
Closing this as we went with Java 6+ and the tests were adjusted to work with |
The Reactive-Streams/j.u.c.Flow's base observer is the
Subscriber
class, but many of our tests mock overrx.Observer
. Changing them toSubscriber
doesn't work by default because this mock doesn't request anything from upstream. There are several options to fix this:Observer
interface with a default unbounded Subscriber wrapper.The text was updated successfully, but these errors were encountered: