/* * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 8214126 8241470 8259499 * @summary Method signatures not formatted correctly in browser * @library ../../lib/ * @modules jdk.javadoc/jdk.javadoc.internal.tool * @build javadoc.tester.* * @run main TestMethodSignature */ import javadoc.tester.JavadocTester; public class TestMethodSignature extends JavadocTester { public static void main(String... args) throws Exception { var tester = new TestMethodSignature(); tester.runTests(); } @Test public void test() { javadoc("-d", "out", "-sourcepath", testSrc, "--no-platform-links", "pkg"); checkExit(Exit.OK); checkOutput("pkg/C.html", true, """
@Generated("GeneratedConstructor") public C()
""", """
public static \ void simpleMeth\ od(int i, java.lang.String s, boolean b)
""", """
@Generated(value="SomeGeneratedName", date="a date", comments="some comment about the method below") public static void annotatedMethod(int i, java.lang.String s, boolean b)
""", """
public static \ <T1 extends java.lang.AutoCloseable, T2 extends java.lang.AutoCloseable, T3 extends java.lang.AutoCloseable, T4 extends java.lang.AutoCloseable, T5 extends java.lang.AutoCloseable, T6 extends java.lang.AutoCloseable, T7 extends java.lang.AutoCloseable, T8 extends java.lang.AutoCloseable> C.Wit\ h8Types<T1,T2,T3,T4,T5,T6,T7,T8> bigGenericMethod(C.F0<? extends T1\ > t1, C.F0<? extends T2> t2, C.F0<? extends T3> t3, C.F0<? extends T4> t4, C.F0<? extends T5> t5, C.F0<? extends T6> t6, C.F0<? extends T7> t7, C.F0<? extends T8> t8) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
""", """
@Generated(value="SomeGeneratedName", date="a date", comments="some comment about the method below") public static <T1 extends java.lang.AutoCloseable, T2 extends java.lang.AutoCloseable, T3 extends java.lang.AutoCloseable, T4 extends java.lang.AutoCloseable, T5 extends java.lang.AutoCloseable, T6 extends java.lang.AutoCloseable, T7 extends java.lang.AutoCloseable, T8 extends java.lang.AutoCloseable> C.Wit\ h8Types<T1,T2,T3,T4,T5,T6,T7,T8> bigGenericAnnotatedMethod(C.F0<? e\ xtends T1> t1, C.F0<? extends T2> t2, C.F0<? extends T3> t3, C.F0<? extends T4> t4, C.F0<? extends T5> t5, C.F0<? extends T6> t6, C.F0<? extends T7> t7, C.F0<? extends T8> t8) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
Generic method with eight type args and annotation.
""", """
public C.Generic&l\ t;java.lang.Integer>.Inne\ r nestedGeneric1(C.Generic<\ java.lang.Integer>.Inner<\ /a> i, C.Generic<C>.Inner j)
""", """
public C.Generic&l\ t;C.F0<C>>.Inner.Foo nestedGeneric2(C.Generic<java.lang\ .Integer>.Inner.Foo f, C.Generic<C.F0<C\ >>.Inner.Foo g)
"""); } }