langtools/test/com/sun/javadoc/testInterface/TestInterface.java
author bpatel
Thu, 10 Oct 2013 10:51:15 -0700
changeset 21008 af0b915df7cc
parent 19253 b97b3e18547f
child 21478 fa4c7cda1b41
permissions -rw-r--r--
8025633: Fix javadoc to generate valid anchor names Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
19253
b97b3e18547f 7198274: RFE : Javadoc Accessibility : Use CSS styles rather than <strong> or <i> tags
bpatel
parents: 7681
diff changeset
     2
 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2985
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2985
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2985
diff changeset
    21
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
 * @test
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19253
diff changeset
    26
 * @bug      4682448 4947464 5029946 8025633
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
 * @summary  Verify that the public modifier does not show up in the
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
 *           documentation for public methods, as recommended by the JLS.
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
 *           If A implements I and B extends A, B should be in the list of
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
 *           implementing classes in the documentation for I.
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
 * @author   jamieh
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
 * @library  ../lib/
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
 * @build    JavadocTester
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 * @build    TestInterface
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 * @run main TestInterface
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
public class TestInterface extends JavadocTester {
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
    //Test information.
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
    private static final String BUG_ID = "4682448-4947464-5029946";
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
    //Javadoc arguments.
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
    private static final String[] ARGS = new String[] {
2985
f43e1241e7fb 6843761: Update langtools tests to remove unncessary -source and -target options
darcy
parents: 2216
diff changeset
    45
        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
    };
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
    //Input for string search tests.
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
    private static final String[][] TEST = {
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
        {BUG_ID + FS + "pkg" + FS + "Interface.html",
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    51
            "<pre>int&nbsp;method()</pre>"},
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
        {BUG_ID + FS + "pkg" + FS + "Interface.html",
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    53
            "<pre>static final&nbsp;int field</pre>"},
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
        // Make sure known implementing class list is correct and omits type parameters.
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
        {BUG_ID + FS + "pkg" + FS + "Interface.html",
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    58
            "<dl>" + NL + "<dt>All Known Implementing Classes:</dt>" + NL +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    59
            "<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child" +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    60
            "</a>, <a href=\"../pkg/Parent.html\" title=\"class in pkg\">Parent" +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    61
            "</a></dd>" + NL + "</dl>"},
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
         // Make sure "All Implemented Interfaces": has substituted type parameters
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
         {BUG_ID + FS + "pkg" + FS + "Child.html",
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    65
            "<dl>" + NL + "<dt>All Implemented Interfaces:</dt>" + NL +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    66
            "<dd><a href=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    67
            "Interface</a>&lt;T&gt;</dd>" + NL + "</dl>"
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
         },
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
         //Make sure Class Tree has substituted type parameters.
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
         {BUG_ID + FS + "pkg" + FS + "Child.html",
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    71
            "<ul class=\"inheritance\">" + NL + "<li>java.lang.Object</li>" + NL +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    72
            "<li>" + NL + "<ul class=\"inheritance\">" + NL +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    73
            "<li><a href=\"../pkg/Parent.html\" title=\"class in pkg\">" +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    74
            "pkg.Parent</a>&lt;T&gt;</li>" + NL + "<li>" + NL +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    75
            "<ul class=\"inheritance\">" + NL + "<li>pkg.Child&lt;T&gt;</li>" + NL +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    76
            "</ul>" + NL + "</li>" + NL + "</ul>" + NL + "</li>" + NL + "</ul>"
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
         },
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
         //Make sure "Direct Know Subclasses" omits type parameters
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
        {BUG_ID + FS + "pkg" + FS + "Parent.html",
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    80
            "<dl>" + NL + "<dt>Direct Known Subclasses:</dt>" + NL +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    81
            "<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child" +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    82
            "</a></dd>" + NL + "</dl>"
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
        },
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
        //Make sure "Specified By" has substituted type parameters.
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
        {BUG_ID + FS + "pkg" + FS + "Child.html",
19253
b97b3e18547f 7198274: RFE : Javadoc Accessibility : Use CSS styles rather than <strong> or <i> tags
bpatel
parents: 7681
diff changeset
    86
            "<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19253
diff changeset
    87
            "<dd><code><a href=\"../pkg/Interface.html#method--\">method</a>" +
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    88
            "</code>&nbsp;in interface&nbsp;<code>" +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    89
            "<a href=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    90
            "Interface</a>&lt;<a href=\"../pkg/Child.html\" title=\"type parameter in Child\">" +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    91
            "T</a>&gt;</code></dd>"
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
         },
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
        //Make sure "Overrides" has substituted type parameters.
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
        {BUG_ID + FS + "pkg" + FS + "Child.html",
19253
b97b3e18547f 7198274: RFE : Javadoc Accessibility : Use CSS styles rather than <strong> or <i> tags
bpatel
parents: 7681
diff changeset
    95
            "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19253
diff changeset
    96
            "<dd><code><a href=\"../pkg/Parent.html#method--\">method</a>" +
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    97
            "</code>&nbsp;in class&nbsp;<code><a href=\"../pkg/Parent.html\" " +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    98
            "title=\"class in pkg\">Parent</a>&lt;<a href=\"../pkg/Child.html\" " +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    99
            "title=\"type parameter in Child\">T</a>&gt;</code></dd>"
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
         },
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
    };
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    private static final String[][] NEGATED_TEST = {
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
        {BUG_ID + FS + "pkg" + FS + "Interface.html",
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   104
            "public int&nbsp;method()"},
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
        {BUG_ID + FS + "pkg" + FS + "Interface.html",
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   106
            "public static final&nbsp;int field"},
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
    };
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     * The entry point of the test.
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     * @param args the array of command line arguments.
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
    public static void main(String[] args) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
        TestInterface tester = new TestInterface();
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
        run(tester, ARGS, TEST, NEGATED_TEST);
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
        tester.printSummary();
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
    public String getBugId() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
        return BUG_ID;
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
    public String getBugName() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
        return getClass().getName();
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
}