/* * Copyright (c) 2003, 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 4951228 6290760 8025633 8026567 8081854 8162363 8175200 8177417 8186332 8182765 * 8258602 8266044 * @summary Test the case where the overridden method returns a different * type than the method in the child class. Make sure the * documentation is inherited but the return type isn't. * @library ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool * @build javadoc.tester.* * @run main TestMemberSummary */ import javadoc.tester.JavadocTester; public class TestMemberSummary extends JavadocTester { public static void main(String... args) throws Exception { var tester = new TestMemberSummary(); tester.runTests(); } @Test public void test() { javadoc("-d", "out", "-private", "--no-platform-links", "-sourcepath", testSrc, "pkg","pkg2"); checkExit(Exit.OK); checkOutput("pkg/PublicChild.html", true, // Check return type in member summary. """ PublicChild
returnTypeTest()
""", // Check return type in member detail. """
public PublicChild returnTypeTest()
""", """
PublicChild()
 
"""); checkOutput("pkg/PrivateParent.html", true, """
private
PrivateParent(int i)
"""); // Legacy anchor dimensions (6290760) checkOutput("pkg2/A.html", true, """

f

"""); } @Test public void testSummaries() { javadoc("-d", "out-summaries", "-private", "--no-platform-links", "-sourcepath", testSrc, "pkg3"); checkExit(Exit.OK); checkOutput("pkg3/Members.html", true, """
Nested Classes
Modifier and Type
Class
Description
private static @interface 
 
private static final class 
 
private static enum 
 
private static interface 
 
private static final record 
 
""", """
Fields
Modifier and Type
Field
Description
private static final int
 
""", """
Constructors
Modifier
Constructor
Description
private
 
"""); checkOutput("pkg3/Members.A.html", true, """
Required Elements
Modifier and Type
Required Element
Description
int
 
""", """
Optional Elements
Modifier and Type
Optional Element
Description
java.lang.String
 
"""); checkOutput("pkg3/Members.E.html", true, """

Enum Constant Summary

Enum Constants
Enum Constant
Description
 
"""); checkOutput("pkg3/Members.R.html", true, """
Fields
Modifier and Type
Field
Description
private final int
The field for the i record component.
"""); } }