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) {
|
if (tsym == null || tsym.name == null) {
|
||||||
sb.append("<none>");
|
sb.append("<none>");
|
||||||
} else {
|
} else {
|
||||||
sb.append(tsym.name);
|
sb.append(tsym.name.toString());
|
||||||
}
|
}
|
||||||
if (moreInfo && hasTag(TYPEVAR)) {
|
if (moreInfo && hasTag(TYPEVAR)) {
|
||||||
sb.append(hashCode());
|
sb.append(hashCode());
|
||||||
|
@ -1432,7 +1432,7 @@ public class HtmlDocletWriter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
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().toString());
|
||||||
if (node.getValueKind() == ValueKind.EMPTY) {
|
if (node.getValueKind() == ValueKind.EMPTY) {
|
||||||
result.add(sb);
|
result.add(sb);
|
||||||
return false;
|
return false;
|
||||||
@ -2050,18 +2050,18 @@ public class HtmlDocletWriter {
|
|||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (Element e: chain) {
|
for (Element e: chain) {
|
||||||
CharSequence name;
|
String name;
|
||||||
switch (e.getKind()) {
|
switch (e.getKind()) {
|
||||||
case MODULE:
|
case MODULE:
|
||||||
case PACKAGE:
|
case PACKAGE:
|
||||||
name = ((QualifiedNameable) e).getQualifiedName();
|
name = ((QualifiedNameable) e).getQualifiedName().toString();
|
||||||
if (name.length() == 0) {
|
if (name.length() == 0) {
|
||||||
name = "<unnamed>";
|
name = "<unnamed>";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
name = e.getSimpleName();
|
name = e.getSimpleName().toString();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ public class HtmlIds {
|
|||||||
* @return the 1.4.x style anchor for the executable element
|
* @return the 1.4.x style anchor for the executable element
|
||||||
*/
|
*/
|
||||||
protected HtmlId forErasure(ExecutableElement executableElement) {
|
protected HtmlId forErasure(ExecutableElement executableElement) {
|
||||||
final StringBuilder buf = new StringBuilder(executableElement.getSimpleName());
|
final StringBuilder buf = new StringBuilder(executableElement.getSimpleName().toString());
|
||||||
buf.append("(");
|
buf.append("(");
|
||||||
List<? extends VariableElement> parameters = executableElement.getParameters();
|
List<? extends VariableElement> parameters = executableElement.getParameters();
|
||||||
boolean foundTypeVariable = false;
|
boolean foundTypeVariable = false;
|
||||||
@ -237,7 +237,7 @@ public class HtmlIds {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean visitTypeVariable(TypeVariable t, Void p) {
|
public Boolean visitTypeVariable(TypeVariable t, Void p) {
|
||||||
buf.append(utils.asTypeElement(t).getQualifiedName());
|
buf.append(utils.asTypeElement(t).getQualifiedName().toString());
|
||||||
foundTypeVariable = true;
|
foundTypeVariable = true;
|
||||||
return foundTypeVariable;
|
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.
|
* 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
|
||||||
@ -70,17 +70,19 @@ public class Entity extends Content {
|
|||||||
* @return the string with all of the HTML characters escaped
|
* @return the string with all of the HTML characters escaped
|
||||||
*/
|
*/
|
||||||
static String escapeHtmlChars(CharSequence s) {
|
static String escapeHtmlChars(CharSequence s) {
|
||||||
for (int i = 0; i < s.length(); i++) {
|
// Convert to string as CharSequence implementations can be slow - see JDK-8263321
|
||||||
char ch = s.charAt(i);
|
String str = s.toString();
|
||||||
|
for (int i = 0; i < str.length(); i++) {
|
||||||
|
char ch = str.charAt(i);
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
// only start building a new string if we need to
|
// only start building a new string if we need to
|
||||||
case '<': case '>': case '&':
|
case '<': case '>': case '&':
|
||||||
StringBuilder sb = new StringBuilder(s.subSequence(0, i));
|
StringBuilder sb = new StringBuilder(str.substring(0, i));
|
||||||
escapeHtmlChars(s, i, sb);
|
escapeHtmlChars(str, i, sb);
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return s.toString();
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,10 +93,10 @@ public class Entity extends Content {
|
|||||||
* @param sb the string builder
|
* @param sb the string builder
|
||||||
*/
|
*/
|
||||||
static void escapeHtmlChars(CharSequence s, StringBuilder sb) {
|
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++) {
|
for (int i = start ; i < s.length(); i++) {
|
||||||
char ch = s.charAt(i);
|
char ch = s.charAt(i);
|
||||||
switch (ch) {
|
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
|
* @param content content for the object
|
||||||
*/
|
*/
|
||||||
|
@ -225,7 +225,7 @@ public class CommentHelper {
|
|||||||
new SimpleDocTreeVisitor<Void, Void>() {
|
new SimpleDocTreeVisitor<Void, Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void visitAttribute(AttributeTree node, Void p) {
|
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) {
|
if (node.getValueKind() == ValueKind.EMPTY) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ public class CommentHelper {
|
|||||||
@Override
|
@Override
|
||||||
public Void visitEndElement(EndElementTree node, Void p) {
|
public Void visitEndElement(EndElementTree node, Void p) {
|
||||||
sb.append("</")
|
sb.append("</")
|
||||||
.append(node.getName())
|
.append(node.getName().toString())
|
||||||
.append(">");
|
.append(">");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -307,7 +307,7 @@ public class CommentHelper {
|
|||||||
@Override
|
@Override
|
||||||
public Void visitStartElement(StartElementTree node, Void p) {
|
public Void visitStartElement(StartElementTree node, Void p) {
|
||||||
sb.append("<");
|
sb.append("<");
|
||||||
sb.append(node.getName());
|
sb.append(node.getName().toString());
|
||||||
node.getAttributes().forEach(dt -> dt.accept(this, null));
|
node.getAttributes().forEach(dt -> dt.accept(this, null));
|
||||||
sb.append(node.isSelfClosing() ? "/>" : ">");
|
sb.append(node.isSelfClosing() ? "/>" : ">");
|
||||||
return null;
|
return null;
|
||||||
|
@ -2158,7 +2158,7 @@ public class Utils {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String visitType(TypeElement e, Void p) {
|
public String visitType(TypeElement e, Void p) {
|
||||||
StringBuilder sb = new StringBuilder(e.getSimpleName());
|
StringBuilder sb = new StringBuilder(e.getSimpleName().toString());
|
||||||
Element enclosed = e.getEnclosingElement();
|
Element enclosed = e.getEnclosingElement();
|
||||||
while (enclosed != null
|
while (enclosed != null
|
||||||
&& (enclosed.getKind().isClass() || enclosed.getKind().isInterface())) {
|
&& (enclosed.getKind().isClass() || enclosed.getKind().isInterface())) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user