author | mchung |
Wed, 27 May 2015 13:25:18 -0700 | |
changeset 30846 | 2b3f379840f0 |
parent 30730 | d3ce7619db2c |
permissions | -rw-r--r-- |
15385 | 1 |
/* |
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
24896
diff
changeset
|
2 |
* Copyright (c) 2009, 2015, 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 |
import static com.sun.tools.classfile.TypeAnnotation.TargetType.*; |
|
25 |
||
26 |
/* |
|
27 |
* @test |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
28 |
* @bug 8042451 |
15385 | 29 |
* @summary Test population of reference info for method receivers |
30846 | 30 |
* @modules jdk.jdeps/com.sun.tools.classfile |
15385 | 31 |
* @compile -g Driver.java ReferenceInfoUtil.java MethodReceivers.java |
32 |
* @run main Driver MethodReceivers |
|
33 |
*/ |
|
34 |
public class MethodReceivers { |
|
35 |
||
36 |
@TADescription(annotation = "TA", type = METHOD_RECEIVER) |
|
37 |
public String regularMethod() { |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
38 |
return "class %TEST_CLASS_NAME% { void test(@TA %TEST_CLASS_NAME% this) { } }"; |
15385 | 39 |
} |
40 |
||
41 |
@TADescription(annotation = "TA", type = METHOD_RECEIVER) |
|
42 |
public String abstractMethod() { |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
43 |
return "abstract class %TEST_CLASS_NAME% { abstract void test(@TA %TEST_CLASS_NAME% this); }"; |
15385 | 44 |
} |
45 |
||
46 |
@TADescription(annotation = "TA", type = METHOD_RECEIVER) |
|
47 |
public String interfaceMethod() { |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
48 |
return "interface %TEST_CLASS_NAME% { void test(@TA %TEST_CLASS_NAME% this); }"; |
15385 | 49 |
} |
50 |
||
51 |
@TADescription(annotation = "TA", type = METHOD_RECEIVER) |
|
52 |
public String regularWithThrows() { |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
53 |
return "class %TEST_CLASS_NAME% { void test(@TA %TEST_CLASS_NAME% this) throws Exception { } }"; |
15385 | 54 |
} |
55 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
56 |
@TADescription(annotation = "TA", type = METHOD_RECEIVER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
57 |
genericLocation = {}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
58 |
@TADescription(annotation = "TB", type = METHOD_RECEIVER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
59 |
genericLocation = {1, 0}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
60 |
@TestClass("%TEST_CLASS_NAME%$TestInner") |
15385 | 61 |
public String nestedtypes1() { |
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
62 |
return "class %TEST_CLASS_NAME% { class TestInner { void test(@TA %TEST_CLASS_NAME%. @TB TestInner this) { } } }"; |
15385 | 63 |
} |
64 |
||
65 |
@TADescription(annotation = "TA", type = METHOD_RECEIVER, |
|
66 |
genericLocation = {}) |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
67 |
@TestClass("%TEST_CLASS_NAME%$TestInner") |
15385 | 68 |
public String nestedtypes2() { |
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
69 |
return "class %TEST_CLASS_NAME% { class TestInner { void test(@TA %TEST_CLASS_NAME%.TestInner this) { } } }"; |
15385 | 70 |
} |
71 |
||
72 |
@TADescription(annotation = "TB", type = METHOD_RECEIVER, |
|
73 |
genericLocation = {1, 0}) |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
74 |
@TestClass("%TEST_CLASS_NAME%$TestInner") |
15385 | 75 |
public String nestedtypes3() { |
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
76 |
return "class %TEST_CLASS_NAME% { class TestInner { void test(%TEST_CLASS_NAME%. @TB TestInner this) { } } }"; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
77 |
} |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
78 |
|
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
79 |
@TADescription(annotation = "RTAs", type = METHOD_RECEIVER) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
80 |
public String regularMethodRepeatableAnnotation() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
81 |
return "class %TEST_CLASS_NAME% { void test(@RTA @RTA %TEST_CLASS_NAME% this) { } }"; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
82 |
} |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
83 |
|
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
84 |
@TADescription(annotation = "RTAs", type = METHOD_RECEIVER) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
85 |
public String abstractMethodRepeatablaAnnotation() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
86 |
return "abstract class %TEST_CLASS_NAME% { abstract void test(@RTA @RTA %TEST_CLASS_NAME% this); }"; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
87 |
} |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
88 |
|
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
89 |
@TADescription(annotation = "RTAs", type = METHOD_RECEIVER) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
90 |
public String interfaceMethodRepeatableAnnotation() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
91 |
return "interface %TEST_CLASS_NAME% { void test(@RTA @RTA %TEST_CLASS_NAME% this); }"; |
15385 | 92 |
} |
93 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
94 |
@TADescription(annotation = "RTAs", type = METHOD_RECEIVER) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
95 |
public String regularWithThrowsRepeatableAnnotation() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
96 |
return "class %TEST_CLASS_NAME% { void test(@RTA @RTA %TEST_CLASS_NAME% this) throws Exception { } }"; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
97 |
} |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
98 |
|
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
99 |
@TADescription(annotation = "RTAs", type = METHOD_RECEIVER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
100 |
genericLocation = {}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
101 |
@TADescription(annotation = "RTBs", type = METHOD_RECEIVER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
102 |
genericLocation = {1, 0}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
103 |
@TestClass("%TEST_CLASS_NAME%$TestInner") |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
104 |
public String nestedtypesRepeatableAnnotation1() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
105 |
return "class %TEST_CLASS_NAME% { class TestInner { void test(@RTA @RTA %TEST_CLASS_NAME%. @RTB @RTB TestInner this) { } } }"; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
106 |
} |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
107 |
|
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
108 |
@TADescription(annotation = "RTAs", type = METHOD_RECEIVER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
109 |
genericLocation = {}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
110 |
@TestClass("%TEST_CLASS_NAME%$TestInner") |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
111 |
public String nestedtypesRepeatableAnnotation2() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
112 |
return "class %TEST_CLASS_NAME% { class TestInner { void test(@RTA @RTA %TEST_CLASS_NAME%.TestInner this) { } } }"; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
113 |
} |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
114 |
|
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
115 |
@TADescription(annotation = "RTBs", type = METHOD_RECEIVER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
116 |
genericLocation = {1, 0}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
117 |
@TestClass("%TEST_CLASS_NAME%$TestInner") |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
118 |
public String nestedtypesRepeatableAnnotation3() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
119 |
return "class %TEST_CLASS_NAME% { class TestInner { void test(%TEST_CLASS_NAME%. @RTB @RTB TestInner this) { } } }"; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
120 |
} |
15385 | 121 |
} |