|
1 /* |
|
2 * Copyright (c) 2003, 2017, 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 */ |
|
23 |
|
24 /* |
|
25 * @test |
|
26 * @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 8025633 8026567 8162363 |
|
27 * 8175200 |
|
28 * @summary Run Javadoc on a set of source files that demonstrate new |
|
29 * language features. Check the output to ensure that the new |
|
30 * language features are properly documented. |
|
31 * @author jamieh |
|
32 * @library ../lib |
|
33 * @modules jdk.javadoc/jdk.javadoc.internal.tool |
|
34 * @build JavadocTester |
|
35 * @run main TestNewLanguageFeatures |
|
36 */ |
|
37 |
|
38 public class TestNewLanguageFeatures extends JavadocTester { |
|
39 |
|
40 public static void main(String... args) throws Exception { |
|
41 TestNewLanguageFeatures tester = new TestNewLanguageFeatures(); |
|
42 tester.runTests(); |
|
43 } |
|
44 |
|
45 @Test |
|
46 void test() { |
|
47 javadoc("-Xdoclint:none", |
|
48 "-d", "out", |
|
49 "-use", "-sourcepath", |
|
50 testSrc, |
|
51 "pkg", "pkg1", "pkg2"); |
|
52 checkExit(Exit.OK); |
|
53 |
|
54 checkEnums(); |
|
55 checkTypeParameters(); |
|
56 checkVarArgs(); |
|
57 checkAnnotationTypeUsage(); |
|
58 } |
|
59 |
|
60 //================================= |
|
61 // ENUM TESTING |
|
62 //================================= |
|
63 void checkEnums() { |
|
64 checkOutput("pkg/Coin.html", true, |
|
65 // Make sure enum header is correct. |
|
66 "Enum Coin</h2>", |
|
67 // Make sure enum signature is correct. |
|
68 "<pre>public enum " |
|
69 + "<span class=\"typeNameLabel\">Coin</span>\n" |
|
70 + "extends java.lang.Enum<<a href=\"../pkg/Coin.html\" " |
|
71 + "title=\"enum in pkg\">Coin</a>></pre>", |
|
72 // Check for enum constant section |
|
73 "<caption><span>Enum Constants" |
|
74 + "</span><span class=\"tabEnd\"> </span></caption>", |
|
75 // Detail for enum constant |
|
76 "<span class=\"memberNameLink\"><a href=\"../pkg/Coin.html#Dime\">Dime</a></span>", |
|
77 // Automatically insert documentation for values() and valueOf(). |
|
78 "Returns an array containing the constants of this enum type,", |
|
79 "Returns the enum constant of this type with the specified name", |
|
80 "for (Coin c : Coin.values())", |
|
81 "Overloaded valueOf() method has correct documentation.", |
|
82 "Overloaded values method has correct documentation.", |
|
83 "<pre>public static <a href=\"../pkg/Coin.html\" title=\"enum in pkg\">Coin</a>" + |
|
84 " valueOf​(java.lang.String name)</pre>\n" + |
|
85 "<div class=\"block\">Returns the enum constant of this type with the specified name.\n" + |
|
86 "The string must match <i>exactly</i> an identifier used to declare an\n" + |
|
87 "enum constant in this type. (Extraneous whitespace characters are \n" + |
|
88 "not permitted.)</div>\n" + |
|
89 "<dl>\n" + |
|
90 "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" + |
|
91 "<dd><code>name</code> - the name of the enum constant to be returned.</dd>\n" + |
|
92 "<dt><span class=\"returnLabel\">Returns:</span></dt>\n" + |
|
93 "<dd>the enum constant with the specified name</dd>\n" + |
|
94 "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n" + |
|
95 "<dd><code>java.lang.IllegalArgumentException</code> - if this enum type has no " + |
|
96 "constant with the specified name</dd>\n" + |
|
97 "<dd><code>java.lang.NullPointerException</code> - if the argument is null</dd>"); |
|
98 |
|
99 // NO constructor section |
|
100 checkOutput("pkg/Coin.html", false, |
|
101 "<h3>Constructor Summary</h3>"); |
|
102 } |
|
103 |
|
104 //================================= |
|
105 // TYPE PARAMETER TESTING |
|
106 //================================= |
|
107 |
|
108 void checkTypeParameters() { |
|
109 checkOutput("pkg/TypeParameters.html", true, |
|
110 // Make sure the header is correct. |
|
111 "Class TypeParameters<E></h2>", |
|
112 // Check class type parameters section. |
|
113 "<dt><span class=\"paramLabel\">Type Parameters:</span></dt>\n" |
|
114 + "<dd><code>E</code> - " |
|
115 + "the type parameter for this class.", |
|
116 // Type parameters in @see/@link |
|
117 "<dl>\n" |
|
118 + "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" |
|
119 + "<dd>" |
|
120 + "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" |
|
121 + "<code>TypeParameters</code></a></dd>\n" |
|
122 + "</dl>", |
|
123 // Method that uses class type parameter. |
|
124 "(<a href=\"../pkg/TypeParameters.html\" title=\"type " |
|
125 + "parameter in TypeParameters\">E</a> param)", |
|
126 // Method type parameter section. |
|
127 "<span class=\"paramLabel\">Type Parameters:</span></dt>\n" |
|
128 + "<dd><code>T</code> - This is the first " |
|
129 + "type parameter.</dd>\n" |
|
130 + "<dd><code>V</code> - This is the second type " |
|
131 + "parameter.", |
|
132 // Signature of method with type parameters |
|
133 "public <T extends java.util.List,V> " |
|
134 + "java.lang.String[] methodThatHasTypeParameters", |
|
135 // Method that returns TypeParameters |
|
136 "<td class=\"colFirst\"><code><a href=\"../pkg/TypeParameters.html\" " |
|
137 + "title=\"type parameter in TypeParameters\">E</a>[]</code></td>\n" |
|
138 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" |
|
139 + "<a href=\"../pkg/TypeParameters.html#methodThatReturnsTypeParameterA-E:A-\">" |
|
140 + "methodThatReturnsTypeParameterA</a></span>​(<a href=\"../pkg/TypeParameters.html\" " |
|
141 + "title=\"type parameter in TypeParameters\">E</a>[] e)</code>", |
|
142 "<pre>public <a href=\"../pkg/TypeParameters.html\" " |
|
143 + "title=\"type parameter in TypeParameters\">E</a>[] " |
|
144 + "methodThatReturnsTypeParameterA​(<a href=\"../pkg/TypeParameters.html\" " |
|
145 + "title=\"type parameter in TypeParameters\">E</a>[] e)</pre>\n", |
|
146 "<td class=\"colFirst\"><code><T extends java.lang.Object & java.lang.Comparable<? super T>>" |
|
147 + "<br>T</code></td>\n" |
|
148 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" |
|
149 + "<a href=\"../pkg/TypeParameters.html#methodtThatReturnsTypeParametersB-java.util.Collection-\">" |
|
150 + "methodtThatReturnsTypeParametersB</a></span>​(java.util.Collection<? extends T> coll)</code>", |
|
151 "<div class=\"block\">Returns TypeParameters</div>\n", |
|
152 // Method takes a TypeVariable |
|
153 "<td class=\"colFirst\"><code><X extends java.lang.Throwable><br>" |
|
154 + "<a href=\"../pkg/TypeParameters.html\" title=\"type parameter in TypeParameters\">E</a>" |
|
155 + "</code></td>\n" |
|
156 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" |
|
157 + "<a href=\"../pkg/TypeParameters.html#orElseThrow-java.util.function.Supplier-\">" |
|
158 + "orElseThrow</a></span>​(java.util.function.Supplier<? extends X> exceptionSupplier)</code>" |
|
159 ); |
|
160 |
|
161 checkOutput("pkg/Wildcards.html", true, |
|
162 // Wildcard testing. |
|
163 "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" |
|
164 + "TypeParameters</a><? super java.lang.String> a", |
|
165 "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" |
|
166 + "TypeParameters</a><? extends java.lang.StringBuffer> b", |
|
167 "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" |
|
168 + "TypeParameters</a> c"); |
|
169 |
|
170 checkOutput(Output.OUT, true, |
|
171 // Bad type parameter warnings. |
|
172 "warning - @param argument " |
|
173 + "\"<BadClassTypeParam>\" is not a type parameter name.", |
|
174 "warning - @param argument " |
|
175 + "\"<BadMethodTypeParam>\" is not a type parameter name."); |
|
176 |
|
177 // Signature of subclass that has type parameters. |
|
178 checkOutput("pkg/TypeParameterSubClass.html", true, |
|
179 "<pre>public class <span class=\"typeNameLabel\">TypeParameterSubClass<T extends " |
|
180 + "java.lang.String></span>\n" |
|
181 + "extends " |
|
182 + "<a href=\"../pkg/TypeParameterSuperClass.html\" title=\"class in pkg\">" |
|
183 + "TypeParameterSuperClass</a><T></pre>"); |
|
184 |
|
185 // Interface generic parameter substitution |
|
186 // Signature of subclass that has type parameters. |
|
187 checkOutput("pkg/TypeParameters.html", true, |
|
188 "<dl>\n" |
|
189 + "<dt>All Implemented Interfaces:</dt>\n" |
|
190 + "<dd><code><a href=\"../pkg/SubInterface.html\" title=\"interface in pkg\">" |
|
191 + "SubInterface</a><E></code>, <code><a href=\"../pkg/SuperInterface.html\" " |
|
192 + "title=\"interface in pkg\">SuperInterface</a><E></code></dd>\n" |
|
193 + "</dl>"); |
|
194 |
|
195 checkOutput("pkg/SuperInterface.html", true, |
|
196 "<dl>\n" |
|
197 + "<dt>All Known Subinterfaces:</dt>\n" |
|
198 + "<dd><code><a href=\"../pkg/SubInterface.html\" title=\"interface in pkg\">" |
|
199 + "SubInterface</a><V></code></dd>\n" |
|
200 + "</dl>"); |
|
201 checkOutput("pkg/SubInterface.html", true, |
|
202 "<dl>\n" |
|
203 + "<dt>All Superinterfaces:</dt>\n" |
|
204 + "<dd><code><a href=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">" |
|
205 + "SuperInterface</a><V></code></dd>\n" |
|
206 + "</dl>"); |
|
207 |
|
208 //============================================================== |
|
209 // Handle multiple bounds. |
|
210 //============================================================== |
|
211 checkOutput("pkg/MultiTypeParameters.html", true, |
|
212 "public <T extends java.lang.Number & java.lang.Runnable> T foo​(T t)"); |
|
213 |
|
214 //============================================================== |
|
215 // Test Class-Use Documentation for Type Parameters. |
|
216 //============================================================== |
|
217 // ClassUseTest1: <T extends Foo & Foo2> |
|
218 checkOutput("pkg2/class-use/Foo.html", true, |
|
219 "<caption><span>Classes in <a href=\"../../pkg2/" |
|
220 + "package-summary.html\">pkg2</a> with type parameters of " |
|
221 + "type <a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">" |
|
222 + "Foo</a></span><span class=\"tabEnd\"> </span></caption>", |
|
223 "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest1.html\" " |
|
224 + "title=\"class in pkg2\">ClassUseTest1</a><T extends " |
|
225 + "<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo" |
|
226 + "</a> & <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">" |
|
227 + "Foo2</a>></span></code></th>", |
|
228 "<caption><span>Methods in <a href=\"../../pkg2/" |
|
229 + "package-summary.html\">pkg2</a> with type parameters of " |
|
230 + "type <a href=\"../../pkg2/Foo.html\" title=\"class in " |
|
231 + "pkg2\">Foo</a></span><span class=\"tabEnd\"> </span></caption>", |
|
232 "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest1." |
|
233 + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/" |
|
234 + "ClassUseTest1.html#method-T-\">method</a></span>" |
|
235 + "​(T t)</code></th>", |
|
236 "<caption><span>Fields in <a href=\"../../pkg2/" |
|
237 + "package-summary.html\">pkg2</a> with type parameters of " |
|
238 + "type <a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">" |
|
239 + "Foo</a></span><span class=\"tabEnd\"> </span></caption>", |
|
240 "td class=\"colFirst\"><code><a href=\"../../pkg2/" |
|
241 + "ParamTest.html\" title=\"class in pkg2\">ParamTest</a>" |
|
242 + "<<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\"" |
|
243 + ">Foo</a>></code></td>" |
|
244 ); |
|
245 |
|
246 checkOutput("pkg2/class-use/ParamTest.html", true, |
|
247 "<caption><span>Fields in <a href=\"../../pkg2/" |
|
248 + "package-summary.html\">pkg2</a> declared as <a href=\"../" |
|
249 + "../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest" |
|
250 + "</a></span><span class=\"tabEnd\"> </span></caption>", |
|
251 "<td class=\"colFirst\"><code><a href=\"../../pkg2/" |
|
252 + "ParamTest.html\" title=\"class in pkg2\">ParamTest</a><<a " |
|
253 + "href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</a" |
|
254 + ">></code></td>" |
|
255 ); |
|
256 |
|
257 checkOutput("pkg2/class-use/Foo2.html", true, |
|
258 "<caption><span>Classes in <a href=\"../../pkg2/" |
|
259 + "package-summary.html\">pkg2</a> with type parameters of " |
|
260 + "type <a href=\"../../pkg2/Foo2.html\" title=\"interface " |
|
261 + "in pkg2\">Foo2</a></span><span class=\"tabEnd\"> " |
|
262 + "</span></caption>", |
|
263 "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest1.html\" " |
|
264 + "title=\"class in pkg2\">ClassUseTest1</a><T extends " |
|
265 + "<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo" |
|
266 + "</a> & <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">" |
|
267 + "Foo2</a>></span></code></th>", |
|
268 "<caption><span>Methods in <a href=\"../../pkg2/" |
|
269 + "package-summary.html\">pkg2</a> with type parameters of " |
|
270 + "type <a href=\"../../pkg2/Foo2.html\" title=\"interface " |
|
271 + "in pkg2\">Foo2</a></span><span class=\"tabEnd\"> " |
|
272 + "</span></caption>", |
|
273 "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">" |
|
274 + "ClassUseTest1.</span><code><span class=\"memberNameLink\"><a href=\"../../" |
|
275 + "pkg2/ClassUseTest1.html#method-T-\">method</a></span>" |
|
276 + "​(T t)</code></th>" |
|
277 ); |
|
278 |
|
279 // ClassUseTest2: <T extends ParamTest<Foo3>> |
|
280 checkOutput("pkg2/class-use/ParamTest.html", true, |
|
281 "<caption><span>Classes in <a href=\"../../pkg2/" |
|
282 + "package-summary.html\">pkg2</a> with type parameters of " |
|
283 + "type <a href=\"../../pkg2/ParamTest.html\" title=\"class " |
|
284 + "in pkg2\">ParamTest</a></span><span class=\"tabEnd\">" |
|
285 + " </span></caption>", |
|
286 "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest2.html\" " |
|
287 + "title=\"class in pkg2\">ClassUseTest2</a><T extends " |
|
288 + "<a href=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">" |
|
289 + "ParamTest</a><<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">" |
|
290 + "Foo3</a>>></span></code></th>", |
|
291 "<caption><span>Methods in <a href=\"../../pkg2/" |
|
292 + "package-summary.html\">pkg2</a> with type parameters of " |
|
293 + "type <a href=\"../../pkg2/ParamTest.html\" title=\"class " |
|
294 + "in pkg2\">ParamTest</a></span><span class=\"tabEnd\">" |
|
295 + " </span></caption>", |
|
296 "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest2." |
|
297 + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/" |
|
298 + "ClassUseTest2.html#method-T-\">method</a></span>" |
|
299 + "​(T t)</code></th>", |
|
300 "<caption><span>Fields in <a href=\"../../pkg2/" |
|
301 + "package-summary.html\">pkg2</a> declared as <a href=\"../" |
|
302 + "../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest" |
|
303 + "</a></span><span class=\"tabEnd\"> </span></caption>", |
|
304 "<td class=\"colFirst\"><code><a href=\"../../pkg2/" |
|
305 + "ParamTest.html\" title=\"class in pkg2\">ParamTest</a>" |
|
306 + "<<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">" |
|
307 + "Foo</a>></code></td>", |
|
308 "<caption><span>Methods in <a href=\"../../pkg2/" |
|
309 + "package-summary.html\">pkg2</a> with type parameters of " |
|
310 + "type <a href=\"../../pkg2/ParamTest.html\" title=\"class " |
|
311 + "in pkg2\">ParamTest</a></span><span class=\"tabEnd\">" |
|
312 + " </span></caption>", |
|
313 "<td class=\"colFirst\"><code><T extends <a href=\"../" |
|
314 + "../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest" |
|
315 + "</a><<a href=\"../../pkg2/Foo3.html\" title=\"class in " |
|
316 + "pkg2\">Foo3</a>>><br><a href=\"../../pkg2/" |
|
317 + "ParamTest.html\" title=\"class in pkg2\">ParamTest</a>" |
|
318 + "<<a href=\"../../pkg2/Foo3.html\" title=\"class in " |
|
319 + "pkg2\">Foo3</a>></code></td>" |
|
320 ); |
|
321 |
|
322 checkOutput("pkg2/class-use/Foo3.html", true, |
|
323 "<caption><span>Classes in <a href=\"../../pkg2/" |
|
324 + "package-summary.html\">pkg2</a> with type parameters of " |
|
325 + "type <a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">" |
|
326 + "Foo3</a></span><span class=\"tabEnd\"> </span></caption>", |
|
327 "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest2.html\" " |
|
328 + "title=\"class in pkg2\">ClassUseTest2</a><T extends " |
|
329 + "<a href=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">" |
|
330 + "ParamTest</a><<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">" |
|
331 + "Foo3</a>>></span></code></th>", |
|
332 "<caption><span>Methods in <a href=\"../../pkg2/" |
|
333 + "package-summary.html\">pkg2</a> with type parameters of " |
|
334 + "type <a href=\"../../pkg2/Foo3.html\" title=\"class in " |
|
335 + "pkg2\">Foo3</a></span><span class=\"tabEnd\"> " |
|
336 + "</span></caption>", |
|
337 "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest2." |
|
338 + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/" |
|
339 + "ClassUseTest2.html#method-T-\">method</a></span>" |
|
340 + "​(T t)</code></th>", |
|
341 "<caption><span>Methods in <a href=\"../../pkg2/" |
|
342 + "package-summary.html\">pkg2</a> that return types with " |
|
343 + "arguments of type <a href=\"../../pkg2/Foo3.html\" title" |
|
344 + "=\"class in pkg2\">Foo3</a></span><span class=\"tabEnd\">" |
|
345 + " </span></caption>", |
|
346 "<td class=\"colFirst\"><code><T extends <a href=\"../../" |
|
347 + "pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</a><" |
|
348 + "<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3" |
|
349 + "</a>>><br><a href=\"../../pkg2/ParamTest.html\" " |
|
350 + "title=\"class in pkg2\">ParamTest</a><<a href=\"../../pkg2/" |
|
351 + "Foo3.html\" title=\"class in pkg2\">Foo3</a>></code></td>" |
|
352 ); |
|
353 |
|
354 // ClassUseTest3: <T extends ParamTest2<List<? extends Foo4>>> |
|
355 checkOutput("pkg2/class-use/ParamTest2.html", true, |
|
356 "<caption><span>Classes in <a href=\"../../pkg2/" |
|
357 + "package-summary.html\">pkg2</a> with type parameters of " |
|
358 + "type <a href=\"../../pkg2/ParamTest2.html\" title=\"class " |
|
359 + "in pkg2\">ParamTest2</a></span><span class=\"tabEnd\">" |
|
360 + " </span></caption>", |
|
361 "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3.html\" " |
|
362 + "title=\"class in pkg2\">ClassUseTest3</a><T extends " |
|
363 + "<a href=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">" |
|
364 + "ParamTest2</a><java.util.List<? extends " |
|
365 + "<a href=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">" |
|
366 + "Foo4</a>>>></span></code></th>", |
|
367 "<caption><span>Methods in <a href=\"../../pkg2/" |
|
368 + "package-summary.html\">pkg2</a> with type parameters of " |
|
369 + "type <a href=\"../../pkg2/ParamTest2.html\" title=\"class " |
|
370 + "in pkg2\">ParamTest2</a></span><span class=\"tabEnd\">" |
|
371 + " </span></caption>", |
|
372 "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest3" |
|
373 + ".</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3." |
|
374 + "html#method-T-\">method</a></span>​(T t)</code></th>", |
|
375 "<td class=\"colFirst\"><code><T extends <a href=\"../" |
|
376 + "../pkg2/ParamTest2.html\" title=\"class in pkg2\">" |
|
377 + "ParamTest2</a><java.util.List<? extends <a href=\".." |
|
378 + "/../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</a>>" |
|
379 + ">><br><a href=\"../../pkg2/ParamTest2.html\" " |
|
380 + "title=\"class in pkg2\">ParamTest2</a><java.util.List" |
|
381 + "<? extends <a href=\"../../pkg2/Foo4.html\" title=\"" |
|
382 + "class in pkg2\">Foo4</a>>></code></td>" |
|
383 ); |
|
384 |
|
385 checkOutput("pkg2/class-use/Foo4.html", true, |
|
386 "<caption><span>Classes in <a href=\"../../pkg2/" |
|
387 + "package-summary.html\">pkg2</a> with type parameters of " |
|
388 + "type <a href=\"../../pkg2/Foo4.html\" title=\"class in " |
|
389 + "pkg2\">Foo4</a></span><span class=\"tabEnd\"> " |
|
390 + "</span></caption>", |
|
391 "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3.html\" " |
|
392 + "title=\"class in pkg2\">ClassUseTest3</a><T extends " |
|
393 + "<a href=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">" |
|
394 + "ParamTest2</a><java.util.List<? extends " |
|
395 + "<a href=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">" |
|
396 + "Foo4</a>>>></span></code></th>", |
|
397 "<caption><span>Methods in <a href=\"../../pkg2/" |
|
398 + "package-summary.html\">pkg2</a> with type parameters of " |
|
399 + "type <a href=\"../../pkg2/Foo4.html\" title=\"class in " |
|
400 + "pkg2\">Foo4</a></span><span class=\"tabEnd\"> </span></caption>", |
|
401 "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest3." |
|
402 + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3." |
|
403 + "html#method-T-\">method</a></span>​(T t)</code>" |
|
404 + "</th>", |
|
405 "<caption><span>Methods in <a href=\"../../pkg2/" |
|
406 + "package-summary.html\">pkg2</a> that return types with " |
|
407 + "arguments of type <a href=\"../../pkg2/Foo4.html\" " |
|
408 + "title=\"class in pkg2\">Foo4</a></span><span class=\"" |
|
409 + "tabEnd\"> </span></caption>", |
|
410 "<td class=\"colFirst\"><code><T extends <a href=\"../" |
|
411 + "../pkg2/ParamTest2.html\" title=\"class in pkg2\">" |
|
412 + "ParamTest2</a><java.util.List<? extends <a href=\".." |
|
413 + "/../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</a>>" |
|
414 + ">><br><a href=\"../../pkg2/ParamTest2.html\" " |
|
415 + "title=\"class in pkg2\">ParamTest2</a><java.util.List" |
|
416 + "<? extends <a href=\"../../pkg2/Foo4.html\" title=\"" |
|
417 + "class in pkg2\">Foo4</a>>></code></td>" |
|
418 ); |
|
419 |
|
420 // Type parameters in constructor and method args |
|
421 checkOutput("pkg2/class-use/Foo4.html", true, |
|
422 "<caption><span>Method parameters in <a href=\"../../pkg2/" |
|
423 + "package-summary.html\">pkg2</a> with type arguments of " |
|
424 + "type <a href=\"../../pkg2/Foo4.html\" title=\"class in " |
|
425 + "pkg2\">Foo4</a></span><span class=\"tabEnd\"> " |
|
426 + "</span></caption>\n" |
|
427 + "<tr>\n" |
|
428 + "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" |
|
429 + "<th class=\"colSecond\" scope=\"col\">Method</th>\n" |
|
430 + "<th class=\"colLast\" scope=\"col\">Description</th>\n" |
|
431 + "</tr>\n" |
|
432 + "<tbody>\n" |
|
433 + "<tr class=\"altColor\">\n" |
|
434 + "<td class=\"colFirst\"><code>void</code></td>\n" |
|
435 + "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest3." |
|
436 + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3." |
|
437 + "html#method-java.util.Set-\">method</a></span>​(java." |
|
438 + "util.Set<<a href=\"../../pkg2/Foo4.html\" title=\"" |
|
439 + "class in pkg2\">Foo4</a>> p)</code></th>", |
|
440 "<caption><span>Constructor parameters in <a href=\"../../" |
|
441 + "pkg2/package-summary.html\">pkg2</a> with type arguments " |
|
442 + "of type <a href=\"../../pkg2/Foo4.html\" title=\"class in " |
|
443 + "pkg2\">Foo4</a></span><span class=\"tabEnd\"> " |
|
444 + "</span></caption>" |
|
445 ); |
|
446 |
|
447 //================================= |
|
448 // TYPE PARAMETER IN INDEX |
|
449 //================================= |
|
450 checkOutput("index-all.html", true, |
|
451 "<span class=\"memberNameLink\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">" |
|
452 + "method(Vector<Object>)</a></span>" |
|
453 ); |
|
454 |
|
455 // TODO: duplicate of previous case; left in delibarately for now to simplify comparison testing |
|
456 //================================= |
|
457 // TYPE PARAMETER IN INDEX |
|
458 //================================= |
|
459 checkOutput("index-all.html", true, |
|
460 "<span class=\"memberNameLink\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">" |
|
461 + "method(Vector<Object>)</a></span>" |
|
462 ); |
|
463 |
|
464 // No type parameters in class frame. |
|
465 checkOutput("allclasses-frame.html", false, |
|
466 "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" |
|
467 + "TypeParameters</a><<a href=\"../pkg/TypeParameters.html\" " |
|
468 + "title=\"type parameter in TypeParameters\">E</a>>" |
|
469 ); |
|
470 |
|
471 } |
|
472 |
|
473 //================================= |
|
474 // VAR ARG TESTING |
|
475 //================================= |
|
476 void checkVarArgs() { |
|
477 checkOutput("pkg/VarArgs.html", true, |
|
478 "(int... i)", |
|
479 "(int[][]... i)", |
|
480 "-int:A...-", |
|
481 "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" |
|
482 + "TypeParameters</a>... t"); |
|
483 } |
|
484 |
|
485 //================================= |
|
486 // ANNOTATION TYPE TESTING |
|
487 //================================= |
|
488 void checkAnnotationTypes() { |
|
489 checkOutput("pkg/AnnotationType.html", true, |
|
490 // Make sure the summary links are correct. |
|
491 "<li>Summary: </li>\n" |
|
492 + "<li>Field | </li>\n" |
|
493 + "<li><a href=\"#annotation.type.required.element.summary\">" |
|
494 + "Required</a> | </li>\n" |
|
495 + "<li>" |
|
496 + "<a href=\"#annotation.type.optional.element.summary\">Optional</a></li>", |
|
497 // Make sure the detail links are correct. |
|
498 "<li>Detail: </li>\n" |
|
499 + "<li>Field | </li>\n" |
|
500 + "<li><a href=\"#annotation.type.element.detail\">Element</a></li>", |
|
501 // Make sure the heading is correct. |
|
502 "Annotation Type AnnotationType</h2>", |
|
503 // Make sure the signature is correct. |
|
504 "public @interface <span class=\"memberNameLabel\">AnnotationType</span>", |
|
505 // Make sure member summary headings are correct. |
|
506 "<h3>Required Element Summary</h3>", |
|
507 "<h3>Optional Element Summary</h3>", |
|
508 // Make sure element detail heading is correct |
|
509 "Element Detail", |
|
510 // Make sure default annotation type value is printed when necessary. |
|
511 "<dl>\n" |
|
512 + "<dt>Default:</dt>\n" |
|
513 + "<dd>\"unknown\"</dd>\n" |
|
514 + "</dl>"); |
|
515 } |
|
516 |
|
517 //================================= |
|
518 // ANNOTATION TYPE USAGE TESTING |
|
519 //================================= |
|
520 void checkAnnotationTypeUsage() { |
|
521 checkOutput("pkg/package-summary.html", true, |
|
522 // PACKAGE |
|
523 "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>=\"Package Annotation\",\n" |
|
524 + " <a href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)"); |
|
525 |
|
526 checkOutput("pkg/AnnotationTypeUsage.html", true, |
|
527 // CLASS |
|
528 "<pre><a href=\"../pkg/AnnotationType.html\" " |
|
529 + "title=\"annotation in pkg\">@AnnotationType</a>(" |
|
530 + "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" |
|
531 + "=\"Class Annotation\",\n" |
|
532 + " <a href=\"../pkg/AnnotationType.html#required--\">" |
|
533 + "required</a>=1994)\n" |
|
534 + "public class <span class=\"typeNameLabel\">" |
|
535 + "AnnotationTypeUsage</span>\n" |
|
536 + "extends java.lang.Object</pre>", |
|
537 // FIELD |
|
538 "<pre><a href=\"../pkg/AnnotationType.html\" " |
|
539 + "title=\"annotation in pkg\">@AnnotationType</a>(" |
|
540 + "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" |
|
541 + "=\"Field Annotation\",\n" |
|
542 + " <a href=\"../pkg/AnnotationType.html#required--\">" |
|
543 + "required</a>=1994)\n" |
|
544 + "public int field</pre>", |
|
545 // CONSTRUCTOR |
|
546 "<pre><a href=\"../pkg/AnnotationType.html\" " |
|
547 + "title=\"annotation in pkg\">@AnnotationType</a>(" |
|
548 + "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" |
|
549 + "=\"Constructor Annotation\",\n" |
|
550 + " <a href=\"../pkg/AnnotationType.html#required--\">" |
|
551 + "required</a>=1994)\n" |
|
552 + "public AnnotationTypeUsage​()</pre>", |
|
553 // METHOD |
|
554 "<pre><a href=\"../pkg/AnnotationType.html\" " |
|
555 + "title=\"annotation in pkg\">@AnnotationType</a>(" |
|
556 + "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" |
|
557 + "=\"Method Annotation\",\n" |
|
558 + " <a href=\"../pkg/AnnotationType.html#required--\">" |
|
559 + "required</a>=1994)\n" |
|
560 + "public void method​()</pre>", |
|
561 // METHOD PARAMS |
|
562 "<pre>public void methodWithParams​(" |
|
563 + "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">" |
|
564 + "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">" |
|
565 + "optional</a>=\"Parameter Annotation\",<a " |
|
566 + "href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)\n" |
|
567 + " int documented,\n" |
|
568 + " int undocmented)</pre>", |
|
569 // CONSTRUCTOR PARAMS |
|
570 "<pre>public AnnotationTypeUsage​(<a " |
|
571 + "href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">" |
|
572 + "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">" |
|
573 + "optional</a>=\"Constructor Param Annotation\",<a " |
|
574 + "href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)\n" |
|
575 + " int documented,\n" |
|
576 + " int undocmented)</pre>"); |
|
577 |
|
578 //================================= |
|
579 // Annotatation Type Usage |
|
580 //================================= |
|
581 checkOutput("pkg/class-use/AnnotationType.html", true, |
|
582 "<caption><span>Packages with annotations of type <a href=\"" |
|
583 + "../../pkg/AnnotationType.html\" title=\"annotation in pkg\">" |
|
584 + "AnnotationType</a></span><span class=\"tabEnd\"> " |
|
585 + "</span></caption>", |
|
586 "<caption><span>Classes in <a href=\"../../pkg/" |
|
587 + "package-summary.html\">pkg</a> with annotations of type " |
|
588 + "<a href=\"../../pkg/AnnotationType.html\" title=\"" |
|
589 + "annotation in pkg\">AnnotationType</a></span><span class" |
|
590 + "=\"tabEnd\"> </span></caption>", |
|
591 "<caption><span>Fields in <a href=\"../../pkg/" |
|
592 + "package-summary.html\">pkg</a> with annotations of type " |
|
593 + "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation " |
|
594 + "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">" |
|
595 + " </span></caption>", |
|
596 "<caption><span>Methods in <a href=\"../../pkg/" |
|
597 + "package-summary.html\">pkg</a> with annotations of type " |
|
598 + "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation " |
|
599 + "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">" |
|
600 + " </span></caption>", |
|
601 "<caption><span>Method parameters in <a href=\"../../pkg/" |
|
602 + "package-summary.html\">pkg</a> with annotations of type " |
|
603 + "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation " |
|
604 + "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">" |
|
605 + " </span></caption>", |
|
606 "<caption><span>Constructors in <a href=\"../../pkg/" |
|
607 + "package-summary.html\">pkg</a> with annotations of type " |
|
608 + "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation " |
|
609 + "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">" |
|
610 + " </span></caption>", |
|
611 "<caption><span>Constructor parameters in <a href=\"../../" |
|
612 + "pkg/package-summary.html\">pkg</a> with annotations of " |
|
613 + "type <a href=\"../../pkg/AnnotationType.html\" title=\"" |
|
614 + "annotation in pkg\">AnnotationType</a></span><span class=\"" |
|
615 + "tabEnd\"> </span></caption>" |
|
616 ); |
|
617 |
|
618 //============================================================== |
|
619 // ANNOTATION TYPE USAGE TESTING (When @Documented is omitted) |
|
620 //=============================================================== |
|
621 checkOutput("pkg/AnnotationTypeUsage.html", false, |
|
622 // CLASS |
|
623 "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Class Annotation\",\n" |
|
624 + " <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n" |
|
625 + "public class <span class=\"typeNameLabel\">AnnotationTypeUsage</span></dt><dt>extends java.lang.Object</dt>", |
|
626 // FIELD |
|
627 "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Field Annotation\",\n" |
|
628 + " <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n" |
|
629 + "public int <span class=\"memberNameLabel\">field</span>", |
|
630 // CONSTRUCTOR |
|
631 "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Constructor Annotation\",\n" |
|
632 + " <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n" |
|
633 + "public <span class=\"typeNameLabel\">AnnotationTypeUsage</span>​()", |
|
634 // METHOD |
|
635 "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Method Annotation\",\n" |
|
636 + " <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n" |
|
637 + "public void <span class=\"memberNameLabel\">method</span>​()"); |
|
638 |
|
639 //================================= |
|
640 // Make sure annotation types do not |
|
641 // trigger this warning. |
|
642 //================================= |
|
643 checkOutput(Output.OUT, false, |
|
644 "Internal error: package sets don't match: [] with: null"); |
|
645 |
|
646 //================================= |
|
647 // ANNOTATION TYPE USAGE TESTING (All Different Types). |
|
648 //================================= |
|
649 checkOutput("pkg1/B.html", true, |
|
650 // Integer |
|
651 "<a href=\"../pkg1/A.html#d--\">d</a>=3.14,", |
|
652 // Double |
|
653 "<a href=\"../pkg1/A.html#d--\">d</a>=3.14,", |
|
654 // Boolean |
|
655 "<a href=\"../pkg1/A.html#b--\">b</a>=true,", |
|
656 // String |
|
657 "<a href=\"../pkg1/A.html#s--\">s</a>=\"sigh\",", |
|
658 // Class |
|
659 "<a href=\"../pkg1/A.html#c--\">c</a>=<a href=\"../pkg2/Foo.html\" title=\"class in pkg2\">Foo.class</a>,", |
|
660 // Bounded Class |
|
661 "<a href=\"../pkg1/A.html#w--\">w</a>=<a href=\"../pkg/TypeParameterSubClass.html\" title=\"class in pkg\">TypeParameterSubClass.class</a>,", |
|
662 // Enum |
|
663 "<a href=\"../pkg1/A.html#e--\">e</a>=<a href=\"../pkg/Coin.html#Penny\">Penny</a>,", |
|
664 // Annotation Type |
|
665 "<a href=\"../pkg1/A.html#a--\">a</a>=<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>=\"foo\",<a href=\"../pkg/AnnotationType.html#required--\">required</a>=1994),", |
|
666 // String Array |
|
667 "<a href=\"../pkg1/A.html#sa--\">sa</a>={\"up\",\"down\"},", |
|
668 // Primitive |
|
669 "<a href=\"../pkg1/A.html#primitiveClassTest--\">primitiveClassTest</a>=boolean.class,"); |
|
670 |
|
671 // XXX: Add array test case after this if fixed: |
|
672 //5020899: Incorrect internal representation of class-valued annotation elements |
|
673 // Make sure that annotations are surrounded by <pre> and </pre> |
|
674 checkOutput("pkg1/B.html", true, |
|
675 "<pre><a href=\"../pkg1/A.html\" title=\"annotation in pkg1\">@A</a>", |
|
676 "public interface <span class=\"typeNameLabel\">B</span></pre>"); |
|
677 |
|
678 } |
|
679 |
|
680 } |