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