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 4927167 4974929 7010344 8025633 8081854 8182765 8187288 27 * @summary When the type parameters are more than 10 characters in length, 28 * make sure there is a line break between type params and return type 29 * in member summary. Also, test for type parameter links in package-summary and 30 * class-use pages. The class/annotation pages should check for type 31 * parameter links in the class/annotation signature section when -linksource is set. 32 * @library ../../lib 33 * @modules jdk.javadoc/jdk.javadoc.internal.tool 34 * @build javadoc.tester.* 35 * @run main TestTypeParameters 36 */ 37 38 import javadoc.tester.JavadocTester; 39 40 public class TestTypeParameters extends JavadocTester { 41 42 public static void main(String... args) throws Exception { 43 TestTypeParameters tester = new TestTypeParameters(); 44 tester.runTests(); 45 } 46 47 @Test 48 public void test1() { 49 javadoc("-d", "out-1", 50 "-use", 51 "-sourcepath", testSrc, 52 "pkg"); 53 checkExit(Exit.OK); 54 55 checkOutput("pkg/C.html", true, 56 "<td class=\"colFirst\"><code><W extends java.lang.String,\nV extends " 57 + "java.util.List><br>java.lang.Object</code></td>", 58 "<code><T> java.lang.Object</code>"); 59 60 checkOutput("pkg/package-summary.html", true, 61 "C</a><E extends <a href=\"Parent.html\" " 62 + "title=\"class in pkg\">Parent</a>>"); 63 64 checkOutput("pkg/class-use/Foo4.html", true, 65 "<a href=\"../ClassUseTest3.html\" title=\"class in pkg\">" 66 + "ClassUseTest3</a><T extends <a href=\"../ParamTest2.html\" " 67 + "title=\"class in pkg\">ParamTest2</a><java.util.List<? extends " 68 + "<a href=\"../Foo4.html\" title=\"class in pkg\">Foo4</a>>>>"); 69 70 // Nested type parameters 71 checkOutput("pkg/C.html", true, 72 "<a id=\"formatDetails(java.util.Collection,java.util.Collection)\">"); 73 } 74 75 @Test 76 public void test2() { 77 javadoc("-d", "out-2", 78 "-linksource", 79 "-sourcepath", testSrc, 80 "pkg"); 81 checkExit(Exit.OK); 82 83 checkOutput("pkg/ClassUseTest3.html", true, 84 "public class <a href=\"../src-html/pkg/ClassUseTest3.html#line.28\">" + 85 "ClassUseTest3</a><T extends <a href=\"ParamTest2.html\" " + 86 "title=\"class in pkg\">ParamTest2</a><java.util.List<? extends " + 87 "<a href=\"Foo4.html\" title=\"class in pkg\">Foo4</a>>>>"); 88 } 89 }