TestNewLanguageFeatures.java revision 3294:9adfb22ff08f
1/*
2 * Copyright (c) 2003, 2016, 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
27 * @summary  Run Javadoc on a set of source files that demonstrate new
28 *           language features.  Check the output to ensure that the new
29 *           language features are properly documented.
30 * @author   jamieh
31 * @library  ../lib
32 * @modules jdk.javadoc/jdk.javadoc.internal.tool
33 * @build    JavadocTester
34 * @run main TestNewLanguageFeatures
35 */
36
37public class TestNewLanguageFeatures extends JavadocTester {
38
39    public static void main(String... args) throws Exception {
40        TestNewLanguageFeatures tester = new TestNewLanguageFeatures();
41        tester.runTests();
42    }
43
44    @Test
45    void test() {
46        javadoc("-Xdoclint:none",
47                "-d", "out",
48                "-use", "-sourcepath",
49                testSrc,
50                "pkg", "pkg1", "pkg2");
51        checkExit(Exit.OK);
52
53        checkEnums();
54        checkTypeParameters();
55        checkVarArgs();
56        checkAnnotationTypeUsage();
57    }
58
59    //=================================
60    // ENUM TESTING
61    //=================================
62    void checkEnums() {
63       checkOutput("pkg/Coin.html", true,
64                // Make sure enum header is correct.
65                "Enum Coin</h2>",
66                // Make sure enum signature is correct.
67                "<pre>public enum "
68                + "<span class=\"typeNameLabel\">Coin</span>\n"
69                + "extends java.lang.Enum&lt;<a href=\"../pkg/Coin.html\" "
70                + "title=\"enum in pkg\">Coin</a>&gt;</pre>",
71                // Check for enum constant section
72                "<caption><span>Enum Constants"
73                + "</span><span class=\"tabEnd\">&nbsp;</span></caption>",
74                // Detail for enum constant
75                "<span class=\"memberNameLink\"><a href=\"../pkg/Coin.html#Dime\">Dime</a></span>",
76                // Automatically insert documentation for values() and valueOf().
77                "Returns an array containing the constants of this enum type,",
78                "Returns the enum constant of this type with the specified name",
79                "for (Coin c : Coin.values())",
80                "Overloaded valueOf() method has correct documentation.",
81                "Overloaded values method  has correct documentation.",
82                "<pre>public static&nbsp;<a href=\"../pkg/Coin.html\" title=\"enum in pkg\">Coin</a>" +
83                "&nbsp;valueOf(java.lang.String&nbsp;name)</pre>\n" +
84                "<div class=\"block\">Returns the enum constant of this type with the specified name.\n" +
85                "The string must match <i>exactly</i> an identifier used to declare an\n" +
86                "enum constant in this type.  (Extraneous whitespace characters are \n" +
87                "not permitted.)</div>\n" +
88                "<dl>\n" +
89                "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" +
90                "<dd><code>name</code> - the name of the enum constant to be returned.</dd>\n" +
91                "<dt><span class=\"returnLabel\">Returns:</span></dt>\n" +
92                "<dd>the enum constant with the specified name</dd>\n" +
93                "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n" +
94                "<dd><code>java.lang.IllegalArgumentException</code> - if this enum type has no " +
95                "constant with the specified name</dd>\n" +
96                "<dd><code>java.lang.NullPointerException</code> - if the argument is null</dd>");
97
98        // NO constructor section
99        checkOutput("pkg/Coin.html", false,
100                "<h3>Constructor Summary</h3>");
101    }
102
103    //=================================
104    // TYPE PARAMETER TESTING
105    //=================================
106
107    void checkTypeParameters() {
108        checkOutput("pkg/TypeParameters.html", true,
109                // Make sure the header is correct.
110                "Class TypeParameters&lt;E&gt;</h2>",
111                // Check class type parameters section.
112                "<dt><span class=\"paramLabel\">Type Parameters:</span></dt>\n"
113                + "<dd><code>E</code> - "
114                + "the type parameter for this class.",
115                // Type parameters in @see/@link
116                "<dl>\n"
117                + "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
118                + "<dd>"
119                + "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">"
120                + "<code>TypeParameters</code></a></dd>\n"
121                + "</dl>",
122                // Method that uses class type parameter.
123                "(<a href=\"../pkg/TypeParameters.html\" title=\"type "
124                + "parameter in TypeParameters\">E</a>&nbsp;param)",
125                // Method type parameter section.
126                "<span class=\"paramLabel\">Type Parameters:</span></dt>\n"
127                + "<dd><code>T</code> - This is the first "
128                + "type parameter.</dd>\n"
129                + "<dd><code>V</code> - This is the second type "
130                + "parameter.",
131                // Signature of method with type parameters
132                "public&nbsp;&lt;T extends java.util.List,V&gt;&nbsp;"
133                + "java.lang.String[]&nbsp;methodThatHasTypeParameters",
134                // Method that returns TypeParameters
135                "<td class=\"colFirst\"><code><a href=\"../pkg/TypeParameters.html\" "
136                + "title=\"type parameter in TypeParameters\">E</a>[]</code></td>\n"
137                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
138                + "<a href=\"../pkg/TypeParameters.html#methodThatReturnsTypeParameterA-E:A-\">"
139                + "methodThatReturnsTypeParameterA</a></span>(<a href=\"../pkg/TypeParameters.html\" "
140                + "title=\"type parameter in TypeParameters\">E</a>[]&nbsp;e)</code>",
141                "<pre>public&nbsp;<a href=\"../pkg/TypeParameters.html\" "
142                + "title=\"type parameter in TypeParameters\">E</a>[]&nbsp;"
143                + "methodThatReturnsTypeParameterA(<a href=\"../pkg/TypeParameters.html\" "
144                + "title=\"type parameter in TypeParameters\">E</a>[]&nbsp;e)</pre>\n",
145                "<td class=\"colFirst\"><code>&lt;T extends java.lang.Object &amp; java.lang.Comparable&lt;? super T&gt;&gt;"
146                + "<br>T</code></td>\n"
147                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
148                + "<a href=\"../pkg/TypeParameters.html#methodtThatReturnsTypeParametersB-java.util.Collection-\">"
149                + "methodtThatReturnsTypeParametersB</a></span>(java.util.Collection&lt;? extends T&gt;&nbsp;coll)</code>\n"
150                + "<div class=\"block\">Returns TypeParameters</div>\n",
151                // Method takes a TypeVariable
152                "<td class=\"colFirst\"><code>&lt;X extends java.lang.Throwable&gt;<br>"
153                + "<a href=\"../pkg/TypeParameters.html\" title=\"type parameter in TypeParameters\">E</a>"
154                + "</code></td>\n"
155                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
156                + "<a href=\"../pkg/TypeParameters.html#orElseThrow-java.util.function.Supplier-\">"
157                + "orElseThrow</a></span>(java.util.function.Supplier&lt;? extends X&gt;&nbsp;exceptionSupplier)</code>"
158                );
159
160        checkOutput("pkg/Wildcards.html", true,
161                // Wildcard testing.
162                "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">"
163                + "TypeParameters</a>&lt;? super java.lang.String&gt;&nbsp;a",
164                "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">"
165                + "TypeParameters</a>&lt;? extends java.lang.StringBuffer&gt;&nbsp;b",
166                "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">"
167                + "TypeParameters</a>&nbsp;c");
168
169        checkOutput(Output.OUT, true,
170                // Bad type parameter warnings.
171                "warning - @param argument "
172                + "\"<BadClassTypeParam>\" is not a type parameter name.",
173                "warning - @param argument "
174                + "\"<BadMethodTypeParam>\" is not a type parameter name.");
175
176        // Signature of subclass that has type parameters.
177        checkOutput("pkg/TypeParameterSubClass.html", true,
178                "<pre>public class <span class=\"typeNameLabel\">TypeParameterSubClass&lt;T extends "
179                + "java.lang.String&gt;</span>\n"
180                + "extends "
181                + "<a href=\"../pkg/TypeParameterSuperClass.html\" title=\"class in pkg\">"
182                + "TypeParameterSuperClass</a>&lt;T&gt;</pre>");
183
184        // Interface generic parameter substitution
185        // Signature of subclass that has type parameters.
186        checkOutput("pkg/TypeParameters.html", true,
187                "<dl>\n"
188                + "<dt>All Implemented Interfaces:</dt>\n"
189                + "<dd><a href=\"../pkg/SubInterface.html\" title=\"interface in pkg\">"
190                + "SubInterface</a>&lt;E&gt;, <a href=\"../pkg/SuperInterface.html\" "
191                + "title=\"interface in pkg\">SuperInterface</a>&lt;E&gt;</dd>\n"
192                + "</dl>");
193
194        checkOutput("pkg/SuperInterface.html", true,
195                "<dl>\n"
196                + "<dt>All Known Subinterfaces:</dt>\n"
197                + "<dd><a href=\"../pkg/SubInterface.html\" title=\"interface in pkg\">"
198                + "SubInterface</a>&lt;V&gt;</dd>\n"
199                + "</dl>");
200        checkOutput("pkg/SubInterface.html", true,
201                "<dl>\n"
202                + "<dt>All Superinterfaces:</dt>\n"
203                + "<dd><a href=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">"
204                + "SuperInterface</a>&lt;V&gt;</dd>\n"
205                + "</dl>");
206
207        //==============================================================
208        // Handle multiple bounds.
209        //==============================================================
210        checkOutput("pkg/MultiTypeParameters.html", true,
211                "public&nbsp;&lt;T extends java.lang.Number &amp; java.lang.Runnable&gt;&nbsp;T&nbsp;foo(T&nbsp;t)");
212
213        //==============================================================
214        // Test Class-Use Documentation for Type Parameters.
215        //==============================================================
216        // ClassUseTest1: <T extends Foo & Foo2>
217        checkOutput("pkg2/class-use/Foo.html", true,
218                "<caption><span>Classes in <a href=\"../../pkg2/"
219                + "package-summary.html\">pkg2</a> with type parameters of "
220                + "type <a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">"
221                + "Foo</a></span><span class=\"tabEnd\">&nbsp;</span></caption>",
222                "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest1.html\" "
223                + "title=\"class in pkg2\">ClassUseTest1</a>&lt;T extends "
224                + "<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo"
225                + "</a> &amp; <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">"
226                + "Foo2</a>&gt;</span></code>&nbsp;</td>",
227                "<caption><span>Methods in <a href=\"../../pkg2/"
228                + "package-summary.html\">pkg2</a> with type parameters of "
229                + "type <a href=\"../../pkg2/Foo.html\" title=\"class in "
230                + "pkg2\">Foo</a></span><span class=\"tabEnd\">&nbsp;</span></caption>",
231                "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest1."
232                + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/"
233                + "ClassUseTest1.html#method-T-\">method</a></span>"
234                + "(T&nbsp;t)</code>&nbsp;</td>",
235                "<caption><span>Fields in <a href=\"../../pkg2/"
236                + "package-summary.html\">pkg2</a> with type parameters of "
237                + "type <a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">"
238                + "Foo</a></span><span class=\"tabEnd\">&nbsp;</span></caption>",
239                "td class=\"colFirst\"><code><a href=\"../../pkg2/"
240                + "ParamTest.html\" title=\"class in pkg2\">ParamTest</a>"
241                + "&lt;<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\""
242                + ">Foo</a>&gt;</code></td>"
243        );
244
245        checkOutput("pkg2/class-use/ParamTest.html", true,
246                "<caption><span>Fields in <a href=\"../../pkg2/"
247                + "package-summary.html\">pkg2</a> declared as <a href=\"../"
248                + "../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest"
249                + "</a></span><span class=\"tabEnd\">&nbsp;</span></caption>",
250                "<td class=\"colFirst\"><code><a href=\"../../pkg2/"
251                + "ParamTest.html\" title=\"class in pkg2\">ParamTest</a>&lt;<a "
252                + "href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</a"
253                + ">&gt;</code></td>"
254        );
255
256        checkOutput("pkg2/class-use/Foo2.html", true,
257                "<caption><span>Classes in <a href=\"../../pkg2/"
258                + "package-summary.html\">pkg2</a> with type parameters of "
259                + "type <a href=\"../../pkg2/Foo2.html\" title=\"interface "
260                + "in pkg2\">Foo2</a></span><span class=\"tabEnd\">&nbsp;"
261                + "</span></caption>",
262                "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest1.html\" "
263                + "title=\"class in pkg2\">ClassUseTest1</a>&lt;T extends "
264                + "<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo"
265                + "</a> &amp; <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">"
266                + "Foo2</a>&gt;</span></code>&nbsp;</td>",
267                "<caption><span>Methods in <a href=\"../../pkg2/"
268                + "package-summary.html\">pkg2</a> with type parameters of "
269                + "type <a href=\"../../pkg2/Foo2.html\" title=\"interface "
270                + "in pkg2\">Foo2</a></span><span class=\"tabEnd\">&nbsp;"
271                + "</span></caption>",
272                "<td class=\"colLast\"><span class=\"typeNameLabel\">"
273                + "ClassUseTest1.</span><code><span class=\"memberNameLink\"><a href=\"../../"
274                + "pkg2/ClassUseTest1.html#method-T-\">method</a></span>"
275                + "(T&nbsp;t)</code>&nbsp;</td>"
276        );
277
278        // ClassUseTest2: <T extends ParamTest<Foo3>>
279        checkOutput("pkg2/class-use/ParamTest.html", true,
280                "<caption><span>Classes in <a href=\"../../pkg2/"
281                + "package-summary.html\">pkg2</a> with type parameters of "
282                + "type <a href=\"../../pkg2/ParamTest.html\" title=\"class "
283                + "in pkg2\">ParamTest</a></span><span class=\"tabEnd\">"
284                + "&nbsp;</span></caption>",
285                "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest2.html\" "
286                + "title=\"class in pkg2\">ClassUseTest2</a>&lt;T extends "
287                + "<a href=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">"
288                + "ParamTest</a>&lt;<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">"
289                + "Foo3</a>&gt;&gt;</span></code>&nbsp;</td>",
290                "<caption><span>Methods in <a href=\"../../pkg2/"
291                + "package-summary.html\">pkg2</a> with type parameters of "
292                + "type <a href=\"../../pkg2/ParamTest.html\" title=\"class "
293                + "in pkg2\">ParamTest</a></span><span class=\"tabEnd\">"
294                + "&nbsp;</span></caption>",
295                "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest2."
296                + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/"
297                + "ClassUseTest2.html#method-T-\">method</a></span>"
298                + "(T&nbsp;t)</code>&nbsp;</td>",
299                "<caption><span>Fields in <a href=\"../../pkg2/"
300                + "package-summary.html\">pkg2</a> declared as <a href=\"../"
301                + "../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest"
302                + "</a></span><span class=\"tabEnd\">&nbsp;</span></caption>",
303                "<td class=\"colFirst\"><code><a href=\"../../pkg2/"
304                + "ParamTest.html\" title=\"class in pkg2\">ParamTest</a>"
305                + "&lt;<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">"
306                + "Foo</a>&gt;</code></td>",
307                "<caption><span>Methods in <a href=\"../../pkg2/"
308                + "package-summary.html\">pkg2</a> with type parameters of "
309                + "type <a href=\"../../pkg2/ParamTest.html\" title=\"class "
310                + "in pkg2\">ParamTest</a></span><span class=\"tabEnd\">"
311                + "&nbsp;</span></caption>",
312                "<td class=\"colFirst\"><code>&lt;T extends <a href=\"../"
313                + "../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest"
314                + "</a>&lt;<a href=\"../../pkg2/Foo3.html\" title=\"class in "
315                + "pkg2\">Foo3</a>&gt;&gt;<br><a href=\"../../pkg2/"
316                + "ParamTest.html\" title=\"class in pkg2\">ParamTest</a>"
317                + "&lt;<a href=\"../../pkg2/Foo3.html\" title=\"class in "
318                + "pkg2\">Foo3</a>&gt;</code></td>"
319        );
320
321        checkOutput("pkg2/class-use/Foo3.html", true,
322                "<caption><span>Classes in <a href=\"../../pkg2/"
323                + "package-summary.html\">pkg2</a> with type parameters of "
324                + "type <a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">"
325                + "Foo3</a></span><span class=\"tabEnd\">&nbsp;</span></caption>",
326                "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest2.html\" "
327                + "title=\"class in pkg2\">ClassUseTest2</a>&lt;T extends "
328                + "<a href=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">"
329                + "ParamTest</a>&lt;<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">"
330                + "Foo3</a>&gt;&gt;</span></code>&nbsp;</td>",
331                "<caption><span>Methods in <a href=\"../../pkg2/"
332                + "package-summary.html\">pkg2</a> with type parameters of "
333                + "type <a href=\"../../pkg2/Foo3.html\" title=\"class in "
334                + "pkg2\">Foo3</a></span><span class=\"tabEnd\">&nbsp;"
335                + "</span></caption>",
336                "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest2."
337                + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/"
338                + "ClassUseTest2.html#method-T-\">method</a></span>"
339                + "(T&nbsp;t)</code>&nbsp;</td>",
340                "<caption><span>Methods in <a href=\"../../pkg2/"
341                + "package-summary.html\">pkg2</a> that return types with "
342                + "arguments of type <a href=\"../../pkg2/Foo3.html\" title"
343                + "=\"class in pkg2\">Foo3</a></span><span class=\"tabEnd\">"
344                + "&nbsp;</span></caption>",
345                "<td class=\"colFirst\"><code>&lt;T extends <a href=\"../../"
346                + "pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</a>&lt;"
347                + "<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3"
348                + "</a>&gt;&gt;<br><a href=\"../../pkg2/ParamTest.html\" "
349                + "title=\"class in pkg2\">ParamTest</a>&lt;<a href=\"../../pkg2/"
350                + "Foo3.html\" title=\"class in pkg2\">Foo3</a>&gt;</code></td>"
351        );
352
353        // ClassUseTest3: <T extends ParamTest2<List<? extends Foo4>>>
354        checkOutput("pkg2/class-use/ParamTest2.html", true,
355                "<caption><span>Classes in <a href=\"../../pkg2/"
356                + "package-summary.html\">pkg2</a> with type parameters of "
357                + "type <a href=\"../../pkg2/ParamTest2.html\" title=\"class "
358                + "in pkg2\">ParamTest2</a></span><span class=\"tabEnd\">"
359                + "&nbsp;</span></caption>",
360                "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3.html\" "
361                + "title=\"class in pkg2\">ClassUseTest3</a>&lt;T extends "
362                + "<a href=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">"
363                + "ParamTest2</a>&lt;java.util.List&lt;? extends "
364                + "<a href=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">"
365                + "Foo4</a>&gt;&gt;&gt;</span></code>&nbsp;</td>",
366                "<caption><span>Methods in <a href=\"../../pkg2/"
367                + "package-summary.html\">pkg2</a> with type parameters of "
368                + "type <a href=\"../../pkg2/ParamTest2.html\" title=\"class "
369                + "in pkg2\">ParamTest2</a></span><span class=\"tabEnd\">"
370                + "&nbsp;</span></caption>",
371                "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest3"
372                + ".</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3."
373                + "html#method-T-\">method</a></span>(T&nbsp;t)</code>&nbsp;</td>",
374                "<td class=\"colFirst\"><code>&lt;T extends <a href=\"../"
375                + "../pkg2/ParamTest2.html\" title=\"class in pkg2\">"
376                + "ParamTest2</a>&lt;java.util.List&lt;? extends <a href=\".."
377                + "/../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</a>&gt;"
378                + "&gt;&gt;<br><a href=\"../../pkg2/ParamTest2.html\" "
379                + "title=\"class in pkg2\">ParamTest2</a>&lt;java.util.List"
380                + "&lt;? extends <a href=\"../../pkg2/Foo4.html\" title=\""
381                + "class in pkg2\">Foo4</a>&gt;&gt;</code></td>"
382        );
383
384        checkOutput("pkg2/class-use/Foo4.html", true,
385                "<caption><span>Classes in <a href=\"../../pkg2/"
386                + "package-summary.html\">pkg2</a> with type parameters of "
387                + "type <a href=\"../../pkg2/Foo4.html\" title=\"class in "
388                + "pkg2\">Foo4</a></span><span class=\"tabEnd\">&nbsp;"
389                + "</span></caption>",
390                "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3.html\" "
391                + "title=\"class in pkg2\">ClassUseTest3</a>&lt;T extends "
392                + "<a href=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">"
393                + "ParamTest2</a>&lt;java.util.List&lt;? extends "
394                + "<a href=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">"
395                + "Foo4</a>&gt;&gt;&gt;</span></code>&nbsp;</td>",
396                "<caption><span>Methods in <a href=\"../../pkg2/"
397                + "package-summary.html\">pkg2</a> with type parameters of "
398                + "type <a href=\"../../pkg2/Foo4.html\" title=\"class in "
399                + "pkg2\">Foo4</a></span><span class=\"tabEnd\">&nbsp;</span></caption>",
400                "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest3."
401                + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3."
402                + "html#method-T-\">method</a></span>(T&nbsp;t)</code>"
403                + "&nbsp;</td>",
404                "<caption><span>Methods in <a href=\"../../pkg2/"
405                + "package-summary.html\">pkg2</a> that return types with "
406                + "arguments of type <a href=\"../../pkg2/Foo4.html\" "
407                + "title=\"class in pkg2\">Foo4</a></span><span class=\""
408                + "tabEnd\">&nbsp;</span></caption>",
409                "<td class=\"colFirst\"><code>&lt;T extends <a href=\"../"
410                + "../pkg2/ParamTest2.html\" title=\"class in pkg2\">"
411                + "ParamTest2</a>&lt;java.util.List&lt;? extends <a href=\".."
412                + "/../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</a>&gt;"
413                + "&gt;&gt;<br><a href=\"../../pkg2/ParamTest2.html\" "
414                + "title=\"class in pkg2\">ParamTest2</a>&lt;java.util.List"
415                + "&lt;? extends <a href=\"../../pkg2/Foo4.html\" title=\""
416                + "class in pkg2\">Foo4</a>&gt;&gt;</code></td>"
417        );
418
419        // Type parameters in constructor and method args
420        checkOutput("pkg2/class-use/Foo4.html", true,
421                "<caption><span>Method parameters in <a href=\"../../pkg2/"
422                + "package-summary.html\">pkg2</a> with type arguments of "
423                + "type <a href=\"../../pkg2/Foo4.html\" title=\"class in "
424                + "pkg2\">Foo4</a></span><span class=\"tabEnd\">&nbsp;"
425                + "</span></caption>\n"
426                + "<tr>\n"
427                + "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
428                + "<th class=\"colLast\" scope=\"col\">Method and Description</th>\n"
429                + "</tr>\n"
430                + "<tbody>\n"
431                + "<tr class=\"altColor\">\n"
432                + "<td class=\"colFirst\"><code>void</code></td>\n"
433                + "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest3."
434                + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3."
435                + "html#method-java.util.Set-\">method</a></span>(java."
436                + "util.Set&lt;<a href=\"../../pkg2/Foo4.html\" title=\""
437                + "class in pkg2\">Foo4</a>&gt;&nbsp;p)</code>&nbsp;</td>\n"
438                + "</tr>\n"
439                + "</tbody>",
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\">&nbsp;"
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&lt;Object&gt;)</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&lt;Object&gt;)</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>&lt;<a href=\"../pkg/TypeParameters.html\" "
468                + "title=\"type parameter in TypeParameters\">E</a>&gt;"
469        );
470
471    }
472
473    //=================================
474    // VAR ARG TESTING
475    //=================================
476    void checkVarArgs() {
477        checkOutput("pkg/VarArgs.html", true,
478                "(int...&nbsp;i)",
479                "(int[][]...&nbsp;i)",
480                "-int:A...-",
481                "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">"
482                + "TypeParameters</a>...&nbsp;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:&nbsp;</li>\n"
492                + "<li>Field&nbsp;|&nbsp;</li>\n"
493                + "<li><a href=\"#annotation.type.required.element.summary\">"
494                + "Required</a>&nbsp;|&nbsp;</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:&nbsp;</li>\n"
499                + "<li>Field&nbsp;|&nbsp;</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&nbsp;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&nbsp;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&nbsp;void&nbsp;method()</pre>",
561                // METHOD PARAMS
562                "<pre>public&nbsp;void&nbsp;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&nbsp;documented,\n"
568                + "                             int&nbsp;undocmented)</pre>",
569                // CONSTRUCTOR PARAMS
570                "<pre>public&nbsp;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&nbsp;documented,\n"
576                + "                           int&nbsp;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\">&nbsp;"
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\">&nbsp;</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                + "&nbsp;</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                + "&nbsp;</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                + "&nbsp;</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                + "&nbsp;</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\">&nbsp;</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}
681