TestInterface.java revision 765
869N/A/*
869N/A * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
869N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
869N/A *
869N/A * This code is free software; you can redistribute it and/or modify it
869N/A * under the terms of the GNU General Public License version 2 only, as
869N/A * published by the Free Software Foundation.
869N/A *
869N/A * This code is distributed in the hope that it will be useful, but WITHOUT
869N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
869N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
869N/A * version 2 for more details (a copy is included in the LICENSE file that
869N/A * accompanied this code).
869N/A *
869N/A * You should have received a copy of the GNU General Public License version
869N/A * 2 along with this work; if not, write to the Free Software Foundation,
869N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
873N/A *
869N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
869N/A * or visit www.oracle.com if you need additional information or have any
869N/A * questions.
869N/A */
5005N/A
6045N/A/*
6332N/A * @test
6415N/A * @bug 4682448 4947464 5029946
869N/A * @summary Verify that the public modifier does not show up in the
869N/A * documentation for public methods, as recommended by the JLS.
0N/A * If A implements I and B extends A, B should be in the list of
0N/A * implementing classes in the documentation for I.
0N/A * @author jamieh
0N/A * @library ../lib/
869N/A * @build JavadocTester
0N/A * @build TestInterface
0N/A * @run main TestInterface
0N/A */
869N/A
0N/Apublic class TestInterface extends JavadocTester {
869N/A
0N/A //Test information.
869N/A private static final String BUG_ID = "4682448-4947464-5029946";
869N/A
869N/A //Javadoc arguments.
2624N/A private static final String[] ARGS = new String[] {
869N/A "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
48N/A };
869N/A
0N/A //Input for string search tests.
869N/A private static final String[][] TEST = {
716N/A {BUG_ID + FS + "pkg" + FS + "Interface.html",
869N/A "<pre>int&nbsp;method()</pre>"},
1958N/A {BUG_ID + FS + "pkg" + FS + "Interface.html",
1963N/A "<pre>static final&nbsp;int field</pre>"},
2340N/A
3103N/A
3127N/A // Make sure known implementing class list is correct and omits type parameters.
3679N/A {BUG_ID + FS + "pkg" + FS + "Interface.html",
5244N/A "<dl>" + NL + "<dt>All Known Implementing Classes:</dt>" + NL +
1954N/A "<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child" +
1954N/A "</a>, <a href=\"../pkg/Parent.html\" title=\"class in pkg\">Parent" +
1954N/A "</a></dd>" + NL + "</dl>"},
1954N/A
1954N/A // Make sure "All Implemented Interfaces": has substituted type parameters
1954N/A {BUG_ID + FS + "pkg" + FS + "Child.html",
4306N/A "<dl>" + NL + "<dt>All Implemented Interfaces:</dt>" + NL +
4306N/A "<dd><a href=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
4306N/A "Interface</a>&lt;T&gt;</dd>" + NL + "</dl>"
1954N/A },
1954N/A //Make sure Class Tree has substituted type parameters.
1954N/A {BUG_ID + FS + "pkg" + FS + "Child.html",
1954N/A "<ul class=\"inheritance\">" + NL + "<li>java.lang.Object</li>" + NL +
5221N/A "<li>" + NL + "<ul class=\"inheritance\">" + NL +
0N/A "<li><a href=\"../pkg/Parent.html\" title=\"class in pkg\">" +
0N/A "pkg.Parent</a>&lt;T&gt;</li>" + NL + "<li>" + NL +
869N/A "<ul class=\"inheritance\">" + NL + "<li>pkg.Child&lt;T&gt;</li>" + NL +
868N/A "</ul>" + NL + "</li>" + NL + "</ul>" + NL + "</li>" + NL + "</ul>"
2624N/A },
2693N/A //Make sure "Direct Know Subclasses" omits type parameters
6169N/A {BUG_ID + FS + "pkg" + FS + "Parent.html",
4563N/A "<dl>" + NL + "<dt>Direct Known Subclasses:</dt>" + NL +
5408N/A "<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child" +
4898N/A "</a></dd>" + NL + "</dl>"
4898N/A },
2980N/A //Make sure "Specified By" has substituted type parameters.
2963N/A {BUG_ID + FS + "pkg" + FS + "Child.html",
1503N/A "<dt><strong>Specified by:</strong></dt>" + NL +
2915N/A "<dd><code><a href=\"../pkg/Interface.html#method()\">method</a>" +
869N/A "</code>&nbsp;in interface&nbsp;<code>" +
2624N/A "<a href=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
2624N/A "Interface</a>&lt;<a href=\"../pkg/Child.html\" title=\"type parameter in Child\">" +
0N/A "T</a>&gt;</code></dd>"
2270N/A },
2270N/A //Make sure "Overrides" has substituted type parameters.
2270N/A {BUG_ID + FS + "pkg" + FS + "Child.html",
2270N/A "<dt><strong>Overrides:</strong></dt>" + NL +
2270N/A "<dd><code><a href=\"../pkg/Parent.html#method()\">method</a>" +
2270N/A "</code>&nbsp;in class&nbsp;<code><a href=\"../pkg/Parent.html\" " +
2270N/A "title=\"class in pkg\">Parent</a>&lt;<a href=\"../pkg/Child.html\" " +
0N/A "title=\"type parameter in Child\">T</a>&gt;</code></dd>"
869N/A },
868N/A };
0N/A private static final String[][] NEGATED_TEST = {
0N/A {BUG_ID + FS + "pkg" + FS + "Interface.html",
65N/A "public int&nbsp;method()"},
869N/A {BUG_ID + FS + "pkg" + FS + "Interface.html",
868N/A "public static final&nbsp;int field"},
65N/A };
869N/A
2624N/A /**
2624N/A * The entry point of the test.
65N/A * @param args the array of command line arguments.
65N/A */
65N/A public static void main(String[] args) {
65N/A TestInterface tester = new TestInterface();
65N/A run(tester, ARGS, TEST, NEGATED_TEST);
65N/A tester.printSummary();
65N/A }
65N/A
65N/A /**
65N/A * {@inheritDoc}
65N/A */
65N/A public String getBugId() {
65N/A return BUG_ID;
2266N/A }
2266N/A
2266N/A /**
2266N/A * {@inheritDoc}
2266N/A */
2624N/A public String getBugName() {
2624N/A return getClass().getName();
2266N/A }
2266N/A}
2624N/A