2017-12-12 20:18:14 -08:00
|
|
|
/*
|
2018-01-22 11:15:51 -08:00
|
|
|
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
2017-12-12 20:18:14 -08: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.
|
|
|
|
*
|
|
|
|
* 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
|
2018-01-22 11:15:51 -08:00
|
|
|
"Properties declared in class pkg5.<a href=\"Classes.P.html",
|
2017-12-12 20:18:14 -08:00
|
|
|
"Classes.P",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Classes.P.html#rateProperty\">rate",
|
2017-12-12 20:18:14 -08:00
|
|
|
|
|
|
|
// Check nested classes
|
|
|
|
"Nested classes/interfaces declared in class pkg5.",
|
|
|
|
"Classes.P",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Classes.P.PN.html",
|
2017-12-12 20:18:14 -08:00
|
|
|
"Classes.P.PN.html",
|
|
|
|
"type parameter in Classes.P.PN\">K",
|
|
|
|
"type parameter in Classes.P.PN",
|
|
|
|
"V",
|
|
|
|
|
|
|
|
// Check fields
|
2018-01-22 11:15:51 -08:00
|
|
|
"Fields declared in class pkg5.<a href=\"Classes.P.html",
|
2017-12-12 20:18:14 -08:00
|
|
|
"Classes.P",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Classes.P.html#field0\">field0",
|
2017-12-12 20:18:14 -08:00
|
|
|
|
|
|
|
// Check method summary
|
|
|
|
"Method Summary",
|
|
|
|
"void",
|
2018-01-22 11:15:51 -08:00
|
|
|
"#m1--\">m1",
|
2017-12-12 20:18:14 -08:00
|
|
|
"A modified method",
|
|
|
|
|
|
|
|
"void",
|
2018-01-22 11:15:51 -08:00
|
|
|
"#m4-java.lang.String-java.lang.String-\">m4",
|
2017-12-12 20:18:14 -08:00
|
|
|
"java.lang.String k,",
|
|
|
|
"java.lang.String",
|
|
|
|
" v)",
|
|
|
|
|
|
|
|
// Check footnotes
|
2018-01-22 11:15:51 -08:00
|
|
|
"Methods declared in class pkg5.<a href=\"Classes.GP.html",
|
2017-12-12 20:18:14 -08:00
|
|
|
"Classes.GP",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Classes.GP.html#m0--\">m0",
|
2017-12-12 20:18:14 -08:00
|
|
|
|
|
|
|
// Check method details for override
|
|
|
|
"overrideSpecifyLabel",
|
|
|
|
"Overrides:",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Classes.GP.html#m7--\">m7",
|
2017-12-12 20:18:14 -08:00
|
|
|
"in class",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Classes.GP.html",
|
2017-12-12 20:18:14 -08:00
|
|
|
"Classes.GP"
|
|
|
|
);
|
|
|
|
|
|
|
|
checkOrder("pkg5/Classes.C.html",
|
|
|
|
// Check footnotes 2
|
|
|
|
"Methods declared in class pkg5.",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Classes.P.html#getRate--\">getRate",
|
|
|
|
"Classes.P.html#m2--\">m2",
|
|
|
|
"Classes.P.html#m3--\">m3",
|
|
|
|
"Classes.P.html#m4-K-V-\">m4",
|
|
|
|
"Classes.P.html#rateProperty--\">rateProperty",
|
|
|
|
"Classes.P.html#setRate-double-\">setRate",
|
2017-12-12 20:18:14 -08:00
|
|
|
|
|
|
|
// Check @link
|
|
|
|
"A test of links to the methods in this class. <p>\n",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Classes.GP.html#m0--",
|
2017-12-12 20:18:14 -08:00
|
|
|
"Classes.GP.m0()",
|
2018-01-22 11:15:51 -08:00
|
|
|
"#m1--",
|
2017-12-12 20:18:14 -08:00
|
|
|
"m1()",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Classes.P.html#m2--",
|
2017-12-12 20:18:14 -08:00
|
|
|
"Classes.P.m2()",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Classes.P.html#m3--",
|
2017-12-12 20:18:14 -08:00
|
|
|
"Classes.P.m3()",
|
|
|
|
"m4(java.lang.String,java.lang.String)",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Classes.P.html#m5--",
|
2017-12-12 20:18:14 -08:00
|
|
|
"Classes.P.m5()",
|
2018-01-22 11:15:51 -08:00
|
|
|
"#m6--",
|
2017-12-12 20:18:14 -08:00
|
|
|
"m6()",
|
2018-01-22 11:15:51 -08:00
|
|
|
"#m7--",
|
2017-12-12 20:18:14 -08:00
|
|
|
"m7()",
|
|
|
|
"End of links",
|
|
|
|
|
|
|
|
// Check @see
|
|
|
|
"See Also:",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Classes.GP.html#m0--",
|
2017-12-12 20:18:14 -08:00
|
|
|
"Classes.GP.m0()",
|
2018-01-22 11:15:51 -08:00
|
|
|
"#m1--",
|
2017-12-12 20:18:14 -08:00
|
|
|
"m1()",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Classes.P.html#m2--",
|
2017-12-12 20:18:14 -08:00
|
|
|
"Classes.P.m2()",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Classes.P.html#m3--",
|
2017-12-12 20:18:14 -08:00
|
|
|
"Classes.P.m3()",
|
2018-01-22 11:15:51 -08:00
|
|
|
"#m4-java.lang.String-java.lang.String-",
|
2017-12-12 20:18:14 -08:00
|
|
|
"m4(String k, String v)",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Classes.P.html#m5--\"><code>Classes.P.m5()",
|
|
|
|
"#m6--\"><code>m6()",
|
|
|
|
"#m7--\"><code>m7()"
|
2017-12-12 20:18:14 -08:00
|
|
|
);
|
|
|
|
|
|
|
|
// 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>",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Interfaces.A.html#m0--\"><code>Interfaces.A.m0()",
|
|
|
|
"Interfaces.A.html#m1--\"><code>Interfaces.A.m1()",
|
|
|
|
"Interfaces.A.html#m2--\"><code>Interfaces.A.m2()",
|
|
|
|
"Interfaces.A.html#m3--\"><code>Interfaces.A.m3()",
|
|
|
|
"#m--\"><code>m()",
|
|
|
|
"#n--\"><code>n()",
|
|
|
|
"Interfaces.C.html#o--\"><code>Interfaces.C.o()",
|
2017-12-12 20:18:14 -08:00
|
|
|
"End of links",
|
|
|
|
|
|
|
|
// Check @see links
|
|
|
|
"See Also:",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Interfaces.A.html#m0--\"><code>Interfaces.A.m0()",
|
|
|
|
"Interfaces.A.html#m1--\"><code>Interfaces.A.m1()",
|
|
|
|
"Interfaces.A.html#m2--\"><code>Interfaces.A.m2()",
|
|
|
|
"Interfaces.A.html#m3--\"><code>Interfaces.A.m3()",
|
|
|
|
"#m--\"><code>m()",
|
|
|
|
"#n--\"><code>n()",
|
|
|
|
"Interfaces.C.html#o--\"><code>Interfaces.C.o()",
|
2017-12-12 20:18:14 -08:00
|
|
|
|
|
|
|
// Check properties
|
2018-01-22 11:15:51 -08:00
|
|
|
"Properties declared in interface pkg5.<a href=\"Interfaces.A.html\" "
|
2017-12-12 20:18:14 -08:00
|
|
|
+ "title=\"interface in pkg5\">Interfaces.A</a>",
|
|
|
|
|
|
|
|
// Check nested classes
|
|
|
|
"Nested classes/interfaces declared in interface pkg5.",
|
|
|
|
"Interfaces.A",
|
2018-01-22 11:15:51 -08:00
|
|
|
"Interfaces.A.AA.html",
|
2017-12-12 20:18:14 -08:00
|
|
|
"Interfaces.A.AA",
|
|
|
|
|
|
|
|
// Check Fields
|
2018-01-22 11:15:51 -08:00
|
|
|
"Fields declared in interface pkg5.<a href=\"Interfaces.A.html",
|
|
|
|
"Interfaces.A.html#f",
|
|
|
|
"Interfaces.A.html#QUOTE\">QUOTE",
|
|
|
|
"Interfaces.A.html#rate\">rate",
|
2017-12-12 20:18:14 -08:00
|
|
|
|
|
|
|
// Check Method Summary
|
|
|
|
"Method Summary",
|
2018-01-22 11:15:51 -08:00
|
|
|
"#m--\">m",
|
|
|
|
"#n--\">n",
|
2017-12-12 20:18:14 -08:00
|
|
|
|
|
|
|
// Check footnotes
|
2018-01-22 11:15:51 -08:00
|
|
|
"Methods declared in interface pkg5.<a href=\"Interfaces.A.html",
|
|
|
|
"Interfaces.A.html#getRate--\">getRate",
|
|
|
|
"Interfaces.A.html#rateProperty--\">rateProperty",
|
|
|
|
"Interfaces.A.html#setRate-double-",
|
|
|
|
"Methods declared in interface pkg5.<a href=\"Interfaces.B.html",
|
|
|
|
"Interfaces.B.html#m1--\">m1",
|
|
|
|
"Interfaces.B.html#m3--\">m3",
|
|
|
|
"Methods declared in interface pkg5.<a href=\"Interfaces.C.html",
|
|
|
|
"<a href=\"Interfaces.C.html#o--\">o</a>"
|
2017-12-12 20:18:14 -08:00
|
|
|
);
|
|
|
|
|
|
|
|
// 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."
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|