1/* 2 * Copyright (c) 2003, 2015, 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 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 * @author jamieh 33 * @library ../lib 34 * @modules jdk.javadoc 35 * @build JavadocTester 36 * @run main TestTypeParameters 37 */ 38 39public class TestTypeParameters extends JavadocTester { 40 41 public static void main(String... args) throws Exception { 42 TestTypeParameters tester = new TestTypeParameters(); 43 tester.runTests(); 44 } 45 46 @Test 47 void test1() { 48 javadoc("-d", "out-1", 49 "-use", 50 "-sourcepath", testSrc, 51 "pkg"); 52 checkExit(Exit.OK); 53 54 checkOutput("pkg/C.html", true, 55 "<td class=\"colFirst\"><code><W extends java.lang.String,V extends " 56 + "java.util.List><br>java.lang.Object</code></td>", 57 "<code><T> java.lang.Object</code>"); 58 59 checkOutput("pkg/package-summary.html", true, 60 "C</a><E extends <a href=\"../pkg/Parent.html\" " 61 + "title=\"class in pkg\">Parent</a>>"); 62 63 checkOutput("pkg/class-use/Foo4.html", true, 64 "<a href=\"../../pkg/ClassUseTest3.html\" title=\"class in pkg\">" 65 + "ClassUseTest3</a><T extends <a href=\"../../pkg/ParamTest2.html\" " 66 + "title=\"class in pkg\">ParamTest2</a><java.util.List<? extends " 67 + "<a href=\"../../pkg/Foo4.html\" title=\"class in pkg\">Foo4</a>>>>"); 68 69 // Nested type parameters 70 checkOutput("pkg/C.html", true, 71 "<a name=\"formatDetails-java.util.Collection-java.util.Collection-\">\n" 72 + "<!-- -->\n" 73 + "</a>"); 74 } 75 76 77 @Test 78 void test2() { 79 javadoc("-d", "out-2", 80 "-linksource", 81 "-sourcepath", testSrc, 82 "pkg"); 83 checkExit(Exit.OK); 84 85 checkOutput("pkg/ClassUseTest3.html", true, 86 "public class <a href=\"../src-html/pkg/ClassUseTest3.html#line.28\">" + 87 "ClassUseTest3</a><T extends <a href=\"../pkg/ParamTest2.html\" " + 88 "title=\"class in pkg\">ParamTest2</a><java.util.List<? extends " + 89 "<a href=\"../pkg/Foo4.html\" title=\"class in pkg\">Foo4</a>>>>"); 90 } 91} 92