2015-11-29 02:52:17 +00:00
|
|
|
/*
|
2024-08-09 09:24:50 +00:00
|
|
|
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
|
2015-11-29 02:52:17 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @test
|
2017-03-15 23:12:20 +00:00
|
|
|
* @bug 4638588 4635809 6256068 6270645 8025633 8026567 8162363 8175200
|
2024-11-12 09:23:29 +00:00
|
|
|
* 8192850 8182765 8220217 8224052 8237383 8341904
|
2015-11-29 02:52:17 +00:00
|
|
|
* @summary Test to make sure that members are inherited properly in the Javadoc.
|
2017-12-13 04:18:14 +00:00
|
|
|
* Verify that inheritance labels are correct.
|
2018-12-21 18:38:33 +00:00
|
|
|
* @library ../../lib
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
2018-12-21 18:38:33 +00:00
|
|
|
* @build javadoc.tester.*
|
2017-12-13 04:18:14 +00:00
|
|
|
* @run main TestMemberInheritance
|
2015-11-29 02:52:17 +00:00
|
|
|
*/
|
|
|
|
|
2018-12-21 18:38:33 +00:00
|
|
|
import javadoc.tester.JavadocTester;
|
|
|
|
|
2017-12-13 04:18:14 +00:00
|
|
|
public class TestMemberInheritance extends JavadocTester {
|
2015-11-29 02:52:17 +00:00
|
|
|
|
|
|
|
public static void main(String... args) throws Exception {
|
2022-12-22 21:20:43 +00:00
|
|
|
var tester = new TestMemberInheritance();
|
2015-11-29 02:52:17 +00:00
|
|
|
tester.runTests();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2018-12-21 18:38:33 +00:00
|
|
|
public void test() {
|
2015-11-29 02:52:17 +00:00
|
|
|
javadoc("-d", "out",
|
|
|
|
"-sourcepath", testSrc,
|
2020-10-07 13:08:34 +00:00
|
|
|
"--no-platform-links",
|
2020-01-16 14:50:23 +00:00
|
|
|
"pkg", "diamond", "inheritDist", "pkg1", "pkg2", "pkg3");
|
2015-11-29 02:52:17 +00:00
|
|
|
checkExit(Exit.OK);
|
|
|
|
|
|
|
|
checkOutput("pkg/SubClass.html", true,
|
|
|
|
// Public field should be inherited
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
|
|
|
<a href="BaseClass.html#pubField">""",
|
2015-11-29 02:52:17 +00:00
|
|
|
// Public method should be inherited
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
|
|
|
<a href="BaseClass.html#pubMethod()">""",
|
2015-11-29 02:52:17 +00:00
|
|
|
// Public inner class should be inherited.
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
|
|
|
<a href="BaseClass.pubInnerClass.html" title="class in pkg">""",
|
2015-11-29 02:52:17 +00:00
|
|
|
// Protected field should be inherited
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
|
|
|
<a href="BaseClass.html#proField">""",
|
2015-11-29 02:52:17 +00:00
|
|
|
// Protected method should be inherited
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
|
|
|
<a href="BaseClass.html#proMethod()">""",
|
2015-11-29 02:52:17 +00:00
|
|
|
// Protected inner class should be inherited.
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
|
|
|
<a href="BaseClass.proInnerClass.html" title="class in pkg">""",
|
2015-11-29 02:52:17 +00:00
|
|
|
// New labels as of 1.5.0
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
|
|
|
Nested classes/interfaces inherited from class pkg.<a href="BaseClass.html" title="class in pkg">BaseClass</a>""",
|
|
|
|
"""
|
|
|
|
Nested classes/interfaces inherited from interface pkg.<a href="BaseInterfa\
|
|
|
|
ce.html" title="interface in pkg">BaseInterface</a>""");
|
2015-11-29 02:52:17 +00:00
|
|
|
|
|
|
|
checkOutput("pkg/BaseClass.html", true,
|
|
|
|
// Test overriding/implementing methods with generic parameters.
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
|
|
|
<dl class="notes">
|
|
|
|
<dt>Specified by:</dt>
|
|
|
|
<dd><code><a href="BaseInterface.html#getAnnotation(java.lang.Class)">getAnnotat\
|
|
|
|
ion</a></code> in interface <code><a href="BaseInterface.html" title="\
|
|
|
|
interface in pkg">BaseInterface</a></code></dd>
|
|
|
|
</dl>""");
|
2015-11-29 02:52:17 +00:00
|
|
|
|
|
|
|
checkOutput("diamond/Z.html", true,
|
2017-12-13 04:18:14 +00:00
|
|
|
// Test diamond inheritance member summary (6256068)
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
|
|
|
<code><a href="A.html#aMethod()">aMethod</a></code>""");
|
2015-11-29 02:52:17 +00:00
|
|
|
|
|
|
|
checkOutput("inheritDist/C.html", true,
|
|
|
|
// Test that doc is inherited from closed parent (6270645)
|
|
|
|
"<div class=\"block\">m1-B</div>");
|
|
|
|
|
2018-03-06 18:45:47 +00:00
|
|
|
checkOutput("pkg/SubClass.html", false,
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
|
|
|
<a href="BaseClass.html#staticMethod()">staticMethod</a></code>""");
|
2018-03-06 18:45:47 +00:00
|
|
|
|
|
|
|
checkOutput("pkg1/Implementer.html", true,
|
|
|
|
// ensure the method makes it
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
2021-01-25 21:45:54 +00:00
|
|
|
<div class="col-first even-row-color method-summary-table method-summary-table-t\
|
|
|
|
ab1 method-summary-table-tab4"><code>static java.time.Period</code></div>
|
|
|
|
<div class="col-second even-row-color method-summary-table method-summary-table-\
|
2021-02-12 08:32:47 +00:00
|
|
|
tab1 method-summary-table-tab4"><code><a href="#between(java.time.LocalDate,java\
|
2021-05-10 20:25:43 +00:00
|
|
|
.time.LocalDate)" class="member-name-link">between</a><wbr>(java.time.LocalDate&\
|
|
|
|
nbsp;startDateInclusive,
|
2020-10-12 09:36:43 +00:00
|
|
|
java.time.LocalDate endDateExclusive)</code></div>""");
|
2018-03-06 18:45:47 +00:00
|
|
|
|
|
|
|
checkOutput("pkg1/Implementer.html", false,
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
|
|
|
<h3>Methods inherited from interface pkg1.<a href="Interface.html" title="interface in pkg1">Interface</a></h3>
|
|
|
|
<code><a href="Interface.html#between(java.time.chrono.ChronoLocalDate,java.time\
|
|
|
|
.chrono.ChronoLocalDate)">between</a></code>"""
|
2018-03-06 18:45:47 +00:00
|
|
|
);
|
2019-10-07 13:58:04 +00:00
|
|
|
|
|
|
|
checkOutput("pkg2/DocumentedNonGenericChild.html", true,
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
2021-03-25 08:59:29 +00:00
|
|
|
<section class="class-description" id="class-description">
|
2020-05-05 20:02:30 +00:00
|
|
|
<hr>
|
2024-08-09 09:24:50 +00:00
|
|
|
<div class="horizontal-scroll">
|
2020-11-27 19:12:31 +00:00
|
|
|
<div class="type-signature"><span class="modifiers">public abstract class </span\
|
|
|
|
><span class="element-name type-name-label">DocumentedNonGenericChild</span>
|
|
|
|
<span class="extends-implements">extends java.lang.Object</span></div>
|
2023-10-16 12:56:41 +00:00
|
|
|
</div>
|
2020-05-05 20:02:30 +00:00
|
|
|
</section>""");
|
2019-10-07 13:58:04 +00:00
|
|
|
|
|
|
|
checkOutput("pkg2/DocumentedNonGenericChild.html", true,
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
2021-01-25 21:45:54 +00:00
|
|
|
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 m\
|
2020-10-12 09:36:43 +00:00
|
|
|
ethod-summary-table-tab3"><code>protected abstract java.lang.String</code></div>
|
2021-01-25 21:45:54 +00:00
|
|
|
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 \
|
2021-02-12 08:32:47 +00:00
|
|
|
method-summary-table-tab3"><code><a href="#parentMethod(T)" class="member-name-link">\
|
2021-05-10 20:25:43 +00:00
|
|
|
parentMethod</a><wbr>(java.lang.String t)</code></div>
|
2021-01-25 21:45:54 +00:00
|
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 me\
|
2020-10-12 09:36:43 +00:00
|
|
|
thod-summary-table-tab3">
|
2020-05-05 20:02:30 +00:00
|
|
|
<div class="block">Returns some value with an inherited search tag.</div>
|
|
|
|
""");
|
2019-10-07 13:58:04 +00:00
|
|
|
|
|
|
|
checkOutput("pkg2/DocumentedNonGenericChild.html", true,
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
|
|
|
<section class="detail" id="parentMethod(T)">
|
|
|
|
<h3 id="parentMethod(java.lang.Object)">parentMethod</h3>
|
2023-10-16 12:56:41 +00:00
|
|
|
<div class="horizontal-scroll">
|
2020-05-05 20:02:30 +00:00
|
|
|
<div class="member-signature"><span class="modifiers">protected abstract</span>&\
|
2021-05-10 20:25:43 +00:00
|
|
|
nbsp;<span class="return-type">java.lang.String</span> <span class="element\
|
|
|
|
-name">parentMethod</span><wbr><span class="parameters">(java.lang.String t\
|
|
|
|
)</span>
|
2020-05-05 20:02:30 +00:00
|
|
|
throws <span class="exceptions">java.lang.IllegalArgumentException,
|
|
|
|
java.lang.InterruptedException,
|
|
|
|
java.lang.IllegalStateException</span></div>
|
2024-11-12 09:23:29 +00:00
|
|
|
<div class="block">Returns some value with an inherited search tag.</div>""");
|
2019-10-07 13:58:04 +00:00
|
|
|
|
2020-01-16 14:50:23 +00:00
|
|
|
checkOutput("pkg2/DocumentedNonGenericChild.html", true,
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
|
|
|
<dt>Throws:</dt>
|
|
|
|
<dd><code>java.lang.InterruptedException</code> - a generic error</dd>
|
|
|
|
<dd><code>java.lang.IllegalStateException</code> - illegal state</dd>
|
|
|
|
<dd><code>java.lang.IllegalArgumentException</code></dd>""");
|
2020-01-16 14:50:23 +00:00
|
|
|
|
|
|
|
checkOutput("pkg2/DocumentedNonGenericChild.html", true,
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
2020-10-12 09:36:43 +00:00
|
|
|
<div class="col-first even-row-color"><code>java.lang.String</code></div>
|
2021-02-12 08:32:47 +00:00
|
|
|
<div class="col-second even-row-color"><code><a href="#parentField" class="membe\
|
|
|
|
r-name-link">parentField</a></code></div>
|
2020-10-12 09:36:43 +00:00
|
|
|
<div class="col-last even-row-color">
|
2020-05-05 20:02:30 +00:00
|
|
|
<div class="block">A field.</div>""",
|
|
|
|
"""
|
|
|
|
<section class="detail" id="parentField">
|
|
|
|
<h3>parentField</h3>
|
2023-10-16 12:56:41 +00:00
|
|
|
<div class="horizontal-scroll">
|
2020-05-05 20:02:30 +00:00
|
|
|
<div class="member-signature"><span class="modifiers">public</span> <span c\
|
2020-11-27 19:12:31 +00:00
|
|
|
lass="return-type">java.lang.String</span> <span class="element-name">parentField</\
|
|
|
|
span></div>
|
2020-05-05 20:02:30 +00:00
|
|
|
<div class="block">A field.</div>
|
2023-10-16 12:56:41 +00:00
|
|
|
</div>
|
2020-05-05 20:02:30 +00:00
|
|
|
</section>""");
|
2020-01-16 14:50:23 +00:00
|
|
|
|
|
|
|
checkOutput("pkg3/PrivateGenericParent.PublicChild.html", true,
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
2021-01-25 21:45:54 +00:00
|
|
|
<div class="col-first even-row-color method-summary-table method-summary-table-t\
|
|
|
|
ab2 method-summary-table-tab4"><code>java.lang.String</code></div>
|
|
|
|
<div class="col-second even-row-color method-summary-table method-summary-table-\
|
2021-02-12 08:32:47 +00:00
|
|
|
tab2 method-summary-table-tab4"><code><a href="#method(T)" class="member-name-li\
|
2021-05-10 20:25:43 +00:00
|
|
|
nk">method</a><wbr>(java.lang.String t)</code></div>""",
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
|
|
|
<section class="detail" id="method(T)">
|
|
|
|
<h3 id="method(java.lang.Object)">method</h3>
|
2023-10-16 12:56:41 +00:00
|
|
|
<div class="horizontal-scroll">
|
2020-05-05 20:02:30 +00:00
|
|
|
<div class="member-signature"><span class="modifiers">public</span> <span c\
|
2021-02-12 08:32:47 +00:00
|
|
|
lass="return-type">java.lang.String</span> <span class="element-name">metho\
|
2021-05-10 20:25:43 +00:00
|
|
|
d</span><wbr><span class="parameters">(java.lang.String t)</span></div>
|
2023-10-16 12:56:41 +00:00
|
|
|
</div>
|
2020-05-05 20:02:30 +00:00
|
|
|
</section>""");
|
2020-04-08 19:28:14 +00:00
|
|
|
|
|
|
|
checkOutput("index-all.html", true,
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
2021-02-12 08:32:47 +00:00
|
|
|
<dt><a href="pkg2/DocumentedNonGenericChild.html#parentField" class="member-name\
|
|
|
|
-link">parentField</a> - Variable in class pkg2.<a href="pkg2/DocumentedNonGener\
|
|
|
|
icChild.html" title="class in pkg2">DocumentedNonGenericChild</a></dt>
|
2020-05-05 20:02:30 +00:00
|
|
|
<dd>
|
|
|
|
<div class="block">A field.</div>
|
|
|
|
</dd>
|
|
|
|
""",
|
|
|
|
"""
|
2021-02-12 08:32:47 +00:00
|
|
|
<dt><a href="pkg2/DocumentedNonGenericChild.html#parentMethod(T)" class="member-\
|
|
|
|
name-link">parentMethod(String)</a> - Method in class pkg2.<a href="pkg2/Documen\
|
|
|
|
tedNonGenericChild.html" title="class in pkg2">DocumentedNonGenericChild</a></dt>
|
2020-05-05 20:02:30 +00:00
|
|
|
<dd>
|
|
|
|
<div class="block">Returns some value with an inherited search tag.</div>
|
|
|
|
</dd>""");
|
2020-04-08 19:28:14 +00:00
|
|
|
checkOutput("member-search-index.js", true,
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
|
|
|
{"p":"pkg2","c":"DocumentedNonGenericChild","l":"parentField"}""",
|
|
|
|
"""
|
|
|
|
{"p":"pkg2","c":"DocumentedNonGenericChild","l":"parentMethod(String)","u":"parentMethod(T)"}""");
|
2024-11-12 09:23:29 +00:00
|
|
|
// Search tags from inherited doc comments are not added to the index (8341904).
|
|
|
|
checkOutput("tag-search-index.js", true, "tagSearchIndex = []");
|
2020-04-08 19:28:14 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testSplitIndex() {
|
|
|
|
javadoc("-d", "out-split",
|
|
|
|
"-splitindex",
|
|
|
|
"-sourcepath", testSrc,
|
2020-10-07 13:08:34 +00:00
|
|
|
"--no-platform-links",
|
2020-04-08 19:28:14 +00:00
|
|
|
"pkg", "diamond", "inheritDist", "pkg1", "pkg2", "pkg3");
|
|
|
|
checkExit(Exit.OK);
|
|
|
|
|
|
|
|
checkOutput("pkg2/DocumentedNonGenericChild.html", true,
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
|
|
|
<section class="detail" id="parentMethod(T)">
|
|
|
|
<h3 id="parentMethod(java.lang.Object)">parentMethod</h3>
|
2023-10-16 12:56:41 +00:00
|
|
|
<div class="horizontal-scroll">
|
2020-05-05 20:02:30 +00:00
|
|
|
<div class="member-signature"><span class="modifiers">protected abstract</span>&\
|
2021-05-10 20:25:43 +00:00
|
|
|
nbsp;<span class="return-type">java.lang.String</span> <span class="element\
|
|
|
|
-name">parentMethod</span><wbr><span class="parameters">(java.lang.String t\
|
|
|
|
)</span>
|
2020-05-05 20:02:30 +00:00
|
|
|
throws <span class="exceptions">java.lang.IllegalArgumentException,
|
|
|
|
java.lang.InterruptedException,
|
|
|
|
java.lang.IllegalStateException</span></div>
|
2024-11-12 09:23:29 +00:00
|
|
|
<div class="block">Returns some value with an inherited search tag.</div>""");
|
2020-04-08 19:28:14 +00:00
|
|
|
|
|
|
|
checkOutput("index-files/index-9.html", true,
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
2021-02-12 08:32:47 +00:00
|
|
|
<dt><a href="../pkg2/DocumentedNonGenericChild.html#parentField" class="member-n\
|
|
|
|
ame-link">parentField</a> - Variable in class pkg2.<a href="../pkg2/DocumentedNo\
|
|
|
|
nGenericChild.html" title="class in pkg2">DocumentedNonGenericChild</a></dt>
|
2020-05-05 20:02:30 +00:00
|
|
|
<dd>
|
|
|
|
<div class="block">A field.</div>
|
|
|
|
</dd>
|
|
|
|
""",
|
|
|
|
"""
|
2021-02-12 08:32:47 +00:00
|
|
|
<dt><a href="../pkg2/DocumentedNonGenericChild.html#parentMethod(T)" class="memb\
|
|
|
|
er-name-link">parentMethod(String)</a> - Method in class pkg2.<a href="../pkg2/D\
|
|
|
|
ocumentedNonGenericChild.html" title="class in pkg2">DocumentedNonGenericChild</a></dt>
|
2020-05-05 20:02:30 +00:00
|
|
|
<dd>
|
|
|
|
<div class="block">Returns some value with an inherited search tag.</div>
|
|
|
|
</dd>""");
|
2020-04-08 19:28:14 +00:00
|
|
|
checkOutput("member-search-index.js", true,
|
2020-05-05 20:02:30 +00:00
|
|
|
"""
|
|
|
|
{"p":"pkg2","c":"DocumentedNonGenericChild","l":"parentField"}""",
|
|
|
|
"""
|
|
|
|
{"p":"pkg2","c":"DocumentedNonGenericChild","l":"parentMethod(String)","u":"parentMethod(T)"}""");
|
2024-11-12 09:23:29 +00:00
|
|
|
// Search tags from inherited doc comments are not added to the index (8341904).
|
|
|
|
checkOutput("tag-search-index.js", true, "tagSearchIndex = []");
|
2018-03-06 18:45:47 +00:00
|
|
|
}
|
2020-04-08 19:28:14 +00:00
|
|
|
|
2015-11-29 02:52:17 +00:00
|
|
|
}
|