changeset 2681:d24b02b48b74

Automated merge with http://hg.openjdk.java.net/jdk8/tl/langtools
author wmdietl
date Thu, 04 Jul 2013 11:06:06 +0200
parents 3b4f92a3797f a004d53eb41d
children f55bdbebd603
files src/share/classes/com/sun/tools/javac/comp/Flow.java src/share/classes/com/sun/tools/javac/comp/Resolve.java src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java src/share/classes/com/sun/tools/javap/AttributeWriter.java src/share/classes/javax/annotation/processing/AbstractProcessor.java
diffstat 10 files changed, 598 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue Jul 02 22:49:40 2013 +0100
+++ b/.hgtags	Thu Jul 04 11:06:06 2013 +0200
@@ -140,6 +140,7 @@
 1cbe86c11ba69521875c0b0357d7540781eb334d jdk8-b17
 ec2c0973cc31e143cffc05ceb63d98fae76f97d4 jdk8-b16
 ab1b1cc7857716914f2bb20b3128e5a8978290f7 jdk8-b18
+2a2d6ac056cfde7326f309ab73b8cddf518cc729 308-jdk8-sync
 77b2c066084cbc75150efc6603a713c558329813 jdk8-b19
 ffd294128a48cbb90ce8f0569f82b61f1f164a18 jdk8-b20
 bcb21abf1c4177baf4574f99709513dcd4474727 jdk8-b21
--- a/make/build.properties	Tue Jul 02 22:49:40 2013 +0100
+++ b/make/build.properties	Thu Jul 04 11:06:06 2013 +0200
@@ -167,7 +167,7 @@
 
 sjavac.tests = \
         tools/sjavac
-        
+
 #
 
 # The following files require the latest JDK to be available.
--- a/make/build.xml	Tue Jul 02 22:49:40 2013 +0100
+++ b/make/build.xml	Thu Jul 04 11:06:06 2013 +0200
@@ -89,7 +89,7 @@
       build-classes-TOOL        build the classes for the tool
       build-TOOL                build the jar file and script for the tool
       jtreg-TOOL                build the tool and run the appropriate tests
-      findbugs-TOOL             run findbugs on the tool's source oode
+      findbugs-TOOL             run findbugs on the tool's source code
       TOOL                      build the tool, run the tests, and run findbugs
  - utility definitions
  -->
--- a/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java	Tue Jul 02 22:49:40 2013 +0100
+++ b/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java	Thu Jul 04 11:06:06 2013 +0200
@@ -51,24 +51,12 @@
         {BUG_ID + FS + "pkg" + FS + "T0x06.html", "@DA"},
         {BUG_ID + FS + "pkg" + FS + "T0x0B.html", "@DA"},
         {BUG_ID + FS + "pkg" + FS + "T0x0F.html", "@DA"},
-        /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
         {BUG_ID + FS + "pkg" + FS + "T0x20.html", "@DA"},
-        */
-        /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
         {BUG_ID + FS + "pkg" + FS + "T0x20A.html", "@DTPA"},
-        */
-        /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
         {BUG_ID + FS + "pkg" + FS + "T0x20B.html", "@DA"},
-        */
-        /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
         {BUG_ID + FS + "pkg" + FS + "T0x22.html", "@DA"},
-        */
-        /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
         {BUG_ID + FS + "pkg" + FS + "T0x22A.html", "@DTPA"},
-        */
-        /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
         {BUG_ID + FS + "pkg" + FS + "T0x22B.html", "@DA"},
-        */
         {BUG_ID + FS + "pkg" + FS + "T0x10.html", "@DA"},
         {BUG_ID + FS + "pkg" + FS + "T0x10A.html", "@DA"},
         {BUG_ID + FS + "pkg" + FS + "T0x12.html", "@DA"},
--- a/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java	Tue Jul 02 22:49:40 2013 +0100
+++ b/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java	Thu Jul 04 11:06:06 2013 +0200
@@ -35,13 +35,16 @@
     // Test count helps identify test case in event of failure.
     int testcount = 0;
 
-    // Base test case template descriptions
+    // Base test case template descriptions;true==annotations in code attribute.
     enum srce  {
         src1("(repeating) type annotations on on field in method body",true),
         src2("(repeating) type annotations on type parameters, bounds and  type arguments", true),
         src3("(repeating) type annotations on type parameters of class, method return value in method", true),
         src4("(repeating) type annotations on field in anonymous class", false),
-        src5("(repeating) type annotations on field in anonymous class", false);
+        src5("(repeating) type annotations on field in anonymous class", false),
+        src6("(repeating) type annotations on void method declaration", false),
+        src7("(repeating) type annotations in use of instanceof", true),
+        src8("(repeating) type annotations in use of instanceof in method", true);
 
         String description;
         Boolean local;
@@ -84,6 +87,12 @@
                        test( 0, 8, 0, 0, As, BDs, ABMix, "RUNTIME", et, ++testrun, srce.src1);
                        test( 2, 0, 2, 0, As, BDs, ABMix, "CLASS",   et, ++testrun, srce.src5);
                        test( 0, 2, 0, 2, As, BDs, ABMix, "RUNTIME", et, ++testrun, srce.src5);
+                       test( 0, 0, 2, 0, As, BDs, ABMix, "CLASS", et, ++testrun, srce.src6);
+                       test( 0, 0, 0, 2, As, BDs, ABMix, "RUNTIME", et, ++testrun, srce.src6);
+                       test( 2, 0, 0, 0, As, BDs, ABMix, "CLASS", et, ++testrun, srce.src7);
+                       test( 0, 2, 0, 0, As, BDs, ABMix, "RUNTIME", et, ++testrun, srce.src7);
+                       test( 4, 0, 0, 0, As, BDs, ABMix, "CLASS", et, ++testrun, srce.src8);
+                       test( 0, 4, 0, 0, As, BDs, ABMix, "RUNTIME", et, ++testrun, srce.src8);
                        break;
                    case "FIELD":
                        test( 8, 0, 0, 0, As, BDs, ABMix, "CLASS",   et, ++testrun, srce.src1);
@@ -121,18 +130,6 @@
                 ", ABmix=" + ABmix + ", retention: " + rtn + ", anno2: " +
                 et2 + ", src=" + source + "\n    " + source.description;
 
-        if(
-// 8005681 - src1,2,3 - skip cases with repeated annotations on new, array, cast.
-            (( source.equals(srce.src1) || source.equals(srce.src2) ||
-              source.equals(srce.src3)) && (ABmix || (Arepeats && BDrepeats)))
- // 8008928 - src4,5 - this change cause crash with t-a on anon class)
-            || (source.equals(srce.src4) || source.equals(srce.src5))
-          ) {
-            System.out.println(testDef +
-                       "\n    8005681-skip repeated annotations on new,array,cast");
-            return;
-        }
-
         println(testDef);
         // Create test source and File.
         String sourceString = sourceString(tname, rtn, et2, Arepeats,
@@ -178,9 +175,7 @@
         println("Pass");
     }
 
-    //
     // Source for test cases
-    //
     String sourceString(String testname, String retentn, String annot2,
                         Boolean Arepeats, Boolean BDrepeats, Boolean ABmix,
                         srce src) {
@@ -359,6 +354,63 @@
                     hasInnerClass=true;
                     innerClassname="$1";
                 break;
+            case src6: // (repeating)annotations on void method declaration
+                    /*
+                     * class Test95{
+                     *     @A @A @B @B public void test() { };
+                     * }
+                     */
+                source = new String( source +
+                    "// " + src.description + "\n" +
+                    "class "+ testname + "{\n" +
+                    "    _As_ _Bs_ public void test() { }\n" +
+                    "}\n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs) +
+                    "\n\n";
+                    hasInnerClass=false;
+                break;
+            case src7: // (repeating) type annotations in use of instanceof
+                    /*
+                     *   class Test10{
+                     *       String data = "test";
+                     *       boolean dataIsString = ( data instanceof @A @B @A @B String);
+                     *   }
+                     */
+                source = new String( source +
+                    "// " + src.description + "\n" +
+                    "class "+ testname + "{\n" +
+                    "    String data = \"test\";\n" +
+                    "    boolean dataIsString = ( data instanceof _As_ _Bs_ String);\n" +
+                    "}\n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs) +
+                    "\n\n";
+                    hasInnerClass=false;
+                break;
+            case src8: // (repeating) type annotations in use of instanceof
+                    /*
+                     *   class Test20{
+                     *       String data = "test";
+                     *       Boolean isString() {
+                     *           if( data instanceof @A @B @A @B String )
+                     *               return true;
+                     *           else
+                     *               return( data instanceof @A @B @A @B String );
+                     *       }
+                     *   }
+                     */
+                source = new String( source +
+                    "// " + src.description + "\n" +
+                    "class "+ testname + "{\n" +
+                    "    String data = \"test\";\n" +
+                    "    Boolean isString() { \n" +
+                    "        if( data instanceof _As_ _Bs_ String )\n" +
+                    "            return true;\n" +
+                    "        else\n" +
+                    "            return( data instanceof _As_ _Bs_ String );\n" +
+                    "    }\n" +
+                    "}\n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs) +
+                    "\n\n";
+                    hasInnerClass=false;
+                break;
+
         }
         return imports + source;
     }
--- a/test/tools/javac/annotations/typeAnnotations/classfile/T8008762.java	Tue Jul 02 22:49:40 2013 +0100
+++ b/test/tools/javac/annotations/typeAnnotations/classfile/T8008762.java	Thu Jul 04 11:06:06 2013 +0200
@@ -24,7 +24,6 @@
 /*
  * @test
  * @bug 8008762
- * @ignore 8013409: test failures for type annotations
  * @summary Type annotation on inner class in anonymous class
  *          shows up as regular annotation
  */
@@ -62,12 +61,12 @@
     static class Test {
         Object mtest( Test t){ return null; }
         public void test() {
-          mtest( new Test() {
+            mtest( new Test() {
                 class InnerAnon { // Test1$1$InnerAnon.class
-                  @A @B String ai_data = null;
-                  @A @B String ai_m(){ return null; };
+                    @A @B String ai_data = null;
+                    @A @B String ai_m(){ return null; };
                 }
-               InnerAnon IA = new InnerAnon();
+                InnerAnon IA = new InnerAnon();
             });
         }
         @Retention(RUNTIME) @Target(TYPE_USE) @interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java	Thu Jul 04 11:06:06 2013 +0200
@@ -0,0 +1,414 @@
+/*
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8005085 8008762 8008751 8013065 8015323 8015257
+ * @summary Type annotations on anonymous and inner class.
+ *  Six TYPE_USE annotations are repeated(or not); Four combinations create
+ *  four test files, and each results in the test class and 2 anonymous classes.
+ *  Each element of these three classes is checked for expected number of the 
+ *  four annotation Attributes. Expected annotation counts depend on type of 
+ *  annotation place on type of element (a FIELD&TYPE_USE element on a field 
+ *  results in 2). Elements with no annotations expect 0.
+ *  Source template is read in from testanoninner.template
+ *
+ */
+import java.lang.annotation.*;
+import java.io.*;
+import java.util.List;
+import com.sun.tools.classfile.*;
+import java.nio.file.Files;
+import java.nio.charset.*;
+import java.io.File;
+import java.io.IOException;
+
+
+import java.lang.annotation.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.*;
+
+/*
+ * A source template is read in and testname and annotations are inserted
+ * via replace().
+ */
+public class TestAnonInnerClasses extends ClassfileTestHelper {
+    // tally errors and test cases
+    int errors = 0;
+    int checks = 0;
+    //Note expected test count in case of skips due to bugs.
+    int tc = 0, xtc = 180; // 45 x 4 variations of repeated annotations.
+    File testSrc = new File(System.getProperty("test.src"));
+
+    String[] AnnoAttributes = {
+        Attribute.RuntimeVisibleTypeAnnotations,
+        Attribute.RuntimeInvisibleTypeAnnotations,
+        Attribute.RuntimeVisibleAnnotations,
+        Attribute.RuntimeInvisibleAnnotations
+    };
+
+    // template for source files
+    String srcTemplate = "testanoninner.template";
+
+    // Four test files generated based on combinations of repeating annotations.
+    Boolean As= false, Bs=true, Cs=false, Ds=false, TAs=false,TBs=false;
+    Boolean [][] bRepeat = new Boolean[][]{
+                 /* no repeats    */ {false, false, false, false, false, false},
+                 /* repeat A,C,TA */ {true,  false, true,  false, true,  false},
+                 /* repeat B,D,TB */ {false, true,  false, true,  false, true},
+                 /* repeat all    */ {true,  true,  true,  true,  true,  true}
+    };
+    // Save descriptions of failed test case; does not terminate upon a failure.
+    List<String> failed = new java.util.LinkedList<>();
+
+    public static void main(String[] args) throws Exception {
+        new TestAnonInnerClasses().run();
+    }
+
+    // Check annotation counts and make reports sufficiently descriptive to 
+    // easily diagnose.
+    void check(String testcase, int vtaX, int itaX, int vaX, int iaX, 
+                                int vtaA, int itaA, int vaA, int iaA) {
+
+        String descr = " checking " + testcase+" _TYPE_, expected: " +
+            vtaX + ", " + itaX + ", " + vaX + ", " + iaX + "; actual: " +
+            vtaA + ", " + itaA + ", " + vaA + ", " + iaA;
+        String description;
+        description=descr.replace("_TYPE_","RuntimeVisibleTypeAnnotations");
+        if(vtaX != vtaA) {
+            errors++;
+            failed.add(++checks + " " + testcase + ": (vtaX) " + vtaX + 
+                       " != " + vtaA + " (vtaA)");
+            println(checks + " FAIL: " + description);
+        } else println(++checks + " PASS: " + description);
+        description=descr.replace("_TYPE_","RuntimeInvisibleTypeAnnotations");
+        if(itaX != itaA) {
+            errors++;
+            failed.add(++checks + " " + testcase + ": (itaX) " + itaX + " != " +
+                       itaA + " (itaA)");
+            println(checks + " FAIL: " + description);
+        } else println(++checks + " PASS: " + description);
+        description=descr.replace("_TYPE_","RuntimeVisibleAnnotations");
+        if(vaX != vaA) {
+            errors++;
+            failed.add(++checks + " " + testcase + ": (vaX) " + vaX + " != " +
+                       vaA + " (vaA)");
+            println(checks + " FAIL: " + description);
+        } else println(++checks + " PASS: " + description);
+        description=descr.replace("_TYPE_","RuntimeInvisibleAnnotations");
+        if(iaX != iaA) {
+            errors++;
+            failed.add(++checks + " " + testcase + ": (iaX) " + iaX + " != " +
+                       iaA + " (iaA)");
+            println(checks + " FAIL: " + description);
+        } else println(++checks + " PASS: " + description);
+        println("");
+    }
+
+    // Print failed cases (if any) and throw exception for fail.
+    void report() {
+        if(errors!=0) {
+            System.err.println("Failed tests: " + errors +
+                               "\nfailed test cases:\n");
+            for(String t: failed) System.err.println("  " + t);
+            throw new RuntimeException("FAIL: There were test failures.");
+        } else
+            System.out.println("PASSED all tests.");
+    }
+
+    void test(String ttype, ClassFile cf, Method m, Field f, boolean visible) {
+        int vtaActual = 0, itaActual = 0, vaActual = 0, iaActual = 0,
+            vtaExp = 0,    itaExp = 0,    vaExp = 0,    iaExp = 0, 
+            index = 0, index2 = 0;
+        String memberName = null, testcase = "undefined", testClassName = null;
+        Attribute attr = null, cattr = null;
+        Code_attribute CAttr = null;
+        // Get counts of 4 annotation Attributes on element being checked.
+        for (String AnnoType : AnnoAttributes) {
+            try {
+                switch(ttype) {
+                    case "METHOD":
+                        index = m.attributes.getIndex(cf.constant_pool,
+                                                      AnnoType);
+                        memberName = m.getName(cf.constant_pool);
+                        if(index != -1) 
+                            attr = m.attributes.get(index);
+                        //fetch index annotations from code attribute.
+                        index2 = m.attributes.getIndex(cf.constant_pool,
+                                                       Attribute.Code);
+                        if(index2 != -1) {
+                            cattr = m.attributes.get(index2);
+                            assert cattr instanceof Code_attribute;
+                            CAttr = (Code_attribute)cattr;
+                            index2 = CAttr.attributes.getIndex(cf.constant_pool,
+                                                               AnnoType); 
+                            if(index2 != -1) 
+                                cattr = CAttr.attributes.get(index2);
+                        }
+                        break;
+                    case "FIELD":
+                        index = f.attributes.getIndex(cf.constant_pool,
+                                                      AnnoType);
+                        memberName = f.getName(cf.constant_pool);
+                        if(index != -1) 
+                            attr = f.attributes.get(index);
+                        //fetch index annotations from code attribute.
+                        index2 = cf.attributes.getIndex(cf.constant_pool,
+                                                        Attribute.Code);
+                        if(index2!= -1) {
+                            cattr = cf.attributes.get(index2);
+                            assert cattr instanceof Code_attribute;
+                            CAttr = (Code_attribute)cattr;
+                            index2 = CAttr.attributes.getIndex(cf.constant_pool,
+                                                               AnnoType); 
+                            if(index2!= -1) 
+                                cattr = CAttr.attributes.get(index2);
+                        }
+                        break;
+
+                    default:
+                        memberName = cf.getName();
+                        index = cf.attributes.getIndex(cf.constant_pool,
+                                                       AnnoType);
+                        if(index!= -1) attr = cf.attributes.get(index);
+                        break;
+                }
+            } catch(ConstantPoolException cpe) { cpe.printStackTrace(); }
+            try {
+                testClassName=cf.getName();
+                testcase = ttype + ": " + testClassName + ": " +
+                           memberName + ", ";
+            } catch(ConstantPoolException cpe) { cpe.printStackTrace(); }
+            if(index != -1) {
+                switch(AnnoType) {
+                    case Attribute.RuntimeVisibleTypeAnnotations:
+                        //count RuntimeVisibleTypeAnnotations
+                        RuntimeVisibleTypeAnnotations_attribute RVTAa =
+                                (RuntimeVisibleTypeAnnotations_attribute)attr;
+                        vtaActual += RVTAa.annotations.length;
+                        break;
+                    case Attribute.RuntimeVisibleAnnotations:
+                        //count RuntimeVisibleAnnotations
+                        RuntimeVisibleAnnotations_attribute RVAa =
+                                (RuntimeVisibleAnnotations_attribute)attr;
+                        vaActual += RVAa.annotations.length;
+                        break;
+                    case Attribute.RuntimeInvisibleTypeAnnotations:
+                        //count RuntimeInvisibleTypeAnnotations
+                        RuntimeInvisibleTypeAnnotations_attribute RITAa =
+                                (RuntimeInvisibleTypeAnnotations_attribute)attr;
+                        itaActual += RITAa.annotations.length;
+                        break;
+                    case Attribute.RuntimeInvisibleAnnotations:
+                        //count RuntimeInvisibleAnnotations
+                        RuntimeInvisibleAnnotations_attribute RIAa =
+                                (RuntimeInvisibleAnnotations_attribute)attr;
+                        iaActual += RIAa.annotations.length;
+                        break;
+                }
+            }
+            // annotations from code attribute.
+            if(index2 != -1) {
+                switch(AnnoType) {
+                    case Attribute.RuntimeVisibleTypeAnnotations:
+                        //count RuntimeVisibleTypeAnnotations
+                        RuntimeVisibleTypeAnnotations_attribute RVTAa =
+                                (RuntimeVisibleTypeAnnotations_attribute)cattr;
+                        vtaActual += RVTAa.annotations.length;
+                        break;
+                    case Attribute.RuntimeVisibleAnnotations:
+                        //count RuntimeVisibleAnnotations
+                        RuntimeVisibleAnnotations_attribute RVAa =
+                                (RuntimeVisibleAnnotations_attribute)cattr;
+                        vaActual += RVAa.annotations.length;
+                        break;
+                    case Attribute.RuntimeInvisibleTypeAnnotations:
+                        //count RuntimeInvisibleTypeAnnotations
+                        RuntimeInvisibleTypeAnnotations_attribute RITAa =
+                                (RuntimeInvisibleTypeAnnotations_attribute)cattr;
+                        itaActual += RITAa.annotations.length;
+                        break;
+                    case Attribute.RuntimeInvisibleAnnotations:
+                        //count RuntimeInvisibleAnnotations
+                        RuntimeInvisibleAnnotations_attribute RIAa =
+                                (RuntimeInvisibleAnnotations_attribute)cattr;
+                        iaActual += RIAa.annotations.length;
+                        break;
+                }
+            }
+        }
+
+        switch ( memberName ) {
+            //METHODs 
+            case "test" : vtaExp=4;  itaExp=4;  vaExp=0; iaExp=0; tc++; break;              
+            case "mtest": vtaExp=4;  itaExp=4;  vaExp=1; iaExp=1; tc++; break;
+            case "m1":    vtaExp=2;  itaExp=2;  vaExp=1; iaExp=1; tc++; break;
+            case "m2":    vtaExp=4;  itaExp=4;  vaExp=1; iaExp=1; tc++; break;
+            case "m3":    vtaExp=10; itaExp=10; vaExp=1; iaExp=1; tc++; break;
+            case "tm":    vtaExp=6;  itaExp=6;  vaExp=1; iaExp=1; tc++; break;
+            //inner class
+            case "i_m1":  vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "i_m2":  vtaExp=4;  itaExp=4; vaExp=1; iaExp=1; tc++; break;
+            case "i_um":  vtaExp=6;  itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            //local class
+            case "l_m1":  vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "l_m2":  vtaExp=4;  itaExp=4; vaExp=1; iaExp=1; tc++; break;
+            case "l_um":  vtaExp=6;  itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            //anon class
+            case "mm_m1": vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "mm_m2": vtaExp=4;  itaExp=4; vaExp=1; iaExp=1; tc++; break;
+            case "mm_m3": vtaExp=10; itaExp=10;vaExp=1; iaExp=1; tc++; break;
+            case "mm_tm": vtaExp=6;  itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            //InnerAnon class
+            case "ia_m1": vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "ia_m2": vtaExp=4;  itaExp=4; vaExp=1; iaExp=1; tc++; break;
+            case "ia_um": vtaExp=6;  itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            //FIELDs
+            case "data":   vtaExp = 2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "odata1": vtaExp = 2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "pdata1": vtaExp = 2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "tdata":  vtaExp = 2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "sa1":    vtaExp = 6;  itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            //inner class
+            case "i_odata1":  vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "i_pdata1":  vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "i_udata":   vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "i_sa1":     vtaExp=6;  itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            case "i_tdata":   vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            //local class
+            case "l_odata1":  vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "l_pdata1":  vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "l_udata":   vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "l_sa1":     vtaExp=6;  itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            case "l_tdata":   vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            //anon class
+            case "mm_odata1": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "mm_pdata1": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "mm_sa1":    vtaExp = 6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            case "mm_tdata":  vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            // InnerAnon class
+            case "ia_odata1": vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "ia_pdata1": vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "ia_udata":  vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "ia_sa1":    vtaExp=6;  itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            case "ia_tdata":  vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "IA":        vtaExp=4;  itaExp=4; vaExp=1; iaExp=1; tc++; break; 
+            case "IN":        vtaExp=4;  itaExp=4; vaExp=1; iaExp=1; tc++; break; 
+            // default cases are <init>, this$0, this$1, mmtest, atest
+            default:          vtaExp = 0;  itaExp=0; vaExp=0; iaExp=0;    break;
+        }
+        check(testcase,vtaExp,   itaExp,   vaExp,   iaExp,
+                       vtaActual,itaActual,vaActual,iaActual);
+    }
+
+    public void run() {
+        ClassFile cf   = null;
+        InputStream in = null;
+        int testcount  = 1;
+        File testFile  = null;
+        // Generate source, check methods and fields for each combination.
+        for(Boolean[] bCombo : bRepeat) {
+            As=bCombo[0]; Bs=bCombo[1]; Cs=bCombo[2];
+            Ds=bCombo[3]; TAs=bCombo[4]; TBs=bCombo[5];
+            String testname = "Test" + testcount++;
+            println("Combinations: " + As + ", " + Bs + ", " + Cs + ", " + Ds +  
+                                ", " + TAs + ", " + TBs + 
+                                "; see " + testname + ".java");
+            String[] classes = {testname + ".class", 
+                                testname + "$Inner.class", 
+                                testname + "$1Local1.class",
+                                testname + "$1.class", 
+                                testname + "$1$1.class", 
+                                testname + "$1$InnerAnon.class"
+            };
+            // Create test source, create and compile File.
+            String sourceString = getSource(srcTemplate, testname, 
+                                            As, Bs, Cs, Ds, TAs, TBs);
+            System.out.println(sourceString);
+            try {
+             testFile = writeTestFile(testname+".java", sourceString);
+            } catch( java.io.IOException ioe) { ioe.printStackTrace(); }
+            // Compile test source and read classfile.
+            File classFile = null; 
+            try {
+                classFile = compile(testFile);
+            } catch (Error err) {
+                System.err.println("FAILED compile. Source:\n" + sourceString);
+                throw err;
+            }
+            String testloc = classFile.getAbsolutePath().substring( 
+                   0,classFile.getAbsolutePath().indexOf(classFile.getPath()));
+            for(String clazz : classes) {
+                try {
+                    cf = ClassFile.read(new File(testloc+clazz));
+                } catch(Exception e) { e.printStackTrace();  }
+                // Test for all methods and fields
+                for (Method m: cf.methods) {
+                    test("METHOD", cf, m, null, true);
+                }
+                for (Field f: cf.fields) {
+                    test("FIELD", cf, null, f, true);
+                }
+            }
+        }
+        report();
+        if(tc!=xtc) System.out.println("Test Count: " + tc + " != " + 
+                                       "expected: " + xtc);
+    }
+
+
+    String getSrcTemplate(String sTemplate) {
+        List<String> tmpl = null;
+        String sTmpl = "";
+        try {
+            tmpl = Files.readAllLines( new File(testSrc,sTemplate).toPath(),
+                                       Charset.defaultCharset());
+        } catch ( IOException ioe ) {
+            String error = "FAILED: Test failed to read template" + sTemplate;
+            ioe.printStackTrace();
+            throw new RuntimeException(error);
+        }
+        for(String l : tmpl) 
+            sTmpl=sTmpl.concat(l).concat("\n");
+        return sTmpl;
+    }
+
+    // test class template
+    String getSource(String templateName, String testname, 
+                     Boolean Arepeats,  Boolean Brepeats, 
+                     Boolean Crepeats,  Boolean Drepeats, 
+                     Boolean TArepeats, Boolean TBrepeats ) {
+        String As  = Arepeats  ? "@A @A":"@A",
+               Bs  = Brepeats  ? "@B @B":"@B",
+               Cs  = Crepeats  ? "@C @C":"@C",
+               Ds  = Drepeats  ? "@D @D":"@D",
+               TAs = TArepeats ? "@TA @TA":"@TA",
+               TBs = TBrepeats ? "@TB @TB":"@TB";
+
+        // split up replace() lines for readability
+        String testsource = getSrcTemplate(templateName).replace("testname",testname);
+        testsource = testsource.replace("_As",As).replace("_Bs",Bs).replace("_Cs",Cs);
+        testsource = testsource.replace("_Ds",Ds).replace("_TAs",TAs).replace("_TBs",TBs);
+        return testsource;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/classfile/testanoninner.template	Thu Jul 04 11:06:06 2013 +0200
@@ -0,0 +1,108 @@
+import java.lang.annotation.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.*;
+import java.util.List;
+
+class testname <T> {                 // TestN.class
+    _As _Bs _Cs _Ds String data = "test";
+    _As _Bs _Cs _Ds Object mtest( _As _Bs _Cs _Ds testname <T> t){ return null;  }
+    Object mmtest( testname<T> t){ return null;  }
+
+    class Inner<U> {        // TestN$1$Inner.class
+         _As _Bs _Cs _Ds String i_odata1 = "test";
+         _As _Bs _Cs _Ds int    i_pdata1 = 0;
+         _As _Bs _Cs _Ds U      i_udata = null;
+//8015257
+         _As _Bs _Cs _Ds Object  _As _Bs _Cs _Ds [] _As _Bs _Cs _Ds [] i_sa1 = null;
+         _As _Bs _Cs _Ds  T    i_tdata = null;
+         _As _Bs _Cs _Ds String i_m1(){ return null; };
+         _As _Bs _Cs _Ds int    i_m2( _As _Bs _Cs _Ds Object o){return 0;}
+         _As _Bs _Cs _Ds
+        <_TAs _TBs _Cs _Ds U> Object i_um( _As _Bs _Cs _Ds  U u) { return null; }
+    }
+//8015323
+    _As _Bs _Cs _Ds Inner< _As _Bs _Cs _Ds String> IN = new  Inner< String>();
+
+    public void test() {
+ 
+        class Local1<U> {                   // TestN$Local1.class
+            _As _Bs _Cs _Ds  String l_odata1 = "test";
+            _As _Bs _Cs _Ds  int    l_pdata1 = 0;
+            _As _Bs _Cs _Ds  U      l_udata = null;
+//8015257
+            _As _Bs _Cs _Ds  Object _As _Bs _Cs _Ds  []_As _Bs _Cs _Ds  [] l_sa1 = null;
+            _TAs _TBs _Cs _Ds  T    l_tdata = null;
+            _As _Bs _Cs _Ds  String l_m1(){ return null; };
+            _As _Bs _Cs _Ds  int    l_m2(_As _Bs _Cs _Ds  Object o){return 0;}
+            _As _Bs _Cs _Ds 
+            <_TAs _TBs _Cs _Ds  U> Object l_um(_As _Bs _Cs _Ds   U u) { return null; }
+        }
+        // The below, as a local variable, will show up on test()
+       _As _Bs _Cs _Ds  Local1<_As _Bs _Cs _Ds  String> LC = new Local1<String>();
+ 
+        mtest( new testname<T>() {  // TestN$1
+                class InnerAnon<U> {        // TestN$1$InnerAnon.class
+                    _As _Bs _Cs _Ds  String ia_odata1 = "test";
+                    _As _Bs _Cs _Ds  int    ia_pdata1 = 0;
+                    _As _Bs _Cs _Ds  U      ia_udata = null;
+//8015257
+                    _As _Bs _Cs _Ds  Object _As _Bs _Cs _Ds  []_As _Bs _Cs _Ds  [] ia_sa1 = null;
+                    _TAs _TBs _Cs _Ds  T    ia_tdata = null;
+                    _As _Bs _Cs _Ds  String ia_m1(){ return null; };
+                    _As _Bs _Cs _Ds  int    ia_m2(_As _Bs _Cs _Ds  Object o){return 0;}
+                    _As _Bs _Cs _Ds 
+                    <_TAs _TBs _Cs _Ds  U> Object ia_um(_As _Bs _Cs _Ds   U u) { return null; }
+                }
+//8015257
+                _As _Bs _Cs _Ds  InnerAnon<_As _Bs _Cs _Ds  String> IA = new InnerAnon< String>();
+
+                _As _Bs _Cs _Ds String odata1 = "test";
+                _As _Bs _Cs _Ds int    pdata1 = 0;
+//8015257
+                _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] sa1 = null;
+                _As _Bs _Cs _Ds T tdata = null;
+
+                _As _Bs _Cs _Ds String m1(){ return null; };
+                _As _Bs _Cs _Ds int    m2(_As _Bs _Cs _Ds Object o){return 0;}
+
+                _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds [] _As _Bs _Cs _Ds []
+                m3(String _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] sa){ return null; }
+
+                _As _Bs _Cs _Ds
+                <_TAs _TBs _Cs _Ds T> Object tm(_As _Bs _Cs _Ds  T t) { return null; }
+
+                public void atest( testname<T> t){
+                    t.mmtest( new testname<T>() {   // TestN$1$1.class 
+                        _As _Bs _Cs _Ds String mm_odata1 = "test";
+                        _As _Bs _Cs _Ds int    mm_pdata1 = 0;
+//8015257
+                        _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] mm_sa1 = null;
+                        _TAs _TBs _Cs _Ds T mm_tdata = null;
+
+                        _As _Bs _Cs _Ds String mm_m1(){ return null; };
+                        _As _Bs _Cs _Ds int    mm_m2(_As _Bs _Cs _Ds Object o){return 0;}
+
+                        _As _Bs _Cs _Ds String _As _Bs _Cs _Ds [] _As _Bs _Cs _Ds []
+                        mm_m3(String _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] sa){ return null; }
+
+                        _As _Bs _Cs _Ds
+                        <_TAs _TBs _Cs _Ds T> Object mm_tm(_As _Bs _Cs _Ds  T t) { return null; }
+                    });
+                }
+           });
+   }
+}
+@Retention(RUNTIME) @Target({TYPE_USE,FIELD})  @Repeatable( AC.class ) @interface A { }
+@Retention(RUNTIME) @Target({TYPE_USE,METHOD}) @Repeatable( BC.class ) @interface B { }
+@Retention(RUNTIME) @Target({TYPE_USE,FIELD})  @interface AC { A[] value(); }
+@Retention(RUNTIME) @Target({TYPE_USE,METHOD}) @interface BC { B[] value(); }
+
+@Retention(CLASS)   @Target({TYPE_USE,FIELD})  @Repeatable( CC.class ) @interface C { }
+@Retention(CLASS)   @Target({TYPE_USE,METHOD}) @Repeatable( DC.class ) @interface D { }
+@Retention(CLASS)   @Target({TYPE_USE,FIELD})  @interface CC { C[] value(); }
+@Retention(CLASS)   @Target({TYPE_USE,METHOD}) @interface DC { D[] value(); }
+
+@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,FIELD})  @Repeatable( TAC.class ) @interface TA { }
+@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,METHOD}) @Repeatable( TBC.class ) @interface TB { }
+@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,FIELD})  @interface TAC { TA[] value(); }
+@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,METHOD}) @interface TBC { TB[] value(); }
--- a/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java	Tue Jul 02 22:49:40 2013 +0100
+++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java	Thu Jul 04 11:06:06 2013 +0200
@@ -1,7 +1,6 @@
 /*
  * @test /nodynamiccopyright/
  * @bug 8006733 8006775
- * @ignore 8013409: test failures for type annotations
  * @summary A static outer class cannot be annotated.
  * @author Werner Dietl
  * @compile/fail/ref=CantAnnotateStaticClass.out -XDrawDiagnostics CantAnnotateStaticClass.java
--- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java	Tue Jul 02 22:49:40 2013 +0100
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java	Thu Jul 04 11:06:06 2013 +0200
@@ -867,7 +867,7 @@
     })
     @TestClass("Test$1Nested")
     public String testNestedInMethod1() {
-        return "class Test {\n" +
+        return "class Test {\n" + 
                 "  void foobar() {\n" +
                 "    class Nested<@TA X extends @TB Object> {\n" +
                 "      @TC List<@TD Object> f;\n" +