test/tools/javap/output/RepeatingTypeAnnotations.java

Sat, 07 Nov 2020 10:30:02 +0800

author
aoqi
date
Sat, 07 Nov 2020 10:30:02 +0800
changeset 3938
93012e2a5d1d
parent 2525
2eb010b6cb22
permissions
-rw-r--r--

Added tag mips-jdk8u275-b01 for changeset eb6ee6a5f2fe

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

mercurial