test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java

Wed, 01 Dec 2010 11:02:38 -0800

author
bpatel
date
Wed, 01 Dec 2010 11:02:38 -0800
changeset 766
90af8d87741f
parent 554
9d9f26857129
child 798
4868a36f6fd8
permissions
-rw-r--r--

6851834: Javadoc doclet needs a structured approach to generate the output HTML.
Reviewed-by: jjg

duke@1 1 /*
ohair@554 2 * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
duke@1 7 * published by the Free Software Foundation.
duke@1 8 *
duke@1 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 13 * accompanied this code).
duke@1 14 *
duke@1 15 * You should have received a copy of the GNU General Public License version
duke@1 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 18 *
ohair@554 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 20 * or visit www.oracle.com if you need additional information or have any
ohair@554 21 * questions.
duke@1 22 */
duke@1 23
duke@1 24 /*
duke@1 25 * @test
duke@1 26 * @bug 4638588 4635809 6256068 6270645
duke@1 27 * @summary Test to make sure that members are inherited properly in the Javadoc.
duke@1 28 * Verify that inheritence labels are correct.
duke@1 29 * @author jamieh
duke@1 30 * @library ../lib/
duke@1 31 * @build JavadocTester
duke@1 32 * @build TestMemberInheritence
duke@1 33 * @run main TestMemberInheritence
duke@1 34 */
duke@1 35
duke@1 36 public class TestMemberInheritence extends JavadocTester {
duke@1 37
duke@1 38 private static final String BUG_ID = "4638588-4635809-6256068-6270645";
duke@1 39
duke@1 40 private static final String[][] TEST = {
duke@1 41 //Public field should be inherited
duke@1 42 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
bpatel@766 43 "<a href=\"../pkg/BaseClass.html#pubField\">"},
duke@1 44
duke@1 45 //Public method should be inherited
duke@1 46 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
bpatel@766 47 "<a href=\"../pkg/BaseClass.html#pubMethod()\">"},
duke@1 48
duke@1 49 //Public inner class should be inherited.
duke@1 50 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
bpatel@766 51 "<a href=\"../pkg/BaseClass.pubInnerClass.html\" title=\"class in pkg\">"},
duke@1 52
duke@1 53 //Protected field should be inherited
duke@1 54 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
bpatel@766 55 "<a href=\"../pkg/BaseClass.html#proField\">"},
duke@1 56
duke@1 57 //Protected method should be inherited
duke@1 58 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
bpatel@766 59 "<a href=\"../pkg/BaseClass.html#proMethod()\">"},
duke@1 60
duke@1 61 //Protected inner class should be inherited.
duke@1 62 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
bpatel@766 63 "<a href=\"../pkg/BaseClass.proInnerClass.html\" title=\"class in pkg\">"},
duke@1 64
duke@1 65 // New labels as of 1.5.0
duke@1 66 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
bpatel@766 67 "Nested classes/interfaces inherited from class&nbsp;pkg." +
bpatel@766 68 "<a href=\"../pkg/BaseClass.html\" title=\"class in pkg\">BaseClass</a>"},
duke@1 69 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
bpatel@766 70 "Nested classes/interfaces inherited from interface&nbsp;pkg." +
bpatel@766 71 "<a href=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">BaseInterface</a>"},
duke@1 72
duke@1 73 // Test overriding/implementing methods with generic parameters.
duke@1 74 {BUG_ID + FS + "pkg" + FS + "BaseClass.html",
bpatel@766 75 "<dl>" + NL + "<dt><strong>Specified by:</strong></dt>" + NL +
bpatel@766 76 "<dd><code><a href=\"../pkg/BaseInterface.html#getAnnotation(java.lang.Class)\">" +
bpatel@766 77 "getAnnotation</a></code>&nbsp;in interface&nbsp;<code>" +
bpatel@766 78 "<a href=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">" +
bpatel@766 79 "BaseInterface</a></code></dd>" + NL + "</dl>"},
duke@1 80
duke@1 81 // Test diamond inheritence member summary (6256068)
duke@1 82 {BUG_ID + FS + "diamond" + FS + "Z.html",
bpatel@766 83 "<code><a href=\"../diamond/A.html#aMethod()\">aMethod</a></code>"},
duke@1 84
duke@1 85 // Test that doc is inherited from closed parent (6270645)
duke@1 86 {BUG_ID + FS + "inheritDist" + FS + "C.html",
bpatel@766 87 "<div class=\"block\">m1-B</div>"},
duke@1 88
duke@1 89 };
duke@1 90
duke@1 91 private static final String[][] NEGATED_TEST = {
duke@1 92 {BUG_ID + FS + "pkg" + FS + "SubClass.html",
bpatel@766 93 "<a href=\"../pkg/BaseClass.html#staticMethod()\">staticMethod</a></code>"},
duke@1 94 };
duke@1 95 private static final String[] ARGS =
duke@1 96 new String[] {
duke@1 97 "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg", "diamond", "inheritDist"};
duke@1 98
duke@1 99 /**
duke@1 100 * The entry point of the test.
duke@1 101 * @param args the array of command line arguments.
duke@1 102 */
duke@1 103 public static void main(String[] args) {
duke@1 104 TestMemberInheritence tester = new TestMemberInheritence();
duke@1 105 run(tester, ARGS, TEST, NEGATED_TEST);
duke@1 106 tester.printSummary();
duke@1 107 }
duke@1 108
duke@1 109 /**
duke@1 110 * {@inheritDoc}
duke@1 111 */
duke@1 112 public String getBugId() {
duke@1 113 return BUG_ID;
duke@1 114 }
duke@1 115
duke@1 116 /**
duke@1 117 * {@inheritDoc}
duke@1 118 */
duke@1 119 public String getBugName() {
duke@1 120 return getClass().getName();
duke@1 121 }
duke@1 122 }

mercurial