JDK-8059937 : wildcards and generic vararg method invocation causes runtime error
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 9
  • Priority: P2
  • Status: Resolved
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2014-10-08
  • Updated: 2014-10-16
  • Resolved: 2014-10-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
Let's consider following code:

public class Test49 {
    interface Iface<T extends Number> {
        void m(T...t);
    }

    public static void main(String argv[]) {
        Iface<? super Integer> i = (Integer...a) -> System.out.println("lmbd");

        i.m(1, 2, 3);
    }
}

this code causes following error at runtime:
Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Number; cannot be cast to [Ljava.lang.Integer;
        at Test49$$Lambda$1/1421795058.m(Unknown Source)
        at Test49.main(Test49.java:9)

JDK-8049075 previously caused compiler error in similar case.
Comments
Looks like a dup of JDK-8059926
08-10-2014

Following JCK 9 tests fail because of this issue (jdk9 b29): lang/INFR/infr064/infr06401m02/infr06401m02.html lang/INFR/infr064/infr06401m12/infr06401m12.html lang/INFR/infr064/infr06401m02/infr06401m02_rt.html lang/INFR/infr064/infr06401m12/infr06401m12_rt.html jdk9 b33 still encounters this error.
08-10-2014