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) 2012, 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 that the examples from the manual are stored as expected |
30846 | 30 |
* @modules jdk.jdeps/com.sun.tools.classfile |
15385 | 31 |
* @compile -g Driver.java ReferenceInfoUtil.java FromSpecification.java |
32 |
* @run main Driver FromSpecification |
|
33 |
*/ |
|
34 |
public class FromSpecification { |
|
35 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
36 |
@TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
37 |
@TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
38 |
genericLocation = {3, 0}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
39 |
@TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
40 |
genericLocation = {3, 0, 2, 0}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
41 |
@TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
42 |
genericLocation = {3, 1}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
43 |
@TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER, |
15385 | 44 |
genericLocation = {3, 1, 3, 0}, paramIndex = 0) |
45 |
public String testSpec1() { |
|
46 |
return "void test(@TA Map<@TB ? extends @TC String, @TD List<@TE Object>> a) { }"; |
|
47 |
} |
|
48 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
49 |
@TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
50 |
@TADescription(annotation = "TG", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
51 |
genericLocation = {0, 0}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
52 |
@TADescription(annotation = "TH", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
53 |
genericLocation = {0, 0, 0, 0}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
54 |
@TADescription(annotation = "TI", type = METHOD_FORMAL_PARAMETER, |
15385 | 55 |
genericLocation = {0, 0, 0, 0, 0, 0}, paramIndex = 0) |
56 |
public String testSpec2() { |
|
57 |
return "void test(@TI String @TF [] @TG [] @TH [] a) { }"; |
|
58 |
} |
|
59 |
||
60 |
// Note first "1, 0" for top-level class Test. |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
61 |
@TADescription(annotation = "TJ", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
62 |
genericLocation = {1, 0, 1, 0, 1, 0, 1, 0}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
63 |
@TADescription(annotation = "TK", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
64 |
genericLocation = {1, 0, 1, 0, 1, 0}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
65 |
@TADescription(annotation = "TL", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
66 |
genericLocation = {1, 0, 1, 0}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
67 |
@TADescription(annotation = "TM", type = METHOD_FORMAL_PARAMETER, |
15385 | 68 |
genericLocation = {1, 0}, paramIndex = 0) |
69 |
public String testSpec3() { |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
70 |
return "class %TEST_CLASS_NAME% { class O1 { class O2 { class O3 { class NestedStatic {} } } }" + |
15385 | 71 |
"void test(@TM O1.@TL O2.@TK O3.@TJ NestedStatic a) { } }"; |
72 |
} |
|
73 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
74 |
@TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
75 |
@TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
76 |
genericLocation = {3, 0}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
77 |
@TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
78 |
genericLocation = {3, 0, 3, 0}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
79 |
@TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
80 |
genericLocation = {3, 0, 3, 0, 0, 0}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
81 |
@TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
82 |
genericLocation = {3, 0, 3, 0, 0, 0, 0, 0}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
83 |
@TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
84 |
genericLocation = {3, 0, 3, 0, 0, 0, 0, 0, 0, 0}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
85 |
@TADescription(annotation = "TG", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
86 |
genericLocation = {3, 1}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
87 |
@TADescription(annotation = "TH", type = METHOD_FORMAL_PARAMETER, |
15385 | 88 |
genericLocation = {3, 1, 3, 0}, paramIndex = 0) |
89 |
public String testSpec4() { |
|
90 |
return "void test(@TA Map<@TB Comparable<@TF Object @TC [] @TD [] @TE []>, @TG List<@TH String>> a) { }"; |
|
91 |
} |
|
92 |
||
93 |
// Note first "1, 0" for top-level class Test. |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
94 |
@TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
95 |
genericLocation = {1, 0, 1, 0, 1, 0, 1, 0}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
96 |
@TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
97 |
genericLocation = {1, 0, 1, 0, 1, 0, 1, 0, 3, 0}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
98 |
@TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
99 |
genericLocation = {1, 0, 1, 0, 1, 0, 1, 0, 3, 1}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
100 |
@TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
101 |
genericLocation = {1, 0, 1, 0, 1, 0}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
102 |
@TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
103 |
genericLocation = {1, 0, 1, 0}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
104 |
@TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
105 |
genericLocation = {1, 0, 1, 0, 3, 0}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
106 |
@TADescription(annotation = "TG", type = METHOD_FORMAL_PARAMETER, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
107 |
genericLocation = {1, 0, 1, 0, 3, 1}, paramIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
108 |
@TADescription(annotation = "TH", type = METHOD_FORMAL_PARAMETER, |
15385 | 109 |
genericLocation = {1, 0}, paramIndex = 0) |
110 |
public String testSpec5() { |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
111 |
return "class %TEST_CLASS_NAME% { class O1 { class O2<A, B> { class O3 { class Nested<X, Y> {} } } }" + |
15385 | 112 |
"void test(@TH O1.@TE O2<@TF String, @TG String>.@TD O3.@TA Nested<@TB String, @TC String> a) { } }"; |
113 |
} |
|
114 |
} |