TestInterface.java revision 553
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 */
869N/A
869N/A/*
869N/A * @test
0N/A * @bug 4682448 4947464 5029946
0N/A * @summary Verify that the public modifier does not show up in the
0N/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
869N/A * implementing classes in the documentation for I.
0N/A * @author jamieh
0N/A * @library ../lib/
0N/A * @build JavadocTester
869N/A * @build TestInterface
0N/A * @run main TestInterface
869N/A */
0N/A
869N/Apublic class TestInterface extends JavadocTester {
869N/A
869N/A //Test information.
0N/A private static final String BUG_ID = "4682448-4947464-5029946";
869N/A
48N/A //Javadoc arguments.
869N/A private static final String[] ARGS = new String[] {
0N/A "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
869N/A };
716N/A
869N/A //Input for string search tests.
0N/A private static final String[][] TEST = {
0N/A {BUG_ID + FS + "pkg" + FS + "Interface.html",
869N/A "int <STRONG>method</STRONG>()"},
868N/A {BUG_ID + FS + "pkg" + FS + "Interface.html",
983N/A "static final int <STRONG>field</STRONG>"},
1004N/A
1007N/A
1378N/A // Make sure known implementing class list is correct and omits type parameters.
1411N/A {BUG_ID + FS + "pkg" + FS + "Interface.html",
1503N/A "<DT><STRONG>All Known Implementing Classes:</STRONG></DT> " +
869N/A "<DD><A HREF=\"../pkg/Child.html\" " +
1774N/A "title=\"class in pkg\">Child</A>, " +
1004N/A "<A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">" +
0N/A "Parent</A></DD>"},
0N/A
869N/A // Make sure "All Implemented Interfaces": has substituted type parameters
868N/A {BUG_ID + FS + "pkg" + FS + "Child.html",
0N/A "<STRONG>All Implemented Interfaces:</STRONG></DT> <DD>" +
0N/A "<A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
65N/A "Interface</A>&lt;T&gt;"
869N/A },
868N/A //Make sure Class Tree has substituted type parameters.
65N/A {BUG_ID + FS + "pkg" + FS + "Child.html",
869N/A "<PRE>" + NL +
65N/A "java.lang.Object" + NL +
65N/A " <IMG SRC=\"../resources/inherit.gif\" ALT=\"extended by \"><A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">pkg.Parent</A>&lt;T&gt;" + NL +
65N/A " <IMG SRC=\"../resources/inherit.gif\" ALT=\"extended by \"><STRONG>pkg.Child&lt;T&gt;</STRONG>" + NL +
65N/A "</PRE>"
65N/A },
65N/A //Make sure "Direct Know Subclasses" omits type parameters
65N/A {BUG_ID + FS + "pkg" + FS + "Parent.html",
65N/A "<STRONG>Direct Known Subclasses:</STRONG></DT> <DD><A HREF=\"../pkg/Child.html\" title=\"class in pkg\">Child</A>"
65N/A },
65N/A //Make sure "Specified By" has substituted type parameters.
65N/A {BUG_ID + FS + "pkg" + FS + "Child.html",
65N/A "<STRONG>Specified by:</STRONG></DT><DD><CODE><A HREF=\"../pkg/Interface.html#method()\">method</A></CODE> in interface <CODE><A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">Interface</A>&lt;<A HREF=\"../pkg/Child.html\" title=\"type parameter in Child\">T</A>&gt;</CODE>"
65N/A },
65N/A //Make sure "Overrides" has substituted type parameters.
65N/A {BUG_ID + FS + "pkg" + FS + "Child.html",
0N/A "<STRONG>Overrides:</STRONG></DT><DD><CODE><A HREF=\"../pkg/Parent.html#method()\">method</A></CODE> in class <CODE><A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">Parent</A>&lt;<A HREF=\"../pkg/Child.html\" title=\"type parameter in Child\">T</A>&gt;</CODE>"
869N/A },
868N/A };
0N/A private static final String[][] NEGATED_TEST = {
0N/A {BUG_ID + FS + "pkg" + FS + "Interface.html",
0N/A "public int <STRONG>method</STRONG>()"},
0N/A {BUG_ID + FS + "pkg" + FS + "Interface.html",
0N/A "public static final int <STRONG>field</STRONG>"},
0N/A };
0N/A
1501N/A /**
0N/A * The entry point of the test.
0N/A * @param args the array of command line arguments.
869N/A */
868N/A public static void main(String[] args) {
0N/A TestInterface tester = new TestInterface();
0N/A run(tester, ARGS, TEST, NEGATED_TEST);
869N/A tester.printSummary();
0N/A }
0N/A
869N/A /**
868N/A * {@inheritDoc}
869N/A */
869N/A public String getBugId() {
868N/A return BUG_ID;
868N/A }
869N/A
869N/A /**
0N/A * {@inheritDoc}
0N/A */
1790N/A public String getBugName() {
48N/A return getClass().getName();
869N/A }
869N/A}
869N/A