Skip to content

Commit b8bb51e

Browse files
committed
8345908: Class links should be properly spaced
Reviewed-by: prappo
1 parent ef6e987 commit b8bb51e

File tree

6 files changed

+24
-27
lines changed

6 files changed

+24
-27
lines changed

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriter.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -740,16 +740,14 @@ private Content getClassLinks(HtmlLinkInfo.Kind context, Collection<?> list) {
740740
}
741741
// TODO: should we simply split this method up to avoid instanceof ?
742742
if (type instanceof TypeElement te) {
743-
Content link = getLink(
744-
new HtmlLinkInfo(configuration, context, te));
745-
content.add(HtmlTree.CODE(link));
743+
content.add(getLink(
744+
new HtmlLinkInfo(configuration, context, te)));
746745
} else {
747-
Content link = getLink(
748-
new HtmlLinkInfo(configuration, context, ((TypeMirror)type)));
749-
content.add(HtmlTree.CODE(link));
746+
content.add(getLink(
747+
new HtmlLinkInfo(configuration, context, ((TypeMirror)type))));
750748
}
751749
}
752-
return content;
750+
return HtmlTree.CODE(content);
753751
}
754752

755753
/**

test/langtools/jdk/javadoc/doclet/testClassLinks/TestClassLinks.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 8163800 8175200 8186332 8182765
26+
* @bug 8163800 8175200 8186332 8182765 8345908
2727
* @summary The fix for JDK-8072052 shows up other minor incorrect use of styles
2828
* @library ../../lib
2929
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -66,10 +66,10 @@ public void test() {
6666

6767
checkOutput("p/C3.html", true,
6868
"""
69-
<code><a href="I1.html" title="interface in p">I1</a></code>, <code><a href="I12\
70-
.html" title="interface in p">I12</a></code>, <code><a href="I2.html" title="int\
71-
erface in p">I2</a></code>, <code><a href="IT1.html" title="interface in p">IT1<\
72-
/a>&lt;T&gt;</code>, <code><a href="IT2.html" title="interface in p">IT2</a>&lt;\
69+
<code><a href="I1.html" title="interface in p">I1</a>, <a href="I12\
70+
.html" title="interface in p">I12</a>, <a href="I2.html" title="int\
71+
erface in p">I2</a>, <a href="IT1.html" title="interface in p">IT1<\
72+
/a>&lt;T&gt;, <a href="IT2.html" title="interface in p">IT2</a>&lt;\
7373
java.lang.String&gt;</code>""",
7474
"""
7575
<code><a href="#%3Cinit%3E()" class="member-name-link">C3</a>()</code>""");
@@ -90,7 +90,7 @@ public void test() {
9090
"""
9191
<code><a href="C3.html" title="class in p">C3</a></code>""",
9292
"""
93-
<code><a href="I1.html" title="interface in p">I1</a></code>, <code><a href="I2.\
93+
<code><a href="I1.html" title="interface in p">I1</a>, <a href="I2.\
9494
html" title="interface in p">I2</a></code>""");
9595

9696
checkOutput("p/IT1.html", true,

test/langtools/jdk/javadoc/doclet/testHiddenTag/TestHiddenTag.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -59,8 +59,8 @@ public void test1() {
5959
"""
6060
<dt>Direct Known Subclasses:</dt>
6161
<dd><code><a href="A.VisibleInner.html" title="class in pkg1">A.VisibleInner</a>\
62-
</code>, <code><a href="A.VisibleInnerExtendsInvisibleInner.html" title="class i\
63-
n pkg1">A.VisibleInnerExtendsInvisibleInner</a></code></dd>""");
62+
, <a href="A.VisibleInnerExtendsInvisibleInner.html" title="class in pkg1">A.Vis\
63+
ibleInnerExtendsInvisibleInner</a></code></dd>""");
6464

6565
checkOutput("pkg1/A.html", false,
6666
"invisibleField",

test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ public void test() {
7676
"""
7777
<dl class="notes">
7878
<dt>All Known Implementing Classes:</dt>
79-
<dd><code><a href="Child.html" title="class in pkg">Child</a></code>, <code><a h\
80-
ref="Parent.html" title="class in pkg">Parent</a></code></dd>
79+
<dd><code><a href="Child.html" title="class in pkg">Child</a>, <a href="Parent.h\
80+
tml" title="class in pkg">Parent</a></code></dd>
8181
</dl>""");
8282

8383
checkOutput("pkg/Child.html", true,

test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ void checkTypeParameters() {
218218
<dl class="notes">
219219
<dt>All Implemented Interfaces:</dt>
220220
<dd><code><a href="SubInterface.html" title="interface in pkg">SubInterface</a>&\
221-
lt;E&gt;</code>, <code><a href="SuperInterface.html" title="interface in pkg">Su\
222-
perInterface</a>&lt;E&gt;</code></dd>
221+
lt;E&gt;, <a href="SuperInterface.html" title="interface in pkg">SuperInterface<\
222+
/a>&lt;E&gt;</code></dd>
223223
</dl>""");
224224

225225
checkOutput("pkg/SuperInterface.html", true,

test/langtools/jdk/javadoc/doclet/testPrivateClasses/TestPrivateClasses.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -187,8 +187,8 @@ public void testPrivate() {
187187
<dl class="notes">
188188
<dt>All Implemented Interfaces:</dt>
189189
<dd><code><a href="PrivateInterface.html" title="interface in pkg">PrivateInterf\
190-
ace</a></code>, <code><a href="PublicInterface.html" title="interface in pkg">Pu\
191-
blicInterface</a></code></dd>
190+
ace</a>, <a href="PublicInterface.html" title="interface in pkg">PublicInterface\
191+
</a></code></dd>
192192
</dl>""",
193193
"""
194194
<div class="type-signature"><span class="modifiers">public class </span><span cl\
@@ -210,9 +210,8 @@ public void testPrivate() {
210210
"""
211211
<dl class="notes">
212212
<dt>All Known Implementing Classes:</dt>
213-
<dd><code><a href="PrivateParent.html" title="class in pkg">PrivateParent</a></c\
214-
ode>, <code><a href="PublicChild.html" title="class in pkg">PublicChild</a></cod\
215-
e></dd>
213+
<dd><code><a href="PrivateParent.html" title="class in pkg">PrivateParent</a>, <\
214+
a href="PublicChild.html" title="class in pkg">PublicChild</a></code></dd>
216215
</dl>""");
217216

218217
checkOutput("pkg/PrivateInterface.html", true,

0 commit comments

Comments
 (0)