diff options
author | Andrey Turbanov <turbanoff@gmail.com> | 2021-11-20 17:16:22 +0300 |
---|---|---|
committer | Andrey Turbanov <turbanoff@gmail.com> | 2021-11-20 17:22:06 +0300 |
commit | b1c52e2f5eb624037b8c799c20fbd1b4fd611d9a (patch) | |
tree | 33d7b6e8f733f20514f46e7871b29e26de47913d /testing | |
parent | 0f85ca109b9e6ab849e201e76f62d5023cbfcb98 (diff) | |
download | aspectj-b1c52e2f5eb624037b8c799c20fbd1b4fd611d9a.tar.gz aspectj-b1c52e2f5eb624037b8c799c20fbd1b4fd611d9a.zip |
Replace uses of StringBuffer with StringBuilder.
StringBuffer is a legacy synchronized class. StringBuilder is a direct replacement to StringBuffer which generally have better performance.
Diffstat (limited to 'testing')
21 files changed, 29 insertions, 29 deletions
diff --git a/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/Ajctest.java b/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/Ajctest.java index d9a91703b..9132a6c81 100644 --- a/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/Ajctest.java +++ b/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/Ajctest.java @@ -1125,7 +1125,7 @@ public class Ajctest extends Task implements PropertyChangeListener { if (null == current) { oneLine = "\nRESULT=\"ERROR\" null ACJTEST"; } else { - StringBuffer sb = new StringBuffer("\n"); + StringBuilder sb = new StringBuilder("\n"); int errs = Ajctest.allErrors.size(); int allFails = errs + current.ajdocStats.fails diff --git a/testing/src/test/java/org/aspectj/testing/CompileSpec.java b/testing/src/test/java/org/aspectj/testing/CompileSpec.java index 33e3d49aa..889183303 100644 --- a/testing/src/test/java/org/aspectj/testing/CompileSpec.java +++ b/testing/src/test/java/org/aspectj/testing/CompileSpec.java @@ -216,7 +216,7 @@ public class CompileSpec implements ITestStep { public void setExtdirs(String extdirs) { this.extdirs = extdirs; } protected String[] buildArgs() { - StringBuffer args = new StringBuffer(); + StringBuilder args = new StringBuilder(); // add any set options, and then files to compile at the end if (getAspectpath() != null) { args.append("-aspectpath "); diff --git a/testing/src/test/java/org/aspectj/testing/OutputSpec.java b/testing/src/test/java/org/aspectj/testing/OutputSpec.java index 210dc24a8..5a6594756 100644 --- a/testing/src/test/java/org/aspectj/testing/OutputSpec.java +++ b/testing/src/test/java/org/aspectj/testing/OutputSpec.java @@ -104,7 +104,7 @@ public class OutputSpec { } private void createFailureMessage(String output, int lineNo, int sizeFound) { - StringBuffer failMessage = new StringBuffer(); + StringBuilder failMessage = new StringBuilder(); failMessage.append("\n expecting output:\n"); for (String line: expectedOutputLines) { failMessage.append(line+"\n"); diff --git a/testing/src/test/java/org/aspectj/testing/WeaveSpec.java b/testing/src/test/java/org/aspectj/testing/WeaveSpec.java index c840f4261..50a78d39e 100644 --- a/testing/src/test/java/org/aspectj/testing/WeaveSpec.java +++ b/testing/src/test/java/org/aspectj/testing/WeaveSpec.java @@ -137,7 +137,7 @@ public class WeaveSpec extends CompileSpec { } private String[] buildWeaveArgs() { - StringBuffer args = new StringBuffer(); + StringBuilder args = new StringBuilder(); if (getOptions() != null) { StringTokenizer strTok = new StringTokenizer(getOptions(),","); while (strTok.hasMoreTokens()) { diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java index c332ab6f2..3954c7ecc 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java @@ -429,7 +429,7 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase { public String stringify(LocalVariableTable lvt, int slotIndex) { LocalVariable lv[] = lvt.getLocalVariableTable(); LocalVariable lvEntry = lv[slotIndex]; - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(lvEntry.getSignature()).append(" ").append(lvEntry.getName()).append("(").append(lvEntry.getIndex()) .append(") start=").append(lvEntry.getStartPC()).append(" len=").append(lvEntry.getLength()); return sb.toString(); @@ -437,7 +437,7 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase { public String stringify(List<LocalVariable> l, int slotIndex) { LocalVariable lvEntry = (LocalVariable) l.get(slotIndex); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(lvEntry.getSignature()).append(" ").append(lvEntry.getName()).append("(").append(lvEntry.getIndex()) .append(") start=").append(lvEntry.getStartPC()).append(" len=").append(lvEntry.getLength()); return sb.toString(); @@ -447,7 +447,7 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase { if (lvt == null) { return ""; } - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("LocalVariableTable. Entries=#" + lvt.getTableLength()).append("\n"); LocalVariable lv[] = lvt.getLocalVariableTable(); for (LocalVariable lvEntry : lv) { diff --git a/testing/src/test/java/org/aspectj/testing/ajde/CompileCommand.java b/testing/src/test/java/org/aspectj/testing/ajde/CompileCommand.java index d78c4e68d..ae33b944b 100644 --- a/testing/src/test/java/org/aspectj/testing/ajde/CompileCommand.java +++ b/testing/src/test/java/org/aspectj/testing/ajde/CompileCommand.java @@ -260,7 +260,7 @@ class LoggingInvocationHandler implements InvocationHandler { } public static String render(Method method, Object[] args) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(render(method.getReturnType())); sb.append(" "); sb.append(method.getName()); diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcSpecTest.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcSpecTest.java index 3da7a6a32..4b7b6ab0f 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcSpecTest.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcSpecTest.java @@ -118,7 +118,7 @@ public class AjcSpecTest extends TestCase { /** @return normal form for list items */ static String normal(List list) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("["); boolean first = true; for (Object o : list) { diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRunSpecTest.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRunSpecTest.java index 419740329..80168e890 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRunSpecTest.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRunSpecTest.java @@ -202,7 +202,7 @@ public class CompilerRunSpecTest extends TestCase { CRSOptions crsOptions = CompilerRun.Spec.testAccessToCRSOptions(); Set options = crsOptions.compilerOptions(); assertTrue(null != options); - StringBuffer notLoaded = new StringBuffer(); + StringBuilder notLoaded = new StringBuilder(); for (Object option : options) { Option compilerOption = (Option) option; if (!(crsOptions.compilerIsLoadable(compilerOption))) { diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/DirChangesTest.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/DirChangesTest.java index 07e6a5036..acb4bcf7c 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/DirChangesTest.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/DirChangesTest.java @@ -180,7 +180,7 @@ public class DirChangesTest extends TestCase { actual[i] = null; } } - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); { IMessage[] expNotFound = (IMessage[]) LangUtil.safeCopy(expected, new IMessage[0]); diff --git a/testing/src/test/java/org/aspectj/testing/run/RunStatus.java b/testing/src/test/java/org/aspectj/testing/run/RunStatus.java index 2cf949f6c..6b93727cf 100644 --- a/testing/src/test/java/org/aspectj/testing/run/RunStatus.java +++ b/testing/src/test/java/org/aspectj/testing/run/RunStatus.java @@ -423,7 +423,7 @@ public class RunStatus implements IRunStatus { } public String toLongString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(BridgeUtil.toShortString(this)); if ((null != children) && (0 < children.size())) { String label = "### --------- " + name; diff --git a/testing/src/test/java/org/aspectj/testing/util/BridgeUtil.java b/testing/src/test/java/org/aspectj/testing/util/BridgeUtil.java index 0e75a7c8b..eb5349667 100644 --- a/testing/src/test/java/org/aspectj/testing/util/BridgeUtil.java +++ b/testing/src/test/java/org/aspectj/testing/util/BridgeUtil.java @@ -443,7 +443,7 @@ public class BridgeUtil { if (0 > numIncomplete) { numIncomplete = 0; } - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if (RunValidator.NORMAL.runPassed(runStatus)) { sb.append("PASS "); } else { @@ -500,7 +500,7 @@ public class BridgeUtil { if (null == runStatus) { return "((RunStatus) null)"; } - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if (RunValidator.NORMAL.runPassed(runStatus)) { sb.append("PASS "); } else { diff --git a/testing/src/test/java/org/aspectj/testing/util/LangUtil.java b/testing/src/test/java/org/aspectj/testing/util/LangUtil.java index c156962df..6b28c8803 100644 --- a/testing/src/test/java/org/aspectj/testing/util/LangUtil.java +++ b/testing/src/test/java/org/aspectj/testing/util/LangUtil.java @@ -242,7 +242,7 @@ public class LangUtil { } else if (0 == ra.length) { return null; } - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); final String cname = LangUtil.unqualifiedClassName(superType); // int index = 0; for (int i = 0; i < ra.length; i++) { @@ -478,7 +478,7 @@ public class LangUtil { * @param errs the StringBuffer for error messages (if any) */ public static String unsplit(String[] input, StringBuffer errs) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(SPLIT_START); for (int i = 0; i < input.length; i++) { if (input[i].contains(SPLIT_DELIM)) { @@ -604,7 +604,7 @@ public class LangUtil { } boolean longFormat = (args.length < 10); String sep = (longFormat ? ", " : "\n\t"); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if (!longFormat) sb.append("["); for (int i = 0; i < args.length; i++) { if (0 < i) sb.append(sep); @@ -693,7 +693,7 @@ public class LangUtil { Class c = o.getClass(); if (c.isArray()) { Object[] ra = (Object[]) o; - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("["); for (int i = 0; i < ra.length; i++) { if (i > 0) { @@ -808,7 +808,7 @@ public class LangUtil { if (null == suffix) { suffix = SPLIT_END; } - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if (null != source) { sb.append(org.aspectj.util.LangUtil.unqualifiedClassName(source)); } diff --git a/testing/src/test/java/org/aspectj/testing/util/LineReader.java b/testing/src/test/java/org/aspectj/testing/util/LineReader.java index b8a29ebdd..f1fbcd91a 100644 --- a/testing/src/test/java/org/aspectj/testing/util/LineReader.java +++ b/testing/src/test/java/org/aspectj/testing/util/LineReader.java @@ -135,7 +135,7 @@ public class LineReader extends LineNumberReader { * @return the String containing all lines skipped (delimited with RETURN) */ public String readToBlankLine() throws IOException { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); String input; while (null != (input = nextLine(false))) { // get next empty line to restart sb.append(input); diff --git a/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java b/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java index 103d201d2..8004c3f67 100644 --- a/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java +++ b/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java @@ -127,7 +127,7 @@ public class LinkCheck { long numChecked = me.checkedUrls.size(); if (numChecked > 0) { float cps = (float) duration / (float) numChecked; - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("DONE. Checked " + numChecked); sb.append(" URL's in " + duration); sb.append(" seconds (" + cps); diff --git a/testing/src/test/java/org/aspectj/testing/util/UtilLineReader.java b/testing/src/test/java/org/aspectj/testing/util/UtilLineReader.java index b46db2ae1..de1d9e477 100644 --- a/testing/src/test/java/org/aspectj/testing/util/UtilLineReader.java +++ b/testing/src/test/java/org/aspectj/testing/util/UtilLineReader.java @@ -135,7 +135,7 @@ public class UtilLineReader extends LineNumberReader { * @return the String containing all lines skipped (delimited with RETURN) */ public String readToBlankLine() throws IOException { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); String input; while (null != (input = nextLine(false))) { // get next empty line to restart sb.append(input); diff --git a/testing/src/test/java/org/aspectj/testing/util/WebInstall.java b/testing/src/test/java/org/aspectj/testing/util/WebInstall.java index 805703ddb..6512eb0e6 100644 --- a/testing/src/test/java/org/aspectj/testing/util/WebInstall.java +++ b/testing/src/test/java/org/aspectj/testing/util/WebInstall.java @@ -183,7 +183,7 @@ public class WebInstall { ms.invoke(null, new Object[] { args }); } public static final String render(String[] args) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("["); for (int i = 0; i < args.length; i++) { if (0 < i) sb.append(", "); diff --git a/testing/src/test/java/org/aspectj/testing/util/options/Options.java b/testing/src/test/java/org/aspectj/testing/util/options/Options.java index 873b00786..cb9ac2540 100644 --- a/testing/src/test/java/org/aspectj/testing/util/options/Options.java +++ b/testing/src/test/java/org/aspectj/testing/util/options/Options.java @@ -48,7 +48,7 @@ public class Options { if (0 == missed.length) { return null; } - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("missed values: ["); for (int i = 0; i < missed.length; i++) { if (i > 0) { diff --git a/testing/src/test/java/org/aspectj/testing/util/options/Values.java b/testing/src/test/java/org/aspectj/testing/util/options/Values.java index c1ded7fab..3d4ed0f73 100644 --- a/testing/src/test/java/org/aspectj/testing/util/options/Values.java +++ b/testing/src/test/java/org/aspectj/testing/util/options/Values.java @@ -680,7 +680,7 @@ public class Values { if (null == input) { return "null"; } - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("["); for (int i = 0; i < input.length; i++) { if (i > 0) { diff --git a/testing/src/test/java/org/aspectj/testing/xml/MessageListXmlReader.java b/testing/src/test/java/org/aspectj/testing/xml/MessageListXmlReader.java index 48b22f19c..46352a0a2 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/MessageListXmlReader.java +++ b/testing/src/test/java/org/aspectj/testing/xml/MessageListXmlReader.java @@ -36,7 +36,7 @@ public class MessageListXmlReader { private static final String INLINE_DOCTYPE; static { final String EOL = LangUtil.EOL; - final StringBuffer r = new StringBuffer(); + final StringBuilder r = new StringBuilder(); r.append("<!DOCTYPE "); r.append(MessageList.XMLNAME); diff --git a/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java b/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java index a223a3453..82c0843c1 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java +++ b/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java @@ -309,7 +309,7 @@ public class SoftMessage implements IMessage { } public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); result.append(null == getKind() ? "<null kind>" : getKind().toString()); diff --git a/testing/src/test/java/org/aspectj/testing/xml/XMLWriter.java b/testing/src/test/java/org/aspectj/testing/xml/XMLWriter.java index f74b87da5..f4b9dd990 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/XMLWriter.java +++ b/testing/src/test/java/org/aspectj/testing/xml/XMLWriter.java @@ -121,7 +121,7 @@ public class XMLWriter { * @throws IllegalArgumentException if list[i].toString() contains a comma */ public static String flattenList(Object[] list) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if (null != list) { boolean printed = false; for (Object o : list) { @@ -228,7 +228,7 @@ public class XMLWriter { if (0 < stack.size()) { indent += TAB; } - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(indent); sb.append("<"); sb.append(name); |