langtools/test/tools/javac/positions/T6253161.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 10 06bc494ca11e
child 6150 d055fa8ced62
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
 * @test  /nodynamiccopyright/
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * @bug     6253161
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 * @summary Compiler will fail to find the correct location of serial warnings for anonymous inner classes
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * @author  Seetharama Avadhanam
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * @compile -Xlint:serial -XDdev T6253161.java
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * @compile/ref=T6253161.out -Xlint:serial -XDdev -XDrawDiagnostics -XDstdout T6253161.java
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
import java.util.List;
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
import java.util.ArrayList;
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
public class T6253161 {
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
    @SuppressWarnings("unchecked")
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
    public void anonymousMethod(){
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
           List list = new ArrayList<String>(){
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
           static final long serialVersionUID = 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
           List list = new ArrayList<Integer>();
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
           public List<Integer> getMyList(){
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
                final List floatList = new ArrayList<Float>(){
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
                    List integerList = new ArrayList<Float>();
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
                    public List<Float> getMyList(){
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
                        for(int i=0;i<10;i++)
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
                            integerList.add((int)((Float.parseFloat(i+""))+(1.11F)));
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
                        return (List)(Object)integerList;
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
                    public void testMethods(){
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
                        //...
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
                }.getMyList();
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
                for(int i=0;i<10;i++)
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
                    list.add((Float)(floatList.get(i)) * 11.232F * i);
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
                return list;
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
         }.getMyList();
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
}