1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359
|
/*
* Copyright (c) 2017, 2018, 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 8182765
* @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",
"--disable-javafx-strict-checks",
"--override-methods=nonsense",
"pkg5");
checkExit(Exit.CMDERR);
}
@Test
void testDetail() {
// Make sure the option works
javadoc("-d", "out-detail",
"-sourcepath", testSrc,
"-javafx",
"--disable-javafx-strict-checks",
"--override-methods=detail",
"pkg5");
checkExit(Exit.OK);
}
@Test
void testSummary() {
javadoc("-d", "out-summary",
"-sourcepath", testSrc,
"-javafx",
"--disable-javafx-strict-checks",
"--override-methods=summary",
"pkg5");
checkExit(Exit.OK);
checkOrder("pkg5/Classes.C.html",
// Check properties
"Properties declared in class pkg5.<a href=\"Classes.P.html",
"Classes.P",
"Classes.P.html#rateProperty\">rate",
// Check nested classes
"Nested classes/interfaces declared in class pkg5.",
"Classes.P",
"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=\"Classes.P.html",
"Classes.P",
"Classes.P.html#field0\">field0",
// Check method summary
"Method Summary",
"void",
"#m1()\">m1",
"A modified method",
"void",
"#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=\"Classes.GP.html",
"Classes.GP",
"Classes.GP.html#m0()\">m0",
// Check method details for override
"overrideSpecifyLabel",
"Overrides:",
"Classes.GP.html#m7()\">m7",
"in class",
"Classes.GP.html",
"Classes.GP"
);
checkOrder("pkg5/Classes.C.html",
// Check footnotes 2
"Methods declared in class pkg5.",
"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",
// Check @link
"A test of links to the methods in this class. <p>\n",
"Classes.GP.html#m0()",
"Classes.GP.m0()",
"#m1()",
"m1()",
"Classes.P.html#m2()",
"Classes.P.m2()",
"Classes.P.html#m3()",
"Classes.P.m3()",
"m4(java.lang.String,java.lang.String)",
"Classes.P.html#m5()",
"Classes.P.m5()",
"#m6()",
"m6()",
"#m7()",
"m7()",
"End of links",
// Check @see
"See Also:",
"Classes.GP.html#m0()",
"Classes.GP.m0()",
"#m1()",
"m1()",
"Classes.P.html#m2()",
"Classes.P.m2()",
"Classes.P.html#m3()",
"Classes.P.m3()",
"#m4(java.lang.String,java.lang.String)",
"m4(String k, String v)",
"Classes.P.html#m5()\"><code>Classes.P.m5()",
"#m6()\"><code>m6()",
"#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>",
"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()",
"End of links",
// Check @see links
"See Also:",
"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()",
// Check properties
"Properties declared in interface pkg5.<a href=\"Interfaces.A.html\" "
+ "title=\"interface in pkg5\">Interfaces.A</a>",
// Check nested classes
"Nested classes/interfaces declared in interface pkg5.",
"Interfaces.A",
"Interfaces.A.AA.html",
"Interfaces.A.AA",
// Check Fields
"Fields declared in interface pkg5.<a href=\"Interfaces.A.html",
"Interfaces.A.html#f",
"Interfaces.A.html#QUOTE\">QUOTE",
"Interfaces.A.html#rate\">rate",
// Check Method Summary
"Method Summary",
"#m()\">m",
"#n()\">n",
// Check footnotes
"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>"
);
// 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."
);
}
@Test
void testSummary_html4() {
javadoc("-d", "out-summary-html4",
"-html4",
"-sourcepath", testSrc,
"-javafx",
"--override-methods=summary",
"pkg5");
checkExit(Exit.OK);
checkOrder("pkg5/Classes.C.html",
"#m1--\">m1",
"#m4-java.lang.String-java.lang.String-\">m4",
"Classes.GP.html#m0--\">m0",
"Classes.GP.html#m7--\">m7"
);
checkOrder("pkg5/Classes.C.html",
// Check footnotes 2
"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",
// Check @link
"Classes.GP.html#m0--",
"#m1--",
"Classes.P.html#m2--",
"Classes.P.html#m3--",
"Classes.P.html#m5--",
"#m6--",
"#m7--",
// Check @see
"Classes.GP.html#m0--",
"#m1--",
"Classes.P.html#m2--",
"Classes.P.html#m3--",
"#m4-java.lang.String-java.lang.String-",
"Classes.P.html#m5--\"><code>Classes.P.m5()",
"#m6--\"><code>m6()",
"#m7--\"><code>m7()"
);
// Tests for interfaces
// Make sure the static methods in the super interface
// do not make it to this interface
checkOrder("pkg5/Interfaces.D.html",
"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()",
"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()",
"#m--\">m",
"#n--\">n",
"Interfaces.A.html#getRate--\">getRate",
"Interfaces.A.html#rateProperty--\">rateProperty",
"Interfaces.A.html#setRate-double-",
"Interfaces.B.html#m1--\">m1",
"Interfaces.B.html#m3--\">m3",
"<a href=\"Interfaces.C.html#o--\">o</a>"
);
// Test synthetic values and valuesof of an enum.
checkOrder("index-all.html",
"<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>"
);
}
}
|