test/langtools/jdk/javadoc/doclet/testMemberInheritance/TestMemberInheritance.java
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 58477 d148a7e7160c
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 53097
diff changeset
     2
 * Copyright (c) 2002, 2019, 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
58477
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
    27
 *      8192850 8182765 8220217
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
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 49139
diff changeset
    31
 * @library ../../lib
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    32
 * @modules jdk.javadoc/jdk.javadoc.internal.tool
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 49139
diff changeset
    33
 * @build javadoc.tester.*
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
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 49139
diff changeset
    37
import javadoc.tester.JavadocTester;
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 49139
diff changeset
    38
48257
125716343184 8192850: method summary tables of inherited methods improperly list static interface methods
ksrini
parents: 47216
diff changeset
    39
public class TestMemberInheritance extends JavadocTester {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    41
    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
    42
        TestMemberInheritance tester = new TestMemberInheritance();
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    43
        tester.runTests();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    44
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    46
    @Test
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 49139
diff changeset
    47
    public void test() {
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    48
        javadoc("-d", "out",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    49
                "-sourcepath", testSrc,
58477
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
    50
                "pkg", "diamond", "inheritDist", "pkg1", "pkg2");
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    51
        checkExit(Exit.OK);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    53
        checkOutput("pkg/SubClass.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    54
                // Public field 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#pubField\">",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    56
                // Public method should be inherited
49139
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    57
                "<a href=\"BaseClass.html#pubMethod()\">",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    58
                // Public inner class should be inherited.
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
    59
                "<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
    60
                // Protected field 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#proField\">",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    62
                // Protected method should be inherited
49139
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    63
                "<a href=\"BaseClass.html#proMethod()\">",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    64
                // Protected inner class should be inherited.
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48257
diff changeset
    65
                "<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
    66
                // 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
    67
                "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
    68
                + "<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
    69
                "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
    70
                + "<a href=\"BaseInterface.html\" title=\"interface in pkg\">BaseInterface</a>");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    72
        checkOutput("pkg/BaseClass.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    73
                // 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
    74
                "<dl>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    75
                + "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
49139
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    76
                + "<dd><code><a href=\"BaseInterface.html#getAnnotation(java.lang.Class)\">"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    77
                + "getAnnotation</a></code>&nbsp;in interface&nbsp;<code>"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    78
                + "<a href=\"BaseInterface.html\" title=\"interface in pkg\">"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    79
                + "BaseInterface</a></code></dd>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    80
                + "</dl>");
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    81
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    82
        checkOutput("diamond/Z.html", true,
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    83
                // Test diamond inheritance member summary (6256068)
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    84
                "<code><a href=\"A.html#aMethod()\">aMethod</a></code>");
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    85
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    86
        checkOutput("inheritDist/C.html", true,
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    87
                // Test that doc is inherited from closed parent (6270645)
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    88
                "<div class=\"block\">m1-B</div>");
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    89
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    90
        checkOutput("pkg/SubClass.html", false,
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    91
                "<a href=\"BaseClass.html#staticMethod()\">staticMethod</a></code>");
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    92
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    93
        checkOutput("pkg1/Implementer.html", true,
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    94
                // ensure the method makes it
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    95
                "<td class=\"colFirst\"><code>static java.time.Period</code></td>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    96
                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    97
                + "<a href=\"#between(java.time.LocalDate,java.time.LocalDate)\">"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    98
                + "between</a></span>&#8203;(java.time.LocalDate&nbsp;startDateInclusive,\n"
55197
0ca8e495bbba 8214126: Method signatures not formatted correctly in browser
hannesw
parents: 53562
diff changeset
    99
                + "java.time.LocalDate&nbsp;endDateExclusive)</code></th>");
49139
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
   100
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
   101
        checkOutput("pkg1/Implementer.html", false,
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
   102
                "<h3>Methods inherited from interface&nbsp;pkg1.<a href=\"Interface.html\""
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
   103
                + " title=\"interface in pkg1\">Interface</a></h3>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
   104
                + "<code><a href=\"Interface.html#between(java.time.chrono.ChronoLocalDate"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
   105
                + ",java.time.chrono.ChronoLocalDate)\">between</a></code>"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
   106
        );
58477
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   107
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   108
        checkOutput("pkg2/DocumentedNonGenericChild.html", true,
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   109
                "<section class=\"description\">\n<hr>\n"
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   110
                + "<pre>public abstract class <span class=\"typeNameLabel\">"
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   111
                + "DocumentedNonGenericChild</span>\n"
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   112
                + "extends java.lang.Object</pre>\n"
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   113
                + "</section>");
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   114
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   115
        checkOutput("pkg2/DocumentedNonGenericChild.html", true,
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   116
                "<td class=\"colFirst\"><code>protected abstract java.lang.String</code></td>\n"
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   117
                + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   118
                + "<a href=\"#parentMethod()\">parentMethod</a></span>()</code></th>\n"
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   119
                + "<td class=\"colLast\">\n"
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   120
                + "<div class=\"block\">Returns some value.</div>\n"
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   121
                + "</td>\n");
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   122
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   123
        checkOutput("pkg2/DocumentedNonGenericChild.html", true,
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   124
                "<h3><a id=\"parentMethod()\">parentMethod</a></h3>\n"
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   125
                + "<div class=\"memberSignature\"><span class=\"modifiers\">protected abstract</span>"
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   126
                + "&nbsp;<span class=\"returnType\">java.lang.String</span>&nbsp;"
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   127
                + "<span class=\"memberName\">parentMethod</span>()</div>");
d148a7e7160c 8220217: Javadoc missing link to member method
hannesw
parents: 55197
diff changeset
   128
49139
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
   129
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
}