Mon, 23 Jan 2017 17:03:12 -0800
Merge
1 /*
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
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 */
24 /*
25 * @test
26 * @bug 8005091 8009686 8025633 8026567
27 * @summary Make sure that type annotations are displayed correctly
28 * @author Bhavesh Patel
29 * @library ../lib/
30 * @ignore
31 * @build JavadocTester TestTypeAnnotations
32 * @run main TestTypeAnnotations
33 */
35 public class TestTypeAnnotations extends JavadocTester {
37 //Test information.
38 private static final String BUG_ID = "8005091-8009686";
40 //Javadoc arguments.
41 private static final String[] ARGS = new String[] {
42 "-d", BUG_ID, "-sourcepath", SRC_DIR, "-private", "typeannos"
43 };
45 //Input for string search tests.
46 private static final String[][] NEGATED_TEST = NO_TEST;
47 private static final String[][] TEST = {
48 // Test for type annotations on Class Extends (ClassExtends.java).
49 {BUG_ID + FS + "typeannos" + FS + "MyClass.html",
50 "extends <a href=\"../typeannos/ClassExtA.html\" title=\"annotation " +
51 "in typeannos\">@ClassExtA</a> <a href=\"../typeannos/ParameterizedClass.html\" " +
52 "title=\"class in typeannos\">ParameterizedClass</a><<a href=\"" +
53 "../typeannos/ClassExtB.html\" title=\"annotation in typeannos\">" +
54 "@ClassExtB</a> java.lang.String>"
55 },
56 {BUG_ID + FS + "typeannos" + FS + "MyClass.html",
57 "implements <a href=\"../typeannos/ClassExtB.html\" title=\"" +
58 "annotation in typeannos\">@ClassExtB</a> java.lang.CharSequence, " +
59 "<a href=\"../typeannos/ClassExtA.html\" title=\"annotation in " +
60 "typeannos\">@ClassExtA</a> <a href=\"../typeannos/ParameterizedInterface.html\" " +
61 "title=\"interface in typeannos\">ParameterizedInterface</a><" +
62 "<a href=\"../typeannos/ClassExtB.html\" title=\"annotation in " +
63 "typeannos\">@ClassExtB</a> java.lang.String></pre>"
64 },
65 {BUG_ID + FS + "typeannos" + FS + "MyInterface.html",
66 "extends <a href=\"../typeannos/ClassExtA.html\" title=\"annotation " +
67 "in typeannos\">@ClassExtA</a> <a href=\"../typeannos/" +
68 "ParameterizedInterface.html\" title=\"interface in typeannos\">" +
69 "ParameterizedInterface</a><<a href=\"../typeannos/ClassExtA.html\" " +
70 "title=\"annotation in typeannos\">@ClassExtA</a> java.lang.String>, " +
71 "<a href=\"../typeannos/ClassExtB.html\" title=\"annotation in " +
72 "typeannos\">@ClassExtB</a> java.lang.CharSequence</pre>"
73 },
75 // Test for type annotations on Class Parameters (ClassParameters.java).
76 {BUG_ID + FS + "typeannos" + FS + "ExtendsBound.html",
77 "class <span class=\"typeNameLabel\">ExtendsBound<K extends <a " +
78 "href=\"../typeannos/ClassParamA.html\" title=\"annotation in " +
79 "typeannos\">@ClassParamA</a> java.lang.String></span>"
80 },
81 {BUG_ID + FS + "typeannos" + FS + "ExtendsGeneric.html",
82 "<pre>class <span class=\"typeNameLabel\">ExtendsGeneric<K extends " +
83 "<a href=\"../typeannos/ClassParamA.html\" title=\"annotation in " +
84 "typeannos\">@ClassParamA</a> <a href=\"../typeannos/Unannotated.html\" " +
85 "title=\"class in typeannos\">Unannotated</a><<a href=\"" +
86 "../typeannos/ClassParamB.html\" title=\"annotation in typeannos\">" +
87 "@ClassParamB</a> java.lang.String>></span>"
88 },
89 {BUG_ID + FS + "typeannos" + FS + "TwoBounds.html",
90 "<pre>class <span class=\"typeNameLabel\">TwoBounds<K extends <a href=\"" +
91 "../typeannos/ClassParamA.html\" title=\"annotation in typeannos\">" +
92 "@ClassParamA</a> java.lang.String,V extends <a href=\"../typeannos/" +
93 "ClassParamB.html\" title=\"annotation in typeannos\">@ClassParamB" +
94 "</a> java.lang.String></span>"
95 },
96 {BUG_ID + FS + "typeannos" + FS + "Complex1.html",
97 "class <span class=\"typeNameLabel\">Complex1<K extends <a href=\"../" +
98 "typeannos/ClassParamA.html\" title=\"annotation in typeannos\">" +
99 "@ClassParamA</a> java.lang.String & java.lang.Runnable></span>"
100 },
101 {BUG_ID + FS + "typeannos" + FS + "Complex2.html",
102 "class <span class=\"typeNameLabel\">Complex2<K extends java.lang." +
103 "String & <a href=\"../typeannos/ClassParamB.html\" title=\"" +
104 "annotation in typeannos\">@ClassParamB</a> java.lang.Runnable></span>"
105 },
106 {BUG_ID + FS + "typeannos" + FS + "ComplexBoth.html",
107 "class <span class=\"typeNameLabel\">ComplexBoth<K extends <a href=\"" +
108 "../typeannos/ClassParamA.html\" title=\"annotation in typeannos\"" +
109 ">@ClassParamA</a> java.lang.String & <a href=\"../typeannos/" +
110 "ClassParamA.html\" title=\"annotation in typeannos\">@ClassParamA" +
111 "</a> java.lang.Runnable></span>"
112 },
114 // Test for type annotations on fields (Fields.java).
115 {BUG_ID + FS + "typeannos" + FS + "DefaultScope.html",
116 "<pre><a href=\"../typeannos/Parameterized.html\" title=\"class in " +
117 "typeannos\">Parameterized</a><<a href=\"../typeannos/FldA.html\" " +
118 "title=\"annotation in typeannos\">@FldA</a> java.lang.String,<a " +
119 "href=\"../typeannos/FldB.html\" title=\"annotation in typeannos\">" +
120 "@FldB</a> java.lang.String> bothTypeArgs</pre>"
121 },
122 {BUG_ID + FS + "typeannos" + FS + "DefaultScope.html",
123 "<pre><a href=\"../typeannos/FldA.html\" title=\"annotation in " +
124 "typeannos\">@FldA</a> java.lang.String <a href=\"../typeannos/" +
125 "FldB.html\" title=\"annotation in typeannos\">@FldB</a> [] " +
126 "array1Deep</pre>"
127 },
128 {BUG_ID + FS + "typeannos" + FS + "DefaultScope.html",
129 "<pre>java.lang.String[] <a href=\"../typeannos/FldB.html\" " +
130 "title=\"annotation in typeannos\">@FldB</a> [] array2SecondOld</pre>"
131 },
132 {BUG_ID + FS + "typeannos" + FS + "DefaultScope.html",
133 "<pre><a href=\"../typeannos/FldD.html\" title=\"annotation in " +
134 "typeannos\">@FldD</a> java.lang.String <a href=\"../typeannos/" +
135 "FldC.html\" title=\"annotation in typeannos\">@FldC</a> <a href=\"" +
136 "../typeannos/FldA.html\" title=\"annotation in typeannos\">@FldA" +
137 "</a> [] <a href=\"../typeannos/FldC.html\" title=\"annotation in " +
138 "typeannos\">@FldC</a> <a href=\"../typeannos/FldB.html\" title=\"" +
139 "annotation in typeannos\">@FldB</a> [] array2Deep</pre>"
140 },
141 {BUG_ID + FS + "typeannos" + FS + "ModifiedScoped.html",
142 "<pre>public final <a href=\"../typeannos/Parameterized.html\" " +
143 "title=\"class in typeannos\">Parameterized</a><<a href=\"../" +
144 "typeannos/FldA.html\" title=\"annotation in typeannos\">@FldA</a> " +
145 "<a href=\"../typeannos/Parameterized.html\" title=\"class in " +
146 "typeannos\">Parameterized</a><<a href=\"../typeannos/FldA.html\" " +
147 "title=\"annotation in typeannos\">@FldA</a> java.lang.String,<a " +
148 "href=\"../typeannos/FldB.html\" title=\"annotation in typeannos\">" +
149 "@FldB</a> java.lang.String>,<a href=\"../typeannos/FldB.html\" " +
150 "title=\"annotation in typeannos\">@FldB</a> java.lang.String> " +
151 "nestedParameterized</pre>"
152 },
153 {BUG_ID + FS + "typeannos" + FS + "ModifiedScoped.html",
154 "<pre>public final <a href=\"../typeannos/FldA.html\" " +
155 "title=\"annotation in typeannos\">@FldA</a> java.lang.String[][] " +
156 "array2</pre>"
157 },
159 // Test for type annotations on method return types (MethodReturnType.java).
160 {BUG_ID + FS + "typeannos" + FS + "MtdDefaultScope.html",
161 "<pre>public <T> <a href=\"../typeannos/MRtnA.html\" " +
162 "title=\"annotation in typeannos\">@MRtnA</a> java.lang.String" +
163 " method()</pre>"
164 },
165 {BUG_ID + FS + "typeannos" + FS + "MtdDefaultScope.html",
166 "<pre><a href=\"../typeannos/MRtnA.html\" title=\"annotation in " +
167 "typeannos\">@MRtnA</a> java.lang.String <a href=\"../typeannos/" +
168 "MRtnA.html\" title=\"annotation in typeannos\">@MRtnA</a> [] <a " +
169 "href=\"../typeannos/MRtnB.html\" title=\"annotation in typeannos\">" +
170 "@MRtnB</a> [] array2Deep()</pre>"
171 },
172 {BUG_ID + FS + "typeannos" + FS + "MtdDefaultScope.html",
173 "<pre><a href=\"../typeannos/MRtnA.html\" title=\"annotation in " +
174 "typeannos\">@MRtnA</a> java.lang.String[][] array2()</pre>"
175 },
176 {BUG_ID + FS + "typeannos" + FS + "MtdModifiedScoped.html",
177 "<pre>public final <a href=\"../typeannos/MtdParameterized.html\" " +
178 "title=\"class in typeannos\">MtdParameterized</a><<a href=\"../" +
179 "typeannos/MRtnA.html\" title=\"annotation in typeannos\">@MRtnA</a> " +
180 "<a href=\"../typeannos/MtdParameterized.html\" title=\"class in " +
181 "typeannos\">MtdParameterized</a><<a href=\"../typeannos/MRtnA." +
182 "html\" title=\"annotation in typeannos\">@MRtnA</a> java.lang." +
183 "String,<a href=\"../typeannos/MRtnB.html\" title=\"annotation in " +
184 "typeannos\">@MRtnB</a> java.lang.String>,<a href=\"../typeannos/" +
185 "MRtnB.html\" title=\"annotation in typeannos\">@MRtnB</a> java." +
186 "lang.String> nestedMtdParameterized()</pre>"
187 },
189 // Test for type annotations on method type parameters (MethodTypeParameters.java).
190 {BUG_ID + FS + "typeannos" + FS + "UnscopedUnmodified.html",
191 "<pre><K extends <a href=\"../typeannos/MTyParamA.html\" title=\"" +
192 "annotation in typeannos\">@MTyParamA</a> java.lang.String>" +
193 " void methodExtends()</pre>"
194 },
195 {BUG_ID + FS + "typeannos" + FS + "UnscopedUnmodified.html",
196 "<pre><K extends <a href=\"../typeannos/MTyParamA.html\" title=\"" +
197 "annotation in typeannos\">@MTyParamA</a> <a href=\"../typeannos/" +
198 "MtdTyParameterized.html\" title=\"class in typeannos\">" +
199 "MtdTyParameterized</a><<a href=\"../typeannos/MTyParamB.html\" " +
200 "title=\"annotation in typeannos\">@MTyParamB</a> java.lang.String" +
201 ">> void nestedExtends()</pre>"
202 },
203 {BUG_ID + FS + "typeannos" + FS + "PublicModifiedMethods.html",
204 "<pre>public final <K extends <a href=\"../typeannos/" +
205 "MTyParamA.html\" title=\"annotation in typeannos\">@MTyParamA</a> " +
206 "java.lang.String> void methodExtends()</pre>"
207 },
208 {BUG_ID + FS + "typeannos" + FS + "PublicModifiedMethods.html",
209 "<pre>public final <K extends <a href=\"../typeannos/" +
210 "MTyParamA.html\" title=\"annotation in typeannos\">@MTyParamA</a> " +
211 "java.lang.String,V extends <a href=\"../typeannos/MTyParamA.html\" " +
212 "title=\"annotation in typeannos\">@MTyParamA</a> <a href=\"../" +
213 "typeannos/MtdTyParameterized.html\" title=\"class in typeannos\">" +
214 "MtdTyParameterized</a><<a href=\"../typeannos/MTyParamB.html\" " +
215 "title=\"annotation in typeannos\">@MTyParamB</a> java.lang.String" +
216 ">> void dual()</pre>"
217 },
219 // Test for type annotations on parameters (Parameters.java).
220 {BUG_ID + FS + "typeannos" + FS + "Parameters.html",
221 "<pre>void unannotated(<a href=\"../typeannos/" +
222 "ParaParameterized.html\" title=\"class in typeannos\">" +
223 "ParaParameterized</a><java.lang.String,java.lang.String>" +
224 " a)</pre>"
225 },
226 {BUG_ID + FS + "typeannos" + FS + "Parameters.html",
227 "<pre>void nestedParaParameterized(<a href=\"../typeannos/" +
228 "ParaParameterized.html\" title=\"class in typeannos\">" +
229 "ParaParameterized</a><<a href=\"../typeannos/ParamA.html\" " +
230 "title=\"annotation in typeannos\">@ParamA</a> <a href=\"../" +
231 "typeannos/ParaParameterized.html\" title=\"class in typeannos\">" +
232 "ParaParameterized</a><<a href=\"../typeannos/ParamA.html\" " +
233 "title=\"annotation in typeannos\">@ParamA</a> java.lang.String," +
234 "<a href=\"../typeannos/ParamB.html\" title=\"annotation in " +
235 "typeannos\">@ParamB</a> java.lang.String>,<a href=\"../" +
236 "typeannos/ParamB.html\" title=\"annotation in typeannos\">@ParamB" +
237 "</a> java.lang.String> a)</pre>"
238 },
239 {BUG_ID + FS + "typeannos" + FS + "Parameters.html",
240 "<pre>void array2Deep(<a href=\"../typeannos/ParamA.html\" " +
241 "title=\"annotation in typeannos\">@ParamA</a> java.lang.String " +
242 "<a href=\"../typeannos/ParamA.html\" title=\"annotation in " +
243 "typeannos\">@ParamA</a> [] <a href=\"../typeannos/ParamB.html\" " +
244 "title=\"annotation in typeannos\">@ParamB</a> [] a)</pre>"
245 },
247 // Test for type annotations on throws (Throws.java).
248 {BUG_ID + FS + "typeannos" + FS + "ThrDefaultUnmodified.html",
249 "<pre>void oneException()" + NL +
250 " throws <a href=\"../typeannos/ThrA.html\" title=\"" +
251 "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>"
252 },
253 {BUG_ID + FS + "typeannos" + FS + "ThrDefaultUnmodified.html",
254 "<pre>void twoExceptions()" + NL +
255 " throws <a href=\"../typeannos/ThrA.html\" title=\"" +
256 "annotation in typeannos\">@ThrA</a> java.lang.RuntimeException," + NL +
257 " <a href=\"../typeannos/ThrA.html\" title=\"" +
258 "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>"
259 },
260 {BUG_ID + FS + "typeannos" + FS + "ThrPublicModified.html",
261 "<pre>public final void oneException(java.lang.String a)" + NL +
262 " throws <a href=\"../typeannos/ThrA.html\" " +
263 "title=\"annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>"
264 },
265 {BUG_ID + FS + "typeannos" + FS + "ThrPublicModified.html",
266 "<pre>public final void twoExceptions(java.lang.String a)" + NL +
267 " throws <a href=\"../typeannos/ThrA.html\" " +
268 "title=\"annotation in typeannos\">@ThrA</a> java.lang.RuntimeException," + NL +
269 " <a href=\"../typeannos/ThrA.html\" " +
270 "title=\"annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>"
271 },
272 {BUG_ID + FS + "typeannos" + FS + "ThrWithValue.html",
273 "<pre>void oneException()" + NL +
274 " throws <a href=\"../typeannos/ThrB.html\" title=\"" +
275 "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" +
276 "ThrB.html#value--\">value</a>=\"m\") java.lang.Exception</pre>"
277 },
278 {BUG_ID + FS + "typeannos" + FS + "ThrWithValue.html",
279 "<pre>void twoExceptions()" + NL +
280 " throws <a href=\"../typeannos/ThrB.html\" title=\"" +
281 "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" +
282 "ThrB.html#value--\">value</a>=\"m\") java.lang.RuntimeException," + NL +
283 " <a href=\"../typeannos/ThrA.html\" title=\"" +
284 "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>"
285 },
287 // Test for type annotations on type parameters (TypeParameters.java).
288 {BUG_ID + FS + "typeannos" + FS + "TestMethods.html",
289 "<pre><K,V extends <a href=\"../typeannos/TyParaA.html\" title=\"" +
290 "annotation in typeannos\">@TyParaA</a> java.lang.String> " +
291 "void secondAnnotated()</pre>"
292 },
294 // Test for type annotations on wildcard type (Wildcards.java).
295 {BUG_ID + FS + "typeannos" + FS + "BoundTest.html",
296 "<pre>void wcExtends(<a href=\"../typeannos/MyList.html\" " +
297 "title=\"class in typeannos\">MyList</a><? extends <a href=\"" +
298 "../typeannos/WldA.html\" title=\"annotation in typeannos\">@WldA" +
299 "</a> java.lang.String> l)</pre>"
300 },
301 {BUG_ID + FS + "typeannos" + FS + "BoundTest.html",
302 "<pre><a href=\"../typeannos/MyList.html\" title=\"class in " +
303 "typeannos\">MyList</a><? super <a href=\"../typeannos/WldA.html\" " +
304 "title=\"annotation in typeannos\">@WldA</a> java.lang.String>" +
305 " returnWcSuper()</pre>"
306 },
307 {BUG_ID + FS + "typeannos" + FS + "BoundWithValue.html",
308 "<pre>void wcSuper(<a href=\"../typeannos/MyList.html\" title=\"" +
309 "class in typeannos\">MyList</a><? super <a href=\"../typeannos/" +
310 "WldB.html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"" +
311 "../typeannos/WldB.html#value--\">value</a>=\"m\") java.lang." +
312 "String> l)</pre>"
313 },
314 {BUG_ID + FS + "typeannos" + FS + "BoundWithValue.html",
315 "<pre><a href=\"../typeannos/MyList.html\" title=\"class in " +
316 "typeannos\">MyList</a><? extends <a href=\"../typeannos/WldB." +
317 "html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"../" +
318 "typeannos/WldB.html#value--\">value</a>=\"m\") java.lang.String" +
319 "> returnWcExtends()</pre>"
320 },
322 // Test for receiver annotations (Receivers.java).
323 {BUG_ID + FS + "typeannos" + FS + "DefaultUnmodified.html",
324 "<pre>void withException(<a href=\"../typeannos/RcvrA.html\" " +
325 "title=\"annotation in typeannos\">@RcvrA</a> " +
326 "DefaultUnmodified this)" + NL + " throws java." +
327 "lang.Exception</pre>"
328 },
329 {BUG_ID + FS + "typeannos" + FS + "DefaultUnmodified.html",
330 "<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrA." +
331 "html\" title=\"annotation in typeannos\">@RcvrA</a> <a href=\"../" +
332 "typeannos/RcvrB.html\" title=\"annotation in typeannos\">@RcvrB" +
333 "</a>(<a href=\"../typeannos/RcvrB.html#value--\">value</a>=\"m\")" +
334 " DefaultUnmodified this)</pre>"
335 },
336 {BUG_ID + FS + "typeannos" + FS + "DefaultUnmodified.html",
337 "<pre><T extends java.lang.Runnable> void accept(" +
338 "<a href=\"../typeannos/RcvrA.html\" title=\"annotation in " +
339 "typeannos\">@RcvrA</a> DefaultUnmodified this," + NL +
340 " T r)" + NL +
341 " throws java.lang.Exception</pre>"
342 },
343 {BUG_ID + FS + "typeannos" + FS + "PublicModified.html",
344 "<pre>public final java.lang.String nonVoid(<a href=\"" +
345 "../typeannos/RcvrA.html\" title=\"annotation in typeannos\">" +
346 "@RcvrA</a> PublicModified this)</pre>"
347 },
348 {BUG_ID + FS + "typeannos" + FS + "PublicModified.html",
349 "<pre>public final <T extends java.lang.Runnable> " +
350 "void accept(<a href=\"../typeannos/RcvrA.html\" title=\"" +
351 "annotation in typeannos\">@RcvrA</a> PublicModified this," + NL +
352 " T r)" + NL +
353 " throws java.lang.Exception</pre>"
354 },
355 {BUG_ID + FS + "typeannos" + FS + "WithValue.html",
356 "<pre><T extends java.lang.Runnable> void accept(" +
357 "<a href=\"../typeannos/RcvrB.html\" title=\"annotation in " +
358 "typeannos\">@RcvrB</a>(<a href=\"../typeannos/RcvrB.html#value--\">" +
359 "value</a>=\"m\") WithValue this," + NL +
360 " T r)" + NL +
361 " throws java.lang.Exception</pre>"
362 },
363 {BUG_ID + FS + "typeannos" + FS + "WithFinal.html",
364 "<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrB." +
365 "html\" title=\"annotation in typeannos\">@RcvrB</a>(<a href=\"../" +
366 "typeannos/RcvrB.html#value--\">value</a>=\"m\") WithFinal" +
367 " this)</pre>"
368 },
369 {BUG_ID + FS + "typeannos" + FS + "WithBody.html",
370 "<pre>void field(<a href=\"../typeannos/RcvrA.html\" title=\"" +
371 "annotation in typeannos\">@RcvrA</a> WithBody this)</pre>"
372 },
373 {BUG_ID + FS + "typeannos" + FS + "Generic2.html",
374 "<pre>void test2(<a href=\"../typeannos/RcvrA.html\" title=\"" +
375 "annotation in typeannos\">@RcvrA</a> Generic2<X> this)</pre>"
376 }
377 };
379 /**
380 * The entry point of the test.
381 * @param args the array of command line arguments.
382 */
383 public static void main(String[] args) {
384 TestTypeAnnotations tester = new TestTypeAnnotations();
385 run(tester, ARGS, TEST, NEGATED_TEST);
386 tester.printSummary();
387 }
389 /**
390 * {@inheritDoc}
391 */
392 public String getBugId() {
393 return BUG_ID;
394 }
396 /**
397 * {@inheritDoc}
398 */
399 public String getBugName() {
400 return getClass().getName();
401 }
402 }