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
adapted RxImplicits tests againt zip to new generics order, renamed t…
…wo more reduceFunctions to zipFunction
  • Loading branch information
jmhofer committed Sep 1, 2013
commit a127b061ac37a7a6789db27dc9100132fffc152c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class UnitTestSuite extends JUnitSuite {

val cheetara = Character("green", "cheetara")
val panthro = Character("blue", "panthro")
val characters = Observable.zip[Character, String, String](colors, names, Character.apply _)
val characters = Observable.zip[String, String, Character](colors, names, Character.apply _)
assertSubscribeReceives(characters)(cheetara, panthro)
}

Expand All @@ -295,7 +295,7 @@ class UnitTestSuite extends JUnitSuite {
val cheetara = Character(2, "green", "cheetara")
val panthro = Character(3, "blue", "panthro")

val characters = Observable.zip[Character, Int, String, String](numbers, colors, names, Character.apply _)
val characters = Observable.zip[Int, String, String, Character](numbers, colors, names, Character.apply _)
assertSubscribeReceives(characters)(liono, cheetara, panthro)
}

Expand All @@ -311,7 +311,7 @@ class UnitTestSuite extends JUnitSuite {
val cheetara = Character(2, "green", "cheetara", false)
val panthro = Character(3, "blue", "panthro", false)

val characters = Observable.zip[Character, Int, String, String, Boolean](numbers, colors, names, isLeader, Character.apply _)
val characters = Observable.zip[Int, String, String, Boolean, Character](numbers, colors, names, isLeader, Character.apply _)
assertSubscribeReceives(characters)(liono, cheetara, panthro)
}

Expand Down
10 changes: 5 additions & 5 deletions rxjava-core/src/main/java/rx/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -1471,16 +1471,16 @@ public Observable<List<T>> buffer(long timespan, long timeshift, TimeUnit unit,
*
* @param ws
* An Observable of source Observables
* @param reduceFunction
* @param zipFunction
* a function that, when applied to an item emitted by each of the source
* Observables, results in an item that will be emitted by the resulting Observable
* @return an Observable that emits the zipped results
*/
public static <R> Observable<R> zip(Observable<Observable<?>> ws, final FuncN<? extends R> reduceFunction) {
public static <R> Observable<R> zip(Observable<Observable<?>> ws, final FuncN<? extends R> zipFunction) {
return ws.toList().mapMany(new Func1<List<Observable<?>>, Observable<R>>() {
@Override
public Observable<R> call(List<Observable<?>> wsList) {
return create(OperationZip.zip(wsList, reduceFunction));
return create(OperationZip.zip(wsList, zipFunction));
}
});
}
Expand All @@ -1505,8 +1505,8 @@ public Observable<R> call(List<Observable<?>> wsList) {
* Observables, results in an item that will be emitted by the resulting Observable
* @return an Observable that emits the zipped results
*/
public static <R> Observable<R> zip(Collection<Observable<?>> ws, FuncN<? extends R> reduceFunction) {
return create(OperationZip.zip(ws, reduceFunction));
public static <R> Observable<R> zip(Collection<Observable<?>> ws, FuncN<? extends R> zipFunction) {
return create(OperationZip.zip(ws, zipFunction));
}

/**
Expand Down