/* * Copyright (c) 2003, 2014, 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 * @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. * @author jamieh * @library ../lib/ * @build JavadocTester TestPrivateClasses * @run main TestPrivateClasses */ public class TestPrivateClasses extends JavadocTester { //Javadoc arguments. private static final String[] ARGS1 = new String[] { "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg", "pkg2" }; private static final String[] ARGS2 = new String[] { "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "-private", "pkg", "pkg2" }; // Test output when -private flag is not used. private static final String[][] TEST1 = { // Field inheritence from non-public superclass. { "pkg/PublicChild.html", "" + "fieldInheritedFromParent" }, // Method inheritence from non-public superclass. { "pkg/PublicChild.html", "" + "methodInheritedFromParent" }, // Field inheritence from non-public superinterface. { "pkg/PublicInterface.html", "" + "fieldInheritedFromInterface" }, // Method inheritence from non-public superinterface. { "pkg/PublicInterface.html", "" + "methodInterface" }, // private class does not show up in tree { "pkg/PublicChild.html", "
public void methodInheritedFromParent(int p1)" }, //Make sure implemented interfaces from private superclass are inherited { "pkg/PublicInterface.html", "
" +
"methodOverridenFromParent
in class " +
"" +
"PrivateParent
" +
"methodInterface
in interface " +
"" +
"PrivateInterface
" +
"I
"},
{ "pkg2/C.html",
"hello
" +
" in interface " +
"I" +
"<java.lang.String>
class PrivateParent"}, { "pkg/PublicChild.html", "public class PublicChild"}, }; private static final String[][] NEGATED_TEST2 = { { "pkg/PrivateParent.html", "class PrivateParent"}, }; /** * The entry point of the test. * @param args the array of command line arguments. */ public static void main(String[] args) { TestPrivateClasses tester = new TestPrivateClasses(); tester.run(ARGS1, TEST1, NEGATED_TEST1); tester.run(ARGS2, TEST2, NEGATED_TEST2); tester.printSummary(); } }