Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8059926

java.lang.ClassCastException: [Ljava.lang.Number; cannot be cast to [Ljava.lang.Integer;

XMLWordPrintable

      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)

            vromero Vicente Arturo Romero Zaldivar
            ntv Nadeesh Tv
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: