Skip to content
Permalink
Browse files

8238646: Cleanup signature and use of CommentHelper

Reviewed-by: prappo
  • Loading branch information
jonathan-gibbons committed Feb 10, 2020
1 parent f0cdbbe commit b83285faccfd8975e79fde3b058ae7936a369955
Showing with 127 additions and 127 deletions.
  1. +1 −1 ...jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java
  2. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java
  3. +9 −9 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
  4. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialFieldWriter.java
  5. +6 −6 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java
  6. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java
  7. +8 −8 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java
  8. +1 −1 ...dk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
  9. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ParamTaglet.java
  10. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ReturnTaglet.java
  11. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/SeeTaglet.java
  12. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/SimpleTaglet.java
  13. +4 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ThrowsTaglet.java
  14. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ValueTaglet.java
  15. +87 −87 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/CommentHelper.java
  16. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
@@ -202,7 +202,7 @@ public void addAnnotationTypeDeprecationInfo(Content annotationInfoTree) {
Content div = HtmlTree.DIV(HtmlStyle.deprecationBlock, deprLabel);
if (!deprs.isEmpty()) {

List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
List<? extends DocTree> commentTags = ch.getDescription(deprs.get(0));
if (!commentTags.isEmpty()) {
addInlineDeprecatedComment(annotationType, deprs.get(0), div);
}
@@ -495,7 +495,7 @@ public void addClassDeprecationInfo(Content classInfoTree) {
if (!deprs.isEmpty()) {
CommentHelper ch = utils.getCommentHelper(typeElement);
DocTree dt = deprs.get(0);
List<? extends DocTree> commentTags = ch.getBody(configuration, dt);
List<? extends DocTree> commentTags = ch.getBody(dt);
if (!commentTags.isEmpty()) {
addInlineDeprecatedComment(typeElement, deprs.get(0), div);
}
@@ -1038,22 +1038,22 @@ public Content seeTagToContent(Element element, DocTree see) {
return new RawHtml(seetext);
}
boolean isLinkPlain = kind == LINK_PLAIN;
Content label = plainOrCode(isLinkPlain, new RawHtml(ch.getLabel(configuration, see)));
Content label = plainOrCode(isLinkPlain, new RawHtml(ch.getLabel(see)));

//The text from the @see tag. We will output this text when a label is not specified.
Content text = plainOrCode(kind == LINK_PLAIN, new RawHtml(seetext));

TypeElement refClass = ch.getReferencedClass(configuration, see);
String refClassName = ch.getReferencedClassName(configuration, see);
Element refMem = ch.getReferencedMember(configuration, see);
TypeElement refClass = ch.getReferencedClass(see);
String refClassName = ch.getReferencedClassName(see);
Element refMem = ch.getReferencedMember(see);
String refMemName = ch.getReferencedMemberName(see);

if (refMemName == null && refMem != null) {
refMemName = refMem.toString();
}
if (refClass == null) {
//@see is not referencing an included class
PackageElement refPackage = ch.getReferencedPackage(configuration, see);
PackageElement refPackage = ch.getReferencedPackage(see);
if (refPackage != null && utils.isIncluded(refPackage)) {
//@see is referencing an included package
if (label.isEmpty())
@@ -1169,7 +1169,7 @@ private Content plainOrCode(boolean plain, Content body) {
*/
public void addInlineComment(Element element, DocTree tag, Content htmltree) {
CommentHelper ch = utils.getCommentHelper(element);
List<? extends DocTree> description = ch.getDescription(configuration, tag);
List<? extends DocTree> description = ch.getDescription(tag);
addCommentTags(element, tag, description, false, false, false, htmltree);
}

@@ -1194,7 +1194,7 @@ public Content getDeprecatedPhrase(Element e) {
*/
public void addInlineDeprecatedComment(Element e, DocTree tag, Content htmltree) {
CommentHelper ch = utils.getCommentHelper(e);
addCommentTags(e, ch.getBody(configuration, tag), true, false, false, htmltree);
addCommentTags(e, ch.getBody(tag), true, false, false, htmltree);
}

/**
@@ -1220,8 +1220,8 @@ public void addSummaryComment(Element element, List<? extends DocTree> firstSent

public void addSummaryDeprecatedComment(Element element, DocTree tag, Content htmltree) {
CommentHelper ch = utils.getCommentHelper(element);
List<? extends DocTree> body = ch.getBody(configuration, tag);
addCommentTags(element, ch.getFirstSentenceTrees(configuration, body), true, true, true, htmltree);
List<? extends DocTree> body = ch.getBody(tag);
addCommentTags(element, ch.getFirstSentenceTrees(body), true, true, true, htmltree);
}

/**
@@ -180,7 +180,7 @@ public void addMemberDescription(VariableElement field, Content contentTree) {
@Override
public void addMemberDescription(VariableElement field, DocTree serialFieldTag, Content contentTree) {
CommentHelper ch = utils.getCommentHelper(field);
List<? extends DocTree> description = ch.getDescription(configuration, serialFieldTag);
List<? extends DocTree> description = ch.getDescription(serialFieldTag);
if (!description.isEmpty()) {
Content serialFieldContent = new RawHtml(ch.getText(description));
Content div = HtmlTree.DIV(HtmlStyle.block, serialFieldContent);
@@ -375,16 +375,16 @@ public void computeModulesData() {
});
// Generate the map of all services listed using @provides, and the description.
(utils.getBlockTags(mdle, DocTree.Kind.PROVIDES)).forEach((tree) -> {
TypeElement t = ch.getServiceType(configuration, tree);
TypeElement t = ch.getServiceType(tree);
if (t != null) {
providesTrees.put(t, commentTagsToContent(tree, mdle, ch.getDescription(configuration, tree), false, true));
providesTrees.put(t, commentTagsToContent(tree, mdle, ch.getDescription(tree), false, true));
}
});
// Generate the map of all services listed using @uses, and the description.
(utils.getBlockTags(mdle, DocTree.Kind.USES)).forEach((tree) -> {
TypeElement t = ch.getServiceType(configuration, tree);
TypeElement t = ch.getServiceType(tree);
if (t != null) {
usesTrees.put(t, commentTagsToContent(tree, mdle, ch.getDescription(configuration, tree), false, true));
usesTrees.put(t, commentTagsToContent(tree, mdle, ch.getDescription(tree), false, true));
}
});
}
@@ -827,7 +827,7 @@ public void addDeprecationInfo(Content div) {
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(mdle));
deprDiv.add(deprPhrase);
if (!deprs.isEmpty()) {
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
List<? extends DocTree> commentTags = ch.getDescription(deprs.get(0));
if (!commentTags.isEmpty()) {
addInlineDeprecatedComment(mdle, deprs.get(0), deprDiv);
}
@@ -892,7 +892,7 @@ public void addPackageDeprecationInfo(Content li, PackageElement pkg) {
deprDiv.add(deprPhrase);
if (!deprs.isEmpty()) {
CommentHelper ch = utils.getCommentHelper(pkg);
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
List<? extends DocTree> commentTags = ch.getDescription(deprs.get(0));
if (!commentTags.isEmpty()) {
addInlineDeprecatedComment(pkg, deprs.get(0), deprDiv);
}
@@ -153,7 +153,7 @@ public void addDeprecationInfo(Content div) {
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(packageElement));
deprDiv.add(deprPhrase);
if (!deprs.isEmpty()) {
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
List<? extends DocTree> commentTags = ch.getDescription(deprs.get(0));
if (!commentTags.isEmpty()) {
addInlineDeprecatedComment(packageElement, deprs.get(0), deprDiv);
}
@@ -139,7 +139,7 @@ public Content deprecatedTagOutput(Element element) {
result.add(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
htmlWriter.getDeprecatedPhrase(element)));
if (!deprs.isEmpty()) {
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
List<? extends DocTree> commentTags = ch.getDescription(deprs.get(0));
if (!commentTags.isEmpty()) {
result.add(commentTagsToOutput(null, element, commentTags, false));
}
@@ -150,7 +150,7 @@ public Content deprecatedTagOutput(Element element) {
result.add(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
htmlWriter.getDeprecatedPhrase(element)));
if (!deprs.isEmpty()) {
List<? extends DocTree> bodyTags = ch.getBody(configuration, deprs.get(0));
List<? extends DocTree> bodyTags = ch.getBody(deprs.get(0));
Content body = commentTagsToOutput(null, element, bodyTags, false);
if (!body.isEmpty())
result.add(HtmlTree.DIV(HtmlStyle.deprecationComment, body));
@@ -191,7 +191,7 @@ public Content paramTagOutput(Element element, DocTree paramTag, String paramNam
Content nameTree = new StringContent(paramName);
body.add(HtmlTree.CODE(defineID ? HtmlTree.SPAN_ID("param-" + paramName, nameTree) : nameTree));
body.add(" - ");
List<? extends DocTree> description = ch.getDescription(configuration, paramTag);
List<? extends DocTree> description = ch.getDescription(paramTag);
body.add(htmlWriter.commentTagsToContent(paramTag, element, description, false, inSummary));
return HtmlTree.DD(body);
}
@@ -215,7 +215,7 @@ public Content returnTagOutput(Element element, DocTree returnTag) {
result.add(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.returnLabel,
new StringContent(resources.getText("doclet.Returns")))));
result.add(HtmlTree.DD(htmlWriter.commentTagsToContent(
returnTag, element, ch.getDescription(configuration, returnTag), false, inSummary)));
returnTag, element, ch.getDescription(returnTag), false, inSummary)));
return result;
}

@@ -279,7 +279,7 @@ public Content simpleTagOutput(Element element, List<? extends DocTree> simpleTa
if (many) {
body.add(", ");
}
List<? extends DocTree> bodyTags = ch.getBody(configuration, simpleTag);
List<? extends DocTree> bodyTags = ch.getBody(simpleTag);
body.add(htmlWriter.commentTagsToContent(simpleTag, element, bodyTags, false, inSummary));
many = true;
}
@@ -292,7 +292,7 @@ public Content simpleTagOutput(Element element, DocTree simpleTag, String header
ContentBuilder result = new ContentBuilder();
result.add(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.simpleTagLabel, new RawHtml(header))));
CommentHelper ch = utils.getCommentHelper(element);
List<? extends DocTree> description = ch.getDescription(configuration, simpleTag);
List<? extends DocTree> description = ch.getDescription(simpleTag);
Content body = htmlWriter.commentTagsToContent(simpleTag, element, description, false, inSummary);
result.add(HtmlTree.DD(body));
return result;
@@ -317,7 +317,7 @@ public Content getThrowsHeader() {
public Content throwsTagOutput(Element element, DocTree throwsTag, TypeMirror substituteType) {
ContentBuilder body = new ContentBuilder();
CommentHelper ch = utils.getCommentHelper(element);
Element exception = ch.getException(configuration, throwsTag);
Element exception = ch.getException(throwsTag);
Content excName;
if (substituteType != null) {
excName = htmlWriter.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER,
@@ -333,7 +333,7 @@ public Content throwsTagOutput(Element element, DocTree throwsTag, TypeMirror su
excName = htmlWriter.getLink(link);
}
body.add(HtmlTree.CODE(excName));
List<? extends DocTree> description = ch.getDescription(configuration, throwsTag);
List<? extends DocTree> description = ch.getDescription(throwsTag);
Content desc = htmlWriter.commentTagsToContent(throwsTag, element, description, false, inSummary);
if (desc != null && !desc.isEmpty()) {
body.add(" - ");
@@ -482,7 +482,7 @@ protected void buildSerialFieldTagsInfo(Content serializableFieldsTree) {
if (tag.getName() == null || tag.getType() == null) // ignore malformed @serialField tags
continue;
Content fieldsContentTree = fieldWriter.getFieldsContentHeader(tag.equals(tags.last()));
TypeElement te = ch.getReferencedClass(configuration, tag);
TypeElement te = ch.getReferencedClass(tag);
String fieldType = ch.getReferencedMemberName(tag);
if (te != null && utils.isPrimitive(te.asType())) {
fieldType = utils.getTypeName(te.asType(), false);
@@ -126,7 +126,7 @@ public void inherit(DocFinder.Input input, DocFinder.Output output) {
if (rankMap.containsKey(paramName) && rankMap.get(paramName).equals((input.tagId))) {
output.holder = input.element;
output.holderTag = tag;
output.inlineTags = ch.getBody(utils.configuration, tag);
output.inlineTags = ch.getBody(tag);
return;
}
}
@@ -64,8 +64,8 @@ public void inherit(DocFinder.Input input, DocFinder.Output output) {
output.holder = input.element;
output.holderTag = tags.get(0);
output.inlineTags = input.isFirstSentence
? ch.getFirstSentenceTrees(input.utils.configuration, output.holderTag)
: ch.getDescription(input.utils.configuration, output.holderTag);
? ch.getFirstSentenceTrees(output.holderTag)
: ch.getDescription(output.holderTag);
}
}

@@ -60,7 +60,7 @@ public void inherit(DocFinder.Input input, DocFinder.Output output) {
output.holder = input.element;
output.holderTag = tags.get(0);
output.inlineTags = input.isFirstSentence
? ch.getFirstSentenceTrees(input.utils.configuration, output.holderTag)
? ch.getFirstSentenceTrees(output.holderTag)
: ch.getReference(output.holderTag);
}
}
@@ -173,8 +173,8 @@ public void inherit(DocFinder.Input input, DocFinder.Output output) {
output.holderTag = tags.get(0);
CommentHelper ch = input.utils.getCommentHelper(output.holder);
output.inlineTags = input.isFirstSentence
? ch.getFirstSentenceTrees(input.utils.configuration, output.holderTag)
: ch.getTags(input.utils.configuration, output.holderTag);
? ch.getFirstSentenceTrees(output.holderTag)
: ch.getTags(output.holderTag);
}
}

@@ -72,7 +72,7 @@ public void inherit(DocFinder.Input input, DocFinder.Output output) {
Element exception;
CommentHelper ch = utils.getCommentHelper(input.element);
if (input.tagId == null) {
exception = ch.getException(utils.configuration, input.docTreeInfo.docTree);
exception = ch.getException(input.docTreeInfo.docTree);
input.tagId = exception == null
? ch.getExceptionName(input.docTreeInfo.docTree).getSignature()
: utils.getFullyQualifiedName(exception);
@@ -81,12 +81,12 @@ public void inherit(DocFinder.Input input, DocFinder.Output output) {
}

for (DocTree dt : input.utils.getThrowsTrees(input.element)) {
Element exc = ch.getException(utils.configuration, dt);
Element exc = ch.getException(dt);
if (exc != null && (input.tagId.equals(utils.getSimpleName(exc)) ||
(input.tagId.equals(utils.getFullyQualifiedName(exc))))) {
output.holder = input.element;
output.holderTag = dt;
output.inlineTags = ch.getBody(input.utils.configuration, output.holderTag);
output.inlineTags = ch.getBody(output.holderTag);
output.tagList.add(dt);
} else if (exception != null && exc != null &&
utils.isTypeElement(exc) && utils.isTypeElement(exception) &&
@@ -193,7 +193,7 @@ protected Content throwsTagsOutput(Map<List<? extends DocTree>, ExecutableElemen
CommentHelper ch = utils.getCommentHelper(entry.getValue());
Element e = entry.getValue();
for (DocTree dt : entry.getKey()) {
Element te = ch.getException(utils.configuration, dt);
Element te = ch.getException(dt);
String excName = ch.getExceptionName(dt).toString();
TypeMirror substituteType = typeSubstitutions.get(excName);
if ((!allowDuplicates) &&
@@ -77,7 +77,7 @@ private VariableElement getVariableElement(Element holder, BaseConfiguration con

Element e = signature == null
? holder
: ch.getReferencedMember(config, tag);
: ch.getReferencedMember(tag);

return (e != null && config.utils.isVariableElement(e))
? (VariableElement) e

0 comments on commit b83285f

Please sign in to comment.