8263321: Regression 8% in javadoc-steady in 17-b11
Reviewed-by: prappo, vromero
This commit is contained in:
parent
e36136fa93
commit
76cad4b1ae
@ -468,7 +468,7 @@ public abstract class Type extends AnnoConstruct implements TypeMirror, PoolCons
|
||||
if (tsym == null || tsym.name == null) {
|
||||
sb.append("<none>");
|
||||
} else {
|
||||
sb.append(tsym.name);
|
||||
sb.append(tsym.name.toString());
|
||||
}
|
||||
if (moreInfo && hasTag(TYPEVAR)) {
|
||||
sb.append(hashCode());
|
||||
|
@ -1432,7 +1432,7 @@ public class HtmlDocletWriter {
|
||||
|
||||
@Override
|
||||
public Boolean visitAttribute(AttributeTree node, Content c) {
|
||||
StringBuilder sb = new StringBuilder(SPACER).append(node.getName());
|
||||
StringBuilder sb = new StringBuilder(SPACER).append(node.getName().toString());
|
||||
if (node.getValueKind() == ValueKind.EMPTY) {
|
||||
result.add(sb);
|
||||
return false;
|
||||
@ -2050,18 +2050,18 @@ public class HtmlDocletWriter {
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Element e: chain) {
|
||||
CharSequence name;
|
||||
String name;
|
||||
switch (e.getKind()) {
|
||||
case MODULE:
|
||||
case PACKAGE:
|
||||
name = ((QualifiedNameable) e).getQualifiedName();
|
||||
name = ((QualifiedNameable) e).getQualifiedName().toString();
|
||||
if (name.length() == 0) {
|
||||
name = "<unnamed>";
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
name = e.getSimpleName();
|
||||
name = e.getSimpleName().toString();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ public class HtmlIds {
|
||||
* @return the 1.4.x style anchor for the executable element
|
||||
*/
|
||||
protected HtmlId forErasure(ExecutableElement executableElement) {
|
||||
final StringBuilder buf = new StringBuilder(executableElement.getSimpleName());
|
||||
final StringBuilder buf = new StringBuilder(executableElement.getSimpleName().toString());
|
||||
buf.append("(");
|
||||
List<? extends VariableElement> parameters = executableElement.getParameters();
|
||||
boolean foundTypeVariable = false;
|
||||
@ -237,7 +237,7 @@ public class HtmlIds {
|
||||
|
||||
@Override
|
||||
public Boolean visitTypeVariable(TypeVariable t, Void p) {
|
||||
buf.append(utils.asTypeElement(t).getQualifiedName());
|
||||
buf.append(utils.asTypeElement(t).getQualifiedName().toString());
|
||||
foundTypeVariable = true;
|
||||
return foundTypeVariable;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2021, 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
|
||||
@ -70,17 +70,19 @@ public class Entity extends Content {
|
||||
* @return the string with all of the HTML characters escaped
|
||||
*/
|
||||
static String escapeHtmlChars(CharSequence s) {
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char ch = s.charAt(i);
|
||||
// Convert to string as CharSequence implementations can be slow - see JDK-8263321
|
||||
String str = s.toString();
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
char ch = str.charAt(i);
|
||||
switch (ch) {
|
||||
// only start building a new string if we need to
|
||||
case '<': case '>': case '&':
|
||||
StringBuilder sb = new StringBuilder(s.subSequence(0, i));
|
||||
escapeHtmlChars(s, i, sb);
|
||||
StringBuilder sb = new StringBuilder(str.substring(0, i));
|
||||
escapeHtmlChars(str, i, sb);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
return s.toString();
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -91,10 +93,10 @@ public class Entity extends Content {
|
||||
* @param sb the string builder
|
||||
*/
|
||||
static void escapeHtmlChars(CharSequence s, StringBuilder sb) {
|
||||
escapeHtmlChars(s, 0, sb);
|
||||
escapeHtmlChars(s.toString(), 0, sb);
|
||||
}
|
||||
|
||||
private static void escapeHtmlChars(CharSequence s, int start, StringBuilder sb) {
|
||||
private static void escapeHtmlChars(String s, int start, StringBuilder sb) {
|
||||
for (int i = start ; i < s.length(); i++) {
|
||||
char ch = s.charAt(i);
|
||||
switch (ch) {
|
||||
|
@ -55,7 +55,7 @@ public class Text extends Content {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor to construct FixedStringContent object.
|
||||
* Constructs an immutable text object.
|
||||
*
|
||||
* @param content content for the object
|
||||
*/
|
||||
|
@ -225,7 +225,7 @@ public class CommentHelper {
|
||||
new SimpleDocTreeVisitor<Void, Void>() {
|
||||
@Override
|
||||
public Void visitAttribute(AttributeTree node, Void p) {
|
||||
sb.append(SPACER).append(node.getName());
|
||||
sb.append(SPACER).append(node.getName().toString());
|
||||
if (node.getValueKind() == ValueKind.EMPTY) {
|
||||
return null;
|
||||
}
|
||||
@ -252,7 +252,7 @@ public class CommentHelper {
|
||||
@Override
|
||||
public Void visitEndElement(EndElementTree node, Void p) {
|
||||
sb.append("</")
|
||||
.append(node.getName())
|
||||
.append(node.getName().toString())
|
||||
.append(">");
|
||||
return null;
|
||||
}
|
||||
@ -307,7 +307,7 @@ public class CommentHelper {
|
||||
@Override
|
||||
public Void visitStartElement(StartElementTree node, Void p) {
|
||||
sb.append("<");
|
||||
sb.append(node.getName());
|
||||
sb.append(node.getName().toString());
|
||||
node.getAttributes().forEach(dt -> dt.accept(this, null));
|
||||
sb.append(node.isSelfClosing() ? "/>" : ">");
|
||||
return null;
|
||||
|
@ -2158,7 +2158,7 @@ public class Utils {
|
||||
|
||||
@Override
|
||||
public String visitType(TypeElement e, Void p) {
|
||||
StringBuilder sb = new StringBuilder(e.getSimpleName());
|
||||
StringBuilder sb = new StringBuilder(e.getSimpleName().toString());
|
||||
Element enclosed = e.getEnclosingElement();
|
||||
while (enclosed != null
|
||||
&& (enclosed.getKind().isClass() || enclosed.getKind().isInterface())) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user