8149139: [javadoc] Modify Content to accept CharSequence
Reviewed-by: jjg
This commit is contained in:
parent
19e4c51157
commit
0bca52a908
@ -104,11 +104,11 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
|
|||||||
sb.append(utils.getFullyQualifiedName(member));
|
sb.append(utils.getFullyQualifiedName(member));
|
||||||
if (!utils.isConstructor(member)) {
|
if (!utils.isConstructor(member)) {
|
||||||
sb.append(".");
|
sb.append(".");
|
||||||
sb.append(member.getSimpleName().toString());
|
sb.append(member.getSimpleName());
|
||||||
}
|
}
|
||||||
sb.append(utils.flatSignature((ExecutableElement) member));
|
sb.append(utils.flatSignature((ExecutableElement) member));
|
||||||
|
|
||||||
return writer.getDocLink(MEMBER, member, sb.toString());
|
return writer.getDocLink(MEMBER, member, sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -204,7 +204,7 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
|
|||||||
htmltree.addContent("(");
|
htmltree.addContent("(");
|
||||||
String sep = "";
|
String sep = "";
|
||||||
List<? extends VariableElement> parameters = member.getParameters();
|
List<? extends VariableElement> parameters = member.getParameters();
|
||||||
String indent = makeSpace(indentSize + 1);
|
CharSequence indent = makeSpace(indentSize + 1);
|
||||||
TypeMirror rcvrType = member.getReceiverType();
|
TypeMirror rcvrType = member.getReceiverType();
|
||||||
if (includeAnnotations && rcvrType != null && utils.isAnnotated(rcvrType)) {
|
if (includeAnnotations && rcvrType != null && utils.isAnnotated(rcvrType)) {
|
||||||
List<? extends AnnotationMirror> annotationMirrors = rcvrType.getAnnotationMirrors();
|
List<? extends AnnotationMirror> annotationMirrors = rcvrType.getAnnotationMirrors();
|
||||||
@ -260,7 +260,7 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
|
|||||||
protected void addExceptions(ExecutableElement member, Content htmltree, int indentSize) {
|
protected void addExceptions(ExecutableElement member, Content htmltree, int indentSize) {
|
||||||
List<? extends TypeMirror> exceptions = member.getThrownTypes();
|
List<? extends TypeMirror> exceptions = member.getThrownTypes();
|
||||||
if (!exceptions.isEmpty()) {
|
if (!exceptions.isEmpty()) {
|
||||||
String indent = makeSpace(indentSize + 1 - 7);
|
CharSequence indent = makeSpace(indentSize + 1 - 7);
|
||||||
htmltree.addContent(DocletConstants.NL);
|
htmltree.addContent(DocletConstants.NL);
|
||||||
htmltree.addContent(indent);
|
htmltree.addContent(indent);
|
||||||
htmltree.addContent("throws ");
|
htmltree.addContent("throws ");
|
||||||
@ -336,7 +336,7 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
|
|||||||
|
|
||||||
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
||||||
protected Boolean defaultAction(TypeMirror e, Void p) {
|
protected Boolean defaultAction(TypeMirror e, Void p) {
|
||||||
buf.append(e.toString());
|
buf.append(e);
|
||||||
return foundTypeVariable;
|
return foundTypeVariable;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -223,26 +223,6 @@ public abstract class AbstractMemberWriter {
|
|||||||
htmltree.addContent(name);
|
htmltree.addContent(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String typeString(Element member) {
|
|
||||||
return new SimpleElementVisitor9<String, Void>() {
|
|
||||||
|
|
||||||
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
|
||||||
public String visitExecutable(ExecutableElement e, Void p) {
|
|
||||||
return utils.isMethod(e) ? e.getReturnType().toString() : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
|
||||||
public String visitVariable(VariableElement e, Void p) {
|
|
||||||
return e.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
|
||||||
protected String defaultAction(Element e, Void p) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}.visit(member);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the modifier for the member. The modifiers are ordered as specified
|
* Add the modifier for the member. The modifiers are ordered as specified
|
||||||
* by <em>The Java Language Specification</em>.
|
* by <em>The Java Language Specification</em>.
|
||||||
@ -282,7 +262,7 @@ public abstract class AbstractMemberWriter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String makeSpace(int len) {
|
protected CharSequence makeSpace(int len) {
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -290,7 +270,7 @@ public abstract class AbstractMemberWriter {
|
|||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
sb.append(' ');
|
sb.append(' ');
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -199,8 +199,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
|||||||
Content classPackageLabel = HtmlTree.SPAN(HtmlStyle.packageLabelInClass, packageLabel);
|
Content classPackageLabel = HtmlTree.SPAN(HtmlStyle.packageLabelInClass, packageLabel);
|
||||||
Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classPackageLabel);
|
Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classPackageLabel);
|
||||||
pkgNameDiv.addContent(getSpace());
|
pkgNameDiv.addContent(getSpace());
|
||||||
Content pkgNameContent = getPackageLink(pkg,
|
Content pkgNameContent = getPackageLink(pkg, new StringContent(pkg.getQualifiedName()));
|
||||||
new StringContent(pkg.getQualifiedName().toString()));
|
|
||||||
pkgNameDiv.addContent(pkgNameContent);
|
pkgNameDiv.addContent(pkgNameContent);
|
||||||
div.addContent(pkgNameDiv);
|
div.addContent(pkgNameDiv);
|
||||||
}
|
}
|
||||||
@ -395,10 +394,10 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
|||||||
new LinkInfoImpl(configuration, LinkInfoImpl.Kind.TREE,
|
new LinkInfoImpl(configuration, LinkInfoImpl.Kind.TREE,
|
||||||
typeElement));
|
typeElement));
|
||||||
if (configuration.shouldExcludeQualifier(utils.containingPackage(typeElement).toString())) {
|
if (configuration.shouldExcludeQualifier(utils.containingPackage(typeElement).toString())) {
|
||||||
li.addContent(utils.asTypeElement(type).getSimpleName().toString());
|
li.addContent(utils.asTypeElement(type).getSimpleName());
|
||||||
li.addContent(typeParameters);
|
li.addContent(typeParameters);
|
||||||
} else {
|
} else {
|
||||||
li.addContent(utils.asTypeElement(type).getQualifiedName().toString());
|
li.addContent(utils.asTypeElement(type).getQualifiedName());
|
||||||
li.addContent(typeParameters);
|
li.addContent(typeParameters);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -244,7 +244,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
|
|||||||
PackageElement enclosingPackage = utils.containingPackage(typeElement);
|
PackageElement enclosingPackage = utils.containingPackage(typeElement);
|
||||||
if (!enclosingPackage.isUnnamed()) {
|
if (!enclosingPackage.isUnnamed()) {
|
||||||
Content cb = new ContentBuilder();
|
Content cb = new ContentBuilder();
|
||||||
cb.addContent(enclosingPackage.getQualifiedName().toString());
|
cb.addContent(enclosingPackage.getQualifiedName());
|
||||||
cb.addContent(".");
|
cb.addContent(".");
|
||||||
cb.addContent(classlink);
|
cb.addContent(classlink);
|
||||||
return getClassName(cb);
|
return getClassName(cb);
|
||||||
@ -332,7 +332,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
|
|||||||
*/
|
*/
|
||||||
private Content getNameColumn(VariableElement member) {
|
private Content getNameColumn(VariableElement member) {
|
||||||
Content nameContent = getDocLink(LinkInfoImpl.Kind.CONSTANT_SUMMARY,
|
Content nameContent = getDocLink(LinkInfoImpl.Kind.CONSTANT_SUMMARY,
|
||||||
member, member.getSimpleName().toString(), false);
|
member, member.getSimpleName(), false);
|
||||||
Content code = HtmlTree.CODE(nameContent);
|
Content code = HtmlTree.CODE(nameContent);
|
||||||
return HtmlTree.TD(code);
|
return HtmlTree.TD(code);
|
||||||
}
|
}
|
||||||
|
@ -166,6 +166,8 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
|
|
||||||
HtmlTree fixedNavDiv = new HtmlTree(HtmlTag.DIV);
|
HtmlTree fixedNavDiv = new HtmlTree(HtmlTag.DIV);
|
||||||
|
|
||||||
|
final static Pattern IMPROPER_HTML_CHARS = Pattern.compile(".*[&<>].*");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor to construct the HtmlStandardWriter object.
|
* Constructor to construct the HtmlStandardWriter object.
|
||||||
*
|
*
|
||||||
@ -945,7 +947,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
public Content getPackageName(PackageElement packageElement) {
|
public Content getPackageName(PackageElement packageElement) {
|
||||||
return packageElement == null || packageElement.isUnnamed()
|
return packageElement == null || packageElement.isUnnamed()
|
||||||
? defaultPackageLabel
|
? defaultPackageLabel
|
||||||
: getPackageLabel(packageElement.getQualifiedName().toString());
|
: getPackageLabel(packageElement.getQualifiedName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -954,7 +956,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
* @param packageName the package name
|
* @param packageName the package name
|
||||||
* @return the package name content
|
* @return the package name content
|
||||||
*/
|
*/
|
||||||
public Content getPackageLabel(String packageName) {
|
public Content getPackageLabel(CharSequence packageName) {
|
||||||
return new StringContent(packageName);
|
return new StringContent(packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1038,7 +1040,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
* @param label the label for the link.
|
* @param label the label for the link.
|
||||||
* @return a content tree for the package link.
|
* @return a content tree for the package link.
|
||||||
*/
|
*/
|
||||||
public Content getPackageLink(PackageElement packageElement, String label) {
|
public Content getPackageLink(PackageElement packageElement, CharSequence label) {
|
||||||
return getPackageLink(packageElement, new StringContent(label));
|
return getPackageLink(packageElement, new StringContent(label));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1081,7 +1083,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
|
|
||||||
public Content interfaceName(TypeElement typeElement, boolean qual) {
|
public Content interfaceName(TypeElement typeElement, boolean qual) {
|
||||||
Content name = new StringContent((qual)
|
Content name = new StringContent((qual)
|
||||||
? typeElement.getQualifiedName().toString()
|
? typeElement.getQualifiedName()
|
||||||
: utils.getSimpleName(typeElement));
|
: utils.getSimpleName(typeElement));
|
||||||
return (utils.isInterface(typeElement)) ? HtmlTree.SPAN(HtmlStyle.interfaceName, name) : name;
|
return (utils.isInterface(typeElement)) ? HtmlTree.SPAN(HtmlStyle.interfaceName, name) : name;
|
||||||
}
|
}
|
||||||
@ -1279,7 +1281,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
* @param label the label for the link
|
* @param label the label for the link
|
||||||
* @return a content tree for the element link
|
* @return a content tree for the element link
|
||||||
*/
|
*/
|
||||||
public Content getDocLink(LinkInfoImpl.Kind context, Element element, String label) {
|
public Content getDocLink(LinkInfoImpl.Kind context, Element element, CharSequence label) {
|
||||||
return getDocLink(context, utils.getEnclosingTypeElement(element), element,
|
return getDocLink(context, utils.getEnclosingTypeElement(element), element,
|
||||||
new StringContent(label));
|
new StringContent(label));
|
||||||
}
|
}
|
||||||
@ -1293,7 +1295,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
* @param strong true if the link should be strong.
|
* @param strong true if the link should be strong.
|
||||||
* @return the link for the given member.
|
* @return the link for the given member.
|
||||||
*/
|
*/
|
||||||
public Content getDocLink(LinkInfoImpl.Kind context, Element element, String label,
|
public Content getDocLink(LinkInfoImpl.Kind context, Element element, CharSequence label,
|
||||||
boolean strong) {
|
boolean strong) {
|
||||||
return getDocLink(context, utils.getEnclosingTypeElement(element), element, label, strong);
|
return getDocLink(context, utils.getEnclosingTypeElement(element), element, label, strong);
|
||||||
}
|
}
|
||||||
@ -1311,7 +1313,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
* @return the link for the given member.
|
* @return the link for the given member.
|
||||||
*/
|
*/
|
||||||
public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element,
|
public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element,
|
||||||
String label, boolean strong) {
|
CharSequence label, boolean strong) {
|
||||||
return getDocLink(context, typeElement, element, label, strong, false);
|
return getDocLink(context, typeElement, element, label, strong, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1334,13 +1336,14 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
* @return the link for the given member.
|
* @return the link for the given member.
|
||||||
*/
|
*/
|
||||||
public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element,
|
public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element,
|
||||||
String label, boolean strong, boolean isProperty) {
|
CharSequence label, boolean strong, boolean isProperty) {
|
||||||
return getDocLink(context, typeElement, element, new StringContent(check(label)), strong, isProperty);
|
return getDocLink(context, typeElement, element, new StringContent(check(label)), strong, isProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
String check(String s) {
|
CharSequence check(CharSequence s) {
|
||||||
if (s.matches(".*[&<>].*")) {
|
Matcher m = IMPROPER_HTML_CHARS.matcher(s);
|
||||||
throw new IllegalArgumentException(s);
|
if (m.matches()) {
|
||||||
|
throw new IllegalArgumentException(s.toString());
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -1426,7 +1429,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
|
|
||||||
CommentHelper ch = utils.getCommentHelper(element);
|
CommentHelper ch = utils.getCommentHelper(element);
|
||||||
String tagName = ch.getTagName(see);
|
String tagName = ch.getTagName(see);
|
||||||
String seetext = replaceDocRootDir(utils.normalizeNewlines(ch.getText(see)));
|
String seetext = replaceDocRootDir(utils.normalizeNewlines(ch.getText(see)).toString());
|
||||||
// Check if @see is an href or "string"
|
// Check if @see is an href or "string"
|
||||||
if (seetext.startsWith("<") || seetext.startsWith("\"")) {
|
if (seetext.startsWith("<") || seetext.startsWith("\"")) {
|
||||||
return new RawHtml(seetext);
|
return new RawHtml(seetext);
|
||||||
@ -1452,7 +1455,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
//@see is referencing an included package
|
//@see is referencing an included package
|
||||||
if (label.isEmpty())
|
if (label.isEmpty())
|
||||||
label = plainOrCode(isLinkPlain,
|
label = plainOrCode(isLinkPlain,
|
||||||
new StringContent(refPackage.getQualifiedName().toString()));
|
new StringContent(refPackage.getQualifiedName()));
|
||||||
return getPackageLink(refPackage, label);
|
return getPackageLink(refPackage, label);
|
||||||
} else {
|
} else {
|
||||||
// @see is not referencing an included class or package. Check for cross links.
|
// @see is not referencing an included class or package. Check for cross links.
|
||||||
@ -1695,7 +1698,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
|
|
||||||
final Content result = new ContentBuilder() {
|
final Content result = new ContentBuilder() {
|
||||||
@Override
|
@Override
|
||||||
public void addContent(String text) {
|
public void addContent(CharSequence text) {
|
||||||
super.addContent(utils.normalizeNewlines(text));
|
super.addContent(utils.normalizeNewlines(text));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1741,7 +1744,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
public Boolean visitAttribute(AttributeTree node, Content c) {
|
public Boolean visitAttribute(AttributeTree node, Content c) {
|
||||||
StringBuilder sb = new StringBuilder(SPACER).append(node.getName());
|
StringBuilder sb = new StringBuilder(SPACER).append(node.getName());
|
||||||
if (node.getValueKind() == ValueKind.EMPTY) {
|
if (node.getValueKind() == ValueKind.EMPTY) {
|
||||||
result.addContent(sb.toString());
|
result.addContent(sb);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sb.append("=");
|
sb.append("=");
|
||||||
@ -1758,7 +1761,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sb.append(quote);
|
sb.append(quote);
|
||||||
result.addContent(sb.toString());
|
result.addContent(sb);
|
||||||
Content docRootContent = new ContentBuilder();
|
Content docRootContent = new ContentBuilder();
|
||||||
|
|
||||||
for (DocTree dt : node.getValue()) {
|
for (DocTree dt : node.getValue()) {
|
||||||
@ -1767,16 +1770,15 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
if (text.startsWith("/..") && !configuration.docrootparent.isEmpty()) {
|
if (text.startsWith("/..") && !configuration.docrootparent.isEmpty()) {
|
||||||
result.addContent(configuration.docrootparent);
|
result.addContent(configuration.docrootparent);
|
||||||
docRootContent = new ContentBuilder();
|
docRootContent = new ContentBuilder();
|
||||||
text = textCleanup(text.substring(3), isLast(node));
|
result.addContent(textCleanup(text.substring(3), isLast(node)));
|
||||||
} else {
|
} else {
|
||||||
if (!docRootContent.isEmpty()) {
|
if (!docRootContent.isEmpty()) {
|
||||||
docRootContent = copyDocRootContent(docRootContent);
|
docRootContent = copyDocRootContent(docRootContent);
|
||||||
} else {
|
} else {
|
||||||
text = redirectRelativeLinks(element, (TextTree) dt);
|
text = redirectRelativeLinks(element, (TextTree) dt);
|
||||||
}
|
}
|
||||||
text = textCleanup(text, isLast(node));
|
result.addContent(textCleanup(text, isLast(node)));
|
||||||
}
|
}
|
||||||
result.addContent(text);
|
|
||||||
} else {
|
} else {
|
||||||
docRootContent = copyDocRootContent(docRootContent);
|
docRootContent = copyDocRootContent(docRootContent);
|
||||||
dt.accept(this, docRootContent);
|
dt.accept(this, docRootContent);
|
||||||
@ -1889,8 +1891,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
@Override @DefinedBy(Api.COMPILER_TREE)
|
@Override @DefinedBy(Api.COMPILER_TREE)
|
||||||
public Boolean visitStartElement(StartElementTree node, Content c) {
|
public Boolean visitStartElement(StartElementTree node, Content c) {
|
||||||
String text = "<" + node.getName();
|
String text = "<" + node.getName();
|
||||||
text = utils.normalizeNewlines(text);
|
RawHtml rawHtml = new RawHtml(utils.normalizeNewlines(text));
|
||||||
RawHtml rawHtml = new RawHtml(text);
|
|
||||||
result.addContent(rawHtml);
|
result.addContent(rawHtml);
|
||||||
|
|
||||||
for (DocTree dt : node.getAttributes()) {
|
for (DocTree dt : node.getAttributes()) {
|
||||||
@ -1900,11 +1901,11 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String textCleanup(String text, boolean isLast) {
|
private CharSequence textCleanup(String text, boolean isLast) {
|
||||||
return textCleanup(text, isLast, false);
|
return textCleanup(text, isLast, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String textCleanup(String text, boolean isLast, boolean trimLeader) {
|
private CharSequence textCleanup(String text, boolean isLast, boolean trimLeader) {
|
||||||
if (trimLeader) {
|
if (trimLeader) {
|
||||||
text = removeLeadingWhitespace(text);
|
text = removeLeadingWhitespace(text);
|
||||||
}
|
}
|
||||||
@ -1912,16 +1913,14 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
text = removeTrailingWhitespace(text);
|
text = removeTrailingWhitespace(text);
|
||||||
}
|
}
|
||||||
text = utils.replaceTabs(text);
|
text = utils.replaceTabs(text);
|
||||||
text = utils.normalizeNewlines(text);
|
return utils.normalizeNewlines(text);
|
||||||
return text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @DefinedBy(Api.COMPILER_TREE)
|
@Override @DefinedBy(Api.COMPILER_TREE)
|
||||||
public Boolean visitText(TextTree node, Content c) {
|
public Boolean visitText(TextTree node, Content c) {
|
||||||
String text = node.getBody();
|
String text = node.getBody();
|
||||||
text = textCleanup(text, isLast(node), commentRemoved);
|
result.addContent(new RawHtml(textCleanup(text, isLast(node), commentRemoved)));
|
||||||
commentRemoved = false;
|
commentRemoved = false;
|
||||||
result.addContent(new RawHtml(text));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2358,7 +2357,8 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
private void addAnnotations(TypeElement annotationDoc, LinkInfoImpl linkInfo,
|
private void addAnnotations(TypeElement annotationDoc, LinkInfoImpl linkInfo,
|
||||||
ContentBuilder annotation, Map<? extends ExecutableElement,? extends AnnotationValue>map,
|
ContentBuilder annotation, Map<? extends ExecutableElement,? extends AnnotationValue>map,
|
||||||
int indent, boolean linkBreak) {
|
int indent, boolean linkBreak) {
|
||||||
linkInfo.label = new StringContent("@" + annotationDoc.getSimpleName().toString());
|
linkInfo.label = new StringContent("@");
|
||||||
|
linkInfo.label.addContent(annotationDoc.getSimpleName());
|
||||||
annotation.addContent(getLink(linkInfo));
|
annotation.addContent(getLink(linkInfo));
|
||||||
if (!map.isEmpty()) {
|
if (!map.isEmpty()) {
|
||||||
annotation.addContent("(");
|
annotation.addContent("(");
|
||||||
@ -2372,7 +2372,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
annotation.addContent(",");
|
annotation.addContent(",");
|
||||||
if (linkBreak) {
|
if (linkBreak) {
|
||||||
annotation.addContent(DocletConstants.NL);
|
annotation.addContent(DocletConstants.NL);
|
||||||
int spaces = annotationDoc.getSimpleName().toString().length() + 2;
|
int spaces = annotationDoc.getSimpleName().length() + 2;
|
||||||
for (int k = 0; k < (spaces + indent); k++) {
|
for (int k = 0; k < (spaces + indent); k++) {
|
||||||
annotation.addContent(" ");
|
annotation.addContent(" ");
|
||||||
}
|
}
|
||||||
@ -2496,7 +2496,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
||||||
public Content visitEnumConstant(VariableElement c, Void p) {
|
public Content visitEnumConstant(VariableElement c, Void p) {
|
||||||
return getDocLink(LinkInfoImpl.Kind.ANNOTATION,
|
return getDocLink(LinkInfoImpl.Kind.ANNOTATION,
|
||||||
c, c.getSimpleName().toString(), false);
|
c, c.getSimpleName(), false);
|
||||||
}
|
}
|
||||||
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
||||||
public Content visitArray(List<? extends AnnotationValue> vals, Void p) {
|
public Content visitArray(List<? extends AnnotationValue> vals, Void p) {
|
||||||
|
@ -294,7 +294,7 @@ public class LinkInfoImpl extends LinkInfo {
|
|||||||
* Set the label for the link.
|
* Set the label for the link.
|
||||||
* @param label plain-text label for the link
|
* @param label plain-text label for the link
|
||||||
*/
|
*/
|
||||||
public LinkInfoImpl label(String label) {
|
public LinkInfoImpl label(CharSequence label) {
|
||||||
this.label = new StringContent(label);
|
this.label = new StringContent(label);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -356,11 +356,10 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
|||||||
Content overriddenTypeLink =
|
Content overriddenTypeLink =
|
||||||
writer.getLink(new LinkInfoImpl(writer.configuration, context, overriddenType));
|
writer.getLink(new LinkInfoImpl(writer.configuration, context, overriddenType));
|
||||||
Content codeOverridenTypeLink = HtmlTree.CODE(overriddenTypeLink);
|
Content codeOverridenTypeLink = HtmlTree.CODE(overriddenTypeLink);
|
||||||
String name = method.getSimpleName().toString();
|
|
||||||
Content methlink = writer.getLink(
|
Content methlink = writer.getLink(
|
||||||
new LinkInfoImpl(writer.configuration, LinkInfoImpl.Kind.MEMBER,
|
new LinkInfoImpl(writer.configuration, LinkInfoImpl.Kind.MEMBER,
|
||||||
holder)
|
holder)
|
||||||
.where(writer.getName(writer.getAnchor(method))).label(name));
|
.where(writer.getName(writer.getAnchor(method))).label(method.getSimpleName()));
|
||||||
Content codeMethLink = HtmlTree.CODE(methlink);
|
Content codeMethLink = HtmlTree.CODE(methlink);
|
||||||
Content dd = HtmlTree.DD(codeMethLink);
|
Content dd = HtmlTree.DD(codeMethLink);
|
||||||
dd.addContent(writer.getSpace());
|
dd.addContent(writer.getSpace());
|
||||||
@ -395,7 +394,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
|||||||
dl.addContent(dt);
|
dl.addContent(dt);
|
||||||
Content methlink = writer.getDocLink(
|
Content methlink = writer.getDocLink(
|
||||||
LinkInfoImpl.Kind.MEMBER, implementedMeth,
|
LinkInfoImpl.Kind.MEMBER, implementedMeth,
|
||||||
implementedMeth.getSimpleName().toString(), false);
|
implementedMeth.getSimpleName(), false);
|
||||||
Content codeMethLink = HtmlTree.CODE(methlink);
|
Content codeMethLink = HtmlTree.CODE(methlink);
|
||||||
Content dd = HtmlTree.DD(codeMethLink);
|
Content dd = HtmlTree.DD(codeMethLink);
|
||||||
dd.addContent(writer.getSpace());
|
dd.addContent(writer.getSpace());
|
||||||
|
@ -123,7 +123,7 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
|
|||||||
packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME,
|
packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME,
|
||||||
packageLabel, "", "packageFrame");
|
packageLabel, "", "packageFrame");
|
||||||
} else {
|
} else {
|
||||||
packageLabel = getPackageLabel(pe.getQualifiedName().toString());
|
packageLabel = getPackageLabel(pe.getQualifiedName());
|
||||||
packageLinkContent = getHyperLink(pathString(pe,
|
packageLinkContent = getHyperLink(pathString(pe,
|
||||||
DocPaths.PACKAGE_FRAME), packageLabel, "",
|
DocPaths.PACKAGE_FRAME), packageLabel, "",
|
||||||
"packageFrame");
|
"packageFrame");
|
||||||
|
@ -158,7 +158,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter
|
|||||||
writer.getDocLink(LinkInfoImpl.Kind.PROPERTY_COPY,
|
writer.getDocLink(LinkInfoImpl.Kind.PROPERTY_COPY,
|
||||||
holder, property,
|
holder, property,
|
||||||
utils.isIncluded(holder)
|
utils.isIncluded(holder)
|
||||||
? holder.toString() : utils.getFullyQualifiedName(holder),
|
? holder.getSimpleName() : holder.getQualifiedName(),
|
||||||
false);
|
false);
|
||||||
Content codeLink = HtmlTree.CODE(link);
|
Content codeLink = HtmlTree.CODE(link);
|
||||||
Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel,
|
Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel,
|
||||||
|
@ -91,8 +91,7 @@ public class TagletWriterImpl extends TagletWriter {
|
|||||||
*/
|
*/
|
||||||
protected Content codeTagOutput(Element element, DocTree tag) {
|
protected Content codeTagOutput(Element element, DocTree tag) {
|
||||||
CommentHelper ch = utils.getCommentHelper(element);
|
CommentHelper ch = utils.getCommentHelper(element);
|
||||||
String str = utils.normalizeNewlines(ch.getText(tag));
|
StringContent content = new StringContent(utils.normalizeNewlines(ch.getText(tag)));
|
||||||
StringContent content = new StringContent(str);
|
|
||||||
Content result = HtmlTree.CODE(content);
|
Content result = HtmlTree.CODE(content);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -75,7 +75,8 @@ public class Comment extends Content {
|
|||||||
* DocletAbortException because it
|
* DocletAbortException because it
|
||||||
* is not supported.
|
* is not supported.
|
||||||
*/
|
*/
|
||||||
public void addContent(String stringContent) {
|
@Override
|
||||||
|
public void addContent(CharSequence stringContent) {
|
||||||
throw new DocletAbortException("not supported");
|
throw new DocletAbortException("not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -50,8 +50,8 @@ public class ContentBuilder extends Content {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addContent(String text) {
|
public void addContent(CharSequence text) {
|
||||||
if (text.isEmpty())
|
if (text.length() == 0)
|
||||||
return;
|
return;
|
||||||
ensureMutableContents();
|
ensureMutableContents();
|
||||||
Content c = contents.isEmpty() ? null : contents.get(contents.size() - 1);
|
Content c = contents.isEmpty() ? null : contents.get(contents.size() - 1);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -89,7 +89,8 @@ public class DocType extends Content {
|
|||||||
* DocletAbortException because it
|
* DocletAbortException because it
|
||||||
* is not supported.
|
* is not supported.
|
||||||
*/
|
*/
|
||||||
public void addContent(String stringContent) {
|
@Override
|
||||||
|
public void addContent(CharSequence stringContent) {
|
||||||
throw new DocletAbortException("not supported");
|
throw new DocletAbortException("not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -90,7 +90,8 @@ public class HtmlDocument extends Content {
|
|||||||
* DocletAbortException because it
|
* DocletAbortException because it
|
||||||
* is not supported.
|
* is not supported.
|
||||||
*/
|
*/
|
||||||
public void addContent(String stringContent) {
|
@Override
|
||||||
|
public void addContent(CharSequence stringContent) {
|
||||||
throw new DocletAbortException("not supported");
|
throw new DocletAbortException("not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,8 @@ public class HtmlTree extends Content {
|
|||||||
*
|
*
|
||||||
* @param stringContent string content that needs to be added
|
* @param stringContent string content that needs to be added
|
||||||
*/
|
*/
|
||||||
public void addContent(String stringContent) {
|
@Override
|
||||||
|
public void addContent(CharSequence stringContent) {
|
||||||
if (!content.isEmpty()) {
|
if (!content.isEmpty()) {
|
||||||
Content lastContent = content.get(content.size() - 1);
|
Content lastContent = content.get(content.size() - 1);
|
||||||
if (lastContent instanceof StringContent)
|
if (lastContent instanceof StringContent)
|
||||||
|
@ -475,7 +475,7 @@ public class HtmlWriter {
|
|||||||
addStyles(HtmlStyle.rowColor, vars);
|
addStyles(HtmlStyle.rowColor, vars);
|
||||||
addStyles(HtmlStyle.tableTab, vars);
|
addStyles(HtmlStyle.tableTab, vars);
|
||||||
addStyles(HtmlStyle.activeTableTab, vars);
|
addStyles(HtmlStyle.activeTableTab, vars);
|
||||||
script.addContent(new RawHtml(vars.toString()));
|
script.addContent(new RawHtml(vars));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -53,8 +53,8 @@ public class RawHtml extends Content {
|
|||||||
*
|
*
|
||||||
* @param rawHtml raw HTML text to be added
|
* @param rawHtml raw HTML text to be added
|
||||||
*/
|
*/
|
||||||
public RawHtml(String rawHtml) {
|
public RawHtml(CharSequence rawHtml) {
|
||||||
rawHtmlContent = nullCheck(rawHtml);
|
rawHtmlContent = rawHtml.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,7 +77,8 @@ public class RawHtml extends Content {
|
|||||||
* DocletAbortException because it
|
* DocletAbortException because it
|
||||||
* is not supported.
|
* is not supported.
|
||||||
*/
|
*/
|
||||||
public void addContent(String stringContent) {
|
@Override
|
||||||
|
public void addContent(CharSequence stringContent) {
|
||||||
throw new DocletAbortException("not supported");
|
throw new DocletAbortException("not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +104,7 @@ public class RawHtml extends Content {
|
|||||||
return charCount(rawHtmlContent);
|
return charCount(rawHtmlContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int charCount(String htmlText) {
|
static int charCount(CharSequence htmlText) {
|
||||||
State state = State.TEXT;
|
State state = State.TEXT;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int i = 0; i < htmlText.length(); i++) {
|
for (int i = 0; i < htmlText.length(); i++) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -58,7 +58,7 @@ public class StringContent extends Content {
|
|||||||
*
|
*
|
||||||
* @param initialContent initial content for the object
|
* @param initialContent initial content for the object
|
||||||
*/
|
*/
|
||||||
public StringContent(String initialContent) {
|
public StringContent(CharSequence initialContent) {
|
||||||
stringContent = new StringBuilder();
|
stringContent = new StringBuilder();
|
||||||
appendChars(initialContent);
|
appendChars(initialContent);
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ public class StringContent extends Content {
|
|||||||
* @param strContent string content to be added
|
* @param strContent string content to be added
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addContent(String strContent) {
|
public void addContent(CharSequence strContent) {
|
||||||
appendChars(strContent);
|
appendChars(strContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ public class StringContent extends Content {
|
|||||||
return s.endsWith(DocletConstants.NL);
|
return s.endsWith(DocletConstants.NL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void appendChars(String s) {
|
private void appendChars(CharSequence s) {
|
||||||
for (int i = 0; i < s.length(); i++) {
|
for (int i = 0; i < s.length(); i++) {
|
||||||
char ch = s.charAt(i);
|
char ch = s.charAt(i);
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -74,7 +74,7 @@ public abstract class Content {
|
|||||||
*
|
*
|
||||||
* @param stringContent the string content to be added
|
* @param stringContent the string content to be added
|
||||||
*/
|
*/
|
||||||
public abstract void addContent(String stringContent);
|
public abstract void addContent(CharSequence stringContent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes content to a writer.
|
* Writes content to a writer.
|
||||||
|
@ -1356,7 +1356,7 @@ public class Utils {
|
|||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String normalizeNewlines(String text) {
|
public CharSequence normalizeNewlines(CharSequence text) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
final int textLength = text.length();
|
final int textLength = text.length();
|
||||||
final String NL = DocletConstants.NL;
|
final String NL = DocletConstants.NL;
|
||||||
@ -1379,7 +1379,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sb.append(text, pos, textLength);
|
sb.append(text, pos, textLength);
|
||||||
return sb.toString();
|
return sb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1746,6 +1746,8 @@ public class Utils {
|
|||||||
* A generic utility which returns the fully qualified names of an entity,
|
* A generic utility which returns the fully qualified names of an entity,
|
||||||
* if the entity is not qualifiable then its enclosing entity, it is upto
|
* if the entity is not qualifiable then its enclosing entity, it is upto
|
||||||
* the caller to add the elements name as required.
|
* the caller to add the elements name as required.
|
||||||
|
* @param e the element to get FQN for.
|
||||||
|
* @return the name
|
||||||
*/
|
*/
|
||||||
public String getFullyQualifiedName(Element e) {
|
public String getFullyQualifiedName(Element e) {
|
||||||
return getFullyQualifiedName(e, true);
|
return getFullyQualifiedName(e, true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user