The jdk9 javac contains breaking changes to type inference, even for compilations targeting older language versions: https://bugs.openjdk.java.net/browse/JDK-8075793?focusedCommentId=13865850
Those changes prevent RxJava from building with jdk9.
Repro:
$ java -fullversion
java full version "1.9.0-ea-b80"
$ ./gradlew build
...
./src/main/java/rx/Observable.java:520: error: incompatible types: Observable<CAP#1> cannot be converted to Observable<R>
return combineLatest(Arrays.asList(o1, o2), Functions.fromFunc(combineFunction));
^
where R,T1,T2 are type-variables:
R extends Object declared in method <T1,T2,R>combineLatest(Observable<? extends T1>,Observable<? extends T2>,Func2<? super T1,? super T2,? extends R>)
T1 extends Object declared in method <T1,T2,R>combineLatest(Observable<? extends T1>,Observable<? extends T2>,Func2<? super T1,? super T2,? extends R>)
T2 extends Object declared in method <T1,T2,R>combineLatest(Observable<? extends T1>,Observable<? extends T2>,Func2<? super T1,? super T2,? extends R>)
where CAP#1 is a fresh type-variable:
CAP#1 extends R from capture of ? extends R
...
38 errors
Thanks. Type inference has been of trouble lately, especially the discrepancy between javac and Eclipse for me. I'll try to fix these errors. The problem is that java doesn't support co- and contravariant type parameters in class definitions unlike C# thus Observable<T> != Observable<? extends T>
I'm closing this issue due to inactivity. If you have further input on the issue, don't hesitate to reopen this issue or post a new one.
RxJava still doesn't build with jdk9.
I'll look into it.
Posted the proposed changes in #3824. Could you verify it?
I verified that it compiles with javac9 and the default language level, but it doesn't compile with -source 1.6 -target 1.6 which is what the gradle build uses.
Here are the other errors I get: https://gist.github.com/cushon/1330f5b61c0d36d362eebca67c7a505a
Updated the PR. Tested with both default and 1.6 source/targets with 9b111.
Looks good to me, thanks!
Should be resolved by now.
Most helpful comment
I'll look into it.