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