Skip to content

Commit 86cdd31

Browse files
laeubiCopilot
andcommitted
Replace StringBuffer with StringBuilder in AntScript
StringBuffer is synchronized and thus slower than StringBuilder. The local variable in getEscaped() is not shared across threads, so StringBuilder is the appropriate choice here. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent cb4a95a commit 86cdd31

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ant

build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ant/AntScript.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,14 +1095,14 @@ public void printTaskDef(String name, String classname) {
10951095
}
10961096

10971097
public static String getEscaped(String s) {
1098-
StringBuffer result = new StringBuffer(s.length() + 10);
1098+
StringBuilder result = new StringBuilder(s.length() + 10);
10991099
for (int i = 0; i < s.length(); ++i) {
11001100
appendEscapedChar(result, s.charAt(i));
11011101
}
11021102
return result.toString();
11031103
}
11041104

1105-
private static void appendEscapedChar(StringBuffer buffer, char c) {
1105+
private static void appendEscapedChar(StringBuilder buffer, char c) {
11061106
buffer.append(getReplacement(c));
11071107
}
11081108

0 commit comments

Comments
 (0)