test/langtools/jdk/javadoc/doclet/testMemberInheritance/TestMemberInheritance.java
author jjg
Mon, 22 Jan 2018 11:15:51 -0800
changeset 48654 36f58bd6269f
parent 48257 125716343184
child 49139 771616d26ca1
permissions -rw-r--r--
8195796: Reduce the size of relative URLs in generated docs Reviewed-by: ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
     2
 * Copyright (c) 2002, 2018, 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: 2216
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2216
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2216
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
44297
e03f5fb3714b 8175200: Long method signatures disturb Method Summary table
bpatel
parents: 41157
diff changeset
    26
 * @bug 4638588 4635809 6256068 6270645 8025633 8026567 8162363 8175200
48257
125716343184 8192850: method summary tables of inherited methods improperly list static interface methods
ksrini
parents: 47216
diff changeset
    27
 *      8192850
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
 * @summary Test to make sure that members are inherited properly in the Javadoc.
48257
125716343184 8192850: method summary tables of inherited methods improperly list static interface methods
ksrini
parents: 47216
diff changeset
    29
 *          Verify that inheritance labels are correct.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
 * @author jamieh
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    31
 * @library ../lib
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    32
 * @modules jdk.javadoc/jdk.javadoc.internal.tool
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
 * @build JavadocTester
48257
125716343184 8192850: method summary tables of inherited methods improperly list static interface methods
ksrini
parents: 47216
diff changeset
    34
 * @run main TestMemberInheritance
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
48257
125716343184 8192850: method summary tables of inherited methods improperly list static interface methods
ksrini
parents: 47216
diff changeset
    37
public class TestMemberInheritance extends JavadocTester {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    39
    public static void main(String... args) throws Exception {
48257
125716343184 8192850: method summary tables of inherited methods improperly list static interface methods
ksrini
parents: 47216
diff changeset
    40
        TestMemberInheritance tester = new TestMemberInheritance();
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    41
        tester.runTests();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    42
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    44
    @Test
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    45
    void test() {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    46
        javadoc("-d", "out",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    47
                "-sourcepath", testSrc,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    48
                "pkg", "diamond", "inheritDist", "pkg1");
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    49
        checkExit(Exit.OK);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    51
        checkOutput("pkg/SubClass.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    52
                // Public field should be inherited
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
    53
                "<a href=\"BaseClass.html#pubField\">",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    54
                // Public method should be inherited
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
    55
                "<a href=\"BaseClass.html#pubMethod--\">",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    56
                // Public inner class should be inherited.
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
    57
                "<a href=\"BaseClass.pubInnerClass.html\" title=\"class in pkg\">",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    58
                // Protected field should be inherited
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
    59
                "<a href=\"BaseClass.html#proField\">",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    60
                // Protected method should be inherited
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
    61
                "<a href=\"BaseClass.html#proMethod--\">",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    62
                // Protected inner class should be inherited.
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
    63
                "<a href=\"BaseClass.proInnerClass.html\" title=\"class in pkg\">",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    64
                // New labels as of 1.5.0
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    65
                "Nested classes/interfaces inherited from class&nbsp;pkg."
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
    66
                + "<a href=\"BaseClass.html\" title=\"class in pkg\">BaseClass</a>",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    67
                "Nested classes/interfaces inherited from interface&nbsp;pkg."
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
    68
                + "<a href=\"BaseInterface.html\" title=\"interface in pkg\">BaseInterface</a>");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    70
        checkOutput("pkg/BaseClass.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    71
                // Test overriding/implementing methods with generic parameters.
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    72
                "<dl>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    73
                + "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
    74
                + "<dd><code><a href=\"BaseInterface.html#getAnnotation-java.lang.Class-\">"
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    75
                + "getAnnotation</a></code>&nbsp;in interface&nbsp;<code>"
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
    76
                + "<a href=\"BaseInterface.html\" title=\"interface in pkg\">"
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    77
                + "BaseInterface</a></code></dd>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    78
                + "</dl>");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    80
        checkOutput("diamond/Z.html", true,
48257
125716343184 8192850: method summary tables of inherited methods improperly list static interface methods
ksrini
parents: 47216
diff changeset
    81
                // Test diamond inheritance member summary (6256068)
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
    82
                "<code><a href=\"A.html#aMethod--\">aMethod</a></code>");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    84
        checkOutput("inheritDist/C.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    85
                // Test that doc is inherited from closed parent (6270645)
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    86
                "<div class=\"block\">m1-B</div>");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    87
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    88
        checkOutput("pkg/SubClass.html", false,
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
    89
                "<a href=\"BaseClass.html#staticMethod--\">staticMethod</a></code>");
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    90
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    91
        checkOutput("pkg1/Implementer.html", true,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    92
                // ensure the method makes it
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    93
                "<td class=\"colFirst\"><code>static java.time.Period</code></td>\n"
41157
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 36526
diff changeset
    94
                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
    95
                + "<a href=\"#between-java.time.LocalDate-java.time.LocalDate-\">"
44297
e03f5fb3714b 8175200: Long method signatures disturb Method Summary table
bpatel
parents: 41157
diff changeset
    96
                + "between</a></span>&#8203;(java.time.LocalDate&nbsp;startDateInclusive,\n"
48257
125716343184 8192850: method summary tables of inherited methods improperly list static interface methods
ksrini
parents: 47216
diff changeset
    97
                + "       java.time.LocalDate&nbsp;endDateExclusive)</code></th>");
125716343184 8192850: method summary tables of inherited methods improperly list static interface methods
ksrini
parents: 47216
diff changeset
    98
125716343184 8192850: method summary tables of inherited methods improperly list static interface methods
ksrini
parents: 47216
diff changeset
    99
        checkOutput("pkg1/Implementer.html", false,
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
   100
                "<h3>Methods inherited from interface&nbsp;pkg1.<a href=\"Interface.html\""
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
   101
                + " title=\"interface in pkg1\">Interface</a></h3>\n"
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
   102
                + "<code><a href=\"Interface.html#between-java.time.chrono.ChronoLocalDate"
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
   103
                + "-java.time.chrono.ChronoLocalDate-\">between</a></code>"
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
   104
        );
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
}