Change in inference behaviour after JDK-8078093
Liam Miller-Cushon
cushon at google.com
Fri Jan 15 19:48:26 UTC 2016
It reproduces in jdk9-dev at head, and bisects to the fix for JDK-8078093
[1][2]. Earlier versions of javac do not report the error. Is this a bug?
=== Test.java ===
abstract class Test {
interface One {}
interface Two<I extends One> { I get(); }
interface Three<T> {}
interface Four<T> {}
<E extends Two<?>, L extends Three<E>> Four<L> f(Class raw, E
destination) {
return g(raw, destination.get());
}
abstract <I extends One, E extends Two<I>, L extends Three<E>> Four<L> g(
Class<L> labelClass, I destinationId);
}
===
$ javac Test.java
error: incompatible types: inference variable I has incompatible bounds
return g(raw, destination.get());
^
equality constraints: CAP#1
lower bounds: One
where I,E,L are type-variables:
I extends One declared in method <I,E,L>g(Class<L>,I)
E extends Two<I> declared in method <I,E,L>g(Class<L>,I)
L extends Three<E> declared in method <I,E,L>g(Class<L>,I)
where CAP#1 is a fresh type-variable:
CAP#1 extends One from capture of ?
1 error
[1] http://hg.openjdk.java.net/jdk9/dev/langtools/rev/286fc9270404
[2] https://bugs.openjdk.java.net/browse/JDK-8078093
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20160115/709b7397/attachment.html>
More information about the compiler-dev
mailing list