TestNewLanguageFeatures.java revision 3658:7f3b6ce62ea7
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 8162363
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                + "<th class=\"colSecond\" scope=\"row\"><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                + "<th class=\"colSecond\" scope=\"row\"><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>",
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                + "<th class=\"colSecond\" scope=\"row\"><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><code><a href=\"../pkg/SubInterface.html\" title=\"interface in pkg\">"
190                + "SubInterface</a>&lt;E&gt;</code>, <code><a href=\"../pkg/SuperInterface.html\" "
191                + "title=\"interface in pkg\">SuperInterface</a>&lt;E&gt;</code></dd>\n"
192                + "</dl>");
193
194        checkOutput("pkg/SuperInterface.html", true,
195                "<dl>\n"
196                + "<dt>All Known Subinterfaces:</dt>\n"
197                + "<dd><code><a href=\"../pkg/SubInterface.html\" title=\"interface in pkg\">"
198                + "SubInterface</a>&lt;V&gt;</code></dd>\n"
199                + "</dl>");
200        checkOutput("pkg/SubInterface.html", true,
201                "<dl>\n"
202                + "<dt>All Superinterfaces:</dt>\n"
203                + "<dd><code><a href=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">"
204                + "SuperInterface</a>&lt;V&gt;</code></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                "<th class=\"colSecond\" scope=\"row\"><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></th>",
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                "<th class=\"colSecond\" scope=\"row\"><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></th>",
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                "<th class=\"colSecond\" scope=\"row\"><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></th>",
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                "<th class=\"colSecond\" scope=\"row\"><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></th>"
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                "<th class=\"colSecond\" scope=\"row\"><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></th>",
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                "<th class=\"colSecond\" scope=\"row\"><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></th>",
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                "<th class=\"colSecond\" scope=\"row\"><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></th>",
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                "<th class=\"colSecond\" scope=\"row\"><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></th>",
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                "<th class=\"colSecond\" scope=\"row\"><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></th>",
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                "<th class=\"colSecond\" scope=\"row\"><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></th>",
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                "<th class=\"colSecond\" scope=\"row\"><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></th>",
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                "<th class=\"colSecond\" scope=\"row\"><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                + "</th>",
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=\"colSecond\" scope=\"col\">Method</th>\n"
429                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
430                + "</tr>\n"
431                + "<tbody>\n"
432                + "<tr class=\"altColor\">\n"
433                + "<td class=\"colFirst\"><code>void</code></td>\n"
434                + "<th class=\"colSecond\" scope=\"row\"><span class=\"typeNameLabel\">ClassUseTest3."
435                + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3."
436                + "html#method-java.util.Set-\">method</a></span>(java."
437                + "util.Set&lt;<a href=\"../../pkg2/Foo4.html\" title=\""
438                + "class in pkg2\">Foo4</a>&gt;&nbsp;p)</code></th>",
439                "<caption><span>Constructor parameters in <a href=\"../../"
440                + "pkg2/package-summary.html\">pkg2</a> with type arguments "
441                + "of type <a href=\"../../pkg2/Foo4.html\" title=\"class in "
442                + "pkg2\">Foo4</a></span><span class=\"tabEnd\">&nbsp;"
443                + "</span></caption>"
444        );
445
446        //=================================
447        // TYPE PARAMETER IN INDEX
448        //=================================
449        checkOutput("index-all.html", true,
450                "<span class=\"memberNameLink\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">"
451                + "method(Vector&lt;Object&gt;)</a></span>"
452        );
453
454        // TODO: duplicate of previous case; left in delibarately for now to simplify comparison testing
455        //=================================
456        // TYPE PARAMETER IN INDEX
457        //=================================
458        checkOutput("index-all.html", true,
459                "<span class=\"memberNameLink\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">"
460                + "method(Vector&lt;Object&gt;)</a></span>"
461        );
462
463        // No type parameters in class frame.
464        checkOutput("allclasses-frame.html", false,
465                "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">"
466                + "TypeParameters</a>&lt;<a href=\"../pkg/TypeParameters.html\" "
467                + "title=\"type parameter in TypeParameters\">E</a>&gt;"
468        );
469
470    }
471
472    //=================================
473    // VAR ARG TESTING
474    //=================================
475    void checkVarArgs() {
476        checkOutput("pkg/VarArgs.html", true,
477                "(int...&nbsp;i)",
478                "(int[][]...&nbsp;i)",
479                "-int:A...-",
480                "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">"
481                + "TypeParameters</a>...&nbsp;t");
482    }
483
484    //=================================
485    // ANNOTATION TYPE TESTING
486    //=================================
487    void checkAnnotationTypes() {
488        checkOutput("pkg/AnnotationType.html", true,
489                // Make sure the summary links are correct.
490                "<li>Summary:&nbsp;</li>\n"
491                + "<li>Field&nbsp;|&nbsp;</li>\n"
492                + "<li><a href=\"#annotation.type.required.element.summary\">"
493                + "Required</a>&nbsp;|&nbsp;</li>\n"
494                + "<li>"
495                + "<a href=\"#annotation.type.optional.element.summary\">Optional</a></li>",
496                // Make sure the detail links are correct.
497                "<li>Detail:&nbsp;</li>\n"
498                + "<li>Field&nbsp;|&nbsp;</li>\n"
499                + "<li><a href=\"#annotation.type.element.detail\">Element</a></li>",
500                // Make sure the heading is correct.
501                "Annotation Type AnnotationType</h2>",
502                // Make sure the signature is correct.
503                "public @interface <span class=\"memberNameLabel\">AnnotationType</span>",
504                // Make sure member summary headings are correct.
505                "<h3>Required Element Summary</h3>",
506                "<h3>Optional Element Summary</h3>",
507                // Make sure element detail heading is correct
508                "Element Detail",
509                // Make sure default annotation type value is printed when necessary.
510                "<dl>\n"
511                + "<dt>Default:</dt>\n"
512                + "<dd>\"unknown\"</dd>\n"
513                + "</dl>");
514    }
515
516    //=================================
517    // ANNOTATION TYPE USAGE TESTING
518    //=================================
519    void checkAnnotationTypeUsage() {
520        checkOutput("pkg/package-summary.html", true,
521                // PACKAGE
522                "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>=\"Package Annotation\",\n"
523                + "                <a href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)");
524
525        checkOutput("pkg/AnnotationTypeUsage.html", true,
526                // CLASS
527                "<pre><a href=\"../pkg/AnnotationType.html\" "
528                + "title=\"annotation in pkg\">@AnnotationType</a>("
529                + "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>"
530                + "=\"Class Annotation\",\n"
531                + "                <a href=\"../pkg/AnnotationType.html#required--\">"
532                + "required</a>=1994)\n"
533                + "public class <span class=\"typeNameLabel\">"
534                + "AnnotationTypeUsage</span>\n"
535                + "extends java.lang.Object</pre>",
536                // FIELD
537                "<pre><a href=\"../pkg/AnnotationType.html\" "
538                + "title=\"annotation in pkg\">@AnnotationType</a>("
539                + "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>"
540                + "=\"Field Annotation\",\n"
541                + "                <a href=\"../pkg/AnnotationType.html#required--\">"
542                + "required</a>=1994)\n"
543                + "public&nbsp;int field</pre>",
544                // CONSTRUCTOR
545                "<pre><a href=\"../pkg/AnnotationType.html\" "
546                + "title=\"annotation in pkg\">@AnnotationType</a>("
547                + "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>"
548                + "=\"Constructor Annotation\",\n"
549                + "                <a href=\"../pkg/AnnotationType.html#required--\">"
550                + "required</a>=1994)\n"
551                + "public&nbsp;AnnotationTypeUsage()</pre>",
552                // METHOD
553                "<pre><a href=\"../pkg/AnnotationType.html\" "
554                + "title=\"annotation in pkg\">@AnnotationType</a>("
555                + "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>"
556                + "=\"Method Annotation\",\n"
557                + "                <a href=\"../pkg/AnnotationType.html#required--\">"
558                + "required</a>=1994)\n"
559                + "public&nbsp;void&nbsp;method()</pre>",
560                // METHOD PARAMS
561                "<pre>public&nbsp;void&nbsp;methodWithParams("
562                + "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">"
563                + "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">"
564                + "optional</a>=\"Parameter Annotation\",<a "
565                + "href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)\n"
566                + "                             int&nbsp;documented,\n"
567                + "                             int&nbsp;undocmented)</pre>",
568                // CONSTRUCTOR PARAMS
569                "<pre>public&nbsp;AnnotationTypeUsage(<a "
570                + "href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">"
571                + "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">"
572                + "optional</a>=\"Constructor Param Annotation\",<a "
573                + "href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)\n"
574                + "                           int&nbsp;documented,\n"
575                + "                           int&nbsp;undocmented)</pre>");
576
577        //=================================
578        // Annotatation Type Usage
579        //=================================
580        checkOutput("pkg/class-use/AnnotationType.html", true,
581                "<caption><span>Packages with annotations of type <a href=\""
582                + "../../pkg/AnnotationType.html\" title=\"annotation in pkg\">"
583                + "AnnotationType</a></span><span class=\"tabEnd\">&nbsp;"
584                + "</span></caption>",
585                "<caption><span>Classes in <a href=\"../../pkg/"
586                + "package-summary.html\">pkg</a> with annotations of type "
587                + "<a href=\"../../pkg/AnnotationType.html\" title=\""
588                + "annotation in pkg\">AnnotationType</a></span><span class"
589                + "=\"tabEnd\">&nbsp;</span></caption>",
590                "<caption><span>Fields in <a href=\"../../pkg/"
591                + "package-summary.html\">pkg</a> with annotations of type "
592                + "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation "
593                + "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">"
594                + "&nbsp;</span></caption>",
595                "<caption><span>Methods in <a href=\"../../pkg/"
596                + "package-summary.html\">pkg</a> with annotations of type "
597                + "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation "
598                + "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">"
599                + "&nbsp;</span></caption>",
600                "<caption><span>Method parameters in <a href=\"../../pkg/"
601                + "package-summary.html\">pkg</a> with annotations of type "
602                + "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation "
603                + "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">"
604                + "&nbsp;</span></caption>",
605                "<caption><span>Constructors in <a href=\"../../pkg/"
606                + "package-summary.html\">pkg</a> with annotations of type "
607                + "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation "
608                + "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">"
609                + "&nbsp;</span></caption>",
610                "<caption><span>Constructor parameters in <a href=\"../../"
611                + "pkg/package-summary.html\">pkg</a> with annotations of "
612                + "type <a href=\"../../pkg/AnnotationType.html\" title=\""
613                + "annotation in pkg\">AnnotationType</a></span><span class=\""
614                + "tabEnd\">&nbsp;</span></caption>"
615        );
616
617        //==============================================================
618        // ANNOTATION TYPE USAGE TESTING (When @Documented is omitted)
619        //===============================================================
620        checkOutput("pkg/AnnotationTypeUsage.html", false,
621                // CLASS
622                "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Class Annotation\",\n"
623                + "                <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n"
624                + "public class <span class=\"typeNameLabel\">AnnotationTypeUsage</span></dt><dt>extends java.lang.Object</dt>",
625                // FIELD
626                "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Field Annotation\",\n"
627                + "                <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n"
628                + "public int <span class=\"memberNameLabel\">field</span>",
629                // CONSTRUCTOR
630                "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Constructor Annotation\",\n"
631                + "                <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n"
632                + "public <span class=\"typeNameLabel\">AnnotationTypeUsage</span>()",
633                // METHOD
634                "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Method Annotation\",\n"
635                + "                <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n"
636                + "public void <span class=\"memberNameLabel\">method</span>()");
637
638        //=================================
639        // Make sure annotation types do not
640        // trigger this warning.
641        //=================================
642        checkOutput(Output.OUT, false,
643                "Internal error: package sets don't match: [] with: null");
644
645        //=================================
646        // ANNOTATION TYPE USAGE TESTING (All Different Types).
647        //=================================
648        checkOutput("pkg1/B.html", true,
649                // Integer
650                "<a href=\"../pkg1/A.html#d--\">d</a>=3.14,",
651                // Double
652                "<a href=\"../pkg1/A.html#d--\">d</a>=3.14,",
653                // Boolean
654                "<a href=\"../pkg1/A.html#b--\">b</a>=true,",
655                // String
656                "<a href=\"../pkg1/A.html#s--\">s</a>=\"sigh\",",
657                // Class
658                "<a href=\"../pkg1/A.html#c--\">c</a>=<a href=\"../pkg2/Foo.html\" title=\"class in pkg2\">Foo.class</a>,",
659                // Bounded Class
660                "<a href=\"../pkg1/A.html#w--\">w</a>=<a href=\"../pkg/TypeParameterSubClass.html\" title=\"class in pkg\">TypeParameterSubClass.class</a>,",
661                // Enum
662                "<a href=\"../pkg1/A.html#e--\">e</a>=<a href=\"../pkg/Coin.html#Penny\">Penny</a>,",
663                // Annotation Type
664                "<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),",
665                // String Array
666                "<a href=\"../pkg1/A.html#sa--\">sa</a>={\"up\",\"down\"},",
667                // Primitive
668                "<a href=\"../pkg1/A.html#primitiveClassTest--\">primitiveClassTest</a>=boolean.class,");
669
670        // XXX:  Add array test case after this if fixed:
671        //5020899: Incorrect internal representation of class-valued annotation elements
672        // Make sure that annotations are surrounded by <pre> and </pre>
673        checkOutput("pkg1/B.html", true,
674                "<pre><a href=\"../pkg1/A.html\" title=\"annotation in pkg1\">@A</a>",
675                "public interface <span class=\"typeNameLabel\">B</span></pre>");
676
677    }
678
679}
680