author | aeremeev |
Fri, 06 Jun 2014 16:08:46 -0400 | |
changeset 24896 | 986d876a9121 |
parent 22448 | a85fbad9d687 |
child 30730 | d3ce7619db2c |
permissions | -rw-r--r-- |
15385 | 1 |
/* |
22448
a85fbad9d687
8029230: Update copyright year to match last edit in jdk8 langtools repository for 2013
ksrini
parents:
15557
diff
changeset
|
2 |
* Copyright (c) 2009, 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 |
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 class extends clauses |
30 |
* @compile -g Driver.java ReferenceInfoUtil.java ClassExtends.java |
|
31 |
* @run main Driver ClassExtends |
|
32 |
*/ |
|
33 |
public class ClassExtends { |
|
34 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
35 |
@TADescription(annotation = "TA", type = CLASS_EXTENDS, typeIndex = -1) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
36 |
@TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1) |
15385 | 37 |
public String regularClass() { |
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
38 |
return "class %TEST_CLASS_NAME% extends @TA Object implements Cloneable, @TB Runnable {" |
15385 | 39 |
+ " public void run() { } }"; |
40 |
} |
|
41 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
42 |
@TADescription(annotation = "RTAs", type = CLASS_EXTENDS, typeIndex = -1) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
43 |
@TADescription(annotation = "RTBs", type = CLASS_EXTENDS, typeIndex = 1) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
44 |
public String regularClassRepeatableAnnotation() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
45 |
return "class %TEST_CLASS_NAME% extends @RTA @RTA Object implements Cloneable, @RTB @RTB Runnable {" |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
46 |
+ " public void run() { } }"; |
15385 | 47 |
} |
48 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
49 |
@TADescription(annotation = "TA", type = CLASS_EXTENDS, typeIndex = -1, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
50 |
genericLocation = { 3, 0 }) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
51 |
@TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
52 |
genericLocation = { 3, 1 }) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
53 |
public String regularClassExtendsParametrized() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
54 |
return "class %TEST_CLASS_NAME% extends HashMap<@TA String, String> implements Cloneable, Map<String, @TB String>{ } "; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
55 |
} |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
56 |
|
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
57 |
@TADescription(annotation = "RTAs", type = CLASS_EXTENDS, typeIndex = -1, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
58 |
genericLocation = { 3, 0 }) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
59 |
@TADescription(annotation = "RTBs", type = CLASS_EXTENDS, typeIndex = 1, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
60 |
genericLocation = { 3, 1 }) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
61 |
public String regularClassExtendsParametrizedRepeatableAnnotation() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
62 |
return "class %TEST_CLASS_NAME% extends HashMap<@RTA @RTA String, String> implements Cloneable, Map<String, @RTB @RTB String>{ } "; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
63 |
} |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
64 |
|
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
65 |
@TADescription(annotation = "TA", type = CLASS_EXTENDS, typeIndex = -1) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
66 |
@TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1) |
15385 | 67 |
public String abstractClass() { |
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
68 |
return "abstract class %TEST_CLASS_NAME% extends @TA Date implements Cloneable, @TB Runnable {" |
15385 | 69 |
+ " public void run() { } }"; |
70 |
} |
|
71 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
72 |
@TADescription(annotation = "RTAs", type = CLASS_EXTENDS, typeIndex = -1) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
73 |
@TADescription(annotation = "RTBs", type = CLASS_EXTENDS, typeIndex = 1) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
74 |
public String abstractClassRepeatableAnnotation() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
75 |
return "abstract class %TEST_CLASS_NAME% extends @RTA @RTA Date implements Cloneable, @RTB @RTB Runnable {" |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
76 |
+ " public void run() { } }"; |
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 = CLASS_EXTENDS, typeIndex = -1, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
80 |
genericLocation = { 3, 0 }) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
81 |
@TADescription(annotation = "RTBs", type = CLASS_EXTENDS, typeIndex = 1, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
82 |
genericLocation = { 3, 1 }) |
15385 | 83 |
public String abstractClassExtendsParametrized() { |
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
84 |
return "abstract class %TEST_CLASS_NAME% extends HashMap<@RTA @RTA String, String> implements Cloneable, Map<String, @RTB @RTB String>{ } "; |
15385 | 85 |
} |
86 |
||
87 |
@TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1) |
|
88 |
public String regularInterface() { |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
89 |
return "interface %TEST_CLASS_NAME% extends Cloneable, @TB Runnable { }"; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
90 |
} |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
91 |
|
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
92 |
@TADescription(annotation = "RTAs", type = CLASS_EXTENDS, typeIndex = 1) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
93 |
public String regularInterfaceRepetableAnnotation() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
94 |
return "interface %TEST_CLASS_NAME% extends Cloneable, @RTA @RTA Runnable { }"; |
15385 | 95 |
} |
96 |
||
97 |
@TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1, |
|
98 |
genericLocation = { 3, 1 }) |
|
99 |
public String regularInterfaceExtendsParametrized() { |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
100 |
return "interface %TEST_CLASS_NAME% extends Cloneable, Map<String, @TB String>{ } "; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
101 |
} |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
102 |
|
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
103 |
@TADescription(annotation = "RTBs", type = CLASS_EXTENDS, typeIndex = 1, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
104 |
genericLocation = { 3, 1 }) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
105 |
public String regularInterfaceExtendsParametrizedRepeatableAnnotation() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
106 |
return "interface %TEST_CLASS_NAME% extends Cloneable, Map<String, @RTB @RTB String>{ } "; |
15385 | 107 |
} |
108 |
||
109 |
@TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1) |
|
110 |
public String regularEnum() { |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
111 |
return "enum %TEST_CLASS_NAME% implements Cloneable, @TB Runnable { TEST; public void run() { } }"; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
112 |
} |
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 |
@TADescription(annotation = "RTBs", type = CLASS_EXTENDS, typeIndex = 1) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
115 |
public String regularEnumRepeatableAnnotation() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
116 |
return "enum %TEST_CLASS_NAME% implements Cloneable, @RTB @RTB Runnable { TEST; public void run() { } }"; |
15385 | 117 |
} |
118 |
||
119 |
@TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1, |
|
120 |
genericLocation = { 3, 0 }) |
|
121 |
public String regularEnumExtendsParametrized() { |
|
122 |
return |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
123 |
"enum %TEST_CLASS_NAME% implements Cloneable, Comparator<@TB String> { TEST; " |
15385 | 124 |
+ "public int compare(String a, String b) { return 0; }}"; |
125 |
} |
|
126 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
127 |
@TADescription(annotation = "RTBs", type = CLASS_EXTENDS, typeIndex = 1, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
128 |
genericLocation = { 3, 0 }) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
129 |
public String regularEnumExtendsParametrizedRepeatableAnnotation() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
130 |
return |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
131 |
"enum %TEST_CLASS_NAME% implements Cloneable, Comparator<@RTB @RTB String> { TEST; " |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
132 |
+ "public int compare(String a, String b) { return 0; }}"; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22448
diff
changeset
|
133 |
} |
15385 | 134 |
} |