-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
8u40, 9
If this test case is compiled with javac:
interface Iface<T extends Number> {
String m(T...t);
}
public class Test {
public static void main(String[] args) {
Iface<? super Integer> i = (Integer...a) -> "";
String result = i.m(1);
}
}
at execution time you will get:
Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Number; cannot be cast to [Ljava.lang.Integer;
at Test$$Lambda$1/980546781.m(Unknown Source)
at Test.main(Test.java:8)
interface Iface<T extends Number> {
String m(T...t);
}
public class Test {
public static void main(String[] args) {
Iface<? super Integer> i = (Integer...a) -> "";
String result = i.m(1);
}
}
at execution time you will get:
Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Number; cannot be cast to [Ljava.lang.Integer;
at Test$$Lambda$1/980546781.m(Unknown Source)
at Test.main(Test.java:8)
- duplicates
-
JDK-8059937 wildcards and generic vararg method invocation causes runtime error
- Closed
- relates to
-
JDK-8060487 Varargs array type incompatible with bridge method
- Open
-
JDK-8049075 javac, wildcards and generic vararg method invocation not accepted
- Closed
-
JDK-8059937 wildcards and generic vararg method invocation causes runtime error
- Closed