-
Bug
-
Resolution: Fixed
-
P4
-
8, 9
Let's consider following code:
public class Test12 {
interface Iface<A1 extends A2, A2> {
String m(A1 t);
}
public void run() {
Iface<? super Integer, Number> i = (Integer a) -> a.toString();
}
}
It fails with following error:
Error:(7, 44) java: incompatible types: Test12.Iface<java.lang.Integer,java.lang.Integer> cannot be converted to Test12.Iface<? super java.lang.Integer,java.lang.Number>
While it should compile successfully since only A1 should be instantiated as a result of reduction in jls-18.5.3-220-A:
Integer = A1
While A2 should remain unchanged as Number according to jls-18.5.3-220-B.
It looks like resolution takes place along with reduction in jls-18.5.3-210 in javac.
public class Test12 {
interface Iface<A1 extends A2, A2> {
String m(A1 t);
}
public void run() {
Iface<? super Integer, Number> i = (Integer a) -> a.toString();
}
}
It fails with following error:
Error:(7, 44) java: incompatible types: Test12.Iface<java.lang.Integer,java.lang.Integer> cannot be converted to Test12.Iface<? super java.lang.Integer,java.lang.Number>
While it should compile successfully since only A1 should be instantiated as a result of reduction in jls-18.5.3-220-A:
Integer = A1
While A2 should remain unchanged as Number according to jls-18.5.3-220-B.
It looks like resolution takes place along with reduction in jls-18.5.3-210 in javac.
- blocks
-
JDK-8048547 JLS8 9.9: non-wildcard parameterization succeeds unexpectedly
-
- Open
-
- is blocked by
-
JDK-8159970 javac, JLS8 18.2.4 is not completely implemented by the compiler
-
- Closed
-