FULL PRODUCT VERSION :
java full version "9-ea+100-2016-01-06-195905.javare.4235.nc"
ADDITIONAL OS VERSION INFORMATION :
x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Generalized target type inference should allow the attached code to compile. The JDK 8 javac accepts it, but it is rejected by JDK 9.
This regression bisects to the fix for JDK-8078093 [1][2]. It may be related to JDK-8147493 [3], which is another type inference regression involving unchecked calls that was introduced by the fix for 8078093.
[1] http://hg.openjdk.java.net/jdk9/dev/langtools/rev/286fc9270404
[2] https://bugs.openjdk.java.net/browse/JDK-8078093
[3] https://bugs.openjdk.java.net/browse/JDK-8147493
REGRESSION. Last worked in version 8u66
ADDITIONAL REGRESSION INFORMATION:
java full version "1.8.0_66-ea-b02"
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac Test.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expected the code to compile.
ACTUAL -
The code does not compile.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Test.java:8: error: incompatible types: Object cannot be converted to String
h(g(raw, f(null)));
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
abstract class Test {
abstract <A> A f(A t);
abstract <B> Class<B> g(Class<B> x, String y);
abstract <C> void h(C t);
void g(Class raw) {
h(g(raw, f(null)));
}
}
---------- END SOURCE ----------