test/tools/javap/output/RepeatingTypeAnnotations.java

Print this page

        

@@ -122,11 +122,12 @@
 
     @TestCase
     @ignore // 8008082:missing type annotation for cast
     public static class TC1 extends RepeatingTypeAnnotations {
         public TC1() {
-            setSrc("    static String so = \"hello world\";",
+            setSrc(" /* TC1 */ ",
+                   "    static String so = \"hello world\";",
                    "    public @A @A @A Object o = (@A @A @A String) Test.so;");
             verify("RuntimeInvisibleTypeAnnotations",
                    "0: #25(#26=[@#27(),@#27(),@#27()]): FIELD",
                    "1: #25(#26=[@#27(),@#27(),@#27()]): CAST, offset=5");
         }

@@ -133,55 +134,59 @@
     }
 
     @TestCase
     public static class TC2 extends RepeatingTypeAnnotations {
         public TC2() {
-            setSrc("    static String so = \"hello world\";",
+            setSrc(" /* TC2 */ ",
+                   "    static String so = \"hello world\";",
                    "    public @A @B @A Object o = (@B @A @B String) Test.so;");
             verify("RuntimeInvisibleTypeAnnotations",
                    "0: #25(#26=[@#27(),@#27()]): FIELD",
                    "1: #28(): FIELD",
-                   "2: #29(#26=[@#28(),@#28()]): CAST, offset=5",
-                   "3: #27(): CAST, offset=5");
+                   "0: #36(#26=[@#28(),@#28()]): CAST, offset=5, type_index=0",
+                   "1: #27(): CAST, offset=5, type_index=0");
         }
     }
 
     @TestCase
     public static class TC3 extends RepeatingTypeAnnotations {
         public TC3() {
-            setSrc("    static String so = \"hello world\";",
+            setSrc(" /* TC3 */ ",
+                   "    static String so = \"hello world\";",
                    "    public @A @A @C Object o = (@B @C @B String) Test.so;");
-            verify("RuntimeInvisibleTypeAnnotations",
+            verify("RuntimeVisibleTypeAnnotations",
+                   "RuntimeInvisibleTypeAnnotations",
                    "0: #25(): FIELD",
-                   "1: #25(): CAST, offset=5",
-                   "RuntimeVisibleTypeAnnotations",
                    "0: #27(#28=[@#29(),@#29()]): FIELD",
-                   "1: #30(#28=[@#31(),@#31()]): CAST, offset=5");
+                   "0: #25(): CAST, offset=5, type_index=0",
+                   "0: #37(#28=[@#38(),@#38()]): CAST, offset=5, type_index=0");
         }
     }
 
     @TestCase
     public static class TC4 extends RepeatingTypeAnnotations {
         public TC4() {
-            setSrc("    static String so = \"hello world\";",
+            setSrc(" /* TC4 */ ",
+                   "    static String so = \"hello world\";",
                    "    public @A @B @C Object o = (@C @B @A String) Test.so;");
             verify("RuntimeInvisibleTypeAnnotations",
                    "RuntimeVisibleTypeAnnotations",
                    "0: #25(): FIELD",
-                   "1: #25(): CAST, offset=5",
                    "0: #27(): FIELD",
                    "1: #28(): FIELD",
-                   "2: #28(): CAST, offset=5",
-                   "3: #27(): CAST, offset=5");
+                   "0: #25(): CAST, offset=5, type_index=0",
+                   "0: #28(): CAST, offset=5, type_index=0",
+                   "1: #27(): CAST, offset=5, type_index=0");
         }
     }
 
     @TestCase
     @ignore // 8008082:missing type annotation for cast
     public static class TC5 extends RepeatingTypeAnnotations {
         public TC5() {
-            setSrc("    static String so = \"hello world\";",
+            setSrc(" /* TC5 */ ",
+                   "    static String so = \"hello world\";",
                    "    public static @A @A @A Object o = (@B @B @B String) Test.so;");
             verify("RuntimeInvisibleTypeAnnotations",
                    "0: #25(#26=[@#27(),@#27(),@#27()]): FIELD",
                    "1: #28(#26=[@#29(),@#29(),@#29()]): CAST, offset=5, type_index=0");
         }

@@ -188,55 +193,60 @@
     }
 
     @TestCase
     public static class TC6 extends RepeatingTypeAnnotations {
         public TC6() {
-            setSrc("    static String so = \"hello world\";",
+            setSrc(" /* TC6 */ ",
+                   "    static String so = \"hello world\";",
                    "    public static @A @B @A Object o = (@B @A @B String) Test.so;");
             verify("RuntimeInvisibleTypeAnnotations",
                    "0: #25(#26=[@#27(),@#27()]): FIELD",
                    "1: #28(): FIELD",
-                   "2: #29(#26=[@#28(),@#28()]): CAST, offset=5",
-                   "3: #27(): CAST, offset=5");
+                   "0: #37(#26=[@#28(),@#28()]): CAST, offset=5, type_index=0",
+                   "1: #27(): CAST, offset=5, type_index=0");
         }
     }
 
     @TestCase
     public static class TC7 extends RepeatingTypeAnnotations {
         public TC7() {
-            setSrc("    static String so = \"hello world\";",
+            setSrc(" /* TC7 */ ",
+                   "    static String so = \"hello world\";",
                    "    public static @A @A @C Object o = (@B @C @B String) Test.so;");
-            verify("RuntimeInvisibleTypeAnnotations",
-                   "RuntimeVisibleTypeAnnotations",
+            verify("RuntimeVisibleTypeAnnotations",
+                   "RuntimeInvisibleTypeAnnotations",
                    "0: #25(): FIELD",
-                   "1: #25(): CAST, offset=5",
                    "0: #27(#28=[@#29(),@#29()]): FIELD",
-                   "1: #30(#28=[@#31(),@#31()]): CAST, offset=5");
+                   "0: #25(): CAST, offset=5, type_index=0",
+                   "0: #38(#28=[@#39(),@#39()]): CAST, offset=5, type_index=0");
         }
     }
 
     @TestCase
     public static class TC8 extends RepeatingTypeAnnotations {
         public TC8() {
-            setSrc("    static String so = \"hello world\";",
+            setSrc(" /* TC8 */ ",
+                   "    static String so = \"hello world\";",
                    "    public static @A @B @C Object o = (@C @B @A String) Test.so;");
-            verify("RuntimeInvisibleTypeAnnotations",
-                   "RuntimeVisibleTypeAnnotations",
+                   
+            verify("RuntimeVisibleTypeAnnotations",
+                   "RuntimeInvisibleTypeAnnotations",
                    "0: #25(): FIELD",
-                   "1: #25(): CAST, offset=5",
                    "0: #27(): FIELD",
                    "1: #28(): FIELD",
-                   "2: #28(): CAST, offset=5",
-                   "3: #27(): CAST, offset=5");
+                   "0: #25(): CAST, offset=5, type_index=0",
+                   "0: #28(): CAST, offset=5, type_index=0",
+                   "1: #27(): CAST, offset=5, type_index=0");
         }
     }
 
     @TestCase
     @ignore // 8008082:missing type annotation for cast
     public static class TC9 extends RepeatingTypeAnnotations {
         public TC9() {
-            setSrc("    public Test(@A @A @A Object o, @A int i, long l) {",
+            setSrc(" /* TC9 */ ",
+                   "    public Test(@A @A @A Object o, @A int i, long l) {",
                    "        @A @A @A String ls = (@B @B @B String) o;",
                    "    }");
             verify("RuntimeInvisibleTypeAnnotations",
                    "0: #34(#35=[@#36(),@#36(),@#36()]): METHOD_FORMAL_PARAMETER, param_index=0",
                    "1: #36(): METHOD_FORMAL_PARAMETER, param_index=1",

@@ -246,71 +256,76 @@
     }
 
     @TestCase
     public static class TC10 extends RepeatingTypeAnnotations {
         public TC10() {
-            setSrc("    public Test(@A @A @B Object o, @A @B int i, long l) {",
+            setSrc(" /* TC10 */ ",
+                   "    public Test(@A @A @B Object o, @A @B int i, long l) {",
                    "        @A @A @B String ls = (@B @A @B String) o;",
                    "    }");
-            verify("RuntimeInvisibleTypeAnnotations:",
-                   "0: #34(#35=[@#36(),@#36()]): METHOD_FORMAL_PARAMETER, param_index=0",
-                   "1: #37(): METHOD_FORMAL_PARAMETER, param_index=0",
-                   "2: #36(): METHOD_FORMAL_PARAMETER, param_index=1",
-                   "3: #37(): METHOD_FORMAL_PARAMETER, param_index=1",
-                   "4: #38(#35=[@#37(),@#37()]): CAST, offset=4, type_index=0",
-                   "5: #36(): CAST, offset=4, type_index=0",
-                   "6: #34(#35=[@#36(),@#36()]): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
-                   "7: #37(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}");
+            verify("RuntimeInvisibleTypeAnnotations",
+                   "0: #34(#35=[@#36(),@#36()]): CAST, offset=4, type_index=0",
+                   "1: #37(): CAST, offset=4, type_index=0",
+                   "2: #38(#35=[@#37(),@#37()]): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
+                   "3: #36(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
+                   "RuntimeInvisibleTypeAnnotations",
+                   "0: #38(#35=[@#37(),@#37()]): METHOD_FORMAL_PARAMETER, param_index=0",
+                   "1: #36(): METHOD_FORMAL_PARAMETER, param_index=0",
+                   "2: #37(): METHOD_FORMAL_PARAMETER, param_index=1",
+                   "3: #36(): METHOD_FORMAL_PARAMETER, param_index=1");
         }
     }
 
     @TestCase
     public static class TC11 extends RepeatingTypeAnnotations {
         public TC11() {
-            setSrc("    public Test(@C @C @A Object o, @A @B int i, long l) {",
+            setSrc(" /* TC11 */ ",
+                   "    public Test(@C @C @A Object o, @A @B int i, long l) {",
                    "        @C @C @A String ls = (@A @A @C String) o;",
                    "    }");
-            verify("RuntimeInvisibleTypeAnnotations",
-                   "RuntimeVisibleTypeAnnotations",
-                   "0: #34(#35=[@#36(),@#36()]): METHOD_FORMAL_PARAMETER, param_index=0",
-                   "1: #36(): CAST, offset=4",
-                   "2: #34(#35=[@#36(),@#36()]): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
-                   "0: #38(): METHOD_FORMAL_PARAMETER, param_index=0",
-                   "1: #38(): METHOD_FORMAL_PARAMETER, param_index=1",
-                   "2: #39(): METHOD_FORMAL_PARAMETER, param_index=1",
-                   "3: #40(#35=[@#38(),@#38()]): CAST, offset=4",
-                   "4: #38(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}");
+            verify("RuntimeVisibleTypeAnnotations",
+                   "RuntimeInvisibleTypeAnnotations",
+                   "0: #34(): CAST, offset=4, type_index=0",
+                   "1: #35(#36=[@#34(),@#34()]): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
+                   "0: #38(#36=[@#39(),@#39()]): CAST, offset=4, type_index=0",
+                   "1: #39(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
+                   "0: #35(#36=[@#34(),@#34()]): METHOD_FORMAL_PARAMETER, param_index=0",
+                   "0: #39(): METHOD_FORMAL_PARAMETER, param_index=0",
+                   "1: #39(): METHOD_FORMAL_PARAMETER, param_index=1",
+                   "2: #40(): METHOD_FORMAL_PARAMETER, param_index=1");
         }
     }
 
     @TestCase
     public static class TC12 extends RepeatingTypeAnnotations {
         public TC12() {
-            setSrc("    public Test(@A @B @C Object o, @A @C int i, long l) {",
+            setSrc(" /* TC12 */ ",
+                   "    public Test(@A @B @C Object o, @A @C int i, long l) {",
                    "        @A @B @C String ls = (@C @A @B String) o;",
                    "    }");
-            verify("RuntimeInvisibleTypeAnnotations",
-                   "RuntimeVisibleTypeAnnotations",
+            verify("RuntimeVisibleTypeAnnotations",
+                   "0: #34(): CAST, offset=4, type_index=0",
+                   "1: #34(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
+                   "RuntimeInvisibleTypeAnnotations",
+                   "0: #36(): CAST, offset=4, type_index=0",
+                   "1: #37(): CAST, offset=4, type_index=0",
+                   "2: #36(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
+                   "3: #37(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
                    "0: #34(): METHOD_FORMAL_PARAMETER, param_index=0",
                    "1: #34(): METHOD_FORMAL_PARAMETER, param_index=1",
-                   "2: #34(): CAST, offset=4",
-                   "3: #34(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
                    "0: #36(): METHOD_FORMAL_PARAMETER, param_index=0",
                    "1: #37(): METHOD_FORMAL_PARAMETER, param_index=0",
-                   "2: #36(): METHOD_FORMAL_PARAMETER, param_index=1",
-                   "3: #36(): CAST, offset=4",
-                   "4: #37(): CAST, offset=4",
-                   "5: #36(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
-                   "6: #37(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}");
+                   "2: #36(): METHOD_FORMAL_PARAMETER, param_index=1");
         }
     }
 
     @TestCase
     @ignore // 8008082:missing type annotation for cast
     public static class TC13 extends RepeatingTypeAnnotations {
         public TC13() {
-            setSrc("    public @A @A @A String foo(@A @A @A Object o, @A int i, long l) {",
+            setSrc(" /* TC13 */ ",
+                   "    public @A @A @A String foo(@A @A @A Object o, @A int i, long l) {",
                    "        @A @A @A String ls = (@B @B @B String) o;",
                    "        return (@A @A @A String) o;",
                    "    }");
             verify("RuntimeInvisibleTypeAnnotations",
                    "0: #36(#37=[@#38(),@#38(),@#38()]): METHOD_RETURN",

@@ -323,78 +338,82 @@
     }
 
     @TestCase
     public static class TC14 extends RepeatingTypeAnnotations {
         public TC14() {
-            setSrc("    public @A @B @B String foo(@A @A @B Object o, @A @B int i, long l) {",
+            setSrc(" /* TC14 */ ",
+                   "    public @A @B @B String foo(@A @A @B Object o, @A @B int i, long l) {",
                    "        @A @A @B String ls = (@B @A @B String) o;",
                    "        return (@A @B @B String) o;",
                    "    }");
-            verify("RuntimeInvisibleTypeAnnotations",
-                    "0: #36(): METHOD_RETURN",
-                    "1: #37(#38=[@#39(),@#39()]): METHOD_RETURN",
-                    "2: #40(#38=[@#36(),@#36()]): METHOD_FORMAL_PARAMETER, param_index=0",
-                    "3: #39(): METHOD_FORMAL_PARAMETER, param_index=0",
-                    "4: #36(): METHOD_FORMAL_PARAMETER, param_index=1",
-                    "5: #39(): METHOD_FORMAL_PARAMETER, param_index=1",
-                    "6: #37(#38=[@#39(),@#39()]): CAST, offset=0",
-                    "7: #36(): CAST, offset=0",
-                    "8: #36(): CAST, offset=6",
-                    "9: #37(#38=[@#39(),@#39()]): CAST, offset=6",
-                    "10: #40(#38=[@#36(),@#36()]): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
-                    "11: #39(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}");
+           verify("RuntimeInvisibleTypeAnnotations:",
+                  "0: #36(#37=[@#38(),@#38()]): CAST, offset=0, type_index=0",
+                  "1: #39(): CAST, offset=0, type_index=0",
+                  "2: #39(): CAST, offset=6, type_index=0",
+                  "3: #36(#37=[@#38(),@#38()]): CAST, offset=6, type_index=0",
+                  "4: #40(#37=[@#39(),@#39()]): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
+                  "5: #38(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
+                  "0: #39(): METHOD_RETURN",
+                  "1: #36(#37=[@#38(),@#38()]): METHOD_RETURN",
+                  "2: #40(#37=[@#39(),@#39()]): METHOD_FORMAL_PARAMETER, param_index=0",
+                  "3: #38(): METHOD_FORMAL_PARAMETER, param_index=0",
+                  "4: #39(): METHOD_FORMAL_PARAMETER, param_index=1",
+                  "5: #38(): METHOD_FORMAL_PARAMETER, param_index=1");
         }
     }
 
     @TestCase
     public static class TC15 extends RepeatingTypeAnnotations {
         public TC15() {
-            setSrc("    public @A @A @C String foo(@C @C @A Object o, @A @B int i, long l) {",
+            setSrc(" /* TC15 */ ",
+                   "    public @A @A @C String foo(@C @C @A Object o, @A @B int i, long l) {",
                    "        @C @C @A String ls = (@A @A @C String) o;",
                    "        return (@C @B @B String) o;",
                    "    }");
-            verify("RuntimeInvisibleTypeAnnotations",
-                    "RuntimeVisibleTypeAnnotations",
+            verify("RuntimeVisibleTypeAnnotations",
+                   "RuntimeInvisibleTypeAnnotations",
+                   "0: #36(): CAST, offset=0, type_index=0",
+                   "1: #36(): CAST, offset=6, type_index=0",
+                   "2: #37(#38=[@#36(),@#36()]): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
+                   "0: #40(#38=[@#41(),@#41()]): CAST, offset=0, type_index=0",
+                   "1: #42(#38=[@#43(),@#43()]): CAST, offset=6, type_index=0",
+                   "2: #41(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
                     "0: #36(): METHOD_RETURN",
                     "1: #37(#38=[@#36(),@#36()]): METHOD_FORMAL_PARAMETER, param_index=0",
-                    "2: #36(): CAST, offset=0",
-                    "3: #36(): CAST, offset=6",
-                    "4: #37(#38=[@#36(),@#36()]): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
                     "0: #40(#38=[@#41(),@#41()]): METHOD_RETURN",
                     "1: #41(): METHOD_FORMAL_PARAMETER, param_index=0",
                     "2: #41(): METHOD_FORMAL_PARAMETER, param_index=1",
-                    "3: #42(): METHOD_FORMAL_PARAMETER, param_index=1",
-                    "4: #40(#38=[@#41(),@#41()]): CAST, offset=0",
-                    "5: #43(#38=[@#42(),@#42()]): CAST, offset=6",
-                    "6: #41(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}");
+                   "3: #43(): METHOD_FORMAL_PARAMETER, param_index=1");
+
         }
     }
 
     @TestCase
     public static class TC16 extends RepeatingTypeAnnotations {
         public TC16() {
-            setSrc("    public @A @B @C String foo(@A @B @C Object o, @A @C int i, long l) {",
+            setSrc(" /* TC16 */ ",
+                   "    public @A @B @C String foo(@A @B @C Object o, @A @C int i, long l) {",
                    "        @A @B @C String ls = (@C @A @B String) o;",
                    "        return (@B @A @C String) o;",
                    "    }");
-            verify("RuntimeInvisibleTypeAnnotations",
-                   "RuntimeVisibleTypeAnnotations",
+            verify("RuntimeVisibleTypeAnnotations",
+                   "RuntimeInvisibleTypeAnnotations",
+                   "0: #36(): CAST, offset=0, type_index=0",
+                   "1: #36(): CAST, offset=6, type_index=0",
+                   "2: #36(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
+                   "0: #38(): CAST, offset=0, type_index=0",
+                   "1: #39(): CAST, offset=0, type_index=0",
+                   "2: #39(): CAST, offset=6, type_index=0",
+                   "3: #38(): CAST, offset=6, type_index=0",
+                   "4: #38(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
+                   "5: #39(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
                    "0: #36(): METHOD_RETURN",
                    "1: #36(): METHOD_FORMAL_PARAMETER, param_index=0",
                    "2: #36(): METHOD_FORMAL_PARAMETER, param_index=1",
-                   "3: #36(): CAST, offset=0",
-                   "4: #36(): CAST, offset=6",
-                   "5: #36(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
                    "0: #38(): METHOD_RETURN",
                    "1: #39(): METHOD_RETURN",
                    "2: #38(): METHOD_FORMAL_PARAMETER, param_index=0",
                    "3: #39(): METHOD_FORMAL_PARAMETER, param_index=0",
-                   "4: #38(): METHOD_FORMAL_PARAMETER, param_index=1",
-                   "5: #38(): CAST, offset=0",
-                   "6: #39(): CAST, offset=0",
-                   "7: #39(): CAST, offset=6",
-                   "8: #38(): CAST, offset=6",
-                   "9: #38(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
-                   "10: #39(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}");
+                   "4: #38(): METHOD_FORMAL_PARAMETER, param_index=1");
         }
     }
 }