test/tools/javac/positions/T6253161a.java

Wed, 26 Sep 2012 14:22:41 +0100

author
mcimadamore
date
Wed, 26 Sep 2012 14:22:41 +0100
changeset 1341
db36841709e4
parent 611
4172cfff05f0
child 2525
2eb010b6cb22
permissions
-rw-r--r--

7188968: New instance creation expression using diamond is checked twice
Summary: Unify method and constructor check logic
Reviewed-by: jjg

     1 /*
     2  * @test  /nodynamiccopyright/
     3  * @bug     6253161
     4  * @summary Compiler will fail to find the correct location of serial warnings for anonymous inner classes
     5  * @author  Seetharama Avadhanam
     6  * @compile -Xlint:serial -XDdev T6253161a.java
     7  * @compile/ref=T6253161a.out -Xlint:serial -XDdev -XDrawDiagnostics T6253161a.java
     8  */
     9 import java.util.List;
    10 import java.util.ArrayList;
    12 public class T6253161a {
    13     @SuppressWarnings("unchecked")
    14     public void anonymousMethod(){
    15            List list = new ArrayList<String>(){
    16            static final long serialVersionUID = 1;
    17            List list = new ArrayList<Integer>();
    18            public List<Integer> getMyList(){
    19                 final List floatList = new ArrayList<Float>(){
    20                     // Blank ....
    21                 };
    22                 for(int i=0;i<10;i++)
    23                     list.add((Float)(floatList.get(i)) * 11.232F * i);
    24                 return list;
    25             }
    26          }.getMyList();
    27     }
    28 }

mercurial