/* * Copyright (c) 2003, 2020, 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 4780441 4874845 4978816 8014017 8016328 8025633 8026567 8175200 8182765 * @summary Make sure that when the -private flag is not used, members * inherited from package private class are documented in the child. * * Make sure that when a method inherits documentation from a method * in a non-public class/interface, the non-public class/interface * is not mentioned anywhere (not even in the signature or tree). * * Make sure that when a private interface method with generic parameters * is implemented, the comments can be inherited properly. * * Make sure when no modifier appear in the class signature, the * signature is displayed correctly without extra space at the beginning. * @library ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool * @build javadoc.tester.* * @run main TestPrivateClasses */ import javadoc.tester.JavadocTester; public class TestPrivateClasses extends JavadocTester { public static void main(String... args) throws Exception { TestPrivateClasses tester = new TestPrivateClasses(); tester.runTests(); } @Test public void testDefault() { javadoc("-d", "out-default", "-sourcepath", testSrc, "--no-platform-links", "pkg", "pkg2"); checkExit(Exit.OK); checkOutput("pkg/PublicChild.html", true, // Field inheritence from non-public superclass. """ fieldInheritedFromParent""", // Method inheritance from non-public superclass. """ methodInheritedFromParent""", // private class does not show up in tree """
PublicInterface
methodInterface(int p1)
methodInterface2(int p1)
PublicChild
methodOverriddenFromParent
in class methodInterface\
a>
in interface PrivateInterface
PrivateInterf\
ace
, Pu\
blicInterface
public class PublicChild""");
checkOutput("pkg/PublicInterface.html", true,
// Field inheritence from non-public superinterface.
"""
Fields inherited from interface pkg.PrivateInterface""",
"""
fieldInheritedFromInterface""",
// Method inheritance from non-public superinterface.
"""
Methods inherited from interface pkg.PrivateInterface""",
// Extend documented private classes or interfaces
"extends",
"All Superinterfaces",
//Make sure implemented interfaces from private superclass are inherited
"""
PrivateParent
PublicChild
<\
a href="I.html#hello(T)">I
""",
"""
hello
in interface class PrivateParent""");
checkOutput("pkg/PrivateParent.html", false,
"""
class PrivateParent""");
}
}