8192850: method summary tables of inherited methods improperly list static interface methods
Reviewed-by: jjg
This commit is contained in:
parent
ac36725e20
commit
05d1149d5e
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders
test/langtools/jdk/javadoc/doclet
testMemberInheritance
testOverriddenMethods
TestBadOverride.javaTestMultiInheritance.javaTestOverriddenMethodDocCopy.javaTestOverriddenPrivateMethods.javaTestOverriddenPrivateMethodsWithPackageFlag.javaTestOverriddenPrivateMethodsWithPrivateFlag.javaTestOverrideMethods.java
pkg1
pkg2
pkg3
pkg4
pkg5
testOverridenMethods
@ -489,6 +489,10 @@ public abstract class MemberSummaryBuilder extends AbstractMemberBuilder {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip static methods in interfaces they are not inherited
|
||||
if (utils.isInterface(inheritedClass) && utils.isStatic(inheritedMember))
|
||||
continue;
|
||||
|
||||
// If applicable, filter those overridden methods that
|
||||
// should not be documented in the summary/detail sections,
|
||||
// and instead document them in the footnote. Care must be taken
|
||||
@ -496,9 +500,8 @@ public abstract class MemberSummaryBuilder extends AbstractMemberBuilder {
|
||||
// but comments for these are synthesized on the output.
|
||||
ExecutableElement inheritedMethod = (ExecutableElement)inheritedMember;
|
||||
if (enclosedSuperMethods.stream()
|
||||
.anyMatch(e -> utils.executableMembersEqual(inheritedMethod, e)
|
||||
&& (!utils.isSimpleOverride(e)
|
||||
|| visibleMemberMap.getPropertyElement(e) != null))) {
|
||||
.anyMatch(e -> utils.executableMembersEqual(inheritedMethod, e) &&
|
||||
(!utils.isSimpleOverride(e) || visibleMemberMap.getPropertyElement(e) != null))) {
|
||||
inheritedMembers.add(inheritedMember);
|
||||
}
|
||||
}
|
||||
|
@ -24,19 +24,20 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 4638588 4635809 6256068 6270645 8025633 8026567 8162363 8175200
|
||||
* 8192850
|
||||
* @summary Test to make sure that members are inherited properly in the Javadoc.
|
||||
* Verify that inheritence labels are correct.
|
||||
* Verify that inheritance labels are correct.
|
||||
* @author jamieh
|
||||
* @library ../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* @build JavadocTester
|
||||
* @run main TestMemberInheritence
|
||||
* @run main TestMemberInheritance
|
||||
*/
|
||||
|
||||
public class TestMemberInheritence extends JavadocTester {
|
||||
public class TestMemberInheritance extends JavadocTester {
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
TestMemberInheritence tester = new TestMemberInheritence();
|
||||
TestMemberInheritance tester = new TestMemberInheritance();
|
||||
tester.runTests();
|
||||
}
|
||||
|
||||
@ -77,7 +78,7 @@ public class TestMemberInheritence extends JavadocTester {
|
||||
+ "</dl>");
|
||||
|
||||
checkOutput("diamond/Z.html", true,
|
||||
// Test diamond inheritence member summary (6256068)
|
||||
// Test diamond inheritance member summary (6256068)
|
||||
"<code><a href=\"../diamond/A.html#aMethod--\">aMethod</a></code>");
|
||||
|
||||
checkOutput("inheritDist/C.html", true,
|
||||
@ -93,8 +94,9 @@ public class TestMemberInheritence extends JavadocTester {
|
||||
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
|
||||
+ "<a href=\"../pkg1/Implementer.html#between-java.time.LocalDate-java.time.LocalDate-\">"
|
||||
+ "between</a></span>​(java.time.LocalDate startDateInclusive,\n"
|
||||
+ " java.time.LocalDate endDateExclusive)</code></th>",
|
||||
// check the inherited from interfaces
|
||||
+ " java.time.LocalDate endDateExclusive)</code></th>");
|
||||
|
||||
checkOutput("pkg1/Implementer.html", false,
|
||||
"<h3>Methods inherited from interface pkg1.<a href=\"../pkg1/Interface.html\""
|
||||
+ " title=\"interface in pkg1\">Interface</a></h3>\n"
|
||||
+ "<code><a href=\"../pkg1/Interface.html#between-java.time.chrono.ChronoLocalDate"
|
@ -30,14 +30,13 @@
|
||||
* @library ../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* @build JavadocTester
|
||||
* @run main TestMultiInheritence
|
||||
* @run main TestMultiInheritance
|
||||
*/
|
||||
|
||||
// TODO: should be TestMultiInheritance
|
||||
public class TestMultiInheritence extends JavadocTester {
|
||||
public class TestMultiInheritance extends JavadocTester {
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
TestMultiInheritence tester = new TestMultiInheritence();
|
||||
TestMultiInheritance tester = new TestMultiInheritance();
|
||||
tester.runTests();
|
||||
}
|
||||
|
@ -30,17 +30,17 @@
|
||||
* @library ../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* @build JavadocTester
|
||||
* @run main TestOverridenMethodDocCopy
|
||||
* @run main TestOverriddenMethodDocCopy
|
||||
*/
|
||||
|
||||
public class TestOverridenMethodDocCopy extends JavadocTester {
|
||||
public class TestOverriddenMethodDocCopy extends JavadocTester {
|
||||
|
||||
/**
|
||||
* The entry point of the test.
|
||||
* @param args the array of command line arguments.
|
||||
*/
|
||||
public static void main(String... args) throws Exception {
|
||||
TestOverridenMethodDocCopy tester = new TestOverridenMethodDocCopy();
|
||||
TestOverriddenMethodDocCopy tester = new TestOverriddenMethodDocCopy();
|
||||
tester.runTests();
|
||||
}
|
||||
|
@ -24,19 +24,19 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 4634891 8026567
|
||||
* @summary Determine if overriden methods are properly documented when
|
||||
* @summary Determine if overridden methods are properly documented when
|
||||
* -protected (default) visibility flag is used.
|
||||
* @author jamieh
|
||||
* @library ../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* @build JavadocTester
|
||||
* @run main TestOverridenPrivateMethods
|
||||
* @run main TestOverriddenPrivateMethods
|
||||
*/
|
||||
|
||||
public class TestOverridenPrivateMethods extends JavadocTester {
|
||||
public class TestOverriddenPrivateMethods extends JavadocTester {
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
TestOverridenPrivateMethods tester = new TestOverridenPrivateMethods();
|
||||
TestOverriddenPrivateMethods tester = new TestOverriddenPrivateMethods();
|
||||
tester.runTests();
|
||||
}
|
||||
|
@ -30,13 +30,13 @@
|
||||
* @library ../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* @build JavadocTester
|
||||
* @run main TestOverridenPrivateMethodsWithPackageFlag
|
||||
* @run main TestOverriddenPrivateMethodsWithPackageFlag
|
||||
*/
|
||||
|
||||
public class TestOverridenPrivateMethodsWithPackageFlag extends JavadocTester {
|
||||
public class TestOverriddenPrivateMethodsWithPackageFlag extends JavadocTester {
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
TestOverridenPrivateMethodsWithPackageFlag tester = new TestOverridenPrivateMethodsWithPackageFlag();
|
||||
TestOverriddenPrivateMethodsWithPackageFlag tester = new TestOverriddenPrivateMethodsWithPackageFlag();
|
||||
tester.runTests();
|
||||
}
|
||||
|
@ -30,13 +30,13 @@
|
||||
* @library ../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* @build JavadocTester
|
||||
* @run main TestOverridenPrivateMethodsWithPrivateFlag
|
||||
* @run main TestOverriddenPrivateMethodsWithPrivateFlag
|
||||
*/
|
||||
|
||||
public class TestOverridenPrivateMethodsWithPrivateFlag extends JavadocTester {
|
||||
public class TestOverriddenPrivateMethodsWithPrivateFlag extends JavadocTester {
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
TestOverridenPrivateMethodsWithPrivateFlag tester = new TestOverridenPrivateMethodsWithPrivateFlag();
|
||||
TestOverriddenPrivateMethodsWithPrivateFlag tester = new TestOverriddenPrivateMethodsWithPrivateFlag();
|
||||
tester.runTests();
|
||||
}
|
||||
|
@ -0,0 +1,255 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 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 8157000 8192850
|
||||
* @summary test the behavior of --override-methods option
|
||||
* @library ../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* @build JavadocTester
|
||||
* @run main TestOverrideMethods
|
||||
*/
|
||||
|
||||
public class TestOverrideMethods extends JavadocTester {
|
||||
public static void main(String... args) throws Exception {
|
||||
TestOverrideMethods tester = new TestOverrideMethods();
|
||||
tester.runTests();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testInvalidOption() {
|
||||
// Make sure an invalid argument fails
|
||||
javadoc("-d", "out-bad-option",
|
||||
"-sourcepath", testSrc,
|
||||
"-javafx",
|
||||
"--override-methods=nonsense",
|
||||
"pkg5");
|
||||
|
||||
checkExit(Exit.CMDERR);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDetail() {
|
||||
// Make sure the option works
|
||||
javadoc("-d", "out-detail",
|
||||
"-sourcepath", testSrc,
|
||||
"-javafx",
|
||||
"--override-methods=detail",
|
||||
"pkg5");
|
||||
|
||||
checkExit(Exit.OK);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSummary() {
|
||||
javadoc("-d", "out-summary",
|
||||
"-sourcepath", testSrc,
|
||||
"-javafx",
|
||||
"--override-methods=summary",
|
||||
"pkg5");
|
||||
|
||||
checkExit(Exit.OK);
|
||||
|
||||
checkOrder("pkg5/Classes.C.html",
|
||||
// Check properties
|
||||
"Properties declared in class pkg5.<a href=\"../pkg5/Classes.P.html",
|
||||
"Classes.P",
|
||||
"../pkg5/Classes.P.html#rateProperty\">rate",
|
||||
|
||||
// Check nested classes
|
||||
"Nested classes/interfaces declared in class pkg5.",
|
||||
"Classes.P",
|
||||
"./pkg5/Classes.P.PN.html",
|
||||
"Classes.P.PN.html",
|
||||
"type parameter in Classes.P.PN\">K",
|
||||
"type parameter in Classes.P.PN",
|
||||
"V",
|
||||
|
||||
// Check fields
|
||||
"Fields declared in class pkg5.<a href=\"../pkg5/Classes.P.html",
|
||||
"Classes.P",
|
||||
"../pkg5/Classes.P.html#field0\">field0",
|
||||
|
||||
// Check method summary
|
||||
"Method Summary",
|
||||
"void",
|
||||
"../pkg5/Classes.C.html#m1--\">m1",
|
||||
"A modified method",
|
||||
|
||||
"void",
|
||||
"../pkg5/Classes.C.html#m4-java.lang.String-java.lang.String-\">m4",
|
||||
"java.lang.String k,",
|
||||
"java.lang.String",
|
||||
" v)",
|
||||
|
||||
// Check footnotes
|
||||
"Methods declared in class pkg5.<a href=\"../pkg5/Classes.GP.html",
|
||||
"Classes.GP",
|
||||
"../pkg5/Classes.GP.html#m0--\">m0",
|
||||
|
||||
// Check method details for override
|
||||
"overrideSpecifyLabel",
|
||||
"Overrides:",
|
||||
"../pkg5/Classes.GP.html#m7--\">m7",
|
||||
"in class",
|
||||
"../pkg5/Classes.GP.html",
|
||||
"Classes.GP"
|
||||
);
|
||||
|
||||
checkOrder("pkg5/Classes.C.html",
|
||||
// Check footnotes 2
|
||||
"Methods declared in class pkg5.",
|
||||
"../pkg5/Classes.P.html#getRate--\">getRate",
|
||||
"../pkg5/Classes.P.html#m2--\">m2",
|
||||
"../pkg5/Classes.P.html#m3--\">m3",
|
||||
"../pkg5/Classes.P.html#m4-K-V-\">m4",
|
||||
"../pkg5/Classes.P.html#rateProperty--\">rateProperty",
|
||||
"../pkg5/Classes.P.html#setRate-double-\">setRate",
|
||||
|
||||
// Check @link
|
||||
"A test of links to the methods in this class. <p>\n",
|
||||
"../pkg5/Classes.GP.html#m0--",
|
||||
"Classes.GP.m0()",
|
||||
"../pkg5/Classes.C.html#m1--",
|
||||
"m1()",
|
||||
"../pkg5/Classes.P.html#m2--",
|
||||
"Classes.P.m2()",
|
||||
"../pkg5/Classes.P.html#m3--",
|
||||
"Classes.P.m3()",
|
||||
"m4(java.lang.String,java.lang.String)",
|
||||
"../pkg5/Classes.P.html#m5--",
|
||||
"Classes.P.m5()",
|
||||
"../pkg5/Classes.C.html#m6--",
|
||||
"m6()",
|
||||
"../pkg5/Classes.C.html#m7--",
|
||||
"m7()",
|
||||
"End of links",
|
||||
|
||||
// Check @see
|
||||
"See Also:",
|
||||
"../pkg5/Classes.GP.html#m0--",
|
||||
"Classes.GP.m0()",
|
||||
"../pkg5/Classes.C.html#m1--",
|
||||
"m1()",
|
||||
"../pkg5/Classes.P.html#m2--",
|
||||
"Classes.P.m2()",
|
||||
"../pkg5/Classes.P.html#m3--",
|
||||
"Classes.P.m3()",
|
||||
"../pkg5/Classes.C.html#m4-java.lang.String-java.lang.String-",
|
||||
"m4(String k, String v)",
|
||||
"../pkg5/Classes.P.html#m5--\"><code>Classes.P.m5()",
|
||||
"../pkg5/Classes.C.html#m6--\"><code>m6()",
|
||||
"../pkg5/Classes.C.html#m7--\"><code>m7()"
|
||||
);
|
||||
|
||||
// Tests for interfaces
|
||||
|
||||
// Make sure the static methods in the super interface
|
||||
// do not make it to this interface
|
||||
checkOutput("pkg5/Interfaces.D.html", false,
|
||||
"msd", "msn");
|
||||
|
||||
checkOrder("pkg5/Interfaces.D.html",
|
||||
"Start of links <p>",
|
||||
"../pkg5/Interfaces.A.html#m0--\"><code>Interfaces.A.m0()",
|
||||
"../pkg5/Interfaces.A.html#m1--\"><code>Interfaces.A.m1()",
|
||||
"../pkg5/Interfaces.A.html#m2--\"><code>Interfaces.A.m2()",
|
||||
"../pkg5/Interfaces.A.html#m3--\"><code>Interfaces.A.m3()",
|
||||
"../pkg5/Interfaces.D.html#m--\"><code>m()",
|
||||
"../pkg5/Interfaces.D.html#n--\"><code>n()",
|
||||
"../pkg5/Interfaces.C.html#o--\"><code>Interfaces.C.o()",
|
||||
"End of links",
|
||||
|
||||
// Check @see links
|
||||
"See Also:",
|
||||
"../pkg5/Interfaces.A.html#m0--\"><code>Interfaces.A.m0()",
|
||||
"../pkg5/Interfaces.A.html#m1--\"><code>Interfaces.A.m1()",
|
||||
"../pkg5/Interfaces.A.html#m2--\"><code>Interfaces.A.m2()",
|
||||
"../pkg5/Interfaces.A.html#m3--\"><code>Interfaces.A.m3()",
|
||||
"../pkg5/Interfaces.D.html#m--\"><code>m()",
|
||||
"../pkg5/Interfaces.D.html#n--\"><code>n()",
|
||||
"../pkg5/Interfaces.C.html#o--\"><code>Interfaces.C.o()",
|
||||
|
||||
// Check properties
|
||||
"Properties declared in interface pkg5.<a href=\"../pkg5/Interfaces.A.html\" "
|
||||
+ "title=\"interface in pkg5\">Interfaces.A</a>",
|
||||
|
||||
// Check nested classes
|
||||
"Nested classes/interfaces declared in interface pkg5.",
|
||||
"Interfaces.A",
|
||||
"../pkg5/Interfaces.A.AA.html",
|
||||
"Interfaces.A.AA",
|
||||
|
||||
// Check Fields
|
||||
"Fields declared in interface pkg5.<a href=\"../pkg5/Interfaces.A.html",
|
||||
"../pkg5/Interfaces.A.html#f",
|
||||
"../pkg5/Interfaces.A.html#QUOTE\">QUOTE",
|
||||
"../pkg5/Interfaces.A.html#rate\">rate",
|
||||
|
||||
// Check Method Summary
|
||||
"Method Summary",
|
||||
"../pkg5/Interfaces.D.html#m--\">m",
|
||||
"../pkg5/Interfaces.D.html#n--\">n",
|
||||
|
||||
// Check footnotes
|
||||
"Methods declared in interface pkg5.<a href=\"../pkg5/Interfaces.A.html",
|
||||
"../pkg5/Interfaces.A.html#getRate--\">getRate",
|
||||
"../pkg5/Interfaces.A.html#rateProperty--\">rateProperty",
|
||||
"../pkg5/Interfaces.A.html#setRate-double-",
|
||||
"Methods declared in interface pkg5.<a href=\"../pkg5/Interfaces.B.html",
|
||||
"../pkg5/Interfaces.B.html#m1--\">m1",
|
||||
"../pkg5/Interfaces.B.html#m3--\">m3",
|
||||
"Methods declared in interface pkg5.<a href=\"../pkg5/Interfaces.C.html",
|
||||
"<a href=\"../pkg5/Interfaces.C.html#o--\">o</a>"
|
||||
);
|
||||
|
||||
// Test synthetic values and valuesof of an enum.
|
||||
checkOrder("index-all.html",
|
||||
"<h2 class=\"title\">M</h2>",
|
||||
"<a href=\"pkg5/Interfaces.C.html#m--\">m()",
|
||||
"<a href=\"pkg5/Interfaces.D.html#m--\">m()</a>",
|
||||
"<a href=\"pkg5/Classes.GP.html#m0--\">m0()",
|
||||
"<a href=\"pkg5/Interfaces.A.html#m0--\">m0()</a>",
|
||||
"<a href=\"pkg5/Classes.C.html#m1--\">m1()</a>",
|
||||
"<a href=\"pkg5/Classes.P.html#m1--\">m1()</a>",
|
||||
"<a href=\"pkg5/Interfaces.A.html#m1--\">m1()</a>",
|
||||
"<a href=\"pkg5/Interfaces.B.html#m1--\">m1()</a>",
|
||||
"<a href=\"pkg5/Classes.P.html#m2--\">m2()</a>",
|
||||
"<a href=\"pkg5/Interfaces.A.html#m2--\">m2()</a>",
|
||||
"<a href=\"pkg5/Classes.P.html#m3--\">m3()</a>",
|
||||
"<a href=\"pkg5/Interfaces.A.html#m3--\">m3()</a>",
|
||||
"<a href=\"pkg5/Interfaces.B.html#m3--\">m3()</a>",
|
||||
"<a href=\"pkg5/Classes.C.html#m4-java.lang.String-java.lang.String-\">m4(String, String)</a>",
|
||||
"<a href=\"pkg5/Classes.P.html#m4-K-V-\">m4(K, V)</a>",
|
||||
"<a href=\"pkg5/Classes.P.html#m5--\">m5()</a>",
|
||||
"<a href=\"pkg5/Classes.C.html#m6--\">m6()</a>",
|
||||
"<a href=\"pkg5/Classes.P.html#m6--\">m6()</a>",
|
||||
"<a href=\"pkg5/Classes.C.html#m7--\">m7()</a>",
|
||||
"<a href=\"pkg5/Classes.GP.html#m7--\">m7()</a>",
|
||||
"Returns the enum constant of this type with the specified name.",
|
||||
"Returns an array containing the constants of this enum type, in\n" +
|
||||
"the order they are declared."
|
||||
);
|
||||
}
|
||||
}
|
@ -29,6 +29,14 @@ public class Interfaces {
|
||||
/** field f in A */
|
||||
public int f = 0;
|
||||
|
||||
public static String QUOTE = "Winter is coming";
|
||||
|
||||
/** a documented static method */
|
||||
public static void msd() {}
|
||||
|
||||
/* An undocumented static method */
|
||||
public static void msn() {}
|
||||
|
||||
/** A property in parent */
|
||||
DoubleProperty rate = null;
|
||||
public void setRate(double l);
|
@ -1,254 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 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 8157000
|
||||
* @summary test the behavior of --override-methods option
|
||||
* @library ../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* @build JavadocTester
|
||||
* @run main TestOverrideMethods
|
||||
*/
|
||||
|
||||
public class TestOverrideMethods extends JavadocTester {
|
||||
public static void main(String... args) throws Exception {
|
||||
TestOverrideMethods tester = new TestOverrideMethods();
|
||||
tester.runTests();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testInvalidOption() {
|
||||
// Make sure an invalid argument fails
|
||||
javadoc("-d", "out-bad-option",
|
||||
"-sourcepath", testSrc,
|
||||
"-javafx",
|
||||
"--override-methods=nonsense",
|
||||
"pkg5");
|
||||
|
||||
checkExit(Exit.CMDERR);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDetail() {
|
||||
// Make sure the option works
|
||||
javadoc("-d", "out-detail",
|
||||
"-sourcepath", testSrc,
|
||||
"-javafx",
|
||||
"--override-methods=detail",
|
||||
"pkg5");
|
||||
|
||||
checkExit(Exit.OK);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSummary() {
|
||||
javadoc("-d", "out-summary",
|
||||
"-sourcepath", testSrc,
|
||||
"-javafx",
|
||||
"--override-methods=summary",
|
||||
"pkg5");
|
||||
|
||||
checkExit(Exit.OK);
|
||||
|
||||
checkOutput("pkg5/Classes.C.html", true,
|
||||
// Check properties
|
||||
"<h3>Properties declared in class pkg5.<a href=\"../pkg5/Classes.P.html\" "
|
||||
+ "title=\"class in pkg5\">Classes.P</a></h3>\n"
|
||||
+ "<code><a href=\"../pkg5/Classes.P.html#rateProperty\">rate</a>",
|
||||
|
||||
// Check nested classes
|
||||
"<h3>Nested classes/interfaces declared in class pkg5."
|
||||
+ "<a href=\"../pkg5/Classes.P.html\" title=\"class in pkg5\">Classes.P</a></h3>\n"
|
||||
+ "<code><a href=\"../pkg5/Classes.P.PN.html\" title=\"class in pkg5\">"
|
||||
+ "Classes.P.PN</a><<a href=\"../pkg5/Classes.P.PN.html\" "
|
||||
+ "title=\"type parameter in Classes.P.PN\">K</a>,"
|
||||
+ "<a href=\"../pkg5/Classes.P.PN.html\" title=\"type parameter in Classes.P.PN\">"
|
||||
+ "V</a>></code></li>\n",
|
||||
|
||||
// Check fields
|
||||
"<h3>Fields declared in class pkg5.<a href=\"../pkg5/Classes.P.html\" "
|
||||
+ "title=\"class in pkg5\">Classes.P</a></h3>\n"
|
||||
+ "<code><a href=\"../pkg5/Classes.P.html#field0\">field0</a></code></li>\n",
|
||||
|
||||
// Check method summary
|
||||
"<td class=\"colFirst\"><code>void</code></td>\n"
|
||||
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
|
||||
+ "<a href=\"../pkg5/Classes.C.html#m1--\">m1</a></span>()</code></th>\n"
|
||||
+ "<td class=\"colLast\">\n"
|
||||
+ "<div class=\"block\">A modified method</div>\n",
|
||||
|
||||
"<td class=\"colFirst\"><code>void</code></td>\n"
|
||||
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
|
||||
+ "<a href=\"../pkg5/Classes.C.html#m4-java.lang.String-java.lang.String-\">m4"
|
||||
+ "</a></span>​(java.lang.String k,\n"
|
||||
+ " java.lang.String v)</code></th>\n",
|
||||
|
||||
// Check footnotes
|
||||
"<h3>Methods declared in class pkg5.<a href=\"../pkg5/Classes.GP.html\" "
|
||||
+ "title=\"class in pkg5\">Classes.GP</a></h3>\n"
|
||||
+ "<code><a href=\"../pkg5/Classes.GP.html#m0--\">m0</a>",
|
||||
|
||||
// Check method details for override
|
||||
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
|
||||
+ "<dd><code><a href=\"../pkg5/Classes.GP.html#m7--\">m7</a>"
|
||||
+ "</code> in class <code><a href=\"../pkg5/Classes.GP.html\" "
|
||||
+ "title=\"class in pkg5\">Classes.GP</a></code></dd>\n"
|
||||
);
|
||||
|
||||
// Check footnotes 2
|
||||
checkOrder("pkg5/Classes.C.html",
|
||||
"Methods declared in class pkg5.",
|
||||
"<code><a href=\"../pkg5/Classes.P.html#getRate--\">getRate</a>, ",
|
||||
"<a href=\"../pkg5/Classes.P.html#m2--\">m2</a>, ",
|
||||
"<a href=\"../pkg5/Classes.P.html#m3--\">m3</a>, ",
|
||||
"<a href=\"../pkg5/Classes.P.html#m4-K-V-\">m4</a>, ",
|
||||
"<a href=\"../pkg5/Classes.P.html#rateProperty--\">rateProperty</a>, ",
|
||||
"<a href=\"../pkg5/Classes.P.html#setRate-double-\">setRate</a>"
|
||||
);
|
||||
|
||||
// Check @link
|
||||
checkOrder("pkg5/Classes.C.html",
|
||||
"A test of links to the methods in this class. <p>\n",
|
||||
"<a href=\"../pkg5/Classes.GP.html#m0--\"><code>Classes.GP.m0()</code></a>",
|
||||
"<a href=\"../pkg5/Classes.C.html#m1--\"><code>m1()</code></a>",
|
||||
"<a href=\"../pkg5/Classes.P.html#m2--\"><code>Classes.P.m2()</code></a>",
|
||||
"<a href=\"../pkg5/Classes.P.html#m3--\"><code>Classes.P.m3()</code></a>",
|
||||
"<code>m4(java.lang.String,java.lang.String)</code></a>",
|
||||
"<a href=\"../pkg5/Classes.P.html#m5--\"><code>Classes.P.m5()</code></a>",
|
||||
"<a href=\"../pkg5/Classes.C.html#m6--\"><code>m6()</code></a>",
|
||||
"<a href=\"../pkg5/Classes.C.html#m7--\"><code>m7()</code></a>",
|
||||
"End of links"
|
||||
);
|
||||
|
||||
// Check @see
|
||||
checkOrder("pkg5/Classes.C.html",
|
||||
"See Also:",
|
||||
"<a href=\"../pkg5/Classes.GP.html#m0--\"><code>Classes.GP.m0()</code>",
|
||||
"<a href=\"../pkg5/Classes.C.html#m1--\"><code>m1()</code></a>",
|
||||
"<a href=\"../pkg5/Classes.P.html#m2--\"><code>Classes.P.m2()</code></a>",
|
||||
"<a href=\"../pkg5/Classes.P.html#m3--\"><code>Classes.P.m3()</code></a>",
|
||||
"<a href=\"../pkg5/Classes.C.html#m4-java.lang.String-java.lang.String-\">"
|
||||
+ "<code>m4(String k, String v)</code>",
|
||||
"<a href=\"../pkg5/Classes.P.html#m5--\"><code>Classes.P.m5()</code></a>",
|
||||
"<a href=\"../pkg5/Classes.C.html#m6--\"><code>m6()</code></a>",
|
||||
"<a href=\"../pkg5/Classes.C.html#m7--\"><code>m7()</code></a>"
|
||||
);
|
||||
|
||||
checkOutput("pkg5/Interfaces.D.html", true,
|
||||
// Check properties
|
||||
"<h3>Properties declared in interface pkg5.<a href=\"../pkg5/Interfaces.A.html\" "
|
||||
+ "title=\"interface in pkg5\">Interfaces.A</a>",
|
||||
|
||||
// Check nested classes
|
||||
"<h3>Nested classes/interfaces declared in interface pkg5."
|
||||
+ "<a href=\"../pkg5/Interfaces.A.html\" title=\"interface in pkg5\">"
|
||||
+ "Interfaces.A</a></h3>\n"
|
||||
+ "<code><a href=\"../pkg5/Interfaces.A.AA.html\" "
|
||||
+ "title=\"interface in pkg5\">Interfaces.A.AA</a>",
|
||||
|
||||
// Check fields
|
||||
"<h3>Fields declared in interface pkg5.<a href=\"../pkg5/Interfaces.A.html\" "
|
||||
+ "title=\"interface in pkg5\">Interfaces.A</a></h3>\n"
|
||||
+ "<code><a href=\"../pkg5/Interfaces.A.html#f\">f</a>",
|
||||
|
||||
// Check method summary
|
||||
"<td class=\"colFirst\"><code>void</code></td>\n"
|
||||
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
|
||||
+ "<a href=\"../pkg5/Interfaces.D.html#m--\">m</a></span>()</code></th>\n"
|
||||
+ "<td class=\"colLast\">\n"
|
||||
+ "<div class=\"block\">m in D</div>\n",
|
||||
|
||||
"<td class=\"colFirst\"><code>void</code></td>\n"
|
||||
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
|
||||
+ "<a href=\"../pkg5/Interfaces.D.html#n--\">n</a></span>()</code></th>\n"
|
||||
+ "<td class=\"colLast\">\n"
|
||||
+ "<div class=\"block\">n in D</div>\n",
|
||||
|
||||
// Check footnote
|
||||
"<h3>Methods declared in interface pkg5.<a href=\"../pkg5/Interfaces.A.html\" "
|
||||
+ "title=\"interface in pkg5\">Interfaces.A</a></h3>\n"
|
||||
+ "<code><a href=\"../pkg5/Interfaces.A.html#getRate--\">getRate</a>, "
|
||||
+ "<a href=\"../pkg5/Interfaces.A.html#rateProperty--\">rateProperty</a>, "
|
||||
+ "<a href=\"../pkg5/Interfaces.A.html#setRate-double-\">setRate</a>",
|
||||
|
||||
"<h3>Methods declared in interface pkg5.<a href=\"../pkg5/Interfaces.B.html\" "
|
||||
+ "title=\"interface in pkg5\">Interfaces.B</a></h3>\n"
|
||||
+ "<code><a href=\"../pkg5/Interfaces.B.html#m1--\">m1</a>, "
|
||||
+ "<a href=\"../pkg5/Interfaces.B.html#m3--\">m3</a>",
|
||||
|
||||
"<h3>Methods declared in interface pkg5.<a href=\"../pkg5/Interfaces.C.html\" "
|
||||
+ "title=\"interface in pkg5\">Interfaces.C</a></h3>\n"
|
||||
+ "<code><a href=\"../pkg5/Interfaces.C.html#o--\">o</a>"
|
||||
);
|
||||
|
||||
checkOrder("pkg5/Interfaces.D.html",
|
||||
"Start of links <p>",
|
||||
"<a href=\"../pkg5/Interfaces.A.html#m0--\"><code>Interfaces.A.m0()</code></a>",
|
||||
"<a href=\"../pkg5/Interfaces.A.html#m1--\"><code>Interfaces.A.m1()</code></a>",
|
||||
"<a href=\"../pkg5/Interfaces.A.html#m2--\"><code>Interfaces.A.m2()</code></a>",
|
||||
"<a href=\"../pkg5/Interfaces.A.html#m3--\"><code>Interfaces.A.m3()</code></a>",
|
||||
"<a href=\"../pkg5/Interfaces.D.html#m--\"><code>m()</code></a>",
|
||||
"<a href=\"../pkg5/Interfaces.D.html#n--\"><code>n()</code></a>",
|
||||
"<a href=\"../pkg5/Interfaces.C.html#o--\"><code>Interfaces.C.o()</code></a>",
|
||||
"End of links");
|
||||
|
||||
checkOrder("pkg5/Interfaces.D.html",
|
||||
"See Also:",
|
||||
"<a href=\"../pkg5/Interfaces.A.html#m0--\"><code>Interfaces.A.m0()</code></a>",
|
||||
"<a href=\"../pkg5/Interfaces.A.html#m1--\"><code>Interfaces.A.m1()</code></a>",
|
||||
"<a href=\"../pkg5/Interfaces.A.html#m2--\"><code>Interfaces.A.m2()</code></a>",
|
||||
"<a href=\"../pkg5/Interfaces.A.html#m3--\"><code>Interfaces.A.m3()</code></a>",
|
||||
"<a href=\"../pkg5/Interfaces.D.html#m--\"><code>m()</code></a>",
|
||||
"<a href=\"../pkg5/Interfaces.D.html#n--\"><code>n()</code></a>",
|
||||
"<a href=\"../pkg5/Interfaces.C.html#o--\"><code>Interfaces.C.o()</code></a>");
|
||||
|
||||
// Test synthetic values and valuesof of an enum.
|
||||
checkOrder("index-all.html",
|
||||
"<h2 class=\"title\">M</h2>",
|
||||
"<a href=\"pkg5/Interfaces.C.html#m--\">m()",
|
||||
"<a href=\"pkg5/Interfaces.D.html#m--\">m()</a>",
|
||||
"<a href=\"pkg5/Classes.GP.html#m0--\">m0()",
|
||||
"<a href=\"pkg5/Interfaces.A.html#m0--\">m0()</a>",
|
||||
"<a href=\"pkg5/Classes.C.html#m1--\">m1()</a>",
|
||||
"<a href=\"pkg5/Classes.P.html#m1--\">m1()</a>",
|
||||
"<a href=\"pkg5/Interfaces.A.html#m1--\">m1()</a>",
|
||||
"<a href=\"pkg5/Interfaces.B.html#m1--\">m1()</a>",
|
||||
"<a href=\"pkg5/Classes.P.html#m2--\">m2()</a>",
|
||||
"<a href=\"pkg5/Interfaces.A.html#m2--\">m2()</a>",
|
||||
"<a href=\"pkg5/Classes.P.html#m3--\">m3()</a>",
|
||||
"<a href=\"pkg5/Interfaces.A.html#m3--\">m3()</a>",
|
||||
"<a href=\"pkg5/Interfaces.B.html#m3--\">m3()</a>",
|
||||
"<a href=\"pkg5/Classes.C.html#m4-java.lang.String-java.lang.String-\">m4(String, String)</a>",
|
||||
"<a href=\"pkg5/Classes.P.html#m4-K-V-\">m4(K, V)</a>",
|
||||
"<a href=\"pkg5/Classes.P.html#m5--\">m5()</a>",
|
||||
"<a href=\"pkg5/Classes.C.html#m6--\">m6()</a>",
|
||||
"<a href=\"pkg5/Classes.P.html#m6--\">m6()</a>",
|
||||
"<a href=\"pkg5/Classes.C.html#m7--\">m7()</a>",
|
||||
"<a href=\"pkg5/Classes.GP.html#m7--\">m7()</a>",
|
||||
"Returns the enum constant of this type with the specified name.",
|
||||
"Returns an array containing the constants of this enum type, in\n" +
|
||||
"the order they are declared."
|
||||
);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user