8232644: bugs in serialized-form.html
Reviewed-by: jjg
This commit is contained in:
parent
b5b31197e5
commit
c6aa8f19ac
@ -165,7 +165,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
|
||||
writer.addInlineComment(field, contentTree);
|
||||
}
|
||||
List<? extends SerialTree> tags = utils.getSerialTrees(field);
|
||||
if (!tags.isEmpty()) {
|
||||
if (!tags.isEmpty() && !tags.get(0).getDescription().isEmpty()) {
|
||||
writer.addInlineComment(field, tags.get(0), contentTree);
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ import jdk.javadoc.internal.doclets.toolkit.taglets.TagletManager;
|
||||
* deletion without notice.</b>
|
||||
*/
|
||||
public class HtmlSerialMethodWriter extends MethodWriterImpl implements
|
||||
SerializedFormWriter.SerialMethodWriter{
|
||||
SerializedFormWriter.SerialMethodWriter {
|
||||
|
||||
public HtmlSerialMethodWriter(SubWriterHolderWriter writer, TypeElement typeElement) {
|
||||
super(writer, typeElement);
|
||||
|
@ -27,8 +27,10 @@ package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
|
||||
@ -106,15 +108,15 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
|
||||
/**
|
||||
* Get the given package header.
|
||||
*
|
||||
* @param packageName the package header to write
|
||||
* @param packageElement the package element to write
|
||||
* @return a content tree for the package header
|
||||
*/
|
||||
@Override
|
||||
public Content getPackageHeader(String packageName) {
|
||||
public Content getPackageHeader(PackageElement packageElement) {
|
||||
Content heading = HtmlTree.HEADING_TITLE(Headings.SerializedForm.PACKAGE_HEADING,
|
||||
contents.packageLabel);
|
||||
heading.add(Entity.NO_BREAK_SPACE);
|
||||
heading.add(packageName);
|
||||
heading.add(getPackageLink(packageElement, Text.of(utils.getPackageName(packageElement))));
|
||||
return heading;
|
||||
}
|
||||
|
||||
@ -159,15 +161,26 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
|
||||
? getLink(new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.SERIALIZED_FORM,
|
||||
typeElement.getSuperclass()))
|
||||
: null;
|
||||
Content interfaceLink = getLink(new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.SERIALIZED_FORM,
|
||||
utils.isExternalizable(typeElement)
|
||||
? utils.getExternalizableType()
|
||||
: utils.getSerializableType()));
|
||||
|
||||
//Print the heading.
|
||||
Content className = superClassLink == null ?
|
||||
contents.getContent(
|
||||
"doclet.Class_0_implements_serializable", classLink) :
|
||||
contents.getContent(
|
||||
"doclet.Class_0_extends_implements_serializable", classLink,
|
||||
superClassLink);
|
||||
// Print the heading.
|
||||
Content className = new ContentBuilder();
|
||||
className.add(utils.getTypeElementKindName(typeElement, false));
|
||||
className.add(Entity.NO_BREAK_SPACE);
|
||||
className.add(classLink);
|
||||
section.add(HtmlTree.HEADING(Headings.SerializedForm.CLASS_HEADING, className));
|
||||
// Print a simplified signature.
|
||||
Content signature = new ContentBuilder();
|
||||
signature.add("class ");
|
||||
signature.add(typeElement.getSimpleName());
|
||||
signature.add(" extends ");
|
||||
signature.add(superClassLink);
|
||||
signature.add(" implements ");
|
||||
signature.add(interfaceLink);
|
||||
section.add(HtmlTree.DIV(HtmlStyle.typeSignature, signature));
|
||||
return section;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
package jdk.javadoc.internal.doclets.toolkit;
|
||||
|
||||
import javax.lang.model.element.ExecutableElement;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
@ -77,10 +78,10 @@ public interface SerializedFormWriter {
|
||||
/**
|
||||
* Get the given package header.
|
||||
*
|
||||
* @param packageName the package header to write
|
||||
* @param packageElement the package element to write
|
||||
* @return a content tree for the package header
|
||||
*/
|
||||
Content getPackageHeader(String packageName);
|
||||
Content getPackageHeader(PackageElement packageElement);
|
||||
|
||||
/**
|
||||
* Get the serialized class header.
|
||||
|
@ -193,8 +193,7 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
* @param packageSerializedTree content tree to which the documentation will be added
|
||||
*/
|
||||
protected void buildPackageHeader(Content packageSerializedTree) {
|
||||
packageSerializedTree.add(writer.getPackageHeader(
|
||||
utils.getPackageName(currentPackage)));
|
||||
packageSerializedTree.add(writer.getPackageHeader(currentPackage));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,8 +32,6 @@ doclet.Serialized_Form=Serialized Form
|
||||
doclet.Serialized_Form_methods=Serialization Methods
|
||||
doclet.Serialized_Form_fields=Serialized Fields
|
||||
doclet.Serialized_Form_class=Serialization Overview
|
||||
doclet.Class_0_implements_serializable=Class {0} implements Serializable
|
||||
doclet.Class_0_extends_implements_serializable=Class {0} extends {1} implements Serializable
|
||||
doclet.Option_conflict=Option {0} conflicts with {1}
|
||||
doclet.Option_reuse=Option reused: {0}
|
||||
doclet.Option_invalid=Invalid argument {0} for {1} option
|
||||
|
@ -54,13 +54,13 @@ h3 {
|
||||
font-size:16px;
|
||||
}
|
||||
h4 {
|
||||
font-size:13px;
|
||||
font-size:15px;
|
||||
}
|
||||
h5 {
|
||||
font-size:12px;
|
||||
font-size:14px;
|
||||
}
|
||||
h6 {
|
||||
font-size:11px;
|
||||
font-size:13px;
|
||||
}
|
||||
ul {
|
||||
list-style-type:disc;
|
||||
|
@ -69,6 +69,7 @@ import static com.sun.source.doctree.DocTree.Kind.EXCEPTION;
|
||||
import static com.sun.source.doctree.DocTree.Kind.HIDDEN;
|
||||
import static com.sun.source.doctree.DocTree.Kind.LINK;
|
||||
import static com.sun.source.doctree.DocTree.Kind.LINK_PLAIN;
|
||||
import static com.sun.source.doctree.DocTree.Kind.PARAM;
|
||||
import static com.sun.source.doctree.DocTree.Kind.PROVIDES;
|
||||
import static com.sun.source.doctree.DocTree.Kind.SEE;
|
||||
import static com.sun.source.doctree.DocTree.Kind.SERIAL;
|
||||
@ -594,6 +595,7 @@ public class TagletManager {
|
||||
// init the serialized form tags for the serialized form page
|
||||
serializedFormTags = new ArrayList<>();
|
||||
serializedFormTags.add(allTaglets.get(SERIAL_DATA.tagName));
|
||||
serializedFormTags.add(allTaglets.get(PARAM.tagName));
|
||||
serializedFormTags.add(allTaglets.get(THROWS.tagName));
|
||||
if (!nosince)
|
||||
serializedFormTags.add(allTaglets.get(SINCE.tagName));
|
||||
|
@ -92,9 +92,9 @@ public class TestHeadings extends JavadocTester {
|
||||
// Serialized Form
|
||||
checkOutput("serialized-form.html", true,
|
||||
"""
|
||||
<h2 title="Package">Package pkg1</h2>""",
|
||||
<h2 title="Package">Package <a href="pkg1/package-summary.html">pkg1</a></h2>""",
|
||||
"""
|
||||
<h3>Class <a href="pkg1/C1.html" title="class in pkg1">pkg1.C1</a> extends java.lang.Object implements Serializable</h3>""",
|
||||
<h3>Class <a href="pkg1/C1.html" title="class in pkg1">pkg1.C1</a></h3>""",
|
||||
"<h4>Serialized Fields</h4>");
|
||||
|
||||
// Overview Summary
|
||||
|
@ -241,7 +241,6 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
|
||||
<a href="pkg1/C1.html#setUndecorated(boolean)"><code>setUndecorated(boolean)</code></a>.</div>
|
||||
</div>
|
||||
<div class="block">This field indicates whether the C1 is undecorated.</div>
|
||||
|
||||
<dl class="notes">
|
||||
<dt>Since:</dt>
|
||||
<dd>1.4</dd>
|
||||
@ -259,6 +258,8 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
|
||||
</div>
|
||||
<div class="block">Reads the object stream.</div>
|
||||
<dl class="notes">
|
||||
<dt>Parameters:</dt>
|
||||
<dd><code>s</code> - ObjectInputStream</dd>
|
||||
<dt>Throws:</dt>
|
||||
<dd><code>java.io.IOException</code></dd>
|
||||
</dl>""",
|
||||
@ -350,7 +351,6 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
|
||||
<a href="pkg1/C1.html#setUndecorated(boolean)"><code>setUndecorated(boolean)</code></a>.</div>
|
||||
</div>
|
||||
<div class="block">This field indicates whether the C1 is undecorated.</div>
|
||||
|
||||
<dl class="notes">
|
||||
<dt>Since:</dt>
|
||||
<dd>1.4</dd>
|
||||
@ -368,6 +368,8 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
|
||||
</div>
|
||||
<div class="block">Reads the object stream.</div>
|
||||
<dl class="notes">
|
||||
<dt>Parameters:</dt>
|
||||
<dd><code>s</code> - ObjectInputStream</dd>
|
||||
<dt>Throws:</dt>
|
||||
<dd><code>java.io.IOException</code></dd>
|
||||
</dl>""",
|
||||
|
@ -241,7 +241,7 @@ public class TestHtmlVersion extends JavadocTester {
|
||||
<div class="header">""",
|
||||
"""
|
||||
<section class="serialized-package-container">
|
||||
<h2 title="Package">Package pkg</h2>
|
||||
<h2 title="Package">Package <a href="pkg/package-summary.html">pkg</a></h2>
|
||||
""",
|
||||
"""
|
||||
<footer role="contentinfo">""",
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4341304 4485668 4966728 8032066 8071982 8192933 8215307
|
||||
* @bug 4341304 4485668 4966728 8032066 8071982 8192933 8215307 8232644
|
||||
* @summary Test that methods readResolve and writeReplace show
|
||||
* up in serialized-form.html the same way that readObject and writeObject do.
|
||||
* If the doclet includes readResolve and writeReplace in the serialized-form
|
||||
@ -76,28 +76,32 @@ public class TestSerializedForm extends JavadocTester {
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>""",
|
||||
"<h3>Class pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass "
|
||||
+ "extends java.lang.Object implements Serializable</h3>",
|
||||
"<h3>Class pkg1.PrivateIncludeInnerClass.PriInnerClass extends "
|
||||
+ "java.lang.Object implements Serializable</h3>",
|
||||
"<h3>Class pkg1.ProtectedInnerClass.ProInnerClass extends "
|
||||
+ "java.lang.Object implements Serializable</h3>");
|
||||
"""
|
||||
<h3>Class pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass</h3>
|
||||
<div class="type-signature">class ProNestedInnerClass extends java.lang.Object i\
|
||||
mplements java.io.Serializable</div>
|
||||
""",
|
||||
"""
|
||||
<h3>Class pkg1.PrivateIncludeInnerClass.PriInnerClass</h3>
|
||||
<div class="type-signature">class PriInnerClass extends java.lang.Object impleme\
|
||||
nts java.io.Serializable</div>""",
|
||||
"""
|
||||
<h3>Class pkg1.ProtectedInnerClass.ProInnerClass</h3>
|
||||
<div class="type-signature">class ProInnerClass extends java.lang.Object impleme\
|
||||
nts java.io.Serializable</div>""");
|
||||
|
||||
checkOutput("serialized-form.html", false,
|
||||
"""
|
||||
<h3>Class <a href="pkg1/NestedInnerClass.InnerClass.ProNestedInnerClass.html" ti\
|
||||
tle="class in pkg1">pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass</a> ext\
|
||||
ends java.lang.Object implements Serializable</h3>""",
|
||||
<h3>Class <a href="pkg1/NestedInnerClass.InnerClass.ProNestedInnerClass.htm\
|
||||
l" title="class in pkg1">pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass</a\
|
||||
></h3>""",
|
||||
"""
|
||||
<h3>Class <a href="pkg1/PrivateInnerClass.PriInnerClass.html" title="class in pk\
|
||||
g1">pkg1.PrivateInnerClass.PriInnerClass</a> extends java.lang.Object implements\
|
||||
Serializable</h3>""",
|
||||
<h3>Class <a href="pkg1/PrivateInnerClass.PriInnerClass.html" title="class \
|
||||
in pkg1">pkg1.PrivateInnerClass.PriInnerClass</a></h3>""",
|
||||
"""
|
||||
<h3>Class <a href="pkg1/ProtectedInnerClass.ProInnerClass.html" title="class in \
|
||||
pkg1">pkg1.ProtectedInnerClass.ProInnerClass</a> extends java.lang.Object implem\
|
||||
ents Serializable</h3>""",
|
||||
"<h3>Class pkg1.PublicExcludeInnerClass.PubInnerClass extends java.lang.Object implements "
|
||||
+ "Serializable</h3>");
|
||||
<h3>Class <a href="pkg1/ProtectedInnerClass.ProInnerClass.html" title="class in \
|
||||
pkg1">pkg1.ProtectedInnerClass.ProInnerClass</a></h3>""",
|
||||
"<h3>Class pkg1.PublicExcludeInnerClass.PubInnerClass</h3>");
|
||||
|
||||
checkOutput("serialized-form.html", true,
|
||||
"""
|
||||
@ -127,29 +131,29 @@ public class TestSerializedForm extends JavadocTester {
|
||||
|
||||
checkOutput("serialized-form.html", true,
|
||||
"""
|
||||
<h3>Class <a href="pkg1/NestedInnerClass.InnerClass.ProNestedInnerClass.html" ti\
|
||||
tle="class in pkg1">pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass</a> ext\
|
||||
ends java.lang.Object implements Serializable</h3>""",
|
||||
<h3>Class <a href="pkg1/NestedInnerClass.InnerClass.ProNestedInnerClass.htm\
|
||||
l" title="class in pkg1">pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass</a\
|
||||
></h3>
|
||||
<div class="type-signature">class ProNestedInnerClass extends java.lang.Object i\
|
||||
mplements java.io.Serializable</div>""",
|
||||
"""
|
||||
<h3>Class <a href="pkg1/PrivateIncludeInnerClass.PriInnerClass.html" title="clas\
|
||||
s in pkg1">pkg1.PrivateIncludeInnerClass.PriInnerClass</a> extends java.lang.Obj\
|
||||
ect implements Serializable</h3>""",
|
||||
<h3>Class <a href="pkg1/PrivateIncludeInnerClass.PriInnerClass.html" title=\
|
||||
"class in pkg1">pkg1.PrivateIncludeInnerClass.PriInnerClass</a></h3>
|
||||
<div class="type-signature">class PriInnerClass extends java.lang.Object impleme\
|
||||
nts java.io.Serializable</div>""",
|
||||
"""
|
||||
<h3>Class <a href="pkg1/ProtectedInnerClass.ProInnerClass.html" title="class in \
|
||||
pkg1">pkg1.ProtectedInnerClass.ProInnerClass</a> extends java.lang.Object implem\
|
||||
ents Serializable</h3>""");
|
||||
<h3>Class <a href="pkg1/ProtectedInnerClass.ProInnerClass.html" title="clas\
|
||||
s in pkg1">pkg1.ProtectedInnerClass.ProInnerClass</a></h3>
|
||||
<div class="type-signature">class ProInnerClass extends java.lang.Object impleme\
|
||||
nts java.io.Serializable</div>""");
|
||||
|
||||
checkOutput("serialized-form.html", false,
|
||||
"<h3>Class pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass "
|
||||
+ "extends java.lang.Object implements Serializable</h3>",
|
||||
"<h3>Class pkg1.PrivateInnerClass.PriInnerClass extends "
|
||||
+ "java.lang.Object implements Serializable</h3>",
|
||||
"<h3>Class pkg1.ProtectedInnerClass.ProInnerClass extends "
|
||||
+ "java.lang.Object implements Serializable</h3>",
|
||||
"<h3>Class pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass</h3>",
|
||||
"<h3>Class pkg1.PrivateInnerClass.PriInnerClass</h3>",
|
||||
"<h3>Class pkg1.ProtectedInnerClass.ProInnerClass</h3>",
|
||||
"""
|
||||
<h3>Class <a href="pkg1/PublicExcludeInnerClass.PubInnerClass.html" title="class\
|
||||
in pkg1">pkg1.PublicExcludeInnerClass.PubInnerClass</a> extends java.lang.Objec\
|
||||
t implements Serializable</h3>""");
|
||||
<h3>Class <a href="pkg1/PublicExcludeInnerClass.PubInnerClass.html" title="class\
|
||||
in pkg1">pkg1.PublicExcludeInnerClass.PubInnerClass</a></h3>""");
|
||||
|
||||
checkOutput("serialized-form.html", true,
|
||||
"""
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6802694 8025633 8026567 8183511 8074407 8182765
|
||||
* @bug 6802694 8025633 8026567 8183511 8074407 8182765 8232644
|
||||
* @summary This test verifies deprecation info in serialized-form.html.
|
||||
* @library ../../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
@ -110,7 +110,6 @@ public class TestSerializedFormDeprecationInfo extends JavadocTester {
|
||||
<a href="pkg1/C1.html#setUndecorated(boolean)"><code>setUndecorated(boolean)</code></a>.</div>
|
||||
</div>
|
||||
<div class="block">This field indicates whether the C1 is undecorated.</div>
|
||||
|
||||
<dl class="notes">
|
||||
<dt>Since:</dt>
|
||||
<dd>1.4</dd>
|
||||
@ -128,6 +127,8 @@ public class TestSerializedFormDeprecationInfo extends JavadocTester {
|
||||
</div>
|
||||
<div class="block">Reads the object stream.</div>
|
||||
<dl class="notes">
|
||||
<dt>Parameters:</dt>
|
||||
<dd><code>s</code> - ObjectInputStream</dd>
|
||||
<dt>Throws:</dt>
|
||||
<dd><code>java.io.IOException</code> - on error</dd>
|
||||
</dl>""",
|
||||
|
@ -44,13 +44,15 @@ public class TestSuperClassInSerialForm extends JavadocTester {
|
||||
@Test
|
||||
public void test() {
|
||||
javadoc("-d", "out",
|
||||
"--no-platform-links",
|
||||
"-sourcepath", testSrc,
|
||||
"pkg");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
checkOutput("serialized-form.html", true,
|
||||
"""
|
||||
<a href="pkg/SubClass.html" title="class in pkg">pkg.SubClass</a> extends <a hre\
|
||||
f="pkg/SuperClass.html" title="class in pkg">SuperClass</a>""");
|
||||
<h3>Class <a href="pkg/SubClass.html" title="class in pkg">pkg.SubClass</a></h3>
|
||||
<div class="type-signature">class SubClass extends <a href="pkg/SuperClass.html" tit\
|
||||
le="class in pkg">SuperClass</a> implements java.io.Serializable</div>""");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user