Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unnecessary memory allocation #45592

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,12 @@ public void runComplete(TestRunResults results) {
summary.append("\n");
}
if (testclass != null) {
summary.append(testclass.getClassName() + "#" + testclass.getMethodName() + "("
+ testclass.getFileName() + ":" + testclass.getLineNumber() + ") ");
summary.append(testclass.getClassName() + "#").append(testclass.getMethodName()).append("(")
.append(testclass.getFileName()).append(":").append(testclass.getLineNumber())
.append(") ");
}
summary.append(RED
+ test.getDisplayName() + RESET
+ " " + test.getTestExecutionResult().getThrowable().get().getMessage());
summary.append(RED).append(test.getDisplayName()).append(RESET).append(" ")
.append(test.getTestExecutionResult().getThrowable().get().getMessage());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public String analyse(String className, String methodName) throws Exception {
attemptedClasses.add(current.className);
List<Node> toAdd = constructors.getOrDefault(current.className, new ArrayList<>());
runQueue.addAll(toAdd);
sb.append(reason + '\n');
sb.append(reason).append('\n');
sb.append("\n");
ret.append(sb);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,21 @@ public String toString() {

public String toString(String prefix) {
StringBuilder sb = new StringBuilder();
sb.append(prefix + "name = " + path + "\n");
sb.append(prefix + "sourceType = " + sourceType + "\n");
sb.append(prefix + "sourceElementName = " + sourceElementName + "\n");
sb.append(prefix + "type = " + type + "\n");
sb.append(prefix + "name = ").append(path).append("\n");
sb.append(prefix + "sourceType = ").append(sourceType).append("\n");
sb.append(prefix + "sourceElementName = ").append(sourceElementName).append("\n");
sb.append(prefix + "type = ").append(type).append("\n");
if (defaultValue != null) {
sb.append(prefix + "defaultValue = " + defaultValue + "\n");
sb.append(prefix + "defaultValue = ").append(defaultValue).append("\n");
}
if (defaultValueForDoc != null) {
sb.append(prefix + "defaultValueForDoc = " + defaultValueForDoc + "\n");
sb.append(prefix + "defaultValueForDoc = ").append(defaultValueForDoc).append("\n");
}
if (deprecation != null) {
sb.append(prefix + "deprecated = true\n");
}
if (mapKey != null) {
sb.append(prefix + "mapKey = " + mapKey + "\n");
sb.append(prefix + "mapKey = ").append(mapKey).append("\n");
}
if (unnamedMapKey) {
sb.append(prefix + "unnamedMapKey = true\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public String toString(String prefix) {
sb.append(prefix + "binaryName = " + this.binaryName);

if (!properties.isEmpty()) {
sb.append("\n\n" + prefix + "--- Properties ---\n\n");
sb.append("\n\n").append(prefix).append("--- Properties ---\n\n");
for (DiscoveryConfigProperty property : properties.values()) {
sb.append(property.toString(prefix) + prefix + "--\n");
sb.append(property.toString(prefix)).append(prefix).append("--\n");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static String toAsciidoc(String javadoc, JavadocFormat format, boolean in
sb.append('`');
appendEscapedAsciiDoc(sb, content, inlineMacroMode, new Context());
sb.append('`');
htmlJavadoc.append("§§" + markerCounter + "§§");
htmlJavadoc.append("§§").append(markerCounter).append("§§");
inlineTagsReplacements.put(markerCounter, sb.toString());
markerCounter++;
break;
Expand All @@ -130,7 +130,7 @@ public static String toAsciidoc(String javadoc, JavadocFormat format, boolean in
sb.append('`');
appendEscapedAsciiDoc(sb, content, inlineMacroMode, new Context());
sb.append('`');
htmlJavadoc.append("§§" + markerCounter + "§§");
htmlJavadoc.append("§§").append(markerCounter).append("§§");
inlineTagsReplacements.put(markerCounter, sb.toString());
markerCounter++;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public String toString() {
sb.append("=======================================================\n\n");

for (DiscoveryConfigRoot configRoot : configRoots.values()) {
sb.append("- " + configRoot.getQualifiedName() + "\n");
sb.append("- ").append(configRoot.getQualifiedName()).append("\n");
sb.append(configRoot.toString(" "));
sb.append("\n\n===\n\n");
}
Expand All @@ -116,7 +116,7 @@ public String toString() {
sb.append("=======================================================\n\n");

for (DiscoveryConfigGroup configGroup : resolvedConfigGroups.values()) {
sb.append("- " + configGroup.getQualifiedName() + "\n");
sb.append("- ").append(configGroup.getQualifiedName()).append("\n");
sb.append(configGroup.toString(" "));
sb.append("\n\n===\n\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,7 @@ public TemplateHtmlBuilder(boolean showStack, String baseUrl, String title, Stri
} else {
result = new StringBuilder(String.format(HTML_TEMPLATE_START_NO_STACK, escapeHtml(title),
subTitle == null || subTitle.isEmpty() ? "" : " - " + escapeHtml(subTitle), CSS));
result.append(
String.format(HEADER_TEMPLATE_NO_STACK, escapeHtml(title), escapeHtml(details), actionLinks.toString()));
result.append(String.format(HEADER_TEMPLATE_NO_STACK, escapeHtml(title), escapeHtml(details), actionLinks.toString()));
}

if (!config.isEmpty()) {
Expand Down