test/com/sun/javadoc/testInterface/TestInterface.java

Wed, 28 Nov 2012 14:07:26 -0800

author
katleman
date
Wed, 28 Nov 2012 14:07:26 -0800
changeset 1425
20230f8b0eef
parent 798
4868a36f6fd8
child 1935
8c55df2442c1
permissions
-rw-r--r--

Merge

duke@1 1 /*
ohair@798 2 * Copyright (c) 2003, 2010, 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 4682448 4947464 5029946
duke@1 27 * @summary Verify that the public modifier does not show up in the
duke@1 28 * documentation for public methods, as recommended by the JLS.
duke@1 29 * If A implements I and B extends A, B should be in the list of
duke@1 30 * implementing classes in the documentation for I.
duke@1 31 * @author jamieh
duke@1 32 * @library ../lib/
duke@1 33 * @build JavadocTester
duke@1 34 * @build TestInterface
duke@1 35 * @run main TestInterface
duke@1 36 */
duke@1 37
duke@1 38 public class TestInterface extends JavadocTester {
duke@1 39
duke@1 40 //Test information.
duke@1 41 private static final String BUG_ID = "4682448-4947464-5029946";
duke@1 42
duke@1 43 //Javadoc arguments.
duke@1 44 private static final String[] ARGS = new String[] {
darcy@289 45 "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
duke@1 46 };
duke@1 47
duke@1 48 //Input for string search tests.
duke@1 49 private static final String[][] TEST = {
duke@1 50 {BUG_ID + FS + "pkg" + FS + "Interface.html",
bpatel@766 51 "<pre>int&nbsp;method()</pre>"},
duke@1 52 {BUG_ID + FS + "pkg" + FS + "Interface.html",
bpatel@766 53 "<pre>static final&nbsp;int field</pre>"},
duke@1 54
duke@1 55
duke@1 56 // Make sure known implementing class list is correct and omits type parameters.
duke@1 57 {BUG_ID + FS + "pkg" + FS + "Interface.html",
bpatel@766 58 "<dl>" + NL + "<dt>All Known Implementing Classes:</dt>" + NL +
bpatel@766 59 "<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child" +
bpatel@766 60 "</a>, <a href=\"../pkg/Parent.html\" title=\"class in pkg\">Parent" +
bpatel@766 61 "</a></dd>" + NL + "</dl>"},
duke@1 62
duke@1 63 // Make sure "All Implemented Interfaces": has substituted type parameters
duke@1 64 {BUG_ID + FS + "pkg" + FS + "Child.html",
bpatel@766 65 "<dl>" + NL + "<dt>All Implemented Interfaces:</dt>" + NL +
bpatel@766 66 "<dd><a href=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
bpatel@766 67 "Interface</a>&lt;T&gt;</dd>" + NL + "</dl>"
duke@1 68 },
duke@1 69 //Make sure Class Tree has substituted type parameters.
duke@1 70 {BUG_ID + FS + "pkg" + FS + "Child.html",
bpatel@766 71 "<ul class=\"inheritance\">" + NL + "<li>java.lang.Object</li>" + NL +
bpatel@766 72 "<li>" + NL + "<ul class=\"inheritance\">" + NL +
bpatel@766 73 "<li><a href=\"../pkg/Parent.html\" title=\"class in pkg\">" +
bpatel@766 74 "pkg.Parent</a>&lt;T&gt;</li>" + NL + "<li>" + NL +
bpatel@766 75 "<ul class=\"inheritance\">" + NL + "<li>pkg.Child&lt;T&gt;</li>" + NL +
bpatel@766 76 "</ul>" + NL + "</li>" + NL + "</ul>" + NL + "</li>" + NL + "</ul>"
duke@1 77 },
duke@1 78 //Make sure "Direct Know Subclasses" omits type parameters
duke@1 79 {BUG_ID + FS + "pkg" + FS + "Parent.html",
bpatel@766 80 "<dl>" + NL + "<dt>Direct Known Subclasses:</dt>" + NL +
bpatel@766 81 "<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child" +
bpatel@766 82 "</a></dd>" + NL + "</dl>"
duke@1 83 },
duke@1 84 //Make sure "Specified By" has substituted type parameters.
duke@1 85 {BUG_ID + FS + "pkg" + FS + "Child.html",
bpatel@766 86 "<dt><strong>Specified by:</strong></dt>" + NL +
bpatel@766 87 "<dd><code><a href=\"../pkg/Interface.html#method()\">method</a>" +
bpatel@766 88 "</code>&nbsp;in interface&nbsp;<code>" +
bpatel@766 89 "<a href=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
bpatel@766 90 "Interface</a>&lt;<a href=\"../pkg/Child.html\" title=\"type parameter in Child\">" +
bpatel@766 91 "T</a>&gt;</code></dd>"
duke@1 92 },
duke@1 93 //Make sure "Overrides" has substituted type parameters.
duke@1 94 {BUG_ID + FS + "pkg" + FS + "Child.html",
bpatel@766 95 "<dt><strong>Overrides:</strong></dt>" + NL +
bpatel@766 96 "<dd><code><a href=\"../pkg/Parent.html#method()\">method</a>" +
bpatel@766 97 "</code>&nbsp;in class&nbsp;<code><a href=\"../pkg/Parent.html\" " +
bpatel@766 98 "title=\"class in pkg\">Parent</a>&lt;<a href=\"../pkg/Child.html\" " +
bpatel@766 99 "title=\"type parameter in Child\">T</a>&gt;</code></dd>"
duke@1 100 },
duke@1 101 };
duke@1 102 private static final String[][] NEGATED_TEST = {
duke@1 103 {BUG_ID + FS + "pkg" + FS + "Interface.html",
bpatel@766 104 "public int&nbsp;method()"},
duke@1 105 {BUG_ID + FS + "pkg" + FS + "Interface.html",
bpatel@766 106 "public static final&nbsp;int field"},
duke@1 107 };
duke@1 108
duke@1 109 /**
duke@1 110 * The entry point of the test.
duke@1 111 * @param args the array of command line arguments.
duke@1 112 */
duke@1 113 public static void main(String[] args) {
duke@1 114 TestInterface tester = new TestInterface();
duke@1 115 run(tester, ARGS, TEST, NEGATED_TEST);
duke@1 116 tester.printSummary();
duke@1 117 }
duke@1 118
duke@1 119 /**
duke@1 120 * {@inheritDoc}
duke@1 121 */
duke@1 122 public String getBugId() {
duke@1 123 return BUG_ID;
duke@1 124 }
duke@1 125
duke@1 126 /**
duke@1 127 * {@inheritDoc}
duke@1 128 */
duke@1 129 public String getBugName() {
duke@1 130 return getClass().getName();
duke@1 131 }
duke@1 132 }

mercurial