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));
|
||||
if (!utils.isConstructor(member)) {
|
||||
sb.append(".");
|
||||
sb.append(member.getSimpleName().toString());
|
||||
sb.append(member.getSimpleName());
|
||||
}
|
||||
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("(");
|
||||
String sep = "";
|
||||
List<? extends VariableElement> parameters = member.getParameters();
|
||||
String indent = makeSpace(indentSize + 1);
|
||||
CharSequence indent = makeSpace(indentSize + 1);
|
||||
TypeMirror rcvrType = member.getReceiverType();
|
||||
if (includeAnnotations && rcvrType != null && utils.isAnnotated(rcvrType)) {
|
||||
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) {
|
||||
List<? extends TypeMirror> exceptions = member.getThrownTypes();
|
||||
if (!exceptions.isEmpty()) {
|
||||
String indent = makeSpace(indentSize + 1 - 7);
|
||||
CharSequence indent = makeSpace(indentSize + 1 - 7);
|
||||
htmltree.addContent(DocletConstants.NL);
|
||||
htmltree.addContent(indent);
|
||||
htmltree.addContent("throws ");
|
||||
@ -336,7 +336,7 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
|
||||
|
||||
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
||||
protected Boolean defaultAction(TypeMirror e, Void p) {
|
||||
buf.append(e.toString());
|
||||
buf.append(e);
|
||||
return foundTypeVariable;
|
||||
}
|
||||
};
|
||||
|
@ -223,26 +223,6 @@ public abstract class AbstractMemberWriter {
|
||||
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
|
||||
* 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) {
|
||||
return "";
|
||||
}
|
||||
@ -290,7 +270,7 @@ public abstract class AbstractMemberWriter {
|
||||
for (int i = 0; i < len; i++) {
|
||||
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 pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classPackageLabel);
|
||||
pkgNameDiv.addContent(getSpace());
|
||||
Content pkgNameContent = getPackageLink(pkg,
|
||||
new StringContent(pkg.getQualifiedName().toString()));
|
||||
Content pkgNameContent = getPackageLink(pkg, new StringContent(pkg.getQualifiedName()));
|
||||
pkgNameDiv.addContent(pkgNameContent);
|
||||
div.addContent(pkgNameDiv);
|
||||
}
|
||||
@ -395,10 +394,10 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
new LinkInfoImpl(configuration, LinkInfoImpl.Kind.TREE,
|
||||
typeElement));
|
||||
if (configuration.shouldExcludeQualifier(utils.containingPackage(typeElement).toString())) {
|
||||
li.addContent(utils.asTypeElement(type).getSimpleName().toString());
|
||||
li.addContent(utils.asTypeElement(type).getSimpleName());
|
||||
li.addContent(typeParameters);
|
||||
} else {
|
||||
li.addContent(utils.asTypeElement(type).getQualifiedName().toString());
|
||||
li.addContent(utils.asTypeElement(type).getQualifiedName());
|
||||
li.addContent(typeParameters);
|
||||
}
|
||||
} else {
|
||||
|
@ -244,7 +244,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
|
||||
PackageElement enclosingPackage = utils.containingPackage(typeElement);
|
||||
if (!enclosingPackage.isUnnamed()) {
|
||||
Content cb = new ContentBuilder();
|
||||
cb.addContent(enclosingPackage.getQualifiedName().toString());
|
||||
cb.addContent(enclosingPackage.getQualifiedName());
|
||||
cb.addContent(".");
|
||||
cb.addContent(classlink);
|
||||
return getClassName(cb);
|
||||
@ -332,7 +332,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
|
||||
*/
|
||||
private Content getNameColumn(VariableElement member) {
|
||||
Content nameContent = getDocLink(LinkInfoImpl.Kind.CONSTANT_SUMMARY,
|
||||
member, member.getSimpleName().toString(), false);
|
||||
member, member.getSimpleName(), false);
|
||||
Content code = HtmlTree.CODE(nameContent);
|
||||
return HtmlTree.TD(code);
|
||||
}
|
||||
|
@ -166,6 +166,8 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
|
||||
HtmlTree fixedNavDiv = new HtmlTree(HtmlTag.DIV);
|
||||
|
||||
final static Pattern IMPROPER_HTML_CHARS = Pattern.compile(".*[&<>].*");
|
||||
|
||||
/**
|
||||
* Constructor to construct the HtmlStandardWriter object.
|
||||
*
|
||||
@ -945,7 +947,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
public Content getPackageName(PackageElement packageElement) {
|
||||
return packageElement == null || packageElement.isUnnamed()
|
||||
? defaultPackageLabel
|
||||
: getPackageLabel(packageElement.getQualifiedName().toString());
|
||||
: getPackageLabel(packageElement.getQualifiedName());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -954,7 +956,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
* @param packageName the package name
|
||||
* @return the package name content
|
||||
*/
|
||||
public Content getPackageLabel(String packageName) {
|
||||
public Content getPackageLabel(CharSequence packageName) {
|
||||
return new StringContent(packageName);
|
||||
}
|
||||
|
||||
@ -1038,7 +1040,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
* @param label the label for the 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));
|
||||
}
|
||||
|
||||
@ -1081,7 +1083,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
|
||||
public Content interfaceName(TypeElement typeElement, boolean qual) {
|
||||
Content name = new StringContent((qual)
|
||||
? typeElement.getQualifiedName().toString()
|
||||
? typeElement.getQualifiedName()
|
||||
: utils.getSimpleName(typeElement));
|
||||
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
|
||||
* @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,
|
||||
new StringContent(label));
|
||||
}
|
||||
@ -1293,7 +1295,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
* @param strong true if the link should be strong.
|
||||
* @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) {
|
||||
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.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1334,13 +1336,14 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
* @return the link for the given member.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
String check(String s) {
|
||||
if (s.matches(".*[&<>].*")) {
|
||||
throw new IllegalArgumentException(s);
|
||||
CharSequence check(CharSequence s) {
|
||||
Matcher m = IMPROPER_HTML_CHARS.matcher(s);
|
||||
if (m.matches()) {
|
||||
throw new IllegalArgumentException(s.toString());
|
||||
}
|
||||
return s;
|
||||
}
|
||||
@ -1426,7 +1429,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
|
||||
CommentHelper ch = utils.getCommentHelper(element);
|
||||
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"
|
||||
if (seetext.startsWith("<") || seetext.startsWith("\"")) {
|
||||
return new RawHtml(seetext);
|
||||
@ -1452,7 +1455,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
//@see is referencing an included package
|
||||
if (label.isEmpty())
|
||||
label = plainOrCode(isLinkPlain,
|
||||
new StringContent(refPackage.getQualifiedName().toString()));
|
||||
new StringContent(refPackage.getQualifiedName()));
|
||||
return getPackageLink(refPackage, label);
|
||||
} else {
|
||||
// @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() {
|
||||
@Override
|
||||
public void addContent(String text) {
|
||||
public void addContent(CharSequence text) {
|
||||
super.addContent(utils.normalizeNewlines(text));
|
||||
}
|
||||
};
|
||||
@ -1741,7 +1744,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
public Boolean visitAttribute(AttributeTree node, Content c) {
|
||||
StringBuilder sb = new StringBuilder(SPACER).append(node.getName());
|
||||
if (node.getValueKind() == ValueKind.EMPTY) {
|
||||
result.addContent(sb.toString());
|
||||
result.addContent(sb);
|
||||
return false;
|
||||
}
|
||||
sb.append("=");
|
||||
@ -1758,7 +1761,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
break;
|
||||
}
|
||||
sb.append(quote);
|
||||
result.addContent(sb.toString());
|
||||
result.addContent(sb);
|
||||
Content docRootContent = new ContentBuilder();
|
||||
|
||||
for (DocTree dt : node.getValue()) {
|
||||
@ -1767,16 +1770,15 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
if (text.startsWith("/..") && !configuration.docrootparent.isEmpty()) {
|
||||
result.addContent(configuration.docrootparent);
|
||||
docRootContent = new ContentBuilder();
|
||||
text = textCleanup(text.substring(3), isLast(node));
|
||||
result.addContent(textCleanup(text.substring(3), isLast(node)));
|
||||
} else {
|
||||
if (!docRootContent.isEmpty()) {
|
||||
docRootContent = copyDocRootContent(docRootContent);
|
||||
} else {
|
||||
text = redirectRelativeLinks(element, (TextTree) dt);
|
||||
}
|
||||
text = textCleanup(text, isLast(node));
|
||||
result.addContent(textCleanup(text, isLast(node)));
|
||||
}
|
||||
result.addContent(text);
|
||||
} else {
|
||||
docRootContent = copyDocRootContent(docRootContent);
|
||||
dt.accept(this, docRootContent);
|
||||
@ -1889,8 +1891,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
@Override @DefinedBy(Api.COMPILER_TREE)
|
||||
public Boolean visitStartElement(StartElementTree node, Content c) {
|
||||
String text = "<" + node.getName();
|
||||
text = utils.normalizeNewlines(text);
|
||||
RawHtml rawHtml = new RawHtml(text);
|
||||
RawHtml rawHtml = new RawHtml(utils.normalizeNewlines(text));
|
||||
result.addContent(rawHtml);
|
||||
|
||||
for (DocTree dt : node.getAttributes()) {
|
||||
@ -1900,11 +1901,11 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
return false;
|
||||
}
|
||||
|
||||
private String textCleanup(String text, boolean isLast) {
|
||||
private CharSequence textCleanup(String text, boolean isLast) {
|
||||
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) {
|
||||
text = removeLeadingWhitespace(text);
|
||||
}
|
||||
@ -1912,16 +1913,14 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
text = removeTrailingWhitespace(text);
|
||||
}
|
||||
text = utils.replaceTabs(text);
|
||||
text = utils.normalizeNewlines(text);
|
||||
return text;
|
||||
return utils.normalizeNewlines(text);
|
||||
}
|
||||
|
||||
@Override @DefinedBy(Api.COMPILER_TREE)
|
||||
public Boolean visitText(TextTree node, Content c) {
|
||||
String text = node.getBody();
|
||||
text = textCleanup(text, isLast(node), commentRemoved);
|
||||
result.addContent(new RawHtml(textCleanup(text, isLast(node), commentRemoved)));
|
||||
commentRemoved = false;
|
||||
result.addContent(new RawHtml(text));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2358,7 +2357,8 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
private void addAnnotations(TypeElement annotationDoc, LinkInfoImpl linkInfo,
|
||||
ContentBuilder annotation, Map<? extends ExecutableElement,? extends AnnotationValue>map,
|
||||
int indent, boolean linkBreak) {
|
||||
linkInfo.label = new StringContent("@" + annotationDoc.getSimpleName().toString());
|
||||
linkInfo.label = new StringContent("@");
|
||||
linkInfo.label.addContent(annotationDoc.getSimpleName());
|
||||
annotation.addContent(getLink(linkInfo));
|
||||
if (!map.isEmpty()) {
|
||||
annotation.addContent("(");
|
||||
@ -2372,7 +2372,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
annotation.addContent(",");
|
||||
if (linkBreak) {
|
||||
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++) {
|
||||
annotation.addContent(" ");
|
||||
}
|
||||
@ -2496,7 +2496,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
||||
public Content visitEnumConstant(VariableElement c, Void p) {
|
||||
return getDocLink(LinkInfoImpl.Kind.ANNOTATION,
|
||||
c, c.getSimpleName().toString(), false);
|
||||
c, c.getSimpleName(), false);
|
||||
}
|
||||
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
||||
public Content visitArray(List<? extends AnnotationValue> vals, Void p) {
|
||||
|
@ -294,7 +294,7 @@ public class LinkInfoImpl extends LinkInfo {
|
||||
* Set the 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);
|
||||
return this;
|
||||
}
|
||||
|
@ -356,11 +356,10 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
Content overriddenTypeLink =
|
||||
writer.getLink(new LinkInfoImpl(writer.configuration, context, overriddenType));
|
||||
Content codeOverridenTypeLink = HtmlTree.CODE(overriddenTypeLink);
|
||||
String name = method.getSimpleName().toString();
|
||||
Content methlink = writer.getLink(
|
||||
new LinkInfoImpl(writer.configuration, LinkInfoImpl.Kind.MEMBER,
|
||||
holder)
|
||||
.where(writer.getName(writer.getAnchor(method))).label(name));
|
||||
.where(writer.getName(writer.getAnchor(method))).label(method.getSimpleName()));
|
||||
Content codeMethLink = HtmlTree.CODE(methlink);
|
||||
Content dd = HtmlTree.DD(codeMethLink);
|
||||
dd.addContent(writer.getSpace());
|
||||
@ -395,7 +394,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
dl.addContent(dt);
|
||||
Content methlink = writer.getDocLink(
|
||||
LinkInfoImpl.Kind.MEMBER, implementedMeth,
|
||||
implementedMeth.getSimpleName().toString(), false);
|
||||
implementedMeth.getSimpleName(), false);
|
||||
Content codeMethLink = HtmlTree.CODE(methlink);
|
||||
Content dd = HtmlTree.DD(codeMethLink);
|
||||
dd.addContent(writer.getSpace());
|
||||
|
@ -123,7 +123,7 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
|
||||
packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME,
|
||||
packageLabel, "", "packageFrame");
|
||||
} else {
|
||||
packageLabel = getPackageLabel(pe.getQualifiedName().toString());
|
||||
packageLabel = getPackageLabel(pe.getQualifiedName());
|
||||
packageLinkContent = getHyperLink(pathString(pe,
|
||||
DocPaths.PACKAGE_FRAME), packageLabel, "",
|
||||
"packageFrame");
|
||||
|
@ -158,7 +158,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
writer.getDocLink(LinkInfoImpl.Kind.PROPERTY_COPY,
|
||||
holder, property,
|
||||
utils.isIncluded(holder)
|
||||
? holder.toString() : utils.getFullyQualifiedName(holder),
|
||||
? holder.getSimpleName() : holder.getQualifiedName(),
|
||||
false);
|
||||
Content codeLink = HtmlTree.CODE(link);
|
||||
Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel,
|
||||
|
@ -91,8 +91,7 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
*/
|
||||
protected Content codeTagOutput(Element element, DocTree tag) {
|
||||
CommentHelper ch = utils.getCommentHelper(element);
|
||||
String str = utils.normalizeNewlines(ch.getText(tag));
|
||||
StringContent content = new StringContent(str);
|
||||
StringContent content = new StringContent(utils.normalizeNewlines(ch.getText(tag)));
|
||||
Content result = HtmlTree.CODE(content);
|
||||
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.
|
||||
*
|
||||
* 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
|
||||
* is not supported.
|
||||
*/
|
||||
public void addContent(String stringContent) {
|
||||
@Override
|
||||
public void addContent(CharSequence stringContent) {
|
||||
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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -50,8 +50,8 @@ public class ContentBuilder extends Content {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addContent(String text) {
|
||||
if (text.isEmpty())
|
||||
public void addContent(CharSequence text) {
|
||||
if (text.length() == 0)
|
||||
return;
|
||||
ensureMutableContents();
|
||||
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.
|
||||
*
|
||||
* 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
|
||||
* is not supported.
|
||||
*/
|
||||
public void addContent(String stringContent) {
|
||||
@Override
|
||||
public void addContent(CharSequence stringContent) {
|
||||
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.
|
||||
*
|
||||
* 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
|
||||
* is not supported.
|
||||
*/
|
||||
public void addContent(String stringContent) {
|
||||
@Override
|
||||
public void addContent(CharSequence stringContent) {
|
||||
throw new DocletAbortException("not supported");
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,8 @@ public class HtmlTree extends Content {
|
||||
*
|
||||
* @param stringContent string content that needs to be added
|
||||
*/
|
||||
public void addContent(String stringContent) {
|
||||
@Override
|
||||
public void addContent(CharSequence stringContent) {
|
||||
if (!content.isEmpty()) {
|
||||
Content lastContent = content.get(content.size() - 1);
|
||||
if (lastContent instanceof StringContent)
|
||||
|
@ -475,7 +475,7 @@ public class HtmlWriter {
|
||||
addStyles(HtmlStyle.rowColor, vars);
|
||||
addStyles(HtmlStyle.tableTab, 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.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
public RawHtml(String rawHtml) {
|
||||
rawHtmlContent = nullCheck(rawHtml);
|
||||
public RawHtml(CharSequence rawHtml) {
|
||||
rawHtmlContent = rawHtml.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,7 +77,8 @@ public class RawHtml extends Content {
|
||||
* DocletAbortException because it
|
||||
* is not supported.
|
||||
*/
|
||||
public void addContent(String stringContent) {
|
||||
@Override
|
||||
public void addContent(CharSequence stringContent) {
|
||||
throw new DocletAbortException("not supported");
|
||||
}
|
||||
|
||||
@ -103,7 +104,7 @@ public class RawHtml extends Content {
|
||||
return charCount(rawHtmlContent);
|
||||
}
|
||||
|
||||
static int charCount(String htmlText) {
|
||||
static int charCount(CharSequence htmlText) {
|
||||
State state = State.TEXT;
|
||||
int count = 0;
|
||||
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.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
public StringContent(String initialContent) {
|
||||
public StringContent(CharSequence initialContent) {
|
||||
stringContent = new StringBuilder();
|
||||
appendChars(initialContent);
|
||||
}
|
||||
@ -83,7 +83,7 @@ public class StringContent extends Content {
|
||||
* @param strContent string content to be added
|
||||
*/
|
||||
@Override
|
||||
public void addContent(String strContent) {
|
||||
public void addContent(CharSequence strContent) {
|
||||
appendChars(strContent);
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ public class StringContent extends Content {
|
||||
return s.endsWith(DocletConstants.NL);
|
||||
}
|
||||
|
||||
private void appendChars(String s) {
|
||||
private void appendChars(CharSequence s) {
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char ch = s.charAt(i);
|
||||
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.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
public abstract void addContent(String stringContent);
|
||||
public abstract void addContent(CharSequence stringContent);
|
||||
|
||||
/**
|
||||
* Writes content to a writer.
|
||||
|
@ -1356,7 +1356,7 @@ public class Utils {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public String normalizeNewlines(String text) {
|
||||
public CharSequence normalizeNewlines(CharSequence text) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
final int textLength = text.length();
|
||||
final String NL = DocletConstants.NL;
|
||||
@ -1379,7 +1379,7 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
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,
|
||||
* if the entity is not qualifiable then its enclosing entity, it is upto
|
||||
* 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) {
|
||||
return getFullyQualifiedName(e, true);
|
||||
|
Loading…
Reference in New Issue
Block a user