src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java Thu Oct 17 20:27:44 2019 +0100
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java Thu Oct 17 20:53:35 2019 +0100
@@ -36,7 +36,6 @@
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.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
@@ -110,8 +109,8 @@
Content methodDetailsTree = new ContentBuilder();
Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
contents.methodDetailLabel);
+ methodDetailsTree.add(links.createAnchor(SectionName.METHOD_DETAIL));
methodDetailsTree.add(heading);
- methodDetailsTree.add(links.createAnchor(SectionName.METHOD_DETAIL));
return methodDetailsTree;
}
@@ -123,12 +122,11 @@
String erasureAnchor;
Content methodDocTree = new ContentBuilder();
Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
- heading.add(name(method));
+ if ((erasureAnchor = getErasureAnchor(method)) != null) {
+ heading.add(links.createAnchor((erasureAnchor)));
+ }
+ heading.add(links.createAnchor(writer.getAnchor(method), new StringContent(name(method))));
methodDocTree.add(heading);
- if ((erasureAnchor = getErasureAnchor(method)) != null) {
- methodDocTree.add(links.createAnchor((erasureAnchor)));
- }
- methodDocTree.add(links.createAnchor(writer.getAnchor(method)));
return HtmlTree.SECTION(HtmlStyle.detail, methodDocTree);
}
@@ -140,23 +138,12 @@
*/
@Override
public Content getSignature(ExecutableElement method) {
- HtmlTree pre = new HtmlTree(HtmlTag.PRE);
- pre.setStyle(HtmlStyle.methodSignature);
- writer.addAnnotationInfo(method, pre);
- int annotationLength = pre.charCount();
- addModifiers(method, pre);
- addTypeParameters(method, pre);
- addReturnType(method, pre);
- if (configuration.linksource) {
- Content methodName = new StringContent(name(method));
- writer.addSrcLink(method, methodName, pre);
- } else {
- addName(name(method), pre);
- }
- int indent = pre.charCount() - annotationLength;
- addParameters(method, pre, indent);
- addExceptions(method, pre, indent);
- return pre;
+ return new MemberSignature(method)
+ .addTypeParameters(getTypeParameters(method))
+ .addReturnType(getReturnType(method))
+ .addParameters(getParameters(method, true))
+ .addExceptions(getExceptions(method))
+ .toContent();
}
/**
@@ -220,9 +207,8 @@
* {@inheritDoc}
*/
@Override
- public Content getMethodDoc(Content methodDocTree,
- boolean isLastContent) {
- return getMemberTree(methodDocTree, isLastContent);
+ public Content getMethodDoc(Content methodDocTree) {
+ return getMemberTree(methodDocTree);
}
/**
@@ -399,19 +385,17 @@
}
/**
- * Add the return type.
+ * Get the return type for the given method.
*
* @param method the method being documented.
- * @param htmltree the content tree to which the return type will be added
+ * @return content containing the return type
*/
- protected void addReturnType(ExecutableElement method, Content htmltree) {
+ protected Content getReturnType(ExecutableElement method) {
TypeMirror type = utils.getReturnType(method);
if (type != null) {
- Content linkContent = writer.getLink(
- new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type));
- htmltree.add(linkContent);
- htmltree.add(Entity.NO_BREAK_SPACE);
+ return writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type));
}
+ return new ContentBuilder();
}
@Override