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