1 /* 2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @bug 8157000 27 * @summary test the behavior of --override-methods option 28 * @library ../lib 29 * @modules jdk.javadoc/jdk.javadoc.internal.tool 30 * @build JavadocTester 31 * @run main TestOverrideMethods 32 */ 33 34 public class TestOverrideMethods extends JavadocTester { 35 public static void main(String... args) throws Exception { 36 TestOverrideMethods tester = new TestOverrideMethods(); 37 tester.runTests(); 38 } 39 40 @Test 41 void test() { 42 javadoc("-d", "out", 43 "-sourcepath", testSrc, 44 "-javafx", 45 "--override-methods=summary", 46 "pkg5"); 47 48 checkExit(Exit.OK); 49 50 checkOutput("pkg5/Classes.C.html", true, 51 // check properties 52 "<h3>Properties declared in class pkg5.<a href=\"../pkg5/Classes.P.html\" " 53 + "title=\"class in pkg5\">Classes.P</a></h3>\n" 54 + "<code><a href=\"../pkg5/Classes.P.html#rateProperty\">rate</a>", 55 56 // check nested classes 57 "<h3>Nested classes/interfaces declared in class pkg5." 58 + "<a href=\"../pkg5/Classes.P.html\" title=\"class in pkg5\">Classes.P</a></h3>\n" 59 + "<code><a href=\"../pkg5/Classes.P.PN.html\" title=\"class in pkg5\">" 60 + "Classes.P.PN</a><<a href=\"../pkg5/Classes.P.PN.html\" " 61 + "title=\"type parameter in Classes.P.PN\">K</a>," 62 + "<a href=\"../pkg5/Classes.P.PN.html\" title=\"type parameter in Classes.P.PN\">" 63 + "V</a>></code></li>\n", 64 65 // check fields 66 "<h3>Fields declared in class pkg5.<a href=\"../pkg5/Classes.P.html\" " 67 + "title=\"class in pkg5\">Classes.P</a></h3>\n" 68 + "<code><a href=\"../pkg5/Classes.P.html#field0\">field0</a></code></li>\n", 69 70 // check method summary 71 "<td class=\"colFirst\"><code>void</code></td>\n" 72 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 73 + "<a href=\"../pkg5/Classes.C.html#m1--\">m1</a></span>()</code></th>\n" 74 + "<td class=\"colLast\">\n" 75 + "<div class=\"block\">A modified method</div>\n", 76 77 "<td class=\"colFirst\"><code>void</code></td>\n" 78 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 79 + "<a href=\"../pkg5/Classes.C.html#m4-java.lang.String-java.lang.String-\">m4" 80 + "</a></span>(java.lang.String k,\n" 81 + " java.lang.String v)</code></th>\n", 82 83 // check footnotes 84 "<h3>Methods declared in class pkg5.<a href=\"../pkg5/Classes.GP.html\" " 85 + "title=\"class in pkg5\">Classes.GP</a></h3>\n" 86 + "<code><a href=\"../pkg5/Classes.GP.html#m0--\">m0</a>", 87 88 // check method details for override 89 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" 90 + "<dd><code><a href=\"../pkg5/Classes.GP.html#m7--\">m7</a>" 91 + "</code> in class <code><a href=\"../pkg5/Classes.GP.html\" " 92 + "title=\"class in pkg5\">Classes.GP</a></code></dd>\n" 93 ); 94 95 // check footnotes 2 96 checkOrder("pkg5/Classes.C.html", 97 "Methods declared in class pkg5.", 98 "<code><a href=\"../pkg5/Classes.P.html#getRate--\">getRate</a>, ", 99 "<a href=\"../pkg5/Classes.P.html#m2--\">m2</a>, ", 100 "<a href=\"../pkg5/Classes.P.html#m3--\">m3</a>, ", 101 "<a href=\"../pkg5/Classes.P.html#m4-K-V-\">m4</a>, ", 102 "<a href=\"../pkg5/Classes.P.html#rateProperty--\">rateProperty</a>, ", 103 "<a href=\"../pkg5/Classes.P.html#setRate-double-\">setRate</a>" 104 ); 105 106 // check @link 107 checkOrder("pkg5/Classes.C.html", 108 "A test of links to the methods in this class. <p>\n", 109 "<a href=\"../pkg5/Classes.GP.html#m0--\"><code>Classes.GP.m0()</code></a>", 110 "<a href=\"../pkg5/Classes.C.html#m1--\"><code>m1()</code></a>", 111 "<a href=\"../pkg5/Classes.P.html#m2--\"><code>Classes.P.m2()</code></a>", 112 "<a href=\"../pkg5/Classes.P.html#m3--\"><code>Classes.P.m3()</code></a>", 113 "<code>m4(java.lang.String,java.lang.String)</code></a>", 114 "<a href=\"../pkg5/Classes.P.html#m5--\"><code>Classes.P.m5()</code></a>", 115 "<a href=\"../pkg5/Classes.C.html#m6--\"><code>m6()</code></a>", 116 "<a href=\"../pkg5/Classes.C.html#m7--\"><code>m7()</code></a>", 117 "End of links" 118 ); 119 120 // check @see 121 checkOrder("pkg5/Classes.C.html", 122 "See Also:", 123 "<a href=\"../pkg5/Classes.GP.html#m0--\"><code>Classes.GP.m0()</code>", 124 "<a href=\"../pkg5/Classes.C.html#m1--\"><code>m1()</code></a>", 125 "<a href=\"../pkg5/Classes.P.html#m2--\"><code>Classes.P.m2()</code></a>", 126 "<a href=\"../pkg5/Classes.P.html#m3--\"><code>Classes.P.m3()</code></a>", 127 "<a href=\"../pkg5/Classes.C.html#m4-java.lang.String-java.lang.String-\">" 128 + "<code>m4(String k, String v)</code>", 129 "<a href=\"../pkg5/Classes.P.html#m5--\"><code>Classes.P.m5()</code></a>", 130 "<a href=\"../pkg5/Classes.C.html#m6--\"><code>m6()</code></a>", 131 "<a href=\"../pkg5/Classes.C.html#m7--\"><code>m7()</code></a>" 132 ); 133 134 checkOutput("pkg5/Interfaces.D.html", true, 135 // check properties 136 "<h3>Properties declared in interface pkg5.<a href=\"../pkg5/Interfaces.A.html\" " 137 + "title=\"interface in pkg5\">Interfaces.A</a>", 138 139 // check nested classes 140 "<h3>Nested classes/interfaces declared in interface pkg5." 141 + "<a href=\"../pkg5/Interfaces.A.html\" title=\"interface in pkg5\">" 142 + "Interfaces.A</a></h3>\n" 143 + "<code><a href=\"../pkg5/Interfaces.A.AA.html\" " 144 + "title=\"interface in pkg5\">Interfaces.A.AA</a>", 145 146 // check fields 147 "<h3>Fields declared in interface pkg5.<a href=\"../pkg5/Interfaces.A.html\" " 148 + "title=\"interface in pkg5\">Interfaces.A</a></h3>\n" 149 + "<code><a href=\"../pkg5/Interfaces.A.html#f\">f</a>", 150 151 // check method summary 152 "<td class=\"colFirst\"><code>void</code></td>\n" 153 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 154 + "<a href=\"../pkg5/Interfaces.D.html#m--\">m</a></span>()</code></th>\n" 155 + "<td class=\"colLast\">\n" 156 + "<div class=\"block\">m in D</div>\n", 157 158 "<td class=\"colFirst\"><code>void</code></td>\n" 159 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 160 + "<a href=\"../pkg5/Interfaces.D.html#n--\">n</a></span>()</code></th>\n" 161 + "<td class=\"colLast\">\n" 162 + "<div class=\"block\">n in D</div>\n", 163 164 // check footnote 165 "<h3>Methods declared in interface pkg5.<a href=\"../pkg5/Interfaces.A.html\" " 166 + "title=\"interface in pkg5\">Interfaces.A</a></h3>\n" 167 + "<code><a href=\"../pkg5/Interfaces.A.html#getRate--\">getRate</a>, " 168 + "<a href=\"../pkg5/Interfaces.A.html#rateProperty--\">rateProperty</a>, " 169 + "<a href=\"../pkg5/Interfaces.A.html#setRate-double-\">setRate</a>", 170 171 "<h3>Methods declared in interface pkg5.<a href=\"../pkg5/Interfaces.B.html\" " 172 + "title=\"interface in pkg5\">Interfaces.B</a></h3>\n" 173 + "<code><a href=\"../pkg5/Interfaces.B.html#m1--\">m1</a>, " 174 + "<a href=\"../pkg5/Interfaces.B.html#m3--\">m3</a>", 175 176 "<h3>Methods declared in interface pkg5.<a href=\"../pkg5/Interfaces.C.html\" " 177 + "title=\"interface in pkg5\">Interfaces.C</a></h3>\n" 178 + "<code><a href=\"../pkg5/Interfaces.C.html#o--\">o</a>" 179 ); 180 181 checkOrder("pkg5/Interfaces.D.html", 182 "Start of links <p>", 183 "<a href=\"../pkg5/Interfaces.A.html#m0--\"><code>Interfaces.A.m0()</code></a>", 184 "<a href=\"../pkg5/Interfaces.A.html#m1--\"><code>Interfaces.A.m1()</code></a>", 185 "<a href=\"../pkg5/Interfaces.A.html#m2--\"><code>Interfaces.A.m2()</code></a>", 186 "<a href=\"../pkg5/Interfaces.A.html#m3--\"><code>Interfaces.A.m3()</code></a>", 187 "<a href=\"../pkg5/Interfaces.D.html#m--\"><code>m()</code></a>", 188 "<a href=\"../pkg5/Interfaces.D.html#n--\"><code>n()</code></a>", 189 "<a href=\"../pkg5/Interfaces.C.html#o--\"><code>Interfaces.C.o()</code></a>", 190 "End of links"); 191 192 checkOrder("pkg5/Interfaces.D.html", 193 "See Also:", 194 "<a href=\"../pkg5/Interfaces.A.html#m0--\"><code>Interfaces.A.m0()</code></a>", 195 "<a href=\"../pkg5/Interfaces.A.html#m1--\"><code>Interfaces.A.m1()</code></a>", 196 "<a href=\"../pkg5/Interfaces.A.html#m2--\"><code>Interfaces.A.m2()</code></a>", 197 "<a href=\"../pkg5/Interfaces.A.html#m3--\"><code>Interfaces.A.m3()</code></a>", 198 "<a href=\"../pkg5/Interfaces.D.html#m--\"><code>m()</code></a>", 199 "<a href=\"../pkg5/Interfaces.D.html#n--\"><code>n()</code></a>", 200 "<a href=\"../pkg5/Interfaces.C.html#o--\"><code>Interfaces.C.o()</code></a>"); 201 202 // Test synthetic values and valuesof of an enum. 203 checkOrder("index-all.html", 204 "<h2 class=\"title\">M</h2>", 205 "<a href=\"pkg5/Interfaces.C.html#m--\">m()", 206 "<a href=\"pkg5/Interfaces.D.html#m--\">m()</a>", 207 "<a href=\"pkg5/Classes.GP.html#m0--\">m0()", 208 "<a href=\"pkg5/Interfaces.A.html#m0--\">m0()</a>", 209 "<a href=\"pkg5/Classes.C.html#m1--\">m1()</a>", 210 "<a href=\"pkg5/Classes.P.html#m1--\">m1()</a>", 211 "<a href=\"pkg5/Interfaces.A.html#m1--\">m1()</a>", 212 "<a href=\"pkg5/Interfaces.B.html#m1--\">m1()</a>", 213 "<a href=\"pkg5/Classes.P.html#m2--\">m2()</a>", 214 "<a href=\"pkg5/Interfaces.A.html#m2--\">m2()</a>", 215 "<a href=\"pkg5/Classes.P.html#m3--\">m3()</a>", 216 "<a href=\"pkg5/Interfaces.A.html#m3--\">m3()</a>", 217 "<a href=\"pkg5/Interfaces.B.html#m3--\">m3()</a>", 218 "<a href=\"pkg5/Classes.C.html#m4-java.lang.String-java.lang.String-\">m4(String, String)</a>", 219 "<a href=\"pkg5/Classes.P.html#m4-K-V-\">m4(K, V)</a>", 220 "<a href=\"pkg5/Classes.P.html#m5--\">m5()</a>", 221 "<a href=\"pkg5/Classes.C.html#m6--\">m6()</a>", 222 "<a href=\"pkg5/Classes.P.html#m6--\">m6()</a>", 223 "<a href=\"pkg5/Classes.C.html#m7--\">m7()</a>", 224 "<a href=\"pkg5/Classes.GP.html#m7--\">m7()</a>", 225 "Returns the enum constant of this type with the specified name.", 226 "Returns an array containing the constants of this enum type, in\n" + 227 "the order they are declared." 228 ); 229 } 230 }