2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2013-06-27 03:42:43 +00:00
|
|
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2010-05-25 22:54:51 +00:00
|
|
|
* 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.
|
2007-12-01 00:00:00 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @test
|
2013-10-18 23:34:42 +00:00
|
|
|
* @bug 4780441 4874845 4978816 8014017 8016328 8025633 8026567
|
2007-12-01 00:00:00 +00:00
|
|
|
* @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.
|
2013-06-27 03:42:43 +00:00
|
|
|
*
|
|
|
|
* Make sure when no modifier appear in the class signature, the
|
|
|
|
* signature is displayed correctly without extra space at the beginning.
|
2007-12-01 00:00:00 +00:00
|
|
|
* @author jamieh
|
|
|
|
* @library ../lib/
|
2013-06-27 03:42:43 +00:00
|
|
|
* @build JavadocTester TestPrivateClasses
|
2007-12-01 00:00:00 +00:00
|
|
|
* @run main TestPrivateClasses
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class TestPrivateClasses extends JavadocTester {
|
|
|
|
|
|
|
|
//Test information.
|
2013-06-27 03:42:43 +00:00
|
|
|
private static final String BUG_ID = "4780441-4874845-4978816-8014017";
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
//Javadoc arguments.
|
|
|
|
private static final String[] ARGS1 = new String[] {
|
|
|
|
"-d", BUG_ID + "-1", "-sourcepath", SRC_DIR, "-source", "1.5", "pkg", "pkg2"
|
|
|
|
};
|
|
|
|
private static final String[] ARGS2 = new String[] {
|
|
|
|
"-d", BUG_ID + "-2", "-sourcepath", SRC_DIR, "-private",
|
|
|
|
"-source", "1.5", "pkg", "pkg2"
|
|
|
|
};
|
|
|
|
|
|
|
|
// Test output when -private flag is not used.
|
|
|
|
private static final String[][] TEST1 = {
|
|
|
|
// Field inheritence from non-public superclass.
|
|
|
|
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
|
2010-12-01 19:02:38 +00:00
|
|
|
"<a href=\"../pkg/PublicChild.html#fieldInheritedFromParent\">" +
|
|
|
|
"fieldInheritedFromParent</a>"
|
2007-12-01 00:00:00 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
// Method inheritence from non-public superclass.
|
|
|
|
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
|
2013-10-10 17:51:15 +00:00
|
|
|
"<a href=\"../pkg/PublicChild.html#methodInheritedFromParent-int-\">" +
|
2010-12-01 19:02:38 +00:00
|
|
|
"methodInheritedFromParent</a>"
|
2007-12-01 00:00:00 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
// Field inheritence from non-public superinterface.
|
|
|
|
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
|
2010-12-01 19:02:38 +00:00
|
|
|
"<a href=\"../pkg/PublicInterface.html#fieldInheritedFromInterface\">" +
|
|
|
|
"fieldInheritedFromInterface</a>"
|
2007-12-01 00:00:00 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
// Method inheritence from non-public superinterface.
|
|
|
|
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
|
2013-10-10 17:51:15 +00:00
|
|
|
"<a href=\"../pkg/PublicInterface.html#methodInterface-int-\">" +
|
2010-12-01 19:02:38 +00:00
|
|
|
"methodInterface</a>"
|
2007-12-01 00:00:00 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
// private class does not show up in tree
|
|
|
|
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
|
2010-12-01 19:02:38 +00:00
|
|
|
"<ul class=\"inheritance\">" + NL + "<li>java.lang.Object</li>" + NL +
|
|
|
|
"<li>" + NL + "<ul class=\"inheritance\">" + NL + "<li>pkg.PublicChild</li>" + NL +
|
|
|
|
"</ul>" + NL + "</li>" + NL + "</ul>"
|
2007-12-01 00:00:00 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
// Method is documented as though it is declared in the inheriting method.
|
|
|
|
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
|
2010-12-01 19:02:38 +00:00
|
|
|
"<pre>public void methodInheritedFromParent(int p1)"
|
2007-12-01 00:00:00 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
//Make sure implemented interfaces from private superclass are inherited
|
|
|
|
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
|
2010-12-01 19:02:38 +00:00
|
|
|
"<dl>" + NL + "<dt>All Known Implementing Classes:</dt>" + NL +
|
|
|
|
"<dd><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">" +
|
|
|
|
"PublicChild</a></dd>" + NL + "</dl>"},
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
|
2010-12-01 19:02:38 +00:00
|
|
|
"<dl>" + NL + "<dt>All Implemented Interfaces:</dt>" + NL +
|
|
|
|
"<dd><a href=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">" +
|
|
|
|
"PublicInterface</a></dd>" + NL + "</dl>"},
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
//Generic interface method test.
|
|
|
|
{BUG_ID + "-1" + FS + "pkg2" + FS + "C.html",
|
|
|
|
"This comment should get copied to the implementing class"},
|
|
|
|
};
|
|
|
|
private static final String[][] NEGATED_TEST1 = {
|
|
|
|
// Should not document that a method overrides method from private class.
|
|
|
|
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
|
2013-10-18 23:34:42 +00:00
|
|
|
"<span class=\"overrideSpecifyLabel\">Overrides:</span>"},
|
2007-12-01 00:00:00 +00:00
|
|
|
// Should not document that a method specified by private interface.
|
|
|
|
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
|
2013-10-18 23:34:42 +00:00
|
|
|
"<span class=\"overrideSpecifyLabel\">Specified by:</span>"},
|
2007-12-01 00:00:00 +00:00
|
|
|
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
|
2013-10-18 23:34:42 +00:00
|
|
|
"<span class=\"overrideSpecifyLabel\">Specified by:</span>"},
|
2007-12-01 00:00:00 +00:00
|
|
|
// Should not mention that any documentation was copied.
|
|
|
|
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
|
|
|
|
"Description copied from"},
|
|
|
|
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
|
|
|
|
"Description copied from"},
|
|
|
|
// Don't extend private classes or interfaces
|
|
|
|
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
|
|
|
|
"PrivateParent"},
|
|
|
|
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
|
|
|
|
"PrivateInterface"},
|
|
|
|
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
|
|
|
|
"PrivateInterface"},
|
|
|
|
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
|
|
|
|
"All Superinterfaces"},
|
|
|
|
// Make inherited constant are documented correctly.
|
|
|
|
{BUG_ID + "-1" + FS + "constant-values.html",
|
|
|
|
"PrivateInterface"},
|
|
|
|
|
|
|
|
//Do not inherit private interface method with generic parameters.
|
|
|
|
//This method has been implemented.
|
|
|
|
{BUG_ID + "-1" + FS + "pkg2" + FS + "C.html",
|
2013-10-18 23:34:42 +00:00
|
|
|
"<span class=\"memberNameLink\"><a href=\"../pkg2/I.html#hello-T-\">hello</a></span>"},
|
2007-12-01 00:00:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Test output when -private flag is used.
|
|
|
|
private static final String[][] TEST2 = {
|
|
|
|
// Field inheritence from non-public superclass.
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
|
2010-12-01 19:02:38 +00:00
|
|
|
"Fields inherited from class pkg." +
|
|
|
|
"<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
|
|
|
|
"PrivateParent</a>"
|
2007-12-01 00:00:00 +00:00
|
|
|
},
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
|
2010-12-01 19:02:38 +00:00
|
|
|
"<a href=\"../pkg/PrivateParent.html#fieldInheritedFromParent\">" +
|
|
|
|
"fieldInheritedFromParent</a>"
|
2007-12-01 00:00:00 +00:00
|
|
|
},
|
|
|
|
// Field inheritence from non-public superinterface.
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html",
|
2010-12-01 19:02:38 +00:00
|
|
|
"Fields inherited from interface pkg." +
|
|
|
|
"<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
|
|
|
|
"PrivateInterface</a>"
|
2007-12-01 00:00:00 +00:00
|
|
|
},
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html",
|
2010-12-01 19:02:38 +00:00
|
|
|
"<a href=\"../pkg/PrivateInterface.html#fieldInheritedFromInterface\">" +
|
|
|
|
"fieldInheritedFromInterface</a>"
|
2007-12-01 00:00:00 +00:00
|
|
|
},
|
|
|
|
// Method inheritence from non-public superclass.
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
|
2010-12-01 19:02:38 +00:00
|
|
|
"Methods inherited from class pkg." +
|
|
|
|
"<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
|
|
|
|
"PrivateParent</a>"
|
2007-12-01 00:00:00 +00:00
|
|
|
},
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
|
2013-10-10 17:51:15 +00:00
|
|
|
"<a href=\"../pkg/PrivateParent.html#methodInheritedFromParent-int-\">" +
|
2010-12-01 19:02:38 +00:00
|
|
|
"methodInheritedFromParent</a>"
|
2007-12-01 00:00:00 +00:00
|
|
|
},
|
|
|
|
// Should document that a method overrides method from private class.
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
|
2013-10-18 23:34:42 +00:00
|
|
|
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
|
2013-10-10 17:51:15 +00:00
|
|
|
"<dd><code><a href=\"../pkg/PrivateParent.html#methodOverridenFromParent-char:A-int-T-V-java.util.List-\">" +
|
2010-12-01 19:02:38 +00:00
|
|
|
"methodOverridenFromParent</a></code> in class <code>" +
|
|
|
|
"<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
|
|
|
|
"PrivateParent</a></code></dd>"},
|
2007-12-01 00:00:00 +00:00
|
|
|
// Should document that a method is specified by private interface.
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
|
2013-10-18 23:34:42 +00:00
|
|
|
"<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>" + NL +
|
2013-10-10 17:51:15 +00:00
|
|
|
"<dd><code><a href=\"../pkg/PrivateInterface.html#methodInterface-int-\">" +
|
2010-12-01 19:02:38 +00:00
|
|
|
"methodInterface</a></code> in interface <code>" +
|
|
|
|
"<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
|
|
|
|
"PrivateInterface</a></code></dd>"},
|
2007-12-01 00:00:00 +00:00
|
|
|
// Method inheritence from non-public superinterface.
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html",
|
2010-12-01 19:02:38 +00:00
|
|
|
"Methods inherited from interface pkg." +
|
|
|
|
"<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
|
|
|
|
"PrivateInterface</a>"
|
2007-12-01 00:00:00 +00:00
|
|
|
},
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PrivateInterface.html",
|
2013-10-10 17:51:15 +00:00
|
|
|
"<a href=\"../pkg/PrivateInterface.html#methodInterface-int-\">" +
|
2010-12-01 19:02:38 +00:00
|
|
|
"methodInterface</a>"
|
2007-12-01 00:00:00 +00:00
|
|
|
},
|
|
|
|
// Should mention that any documentation was copied.
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
|
|
|
|
"Description copied from"},
|
|
|
|
// Extend documented private classes or interfaces
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
|
|
|
|
"extends"},
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html",
|
|
|
|
"extends"},
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html",
|
|
|
|
"All Superinterfaces"},
|
|
|
|
|
|
|
|
//Make sure implemented interfaces from private superclass are inherited
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html",
|
2010-12-01 19:02:38 +00:00
|
|
|
"<dl>" + NL + "<dt>All Known Implementing Classes:</dt>" + NL +
|
|
|
|
"<dd><a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
|
|
|
|
"PrivateParent</a>, " +
|
|
|
|
"<a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild" +
|
|
|
|
"</a></dd>" + NL + "</dl>"},
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
|
2010-12-01 19:02:38 +00:00
|
|
|
"<dl>" + NL + "<dt>All Implemented Interfaces:</dt>" + NL +
|
|
|
|
"<dd><a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
|
|
|
|
"PrivateInterface</a>, " +
|
|
|
|
"<a href=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">" +
|
|
|
|
"PublicInterface</a></dd>" + NL + "</dl>"},
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
//Since private flag is used, we can document that private interface method
|
|
|
|
//with generic parameters has been implemented.
|
|
|
|
{BUG_ID + "-2" + FS + "pkg2" + FS + "C.html",
|
2013-10-18 23:34:42 +00:00
|
|
|
"<span class=\"descfrmTypeLabel\">Description copied from interface: <code>" +
|
2013-10-10 17:51:15 +00:00
|
|
|
"<a href=\"../pkg2/I.html#hello-T-\">I</a></code></span>"},
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
{BUG_ID + "-2" + FS + "pkg2" + FS + "C.html",
|
2013-10-18 23:34:42 +00:00
|
|
|
"<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>" + NL +
|
2013-10-10 17:51:15 +00:00
|
|
|
"<dd><code><a href=\"../pkg2/I.html#hello-T-\">hello</a></code>" +
|
2010-12-01 19:02:38 +00:00
|
|
|
" in interface <code>" +
|
|
|
|
"<a href=\"../pkg2/I.html\" title=\"interface in pkg2\">I</a>" +
|
|
|
|
"<java.lang.String></code></dd>"},
|
2013-06-27 03:42:43 +00:00
|
|
|
|
|
|
|
//Make sure when no modifier appear in the class signature, the
|
|
|
|
//signature is displayed correctly without extra space at the beginning.
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PrivateParent.html",
|
2013-10-18 23:34:42 +00:00
|
|
|
"<pre>class <span class=\"typeNameLabel\">PrivateParent</span>"},
|
2013-06-27 03:42:43 +00:00
|
|
|
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
|
2013-10-18 23:34:42 +00:00
|
|
|
"<pre>public class <span class=\"typeNameLabel\">PublicChild</span>"},
|
2013-06-27 03:42:43 +00:00
|
|
|
};
|
|
|
|
private static final String[][] NEGATED_TEST2 = {
|
|
|
|
{BUG_ID + "-2" + FS + "pkg" + FS + "PrivateParent.html",
|
2013-10-18 23:34:42 +00:00
|
|
|
"<pre> class <span class=\"typeNameLabel\">PrivateParent</span>"},
|
2007-12-01 00:00:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The entry point of the test.
|
|
|
|
* @param args the array of command line arguments.
|
|
|
|
*/
|
|
|
|
public static void main(String[] args) {
|
|
|
|
TestPrivateClasses tester = new TestPrivateClasses();
|
|
|
|
run(tester, ARGS1, TEST1, NEGATED_TEST1);
|
|
|
|
run(tester, ARGS2, TEST2, NEGATED_TEST2);
|
|
|
|
tester.printSummary();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
public String getBugId() {
|
|
|
|
return BUG_ID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
public String getBugName() {
|
|
|
|
return getClass().getName();
|
|
|
|
}
|
|
|
|
}
|