From 70984fbf83506ae3ddbd4278f6454f61c5a078b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Mon, 23 Mar 2026 14:18:40 +0100 Subject: [PATCH] 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> --- .../src/org/eclipse/pde/internal/build/ant/AntScript.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ant/AntScript.java b/build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ant/AntScript.java index 5da8911985e..288497c9800 100644 --- a/build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ant/AntScript.java +++ b/build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ant/AntScript.java @@ -1095,14 +1095,14 @@ public void printTaskDef(String name, String classname) { } public static String getEscaped(String s) { - StringBuffer result = new StringBuffer(s.length() + 10); + StringBuilder result = new StringBuilder(s.length() + 10); for (int i = 0; i < s.length(); ++i) { appendEscapedChar(result, s.charAt(i)); } return result.toString(); } - private static void appendEscapedChar(StringBuffer buffer, char c) { + private static void appendEscapedChar(StringBuilder buffer, char c) { buffer.append(getReplacement(c)); }