8163800: The fix for JDK-8072052 shows up other minor incorrect use of styles

Reviewed-by: bpatel
This commit is contained in:
Jonathan Gibbons 2016-08-16 10:57:13 -07:00
parent 4c9b47f1fa
commit f8ab3f84a4
7 changed files with 160 additions and 32 deletions
langtools
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html
test/jdk/javadoc/doclet
testClassLinks
testHiddenTag
testInterface
testNewLanguageFeatures
testPrivateClasses

@ -651,11 +651,11 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
if (type instanceof TypeElement) {
Content link = getLink(
new LinkInfoImpl(configuration, context, (TypeElement)(type)));
dd.addContent(link);
dd.addContent(HtmlTree.CODE(link));
} else {
Content link = getLink(
new LinkInfoImpl(configuration, context, ((TypeMirror)type)));
dd.addContent(link);
dd.addContent(HtmlTree.CODE(link));
}
}
return dd;

@ -0,0 +1,88 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* 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
* @bug 8163800
* @summary The fix for JDK-8072052 shows up other minor incorrect use of styles
* @library ../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
* @build JavadocTester
* @build TestClassLinks
* @run main TestClassLinks
*/
public class TestClassLinks extends JavadocTester {
public static void main(String... args) throws Exception {
TestClassLinks tester = new TestClassLinks();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-Xdoclint:none",
"-sourcepath", testSrc,
"-package",
"p");
checkExit(Exit.OK);
checkOutput("p/C1.html", true,
"<code><a href=\"../p/C2.html\" title=\"class in p\">C2</a></code>",
"<code><span class=\"memberNameLink\"><a href=\"../p/C1.html#C1--\">C1</a></span>()</code>");
checkOutput("p/C2.html", true,
"<code><a href=\"../p/C3.html\" title=\"class in p\">C3</a></code>",
"<code><span class=\"memberNameLink\"><a href=\"../p/C2.html#C2--\">C2</a></span>()</code>");
checkOutput("p/C3.html", true,
"<code><a href=\"../p/I1.html\" title=\"interface in p\">I1</a></code>, "
+ "<code><a href=\"../p/I12.html\" title=\"interface in p\">I12</a></code>, "
+ "<code><a href=\"../p/I2.html\" title=\"interface in p\">I2</a></code>, "
+ "<code><a href=\"../p/IT1.html\" title=\"interface in p\">IT1</a>&lt;T&gt;</code>, "
+ "<code><a href=\"../p/IT2.html\" title=\"interface in p\">IT2</a>&lt;java.lang.String&gt;</code>",
"<code><span class=\"memberNameLink\"><a href=\"../p/C3.html#C3--\">C3</a></span>()</code>");
checkOutput("p/I1.html", true,
"<code><a href=\"../p/C3.html\" title=\"class in p\">C3</a></code>",
"<code><a href=\"../p/I12.html\" title=\"interface in p\">I12</a></code>");
checkOutput("p/I2.html", true,
"<code><a href=\"../p/C3.html\" title=\"class in p\">C3</a></code>",
"<code><a href=\"../p/I12.html\" title=\"interface in p\">I12</a></code>");
checkOutput("p/I12.html", true,
"<code><a href=\"../p/C3.html\" title=\"class in p\">C3</a></code>",
"<code><a href=\"../p/I1.html\" title=\"interface in p\">I1</a></code>, <code><a href=\"../p/I2.html\" title=\"interface in p\">I2</a></code>");
checkOutput("p/IT1.html", true,
"<code><a href=\"../p/C3.html\" title=\"class in p\">C3</a></code>");
checkOutput("p/IT2.html", true,
"code><a href=\"../p/C3.html\" title=\"class in p\">C3</a></code>");
}
}

@ -0,0 +1,40 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* 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.
*/
package p;
interface I1 { }
interface I2 { }
interface I12 extends I1, I2 { }
interface IT1<T> { }
interface IT2<T> { }
class C1 { }
class C2 extends C1 { }
class C3<T> extends C2 implements I12, IT1<T>, IT2<String> { }

@ -54,9 +54,9 @@ public class TestHiddenTag extends JavadocTester {
"<a name=\"visibleField\">",
"<a name=\"visibleMethod--\">",
"<dt>Direct Known Subclasses:</dt>\n" +
"<dd><a href=\"../pkg1/A.VisibleInner.html\" title=\"class in pkg1\">" +
"A.VisibleInner</a>, <a href=\"../pkg1/A.VisibleInnerExtendsInvisibleInner.html\" " +
"title=\"class in pkg1\">A.VisibleInnerExtendsInvisibleInner</a></dd>");
"<dd><code><a href=\"../pkg1/A.VisibleInner.html\" title=\"class in pkg1\">" +
"A.VisibleInner</a></code>, <code><a href=\"../pkg1/A.VisibleInnerExtendsInvisibleInner.html\" " +
"title=\"class in pkg1\">A.VisibleInnerExtendsInvisibleInner</a></code></dd>");
checkOutput("pkg1/A.html", false,
"<a name=\"inVisibleField\">",

@ -36,7 +36,7 @@
*/
/*
* TODO: make it Inteferface<PE> ie. fix all ParameterTypes, likely should get
* TODO: make it Interface<PE> ie. fix all ParameterTypes, likely should get
* fixed when Doc is replace by j.l.m, but meanwhile this test has been adjusted
* take the current format this is better than @ignore because we can follow the
* differences as the work progress.
@ -69,17 +69,17 @@ public class TestInterface extends JavadocTester {
// Make sure known implementing class list is correct and omits type parameters.
"<dl>\n"
+ "<dt>All Known Implementing Classes:</dt>\n"
+ "<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child"
+ "</a>, <a href=\"../pkg/Parent.html\" title=\"class in pkg\">Parent"
+ "</a></dd>\n"
+ "<dd><code><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child"
+ "</a></code>, <code><a href=\"../pkg/Parent.html\" title=\"class in pkg\">Parent"
+ "</a></code></dd>\n"
+ "</dl>");
checkOutput("pkg/Child.html", true,
// Make sure "All Implemented Interfaces": has substituted type parameters
"<dl>\n"
+ "<dt>All Implemented Interfaces:</dt>\n"
+ "<dd><a href=\"../pkg/Interface.html\" title=\"interface in pkg\">"
+ "Interface</a>&lt;CE&gt;</dd>\n"
+ "<dd><code><a href=\"../pkg/Interface.html\" title=\"interface in pkg\">"
+ "Interface</a>&lt;CE&gt;</code></dd>\n"
+ "</dl>",
//Make sure Class Tree has substituted type parameters.
"<ul class=\"inheritance\">\n"
@ -114,8 +114,8 @@ public class TestInterface extends JavadocTester {
//Make sure "Direct Know Subclasses" omits type parameters
"<dl>\n"
+ "<dt>Direct Known Subclasses:</dt>\n"
+ "<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child"
+ "</a></dd>\n"
+ "<dd><code><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child"
+ "</a></code></dd>\n"
+ "</dl>");
checkOutput("pkg/Interface.html", false,

@ -186,22 +186,22 @@ public class TestNewLanguageFeatures extends JavadocTester {
checkOutput("pkg/TypeParameters.html", true,
"<dl>\n"
+ "<dt>All Implemented Interfaces:</dt>\n"
+ "<dd><a href=\"../pkg/SubInterface.html\" title=\"interface in pkg\">"
+ "SubInterface</a>&lt;E&gt;, <a href=\"../pkg/SuperInterface.html\" "
+ "title=\"interface in pkg\">SuperInterface</a>&lt;E&gt;</dd>\n"
+ "<dd><code><a href=\"../pkg/SubInterface.html\" title=\"interface in pkg\">"
+ "SubInterface</a>&lt;E&gt;</code>, <code><a href=\"../pkg/SuperInterface.html\" "
+ "title=\"interface in pkg\">SuperInterface</a>&lt;E&gt;</code></dd>\n"
+ "</dl>");
checkOutput("pkg/SuperInterface.html", true,
"<dl>\n"
+ "<dt>All Known Subinterfaces:</dt>\n"
+ "<dd><a href=\"../pkg/SubInterface.html\" title=\"interface in pkg\">"
+ "SubInterface</a>&lt;V&gt;</dd>\n"
+ "<dd><code><a href=\"../pkg/SubInterface.html\" title=\"interface in pkg\">"
+ "SubInterface</a>&lt;V&gt;</code></dd>\n"
+ "</dl>");
checkOutput("pkg/SubInterface.html", true,
"<dl>\n"
+ "<dt>All Superinterfaces:</dt>\n"
+ "<dd><a href=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">"
+ "SuperInterface</a>&lt;V&gt;</dd>\n"
+ "<dd><code><a href=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">"
+ "SuperInterface</a>&lt;V&gt;</code></dd>\n"
+ "</dl>");
//==============================================================

@ -77,8 +77,8 @@ public class TestPrivateClasses extends JavadocTester {
"<pre>public&nbsp;void&nbsp;methodInheritedFromParent(int&nbsp;p1)",
"<dl>\n"
+ "<dt>All Implemented Interfaces:</dt>\n"
+ "<dd><a href=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">"
+ "PublicInterface</a></dd>\n"
+ "<dd><code><a href=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">"
+ "PublicInterface</a></code></dd>\n"
+ "</dl>");
checkOutput("pkg/PublicChild.html", false,
@ -115,8 +115,8 @@ public class TestPrivateClasses extends JavadocTester {
//Make sure implemented interfaces from private superclass are inherited
"<dl>\n"
+ "<dt>All Known Implementing Classes:</dt>\n"
+ "<dd><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">"
+ "PublicChild</a></dd>\n"
+ "<dd><code><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">"
+ "PublicChild</a></code></dd>\n"
+ "</dl>");
checkOutput("pkg/PublicInterface.html", false,
@ -178,10 +178,10 @@ public class TestPrivateClasses extends JavadocTester {
"extends",
"<dl>\n"
+ "<dt>All Implemented Interfaces:</dt>\n"
+ "<dd><a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">"
+ "PrivateInterface</a>, "
+ "<a href=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">"
+ "PublicInterface</a></dd>\n"
+ "<dd><code><a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">"
+ "PrivateInterface</a></code>, "
+ "<code><a href=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">"
+ "PublicInterface</a></code></dd>\n"
+ "</dl>",
"<pre>public class <span class=\"typeNameLabel\">PublicChild</span>");
@ -202,10 +202,10 @@ public class TestPrivateClasses extends JavadocTester {
//Make sure implemented interfaces from private superclass are inherited
"<dl>\n"
+ "<dt>All Known Implementing Classes:</dt>\n"
+ "<dd><a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">"
+ "PrivateParent</a>, "
+ "<a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild"
+ "</a></dd>\n"
+ "<dd><code><a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">"
+ "PrivateParent</a></code>, "
+ "<code><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild"
+ "</a></code></dd>\n"
+ "</dl>");
checkOutput("pkg/PrivateInterface.html", true,