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

Wed, 15 Oct 2008 17:23:55 +0100

author
mcimadamore
date
Wed, 15 Oct 2008 17:23:55 +0100
changeset 141
83ffdd1a6294
parent 1
9a66ca7c79fa
child 182
47a62d8d98b4
permissions
-rw-r--r--

6759682: APT: compiler message file broken after refactoring of com.sun.tools.javac.util.Message
Summary: JavacMessages should refresh its own bundle cache when a new resource bundle is added by APT
Reviewed-by: jjg

     1 /*
     2  * Copyright 2003-2004 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
    21  * have any questions.
    22  */
    24 /*
    25  * @test
    26  * @bug      4682448 4947464 5029946
    27  * @summary  Verify that the public modifier does not show up in the
    28  *           documentation for public methods, as recommended by the JLS.
    29  *           If A implements I and B extends A, B should be in the list of
    30  *           implementing classes in the documentation for I.
    31  * @author   jamieh
    32  * @library  ../lib/
    33  * @build    JavadocTester
    34  * @build    TestInterface
    35  * @run main TestInterface
    36  */
    38 public class TestInterface extends JavadocTester {
    40     //Test information.
    41     private static final String BUG_ID = "4682448-4947464-5029946";
    43     //Javadoc arguments.
    44     private static final String[] ARGS = new String[] {
    45         "-source", "1.5", "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
    46     };
    48     //Input for string search tests.
    49     private static final String[][] TEST = {
    50         {BUG_ID + FS + "pkg" + FS + "Interface.html",
    51             "int <B>method</B>()"},
    52         {BUG_ID + FS + "pkg" + FS + "Interface.html",
    53             "static final int <B>field</B>"},
    56         // Make sure known implementing class list is correct and omits type parameters.
    57         {BUG_ID + FS + "pkg" + FS + "Interface.html",
    58             "<DT><B>All Known Implementing Classes:</B> " +
    59             "<DD><A HREF=\"../pkg/Child.html\" " +
    60             "title=\"class in pkg\">Child</A>, " +
    61             "<A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">" +
    62             "Parent</A></DD>"},
    64          // Make sure "All Implemented Interfaces": has substituted type parameters
    65          {BUG_ID + FS + "pkg" + FS + "Child.html",
    66             "<B>All Implemented Interfaces:</B> <DD><A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">Interface</A>&lt;T&gt;"
    67          },
    68          //Make sure Class Tree has substituted type parameters.
    69          {BUG_ID + FS + "pkg" + FS + "Child.html",
    70             "<PRE>" + NL +
    71             "java.lang.Object" + NL +
    72             "  <IMG SRC=\"../resources/inherit.gif\" ALT=\"extended by \"><A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">pkg.Parent</A>&lt;T&gt;" + NL +
    73             "      <IMG SRC=\"../resources/inherit.gif\" ALT=\"extended by \"><B>pkg.Child&lt;T&gt;</B>" + NL +
    74             "</PRE>"
    75          },
    76          //Make sure "Direct Know Subclasses" omits type parameters
    77         {BUG_ID + FS + "pkg" + FS + "Parent.html",
    78             "<B>Direct Known Subclasses:</B> <DD><A HREF=\"../pkg/Child.html\" title=\"class in pkg\">Child</A>"
    79         },
    80         //Make sure "Specified By" has substituted type parameters.
    81         {BUG_ID + FS + "pkg" + FS + "Child.html",
    82             "<B>Specified by:</B><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>"
    83          },
    84         //Make sure "Overrides" has substituted type parameters.
    85         {BUG_ID + FS + "pkg" + FS + "Child.html",
    86             "<B>Overrides:</B><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>"
    87          },
    88     };
    89     private static final String[][] NEGATED_TEST = {
    90         {BUG_ID + FS + "pkg" + FS + "Interface.html",
    91             "public int <B>method</B>()"},
    92         {BUG_ID + FS + "pkg" + FS + "Interface.html",
    93             "public static final int <B>field</B>"},
    94     };
    96     /**
    97      * The entry point of the test.
    98      * @param args the array of command line arguments.
    99      */
   100     public static void main(String[] args) {
   101         TestInterface tester = new TestInterface();
   102         run(tester, ARGS, TEST, NEGATED_TEST);
   103         tester.printSummary();
   104     }
   106     /**
   107      * {@inheritDoc}
   108      */
   109     public String getBugId() {
   110         return BUG_ID;
   111     }
   113     /**
   114      * {@inheritDoc}
   115      */
   116     public String getBugName() {
   117         return getClass().getName();
   118     }
   119 }

mercurial