1 /* 2 * Copyright (c) 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 8214126 27 * @summary Method signatures not formatted correctly in browser 28 * @library ../../lib/ 29 * @modules jdk.javadoc/jdk.javadoc.internal.tool 30 * @build javadoc.tester.* 31 * @run main TestMethodSignature 32 */ 33 34 import javadoc.tester.JavadocTester; 35 36 public class TestMethodSignature extends JavadocTester { 37 38 public static void main(String... args) throws Exception { 39 TestMethodSignature tester = new TestMethodSignature(); 40 tester.runTests(); 41 } 42 43 @Test 44 public void test() { 45 javadoc("-d", "out", 46 "-sourcepath", testSrc, 47 "pkg"); 48 checkExit(Exit.OK); 49 50 checkOutput("pkg/C.html", true, 51 "<ul class=\"blockList\">\n" + 52 "<li class=\"blockList\">\n" + 53 "<h3>simpleMethod</h3>\n" + 54 "<pre class=\"methodSignature\">public static void simpleMethod(int i,\n" + 55 " java.lang.String s,\n" + 56 " boolean b)</pre>\n" + 57 "<div class=\"block\">Simple method.</div>\n" + 58 "<dl>\n" + 59 "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" + 60 "<dd><code>i</code> - param 1</dd>\n" + 61 "<dd><code>s</code> - param 2</dd>\n" + 62 "<dd><code>b</code> - param 3</dd>\n" + 63 "</dl>\n" + 64 "</li>\n" + 65 "</ul>", 66 "<ul class=\"blockList\">\n" + 67 "<li class=\"blockList\">\n" + 68 "<h3>annotatedMethod</h3>\n" + 69 "<pre class=\"methodSignature\">@Generated(value=\"SomeGeneratedName\",\n" + 70 " date=\"a date\",\n" + 71 " comments=\"some comment about the method below\")\n" + 72 "public static void annotatedMethod(int i,\n" + 73 " java.lang.String s,\n" + 74 " boolean b)</pre>\n" + 75 "<div class=\"block\">Annotated method.</div>\n" + 76 "<dl>\n" + 77 "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" + 78 "<dd><code>i</code> - param 1</dd>\n" + 79 "<dd><code>s</code> - param 2</dd>\n" + 80 "<dd><code>b</code> - param 3</dd>\n" + 81 "</dl>\n" + 82 "</li>\n" + 83 "</ul>", 84 "<ul class=\"blockList\">\n" + 85 "<li class=\"blockList\">\n" + 86 "<h3>bigGenericMethod</h3>\n" + 87 "<pre class=\"methodSignature\">public static <T1 extends java.lang.AutoCloseable," + 88 "T2 extends java.lang.AutoCloseable,T3 extends java.lang.AutoCloseable,\n" + 89 " T4 extends java.lang.AutoCloseable,T5 extends java.lang.AutoCloseable," + 90 "T6 extends java.lang.AutoCloseable,\n" + 91 " T7 extends java.lang.AutoCloseable,T8 extends java.lang.AutoCloseable> \n" + 92 "<a href=\"C.With8Types.html\" title=\"class in pkg\">C.With8Types</a><T1,T2," + 93 "T3,T4,T5,T6,T7,T8> bigGenericMethod" + 94 "(<a href=\"C.F0.html\" title=\"interface in pkg\">C.F0</a><? extends T1> t1,\n" + 95 " <a href=\"C.F0.html\" " + 96 "title=\"interface in pkg\">C.F0</a><? extends T2> t2,\n" + 97 " <a href=\"C.F0.html\" " + 98 "title=\"interface in pkg\">C.F0</a><? extends T3> t3,\n" + 99 " <a href=\"C.F0.html\" " + 100 "title=\"interface in pkg\">C.F0</a><? extends T4> t4,\n" + 101 " <a href=\"C.F0.html\" " + 102 "title=\"interface in pkg\">C.F0</a><? extends T5> t5,\n" + 103 " <a href=\"C.F0.html\" " + 104 "title=\"interface in pkg\">C.F0</a><? extends T6> t6,\n" + 105 " <a href=\"C.F0.html\" " + 106 "title=\"interface in pkg\">C.F0</a><? extends T7> t7,\n" + 107 " <a href=\"C.F0.html\" " + 108 "title=\"interface in pkg\">C.F0</a><? extends T8> t8)\n" + 109 " throws java.lang.IllegalArgumentException,\n" + 110 " java.lang.IllegalStateException</pre>\n" + 111 "<div class=\"block\">Generic method with eight type args.</div>\n" + 112 "<dl>\n" + 113 "<dt><span class=\"paramLabel\">Type Parameters:</span></dt>\n" + 114 "<dd><code>T1</code> - type 1</dd>\n" + 115 "<dd><code>T2</code> - type 2</dd>\n" + 116 "<dd><code>T3</code> - type 3</dd>\n" + 117 "<dd><code>T4</code> - type 4</dd>\n" + 118 "<dd><code>T5</code> - type 5</dd>\n" + 119 "<dd><code>T6</code> - type 6</dd>\n" + 120 "<dd><code>T7</code> - type 7</dd>\n" + 121 "<dd><code>T8</code> - type 8</dd>\n" + 122 "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" + 123 "<dd><code>t1</code> - param 1</dd>\n" + 124 "<dd><code>t2</code> - param 2</dd>\n" + 125 "<dd><code>t3</code> - param 3</dd>\n" + 126 "<dd><code>t4</code> - param 4</dd>\n" + 127 "<dd><code>t5</code> - param 5</dd>\n" + 128 "<dd><code>t6</code> - param 6</dd>\n" + 129 "<dd><code>t7</code> - param 7</dd>\n" + 130 "<dd><code>t8</code> - param 8</dd>\n" + 131 "<dt><span class=\"returnLabel\">Returns:</span></dt>\n" + 132 "<dd>null</dd>\n" + 133 "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n" + 134 "<dd><code>java.lang.IllegalArgumentException</code></dd>\n" + 135 "<dd><code>java.lang.IllegalStateException</code></dd>\n" + 136 "</dl>\n" + 137 "</li>\n" + 138 "</ul>", 139 "<ul class=\"blockListLast\">\n" + 140 "<li class=\"blockList\">\n" + 141 "<h3>bigGenericAnnotatedMethod</h3>\n" + 142 "<pre class=\"methodSignature\">@Generated(value=\"SomeGeneratedName\",\n" + 143 " date=\"a date\",\n" + 144 " comments=\"some comment about the method below\")\n" + 145 "public static <T1 extends java.lang.AutoCloseable,T2 extends " + 146 "java.lang.AutoCloseable,T3 extends java.lang.AutoCloseable,\n" + 147 " T4 extends java.lang.AutoCloseable,T5 extends java.lang.AutoCloseable," + 148 "T6 extends java.lang.AutoCloseable,\n" + 149 " T7 extends java.lang.AutoCloseable,T8 extends java.lang.AutoCloseable> \n" + 150 "<a href=\"C.With8Types.html\" title=\"class in pkg\">C.With8Types</a><T1,T2," + 151 "T3,T4,T5,T6,T7,T8> bigGenericAnnotatedMethod" + 152 "(<a href=\"C.F0.html\" title=\"interface in pkg\">C.F0</a><? extends T1> t1,\n" + 153 " <a href=\"C.F0.html\" " + 154 "title=\"interface in pkg\">C.F0</a><? extends T2> t2,\n" + 155 " <a href=\"C.F0.html\" " + 156 "title=\"interface in pkg\">C.F0</a><? extends T3> t3,\n" + 157 " <a href=\"C.F0.html\" " + 158 "title=\"interface in pkg\">C.F0</a><? extends T4> t4,\n" + 159 " <a href=\"C.F0.html\" " + 160 "title=\"interface in pkg\">C.F0</a><? extends T5> t5,\n" + 161 " <a href=\"C.F0.html\" " + 162 "title=\"interface in pkg\">C.F0</a><? extends T6> t6,\n" + 163 " <a href=\"C.F0.html\" " + 164 "title=\"interface in pkg\">C.F0</a><? extends T7> t7,\n" + 165 " <a href=\"C.F0.html\" " + 166 "title=\"interface in pkg\">C.F0</a><? extends T8> t8)\n" + 167 " throws java.lang.IllegalArgumentException,\n" + 168 " java.lang.IllegalStateException</pre>\n" + 169 "<div class=\"block\">Generic method with eight type args and annotation.</div>\n" + 170 "<dl>\n" + 171 "<dt><span class=\"paramLabel\">Type Parameters:</span></dt>\n" + 172 "<dd><code>T1</code> - type 1</dd>\n" + 173 "<dd><code>T2</code> - type 2</dd>\n" + 174 "<dd><code>T3</code> - type 3</dd>\n" + 175 "<dd><code>T4</code> - type 4</dd>\n" + 176 "<dd><code>T5</code> - type 5</dd>\n" + 177 "<dd><code>T6</code> - type 6</dd>\n" + 178 "<dd><code>T7</code> - type 7</dd>\n" + 179 "<dd><code>T8</code> - type 8</dd>\n" + 180 "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" + 181 "<dd><code>t1</code> - param 1</dd>\n" + 182 "<dd><code>t2</code> - param 2</dd>\n" + 183 "<dd><code>t3</code> - param 3</dd>\n" + 184 "<dd><code>t4</code> - param 4</dd>\n" + 185 "<dd><code>t5</code> - param 5</dd>\n" + 186 "<dd><code>t6</code> - param 6</dd>\n" + 187 "<dd><code>t7</code> - param 7</dd>\n" + 188 "<dd><code>t8</code> - param 8</dd>\n" + 189 "<dt><span class=\"returnLabel\">Returns:</span></dt>\n" + 190 "<dd>null</dd>\n" + 191 "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n" + 192 "<dd><code>java.lang.IllegalArgumentException</code></dd>\n" + 193 "<dd><code>java.lang.IllegalStateException</code></dd>\n" + 194 "</dl>\n" + 195 "</li>\n" + 196 "</ul>"); 197 } 198 }