test/tools/javac/cast/7005671/T7005671.java

Thu, 21 Feb 2013 15:26:46 +0000

author
mcimadamore
date
Thu, 21 Feb 2013 15:26:46 +0000
changeset 1599
9f0ec00514b6
parent 0
959103a6100f
permissions
-rw-r--r--

8007461: Regression: bad overload resolution when inner class and outer class have method with same name
Summary: Fix regression in varargs method resolution introduced by bad refactoring
Reviewed-by: jjg

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @author mcimadamore
     4  * @bug     7005671
     5  * @summary Regression: compiler accepts invalid cast from X[] to primitive array
     6  * @compile/fail/ref=T7005671.out -XDrawDiagnostics T7005671.java
     7  */
     9 class T7005671<X> {
    11     void test1() {
    12         Object o1 = (X[])(byte[])null;
    13         Object o2 = (X[])(short[])null;
    14         Object o3 = (X[])(int[])null;
    15         Object o4 = (X[])(long[])null;
    16         Object o5 = (X[])(float[])null;
    17         Object o6 = (X[])(double[])null;
    18         Object o7 = (X[])(char[])null;
    19         Object o8 = (X[])(boolean[])null;
    20     }
    22     void test2() {
    23         Object o1 = (byte[])(X[])null;
    24         Object o2 = (short[])(X[])null;
    25         Object o3 = (int[])(X[])null;
    26         Object o4 = (long[])(X[])null;
    27         Object o5 = (float[])(X[])null;
    28         Object o6 = (double[])(X[])null;
    29         Object o7 = (char[])(X[])null;
    30         Object o8 = (boolean[])(X[])null;
    31     }
    32 }

mercurial