Skip to content

Covariant Support with super/extends and OnSubscribeFunc #343

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

Merged
merged 24 commits into from
Sep 4, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
34942ad
making Func0 covariant in its return type, cleaning up a few warnings…
Aug 31, 2013
52342a2
added variance to Func1 (hopefully) everywhere...
Aug 31, 2013
f8cba6a
added variance to Func2, too
Aug 31, 2013
21bc549
added variance to all other Func*; this breaks Scala for good, it see…
Aug 31, 2013
69c6e80
added variance to Action*, too
Aug 31, 2013
0438505
lots of Observer<? super X>
Aug 31, 2013
6b9867c
updated to Scala 2.10.2 again, repaired Scala tests, generalized two …
Aug 31, 2013
6bd2033
UnitTest confirming compilation failure without super/extends and suc…
benjchristensen Aug 31, 2013
98cd711
Need to stay pinned on Scala 2.10.1 still …
benjchristensen Aug 31, 2013
ac6a0a1
Zip: Order of Generics and Artities 5-9
benjchristensen Aug 31, 2013
ebaa616
Merge pull request #1 from benjchristensen/super-extends-additions
Sep 1, 2013
a127b06
adapted RxImplicits tests againt zip to new generics order, renamed t…
Sep 1, 2013
eba4857
generalized everything in Observable that deals with covariance of ob…
Sep 1, 2013
29289d1
Timestamped, Notification and Future are now also treated as covariant
Sep 1, 2013
78a0a1b
added an unnecessary explicit cast because the Jenkins java compiler …
Sep 1, 2013
1ca5900
Generalized all the operators, too
Sep 1, 2013
04f35cd
generalized BlockingObservable and the execution hook further
Sep 1, 2013
e962d00
added a few 'compiler' tests
Sep 1, 2013
68d181b
removed some <? super Throwable>s because that's rather unnecessary
Sep 4, 2013
51dd848
Merged in master so that the gradle pull request build has a chance t…
Sep 4, 2013
94f5fbe
Merge branch 'super-extends' of git://github.com/jmhofer/RxJava into …
benjchristensen Sep 4, 2013
b7de349
Add OnSubscribeFunction and refactor to support it
benjchristensen Sep 4, 2013
a1ad9c4
Adding implicit for OnSubscribeFunc
mattrjacobs Sep 4, 2013
3585570
Change OnSubscribeFunc.call to OnSubscribeFunc.onSubscribe
benjchristensen Sep 4, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed some <? super Throwable>s because that's rather unnecessary
  • Loading branch information
Joachim Hofer committed Sep 4, 2013
commit 68d181b39fa134e9a578f0e85f8e91739a6a3a78
12 changes: 6 additions & 6 deletions rxjava-core/src/main/java/rx/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public Subscription subscribe(final Action1<? super T> onNext, Scheduler schedul
return subscribeOn(scheduler).subscribe(onNext);
}

public Subscription subscribe(final Action1<? super T> onNext, final Action1<? super Throwable> onError) {
public Subscription subscribe(final Action1<? super T> onNext, final Action1<Throwable> onError) {
if (onNext == null) {
throw new IllegalArgumentException("onNext can not be null");
}
Expand Down Expand Up @@ -321,11 +321,11 @@ public void onNext(T args) {
});
}

public Subscription subscribe(final Action1<? super T> onNext, final Action1<? super Throwable> onError, Scheduler scheduler) {
public Subscription subscribe(final Action1<? super T> onNext, final Action1<Throwable> onError, Scheduler scheduler) {
return subscribeOn(scheduler).subscribe(onNext, onError);
}

public Subscription subscribe(final Action1<? super T> onNext, final Action1<? super Throwable> onError, final Action0 onComplete) {
public Subscription subscribe(final Action1<? super T> onNext, final Action1<Throwable> onError, final Action0 onComplete) {
if (onNext == null) {
throw new IllegalArgumentException("onNext can not be null");
}
Expand Down Expand Up @@ -362,7 +362,7 @@ public void onNext(T args) {
});
}

public Subscription subscribe(final Action1<? super T> onNext, final Action1<? super Throwable> onError, final Action0 onComplete, Scheduler scheduler) {
public Subscription subscribe(final Action1<? super T> onNext, final Action1<Throwable> onError, final Action0 onComplete, Scheduler scheduler) {
return subscribeOn(scheduler).subscribe(onNext, onError, onComplete);
}

Expand Down Expand Up @@ -1730,7 +1730,7 @@ public <T2> Observable<T2> dematerialize() {
* encounters an error
* @return the original Observable, with appropriately modified behavior
*/
public Observable<T> onErrorResumeNext(final Func1<? super Throwable, ? extends Observable<? extends T>> resumeFunction) {
public Observable<T> onErrorResumeNext(final Func1<Throwable, ? extends Observable<? extends T>> resumeFunction) {
return create(OperationOnErrorResumeNextViaFunction.onErrorResumeNextViaFunction(this, resumeFunction));
}

Expand Down Expand Up @@ -1815,7 +1815,7 @@ public Observable<T> onExceptionResumeNext(final Observable<? extends T> resumeS
* Observable encounters an error
* @return the original Observable with appropriately modified behavior
*/
public Observable<T> onErrorReturn(Func1<? super Throwable, ? extends T> resumeFunction) {
public Observable<T> onErrorReturn(Func1<Throwable, ? extends T> resumeFunction) {
return create(OperationOnErrorReturn.onErrorReturn(this, resumeFunction));
}

Expand Down
4 changes: 2 additions & 2 deletions rxjava-core/src/main/java/rx/operators/OperationGroupBy.java
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ public String call(Event event) {
}
});

};
}
}).subscribe(new Observer<String>() {

@Override
Expand Down Expand Up @@ -515,7 +515,7 @@ public String call(Event event) {
}
});

};
}
}).subscribe(new Observer<String>() {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@
*/
public final class OperationOnErrorResumeNextViaFunction<T> {

public static <T> Func1<Observer<? super T>, Subscription> onErrorResumeNextViaFunction(Observable<? extends T> originalSequence, Func1<? super Throwable, ? extends Observable<? extends T>> resumeFunction) {
public static <T> Func1<Observer<? super T>, Subscription> onErrorResumeNextViaFunction(Observable<? extends T> originalSequence, Func1<Throwable, ? extends Observable<? extends T>> resumeFunction) {
return new OnErrorResumeNextViaFunction<T>(originalSequence, resumeFunction);
}

private static class OnErrorResumeNextViaFunction<T> implements Func1<Observer<? super T>, Subscription> {

private final Func1<? super Throwable, ? extends Observable<? extends T>> resumeFunction;
private final Func1<Throwable, ? extends Observable<? extends T>> resumeFunction;
private final Observable<? extends T> originalSequence;

public OnErrorResumeNextViaFunction(Observable<? extends T> originalSequence, Func1<? super Throwable, ? extends Observable<? extends T>> resumeFunction) {
public OnErrorResumeNextViaFunction(Observable<? extends T> originalSequence, Func1<Throwable, ? extends Observable<? extends T>> resumeFunction) {
this.resumeFunction = resumeFunction;
this.originalSequence = originalSequence;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@
*/
public final class OperationOnErrorReturn<T> {

public static <T> Func1<Observer<? super T>, Subscription> onErrorReturn(Observable<? extends T> originalSequence, Func1<? super Throwable, ? extends T> resumeFunction) {
public static <T> Func1<Observer<? super T>, Subscription> onErrorReturn(Observable<? extends T> originalSequence, Func1<Throwable, ? extends T> resumeFunction) {
return new OnErrorReturn<T>(originalSequence, resumeFunction);
}

private static class OnErrorReturn<T> implements Func1<Observer<? super T>, Subscription> {
private final Func1<? super Throwable, ? extends T> resumeFunction;
private final Func1<Throwable, ? extends T> resumeFunction;
private final Observable<? extends T> originalSequence;

public OnErrorReturn(Observable<? extends T> originalSequence, Func1<? super Throwable, ? extends T> resumeFunction) {
public OnErrorReturn(Observable<? extends T> originalSequence, Func1<Throwable, ? extends T> resumeFunction) {
this.resumeFunction = resumeFunction;
this.originalSequence = originalSequence;
}
Expand Down