-
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
Add scala adapters for doOnEach operator. #537
Conversation
RxJava-pull-requests #465 SUCCESS |
RxJava-pull-requests #468 SUCCESS |
@samuelgruetter I'm happy to take a look; can you expand a bit on what needs doing? |
Ok, first, concerning this PR, I think the only change we need is to replace def doOnEach[U >: T](observer: Observer[U]): Observable[T] by def doOnEach(observer: Observer[T]): Observable[T] Now concerning #532 : Apparently it's not strictly necessary to resolve it to make this PR work, because implicit conversions perform even more magic than I would have excpected (or in other words: I'd be interested to see if you could implement this PR without implicit conversions and without #532 , but that's only out of curiosity, there's no purpose in not using implicit conversions). In #532 , I'd like the following Java code (as well as all similar examples using different overloads of doOnXxx) to work: class Fruit {}
class Apple extends Fruit {}
Action1<Fruit> printFruit1 = new Action1<Fruit>() {
public void call(Fruit f) {
System.out.println(f.getClass().getName());
}
};
public void test1() {
Observable<Fruit> o = Observable.from(new Fruit(), new Apple());
o.doOnEach(printFruit1).subscribe();
}
public void test2() {
Observable<Apple> o = Observable.from(new Apple(), new Apple());
o.doOnEach(printFruit1).subscribe();
} With the current |
@samuelgruetter @headinthebox @landonf Should this be merged, or should it be changed as per the last comment? |
Just remove this |
Apparently (to my surprise), the implicit conversions are smart enough to resolve this.
RxJava-pull-requests #486 SUCCESS |
@samuelgruetter For which I'm much obliged. I've updated this pull request, and submitted a new request for #532. |
Now it looks good. |
Add scala adapters for doOnEach operator.
Add scala adapters for doOnEach operator.
…en AspectJ is on classpath
This re-integrates support for doOnEach that was lost in the Scala refactor.