FULL PRODUCT VERSION :
java full version "1.9.0-ea-b80"
ADDITIONAL OS VERSION INFORMATION :
x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
The JDK 9 javac fails to perform type inference on the attached program.
REGRESSION. Last worked in version 8u60
ADDITIONAL REGRESSION INFORMATION:
java full version "1.8.0_60-ea-b21"
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
$ javac -source 7 -target 7 Test.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expected the compilation to succeed.
ACTUAL -
The compilation did not succeed.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
warning: [options] bootstrap class path not set in conjunction with -source 1.7
Test.java:11: error: incompatible types: Map<Object,CAP#1> cannot be converted to Map<Object,String>
return h(g(xs, new F<String, Object>() {}));
^
where CAP#1 is a fresh type-variable:
CAP#1 extends String from capture of ? extends String
1 error
1 warning
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.Map;
abstract class Test {
interface F<A, V> {}
abstract <K, V> Map<K, V> g(Iterable<V> xs, F<? super V, K> f);
abstract <K, V> Map<K, V> h(Map<? extends K, ? extends V> xs);
Map<Object, String> f(Iterable<? extends String> xs) {
return h(g(xs, new F<String, Object>() {}));
}
}
---------- END SOURCE ----------