-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Fix issue #1173 #1178
Fix issue #1173 #1178
Conversation
@headinthebox 's example also inspires me that the inner Subscriber can not be unsubscribed from outside if RxScala does not provide a /cc @samuelgruetter |
RxJava-pull-requests #1096 FAILURE |
def subscribe(subscriber: Subscriber[T]): Subscription = { | ||
// Add the casting to avoid compile error "ambiguous reference to overloaded definition" | ||
val thisJava = asJavaObservable.asInstanceOf[rx.Observable[T]] | ||
thisJava.subscribe(subscriber.asJavaSubscriber) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compile error of removing casting:
error: ambiguous reference to overloaded definition,
[ant:scalac] both method subscribe in class Observable of type (x$1: rx.Subscriber[_ >: _$1], x$2: rx.Scheduler)rx.Subscription
[ant:scalac] and method subscribe in class Observable of type (x$1: rx.Observer[_ >: _$1], x$2: rx.Scheduler)rx.Subscription
[ant:scalac] match argument types (rx.Subscriber[_$2],rx.lang.scala.Scheduler) and expected result type rx.lang.scala.Subscription
[ant:scalac] asJavaObservable.subscribe(subscriber.asJavaSubscriber, scheduler)
[ant:scalac] ^
RxJava-pull-requests #1097 FAILURE |
RxJava-pull-requests #1110 FAILURE |
RxJava-pull-requests #1113 FAILURE |
@samuelgruetter any suggestions about this one? |
Waiting on feedback and confirmation. |
I'll have a look over the weekend. |
The problem is that the three vals asJavaObserver, asJavaSubscription, asJavaSubscriber, defined in trait Subscriber, are not in the right order. It should first define asJavaSubscriber, because the other two are defined in terms of asJavaSubscriber, and initialization of vals is done sequentially. |
Good catch. |
RxJava-pull-requests #1124 SUCCESS |
thanks for staying on top! |
LGTM |
@benjchristensen can you merge this? |
Thanks! |
In
Subscriber.apply(rx.Subscriber)
,asJavaObserver
andasJavaSubscription
will be set tonull
because the parent class will be initialized withasJavaSubscriber==null
. #1173.This PR did the initialization again in the subclass.