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