test/tools/javap/output/RepeatingTypeAnnotations.java

Tue, 14 May 2013 15:04:06 -0700

author
jjg
date
Tue, 14 May 2013 15:04:06 -0700
changeset 1755
ddb4a2bfcd82
parent 1721
abd153854f16
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8013852: update reference impl for type-annotations
Reviewed-by: jjg
Contributed-by: wdietl@gmail.com, steve.sides@oracle.com, joel.franck@oracle.com, alex.buckley@oracle.com

jjg@1643 1 /*
jjg@1643 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
jjg@1643 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jjg@1643 4 *
jjg@1643 5 * This code is free software; you can redistribute it and/or modify it
jjg@1643 6 * under the terms of the GNU General Public License version 2 only, as
jjg@1643 7 * published by the Free Software Foundation.
jjg@1643 8 *
jjg@1643 9 * This code is distributed in the hope that it will be useful, but WITHOUT
jjg@1643 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jjg@1643 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jjg@1643 12 * version 2 for more details (a copy is included in the LICENSE file that
jjg@1643 13 * accompanied this code).
jjg@1643 14 *
jjg@1643 15 * You should have received a copy of the GNU General Public License version
jjg@1643 16 * 2 along with this work; if not, write to the Free Software Foundation,
jjg@1643 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jjg@1643 18 *
jjg@1643 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jjg@1643 20 * or visit www.oracle.com if you need additional information or have any
jjg@1643 21 * questions.
jjg@1643 22 */
jjg@1643 23
jjg@1643 24 /*
jjg@1643 25 * @test
jjg@1643 26 * @bug 8005220
jjg@1643 27 * @summary javap must display repeating annotations
jjg@1643 28 */
jjg@1643 29 import java.io.*;
jjg@1643 30 import java.util.*;
jjg@1643 31
jjg@1643 32 /**
jjg@1643 33 * This class extends the abstract {@link Tester} test-driver, and
jjg@1643 34 * encapusulates a number of test-case classes (i.e. classes extending
jjg@1643 35 * this class and annotated with {@code TestCase}).
jjg@1643 36 * <p>
jjg@1643 37 * By default (no argument), this test runs all test-cases, except
jjg@1643 38 * if annotated with {@code ignore}.
jjg@1643 39 * <p>
jjg@1643 40 * Individual test cases can be executed using a run action.
jjg@1643 41 * <p>
jjg@1643 42 * Example: @run main RepeatingTypeAnnotations RepeatingTypeAnnotations$TC4
jjg@1643 43 * <p>
jjg@1643 44 * Note: when specific test-cases are run, additional debug output is
jjg@1643 45 * produced to help debugging. Test annotated with {@code ignore}
jjg@1643 46 * can be executed explicitly.
jjg@1643 47 */
jjg@1643 48 public class RepeatingTypeAnnotations extends Tester {
jjg@1643 49
jjg@1643 50 /**
jjg@1643 51 * Main method instantiates test and run test-cases.
jjg@1643 52 */
jjg@1643 53 public static void main(String... args) throws Exception {
jjg@1643 54 Tester tester = new RepeatingTypeAnnotations();
jjg@1643 55 tester.run(args);
jjg@1643 56 }
jjg@1643 57
jjg@1643 58 /**
jjg@1643 59 * Testcases are classes extending {@code RepeatingTypeAnnotations},
jjg@1643 60 * and calling {@link setSrc}, followed by one or more invocations
jjg@1643 61 * of {@link verify} in the body of the constructor.
jjg@1643 62 */
jjg@1643 63 public RepeatingTypeAnnotations() {
jjg@1643 64 setSrc(new TestSource(template));
jjg@1643 65 }
jjg@1643 66
jjg@1643 67 /**
jjg@1643 68 * Common template for test cases. The line TESTCASE is
jjg@1643 69 * replaced with the specific lines of individual tests.
jjg@1643 70 */
jjg@1643 71 private static final String[] template = {
jjg@1643 72 "import java.lang.annotation.*;",
jjg@1643 73 "class Test {",
jjg@1643 74 " @Repeatable(As.class)",
jjg@1643 75 " @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})",
jjg@1643 76 " @Retention(RetentionPolicy.CLASS)",
jjg@1643 77 " @interface A {",
jjg@1643 78 " Class f() default int.class;",
jjg@1643 79 " }",
jjg@1643 80
jjg@1643 81 " @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})",
jjg@1643 82 " @Retention(RetentionPolicy.CLASS)",
jjg@1643 83 " @interface As { A[] value(); }",
jjg@1643 84
jjg@1643 85 " @Repeatable(Bs.class)",
jjg@1643 86 " @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})",
jjg@1643 87 " @Retention(RetentionPolicy.CLASS)",
jjg@1643 88 " @interface B {",
jjg@1643 89 " Class f() default int.class;",
jjg@1643 90 " }",
jjg@1643 91
jjg@1643 92 " @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})",
jjg@1643 93 " @Retention(RetentionPolicy.CLASS)",
jjg@1643 94 " @interface Bs { B[] value(); }",
jjg@1643 95
jjg@1643 96 " @Repeatable(Cs.class)",
jjg@1643 97 " @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})",
jjg@1643 98 " @Retention(RetentionPolicy.RUNTIME)",
jjg@1643 99 " @interface C {",
jjg@1643 100 " Class f() default int.class;",
jjg@1643 101 " }",
jjg@1643 102
jjg@1643 103 " @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})",
jjg@1643 104 " @Retention(RetentionPolicy.RUNTIME)",
jjg@1643 105 " @interface Cs { C[] value(); }",
jjg@1643 106 "TESTCASE",
jjg@1643 107 "}"
jjg@1643 108 };
jjg@1643 109
jjg@1643 110 /*
jjg@1643 111 * The test cases covers annotation in the following locations:
jjg@1643 112 * - static and non-static fields
jjg@1643 113 * - local variables
jjg@1643 114 * - constructor and method return type and parameter types
jjg@1643 115 * - casts in class and method contexts.
jjg@1643 116 * For the above locations the test-cases covers:
jjg@1643 117 * - single annotation type
jjg@1643 118 * - two annotation types with same retention
jjg@1643 119 * - two annotation types with different retention
jjg@1643 120 * - three annotation types, two of same retention, one different.
jjg@1643 121 */
jjg@1643 122
jjg@1643 123 @TestCase
jjg@1643 124 public static class TC1 extends RepeatingTypeAnnotations {
jjg@1643 125 public TC1() {
jjg@1755 126 setSrc(" /* TC1 */ ",
jjg@1755 127 " static String so = \"hello world\";",
jjg@1643 128 " public @A @A @A Object o = (@A @A @A String) Test.so;");
jjg@1643 129 verify("RuntimeInvisibleTypeAnnotations",
jjg@1643 130 "0: #25(#26=[@#27(),@#27(),@#27()]): FIELD",
jjg@1755 131 "0: #25(#26=[@#27(),@#27(),@#27()]): CAST, offset=5, type_index=0");
jjg@1643 132 }
jjg@1643 133 }
jjg@1643 134
jjg@1643 135 @TestCase
jjg@1643 136 public static class TC2 extends RepeatingTypeAnnotations {
jjg@1643 137 public TC2() {
jjg@1755 138 setSrc(" /* TC2 */ ",
jjg@1755 139 " static String so = \"hello world\";",
jjg@1643 140 " public @A @B @A Object o = (@B @A @B String) Test.so;");
jjg@1643 141 verify("RuntimeInvisibleTypeAnnotations",
jjg@1643 142 "0: #25(#26=[@#27(),@#27()]): FIELD",
jjg@1643 143 "1: #28(): FIELD",
jjg@1755 144 "0: #36(#26=[@#28(),@#28()]): CAST, offset=5, type_index=0",
jjg@1755 145 "1: #27(): CAST, offset=5, type_index=0");
jjg@1643 146 }
jjg@1643 147 }
jjg@1643 148
jjg@1643 149 @TestCase
jjg@1643 150 public static class TC3 extends RepeatingTypeAnnotations {
jjg@1643 151 public TC3() {
jjg@1755 152 setSrc(" /* TC3 */ ",
jjg@1755 153 " static String so = \"hello world\";",
jjg@1643 154 " public @A @A @C Object o = (@B @C @B String) Test.so;");
jjg@1755 155 verify("RuntimeVisibleTypeAnnotations",
jjg@1755 156 "RuntimeInvisibleTypeAnnotations",
jjg@1643 157 "0: #25(): FIELD",
jjg@1643 158 "0: #27(#28=[@#29(),@#29()]): FIELD",
jjg@1755 159 "0: #25(): CAST, offset=5, type_index=0",
jjg@1755 160 "0: #37(#28=[@#38(),@#38()]): CAST, offset=5, type_index=0");
jjg@1643 161 }
jjg@1643 162 }
jjg@1643 163
jjg@1643 164 @TestCase
jjg@1643 165 public static class TC4 extends RepeatingTypeAnnotations {
jjg@1643 166 public TC4() {
jjg@1755 167 setSrc(" /* TC4 */ ",
jjg@1755 168 " static String so = \"hello world\";",
jjg@1643 169 " public @A @B @C Object o = (@C @B @A String) Test.so;");
jjg@1643 170 verify("RuntimeInvisibleTypeAnnotations",
jjg@1643 171 "RuntimeVisibleTypeAnnotations",
jjg@1643 172 "0: #25(): FIELD",
jjg@1643 173 "0: #27(): FIELD",
jjg@1643 174 "1: #28(): FIELD",
jjg@1755 175 "0: #25(): CAST, offset=5, type_index=0",
jjg@1755 176 "0: #28(): CAST, offset=5, type_index=0",
jjg@1755 177 "1: #27(): CAST, offset=5, type_index=0");
jjg@1643 178 }
jjg@1643 179 }
jjg@1643 180
jjg@1643 181 @TestCase
jjg@1643 182 public static class TC5 extends RepeatingTypeAnnotations {
jjg@1643 183 public TC5() {
jjg@1755 184 setSrc(" /* TC5 */ ",
jjg@1755 185 " static String so = \"hello world\";",
jjg@1643 186 " public static @A @A @A Object o = (@B @B @B String) Test.so;");
jjg@1643 187 verify("RuntimeInvisibleTypeAnnotations",
jjg@1643 188 "0: #25(#26=[@#27(),@#27(),@#27()]): FIELD",
jjg@1755 189 "0: #36(#26=[@#37(),@#37(),@#37()]): CAST, offset=5, type_index=0");
jjg@1643 190 }
jjg@1643 191 }
jjg@1643 192
jjg@1643 193 @TestCase
jjg@1643 194 public static class TC6 extends RepeatingTypeAnnotations {
jjg@1643 195 public TC6() {
jjg@1755 196 setSrc(" /* TC6 */ ",
jjg@1755 197 " static String so = \"hello world\";",
jjg@1643 198 " public static @A @B @A Object o = (@B @A @B String) Test.so;");
jjg@1643 199 verify("RuntimeInvisibleTypeAnnotations",
jjg@1643 200 "0: #25(#26=[@#27(),@#27()]): FIELD",
jjg@1643 201 "1: #28(): FIELD",
jjg@1755 202 "0: #37(#26=[@#28(),@#28()]): CAST, offset=5, type_index=0",
jjg@1755 203 "1: #27(): CAST, offset=5, type_index=0");
jjg@1643 204 }
jjg@1643 205 }
jjg@1643 206
jjg@1643 207 @TestCase
jjg@1643 208 public static class TC7 extends RepeatingTypeAnnotations {
jjg@1643 209 public TC7() {
jjg@1755 210 setSrc(" /* TC7 */ ",
jjg@1755 211 " static String so = \"hello world\";",
jjg@1643 212 " public static @A @A @C Object o = (@B @C @B String) Test.so;");
jjg@1755 213 verify("RuntimeVisibleTypeAnnotations",
jjg@1755 214 "RuntimeInvisibleTypeAnnotations",
jjg@1643 215 "0: #25(): FIELD",
jjg@1643 216 "0: #27(#28=[@#29(),@#29()]): FIELD",
jjg@1755 217 "0: #25(): CAST, offset=5, type_index=0",
jjg@1755 218 "0: #38(#28=[@#39(),@#39()]): CAST, offset=5, type_index=0");
jjg@1643 219 }
jjg@1643 220 }
jjg@1643 221
jjg@1643 222 @TestCase
jjg@1643 223 public static class TC8 extends RepeatingTypeAnnotations {
jjg@1643 224 public TC8() {
jjg@1755 225 setSrc(" /* TC8 */ ",
jjg@1755 226 " static String so = \"hello world\";",
jjg@1643 227 " public static @A @B @C Object o = (@C @B @A String) Test.so;");
jjg@1755 228
jjg@1755 229 verify("RuntimeVisibleTypeAnnotations",
jjg@1755 230 "RuntimeInvisibleTypeAnnotations",
jjg@1643 231 "0: #25(): FIELD",
jjg@1643 232 "0: #27(): FIELD",
jjg@1643 233 "1: #28(): FIELD",
jjg@1755 234 "0: #25(): CAST, offset=5, type_index=0",
jjg@1755 235 "0: #28(): CAST, offset=5, type_index=0",
jjg@1755 236 "1: #27(): CAST, offset=5, type_index=0");
jjg@1643 237 }
jjg@1643 238 }
jjg@1643 239
jjg@1643 240 @TestCase
jjg@1643 241 public static class TC9 extends RepeatingTypeAnnotations {
jjg@1643 242 public TC9() {
jjg@1755 243 setSrc(" /* TC9 */ ",
jjg@1755 244 " public Test(@A @A @A Object o, @A int i, long l) {",
jjg@1643 245 " @A @A @A String ls = (@B @B @B String) o;",
jjg@1643 246 " }");
jjg@1643 247 verify("RuntimeInvisibleTypeAnnotations",
jjg@1755 248 "0: #34(#35=[@#36(),@#36(),@#36()]): CAST, offset=4, type_index=0",
jjg@1755 249 "1: #37(#35=[@#38(),@#38(),@#38()]): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
jjg@1755 250 "RuntimeInvisibleTypeAnnotations",
jjg@1755 251 "0: #37(#35=[@#38(),@#38(),@#38()]): METHOD_FORMAL_PARAMETER, param_index=0",
jjg@1755 252 "1: #38(): METHOD_FORMAL_PARAMETER, param_index=1");
jjg@1643 253 }
jjg@1643 254 }
jjg@1643 255
jjg@1643 256 @TestCase
jjg@1643 257 public static class TC10 extends RepeatingTypeAnnotations {
jjg@1643 258 public TC10() {
jjg@1755 259 setSrc(" /* TC10 */ ",
jjg@1755 260 " public Test(@A @A @B Object o, @A @B int i, long l) {",
jjg@1643 261 " @A @A @B String ls = (@B @A @B String) o;",
jjg@1643 262 " }");
jjg@1755 263 verify("RuntimeInvisibleTypeAnnotations",
jjg@1755 264 "0: #34(#35=[@#36(),@#36()]): CAST, offset=4, type_index=0",
jjg@1755 265 "1: #37(): CAST, offset=4, type_index=0",
jjg@1755 266 "2: #38(#35=[@#37(),@#37()]): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
jjg@1755 267 "3: #36(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
jjg@1755 268 "RuntimeInvisibleTypeAnnotations",
jjg@1755 269 "0: #38(#35=[@#37(),@#37()]): METHOD_FORMAL_PARAMETER, param_index=0",
jjg@1755 270 "1: #36(): METHOD_FORMAL_PARAMETER, param_index=0",
jjg@1755 271 "2: #37(): METHOD_FORMAL_PARAMETER, param_index=1",
jjg@1755 272 "3: #36(): METHOD_FORMAL_PARAMETER, param_index=1");
jjg@1643 273 }
jjg@1643 274 }
jjg@1643 275
jjg@1643 276 @TestCase
jjg@1643 277 public static class TC11 extends RepeatingTypeAnnotations {
jjg@1643 278 public TC11() {
jjg@1755 279 setSrc(" /* TC11 */ ",
jjg@1755 280 " public Test(@C @C @A Object o, @A @B int i, long l) {",
jjg@1643 281 " @C @C @A String ls = (@A @A @C String) o;",
jjg@1643 282 " }");
jjg@1755 283 verify("RuntimeVisibleTypeAnnotations",
jjg@1755 284 "RuntimeInvisibleTypeAnnotations",
jjg@1755 285 "0: #34(): CAST, offset=4, type_index=0",
jjg@1755 286 "1: #35(#36=[@#34(),@#34()]): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
jjg@1755 287 "0: #38(#36=[@#39(),@#39()]): CAST, offset=4, type_index=0",
jjg@1755 288 "1: #39(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
jjg@1755 289 "0: #35(#36=[@#34(),@#34()]): METHOD_FORMAL_PARAMETER, param_index=0",
jjg@1755 290 "0: #39(): METHOD_FORMAL_PARAMETER, param_index=0",
jjg@1755 291 "1: #39(): METHOD_FORMAL_PARAMETER, param_index=1",
jjg@1755 292 "2: #40(): METHOD_FORMAL_PARAMETER, param_index=1");
jjg@1643 293 }
jjg@1643 294 }
jjg@1643 295
jjg@1643 296 @TestCase
jjg@1643 297 public static class TC12 extends RepeatingTypeAnnotations {
jjg@1643 298 public TC12() {
jjg@1755 299 setSrc(" /* TC12 */ ",
jjg@1755 300 " public Test(@A @B @C Object o, @A @C int i, long l) {",
jjg@1643 301 " @A @B @C String ls = (@C @A @B String) o;",
jjg@1643 302 " }");
jjg@1755 303 verify("RuntimeVisibleTypeAnnotations",
jjg@1755 304 "0: #34(): CAST, offset=4, type_index=0",
jjg@1755 305 "1: #34(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
jjg@1755 306 "RuntimeInvisibleTypeAnnotations",
jjg@1755 307 "0: #36(): CAST, offset=4, type_index=0",
jjg@1755 308 "1: #37(): CAST, offset=4, type_index=0",
jjg@1755 309 "2: #36(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
jjg@1755 310 "3: #37(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
jjg@1643 311 "0: #34(): METHOD_FORMAL_PARAMETER, param_index=0",
jjg@1643 312 "1: #34(): METHOD_FORMAL_PARAMETER, param_index=1",
jjg@1643 313 "0: #36(): METHOD_FORMAL_PARAMETER, param_index=0",
jjg@1643 314 "1: #37(): METHOD_FORMAL_PARAMETER, param_index=0",
jjg@1755 315 "2: #36(): METHOD_FORMAL_PARAMETER, param_index=1");
jjg@1643 316 }
jjg@1643 317 }
jjg@1643 318
jjg@1643 319 @TestCase
jjg@1643 320 public static class TC13 extends RepeatingTypeAnnotations {
jjg@1643 321 public TC13() {
jjg@1755 322 setSrc(" /* TC13 */ ",
jjg@1755 323 " public @A @A @A String foo(@A @A @A Object o, @A int i, long l) {",
jjg@1643 324 " @A @A @A String ls = (@B @B @B String) o;",
jjg@1643 325 " return (@A @A @A String) o;",
jjg@1643 326 " }");
jjg@1643 327 verify("RuntimeInvisibleTypeAnnotations",
jjg@1755 328 "0: #36(#37=[@#38(),@#38(),@#38()]): CAST, offset=0, type_index=0",
jjg@1755 329 "1: #39(#37=[@#40(),@#40(),@#40()]): CAST, offset=6, type_index=0",
jjg@1755 330 "2: #39(#37=[@#40(),@#40(),@#40()]): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
jjg@1755 331 "RuntimeInvisibleTypeAnnotations",
jjg@1755 332 "0: #39(#37=[@#40(),@#40(),@#40()]): METHOD_RETURN",
jjg@1755 333 "1: #39(#37=[@#40(),@#40(),@#40()]): METHOD_FORMAL_PARAMETER, param_index=0",
jjg@1755 334 "2: #40(): METHOD_FORMAL_PARAMETER, param_index=1");
jjg@1643 335 }
jjg@1643 336 }
jjg@1643 337
jjg@1643 338 @TestCase
jjg@1643 339 public static class TC14 extends RepeatingTypeAnnotations {
jjg@1643 340 public TC14() {
jjg@1755 341 setSrc(" /* TC14 */ ",
jjg@1755 342 " public @A @B @B String foo(@A @A @B Object o, @A @B int i, long l) {",
jjg@1643 343 " @A @A @B String ls = (@B @A @B String) o;",
jjg@1643 344 " return (@A @B @B String) o;",
jjg@1643 345 " }");
jjg@1755 346 verify(
jjg@1755 347 "RuntimeInvisibleTypeAnnotations:",
jjg@1755 348 "0: #36(#37=[@#38(),@#38()]): CAST, offset=0, type_index=0",
jjg@1755 349 "1: #39(): CAST, offset=0, type_index=0",
jjg@1755 350 "2: #39(): CAST, offset=6, type_index=0",
jjg@1755 351 "3: #36(#37=[@#38(),@#38()]): CAST, offset=6, type_index=0",
jjg@1755 352 "4: #40(#37=[@#39(),@#39()]): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
jjg@1755 353 "5: #38(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
jjg@1755 354 "RuntimeInvisibleTypeAnnotations:",
jjg@1755 355 "0: #39(): METHOD_RETURN",
jjg@1755 356 "1: #36(#37=[@#38(),@#38()]): METHOD_RETURN",
jjg@1755 357 "2: #40(#37=[@#39(),@#39()]): METHOD_FORMAL_PARAMETER, param_index=0",
jjg@1755 358 "3: #38(): METHOD_FORMAL_PARAMETER, param_index=0",
jjg@1755 359 "4: #39(): METHOD_FORMAL_PARAMETER, param_index=1",
jjg@1755 360 "5: #38(): METHOD_FORMAL_PARAMETER, param_index=1"
jjg@1755 361 );
jjg@1643 362 }
jjg@1643 363 }
jjg@1643 364
jjg@1643 365 @TestCase
jjg@1643 366 public static class TC15 extends RepeatingTypeAnnotations {
jjg@1643 367 public TC15() {
jjg@1755 368 setSrc(" /* TC15 */ ",
jjg@1755 369 " public @A @A @C String foo(@C @C @A Object o, @A @B int i, long l) {",
jjg@1643 370 " @C @C @A String ls = (@A @A @C String) o;",
jjg@1643 371 " return (@C @B @B String) o;",
jjg@1643 372 " }");
jjg@1755 373 verify(
jjg@1755 374 "RuntimeVisibleTypeAnnotations:",
jjg@1755 375 "0: #36(): CAST, offset=0, type_index=0",
jjg@1755 376 "1: #36(): CAST, offset=6, type_index=0",
jjg@1755 377 "2: #37(#38=[@#36(),@#36()]): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
jjg@1755 378 "RuntimeInvisibleTypeAnnotations:",
jjg@1755 379 "0: #40(#38=[@#41(),@#41()]): CAST, offset=0, type_index=0",
jjg@1755 380 "1: #42(#38=[@#43(),@#43()]): CAST, offset=6, type_index=0",
jjg@1755 381 "2: #41(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
jjg@1755 382 "RuntimeVisibleTypeAnnotations:",
jjg@1755 383 "0: #36(): METHOD_RETURN",
jjg@1755 384 "1: #37(#38=[@#36(),@#36()]): METHOD_FORMAL_PARAMETER, param_index=0",
jjg@1755 385 "RuntimeInvisibleTypeAnnotations:",
jjg@1755 386 "0: #40(#38=[@#41(),@#41()]): METHOD_RETURN",
jjg@1755 387 "1: #41(): METHOD_FORMAL_PARAMETER, param_index=0",
jjg@1755 388 "2: #41(): METHOD_FORMAL_PARAMETER, param_index=1",
jjg@1755 389 "3: #43(): METHOD_FORMAL_PARAMETER, param_index=1"
jjg@1755 390 );
jjg@1643 391 }
jjg@1643 392 }
jjg@1643 393
jjg@1643 394 @TestCase
jjg@1643 395 public static class TC16 extends RepeatingTypeAnnotations {
jjg@1643 396 public TC16() {
jjg@1755 397 setSrc(" /* TC16 */ ",
jjg@1755 398 " public @A @B @C String foo(@A @B @C Object o, @A @C int i, long l) {",
jjg@1643 399 " @A @B @C String ls = (@C @A @B String) o;",
jjg@1643 400 " return (@B @A @C String) o;",
jjg@1643 401 " }");
jjg@1755 402 verify(
jjg@1755 403 "RuntimeVisibleTypeAnnotations:",
jjg@1755 404 "0: #36(): CAST, offset=0, type_index=0",
jjg@1755 405 "1: #36(): CAST, offset=6, type_index=0",
jjg@1755 406 "2: #36(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
jjg@1755 407 "RuntimeInvisibleTypeAnnotations:",
jjg@1755 408 "0: #38(): CAST, offset=0, type_index=0",
jjg@1755 409 "1: #39(): CAST, offset=0, type_index=0",
jjg@1755 410 "2: #39(): CAST, offset=6, type_index=0",
jjg@1755 411 "3: #38(): CAST, offset=6, type_index=0",
jjg@1755 412 "4: #38(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
jjg@1755 413 "5: #39(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
jjg@1755 414 "RuntimeVisibleTypeAnnotations:",
jjg@1643 415 "0: #36(): METHOD_RETURN",
jjg@1643 416 "1: #36(): METHOD_FORMAL_PARAMETER, param_index=0",
jjg@1643 417 "2: #36(): METHOD_FORMAL_PARAMETER, param_index=1",
jjg@1755 418 "RuntimeInvisibleTypeAnnotations:",
jjg@1643 419 "0: #38(): METHOD_RETURN",
jjg@1643 420 "1: #39(): METHOD_RETURN",
jjg@1643 421 "2: #38(): METHOD_FORMAL_PARAMETER, param_index=0",
jjg@1643 422 "3: #39(): METHOD_FORMAL_PARAMETER, param_index=0",
jjg@1755 423 "4: #38(): METHOD_FORMAL_PARAMETER, param_index=1"
jjg@1755 424 );
jjg@1643 425 }
jjg@1643 426 }
jjg@1643 427 }

mercurial