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