author | emc |
Fri, 13 Feb 2015 17:00:45 -0500 | |
changeset 29050 | 76df9080086c |
parent 27545 | 9b19c6e31489 |
child 30730 | d3ce7619db2c |
permissions | -rw-r--r-- |
15385 | 1 |
/* |
17578 | 2 |
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
15385 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
/* |
|
25 |
* @test |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
26 |
* @bug 8026791 8042451 |
15385 | 27 |
* @summary Test population of reference info for constructor results |
28 |
* @compile -g Driver.java ReferenceInfoUtil.java Constructors.java |
|
29 |
* @run main Driver Constructors |
|
30 |
*/ |
|
21481
f0aeb1da97bd
8026791: wrong type_path encoded for method_return on an inner class constructor
jjg
parents:
19651
diff
changeset
|
31 |
|
f0aeb1da97bd
8026791: wrong type_path encoded for method_return on an inner class constructor
jjg
parents:
19651
diff
changeset
|
32 |
import static com.sun.tools.classfile.TypeAnnotation.TargetType.*; |
f0aeb1da97bd
8026791: wrong type_path encoded for method_return on an inner class constructor
jjg
parents:
19651
diff
changeset
|
33 |
|
15385 | 34 |
public class Constructors { |
35 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
36 |
@TADescription(annotation = "TA", type = METHOD_RETURN) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
37 |
@TADescription(annotation = "TB", type = METHOD_RETURN) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
38 |
@TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
15385 | 39 |
public String regularClass() { |
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
40 |
return "class %TEST_CLASS_NAME% { @TA %TEST_CLASS_NAME%() {}" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
41 |
" @TB %TEST_CLASS_NAME%(@TC int b) {} }"; |
15385 | 42 |
} |
43 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
44 |
@TADescription(annotation = "TA", type = METHOD_RETURN, genericLocation = {1, 0}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
45 |
@TADescription(annotation = "TB", type = METHOD_RETURN, genericLocation = {1, 0}) |
29050 | 46 |
@TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
47 |
@TestClass("%TEST_CLASS_NAME%$Inner") |
15385 | 48 |
public String innerClass() { |
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
49 |
return "class %TEST_CLASS_NAME% { class Inner {" + |
15385 | 50 |
" @TA Inner() {}" + |
51 |
" @TB Inner(@TC int b) {}" + |
|
52 |
" } }"; |
|
53 |
} |
|
54 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
55 |
@TADescription(annotation = "TA", type = METHOD_RECEIVER) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
56 |
@TADescription(annotation = "TB", type = METHOD_RETURN, genericLocation = {1, 0}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
57 |
@TADescription(annotation = "TC", type = METHOD_RECEIVER) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
58 |
@TADescription(annotation = "TD", type = METHOD_RETURN, genericLocation = {1, 0}) |
29050 | 59 |
@TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
60 |
@TestClass("%TEST_CLASS_NAME%$Inner") |
15385 | 61 |
public String innerClass2() { |
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
62 |
return "class %TEST_CLASS_NAME% { class Inner {" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
63 |
" @TB Inner(@TA %TEST_CLASS_NAME% %TEST_CLASS_NAME%.this) {}" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
64 |
" @TD Inner(@TC %TEST_CLASS_NAME% %TEST_CLASS_NAME%.this, @TE int b) {}" + |
15385 | 65 |
" } }"; |
66 |
} |
|
17578 | 67 |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
68 |
@TADescription(annotation = "TA", type = METHOD_RECEIVER) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
69 |
@TADescription(annotation = "TB", type = METHOD_RECEIVER, genericLocation = {1, 0}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
70 |
@TADescription(annotation = "TC", type = METHOD_RETURN, genericLocation = {1, 0, 1, 0}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
71 |
@TADescription(annotation = "TD", type = METHOD_RECEIVER, genericLocation = {1, 0}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
72 |
@TADescription(annotation = "TE", type = METHOD_RETURN, genericLocation = {1, 0, 1, 0}) |
29050 | 73 |
@TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
17578 | 74 |
@TestClass("Outer$Middle$Inner") |
75 |
public String innerClass3() { |
|
76 |
return "class Outer { class Middle { class Inner {" + |
|
77 |
" @TC Inner(@TA Outer. @TB Middle Middle.this) {}" + |
|
78 |
" @TE Inner(@TD Middle Outer.Middle.this, @TF int b) {}" + |
|
79 |
" } } }"; |
|
80 |
} |
|
81 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
82 |
@TADescription(annotation = "RTAs", type = METHOD_RETURN) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
83 |
@TADescription(annotation = "RTBs", type = METHOD_RETURN) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
84 |
@TADescription(annotation = "RTCs", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
85 |
public String regularClassRepeatableAnnotation() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
86 |
return "class %TEST_CLASS_NAME% { @RTA @RTA %TEST_CLASS_NAME%() {}" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
87 |
" @RTB @RTB %TEST_CLASS_NAME%(@RTC @RTC int b) {} }"; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
88 |
} |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
89 |
|
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
90 |
@TADescription(annotation = "RTAs", type = METHOD_RETURN, genericLocation = {1, 0}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
91 |
@TADescription(annotation = "RTBs", type = METHOD_RETURN, genericLocation = {1, 0}) |
29050 | 92 |
@TADescription(annotation = "RTCs", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
93 |
@TestClass("%TEST_CLASS_NAME%$Inner") |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
94 |
public String innerClassRepeatableAnnotation() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
95 |
return "class %TEST_CLASS_NAME% { class Inner {" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
96 |
" @RTA @RTA Inner() {}" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
97 |
" @RTB @RTB Inner(@RTC @RTC int b) {}" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
98 |
" } }"; |
19651 | 99 |
} |
100 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
101 |
@TADescription(annotation = "RTAs", type = METHOD_RECEIVER) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
102 |
@TADescription(annotation = "RTBs", type = METHOD_RETURN, genericLocation = {1, 0}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
103 |
@TADescription(annotation = "RTCs", type = METHOD_RECEIVER) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
104 |
@TADescription(annotation = "RTDs", type = METHOD_RETURN, genericLocation = {1, 0}) |
29050 | 105 |
@TADescription(annotation = "RTEs", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
106 |
@TestClass("%TEST_CLASS_NAME%$Inner") |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
107 |
public String innerClassRepeatableAnnotation2() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
108 |
return "class %TEST_CLASS_NAME% { class Inner {" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
109 |
" @RTB @RTB Inner(@RTA @RTA %TEST_CLASS_NAME% %TEST_CLASS_NAME%.this) {}" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
110 |
" @RTD @RTD Inner(@RTC @RTC %TEST_CLASS_NAME% %TEST_CLASS_NAME%.this, @RTE @RTE int b) {}" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
111 |
" } }"; |
19651 | 112 |
} |
113 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
114 |
@TADescription(annotation = "RTAs", type = METHOD_RECEIVER) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
115 |
@TADescription(annotation = "RTBs", type = METHOD_RECEIVER, genericLocation = {1, 0}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
116 |
@TADescription(annotation = "RTCs", type = METHOD_RETURN, genericLocation = {1, 0, 1, 0}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
117 |
@TADescription(annotation = "RTDs", type = METHOD_RECEIVER, genericLocation = {1, 0}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
118 |
@TADescription(annotation = "RTEs", type = METHOD_RETURN, genericLocation = {1, 0, 1, 0}) |
29050 | 119 |
@TADescription(annotation = "RTFs", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
120 |
@TestClass("Outer$Middle$Inner") |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
121 |
public String innerClassRepatableAnnotation3() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
122 |
return "class Outer { class Middle { class Inner {" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
123 |
" @RTC @RTC Inner(@RTA @RTA Outer. @RTB @RTB Middle Middle.this) {}" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
124 |
" @RTE @RTE Inner(@RTD @RTD Middle Outer.Middle.this, @RTF @RTF int b) {}" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
125 |
" } } }"; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
21481
diff
changeset
|
126 |
} |
15385 | 127 |
} |