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 /tests | |
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 'tests')
6 files changed, 15 insertions, 15 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java index 8bb04f389..ae44e9a60 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java @@ -880,7 +880,7 @@ public class GenericsTests extends XMLBasedAjcTestCase { */ public void checkMethodsExist(String classname,String[] methods) { Set<String> methodsFound = new HashSet<>(); - StringBuffer debugString = new StringBuffer(); + StringBuilder debugString = new StringBuilder(); try { ClassLoader cl = new URLClassLoader(new URL[]{ajc.getSandboxDirectory().toURI().toURL()}); Class<?> clz = Class.forName(classname,false,cl); @@ -906,7 +906,7 @@ public class GenericsTests extends XMLBasedAjcTestCase { fail("Couldn't find [" + string + "] in the set of methods in " + classname + " => " + debugString); } } - StringBuffer unexpectedMethods = new StringBuffer(); + StringBuilder unexpectedMethods = new StringBuilder(); if (!methodsFound.isEmpty()) { for (String element: methodsFound) { unexpectedMethods.append("[").append(element).append("]"); @@ -959,7 +959,7 @@ public class GenericsTests extends XMLBasedAjcTestCase { JavaClass clazz = getClass(ajc,classname); Attribute[] attrs = clazz.getAttributes(); int signatureCount = 0; - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (Attribute attribute : attrs) { if (attribute.getName().equals("Signature")) { signatureCount++; @@ -979,7 +979,7 @@ public class GenericsTests extends XMLBasedAjcTestCase { private static String stringify(Class<?>[] clazzes) { if (clazzes==null) return ""; - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (int i = 0; i < clazzes.length; i++) { if (i>0) sb.append(","); sb.append(clazzes[i].getName()); diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java index e7ff69f57..03cb07828 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java @@ -255,7 +255,7 @@ public class SynchronizationTransformTests extends XMLBasedAjcTestCase { } private String stringify(List<String> l) { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); for (String str : l) { result.append(str); result.append("\n"); diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc169/TransparentWeavingTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc169/TransparentWeavingTests.java index 3289e3331..a43907df0 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc169/TransparentWeavingTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc169/TransparentWeavingTests.java @@ -159,7 +159,7 @@ public class TransparentWeavingTests extends org.aspectj.testing.XMLBasedAjcTest try { JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), clazzname); Field[] fs = jc.getFields(); - StringBuffer fields = new StringBuffer(); + StringBuilder fields = new StringBuilder(); for (Field f : fs) { fields.append(f.getName()).append(" "); if (f.getName().equals(name)) { @@ -175,7 +175,7 @@ public class TransparentWeavingTests extends org.aspectj.testing.XMLBasedAjcTest private Field checkForField(String clazzname, int modifiers, String name) throws Exception { JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), clazzname); Field[] fs = jc.getFields(); - StringBuffer fields = new StringBuffer(); + StringBuilder fields = new StringBuilder(); for (Field f : fs) { fields.append(f.getName()).append(" "); if (f.getName().equals(name)) { @@ -192,7 +192,7 @@ public class TransparentWeavingTests extends org.aspectj.testing.XMLBasedAjcTest private Method checkForMethod(String clazzname, int modifiers, String name) throws Exception { JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), clazzname); Method[] fs = jc.getMethods(); - StringBuffer methods = new StringBuffer(); + StringBuilder methods = new StringBuilder(); methods.append("\n"); for (Method f : fs) { methods.append(f.getName()).append("\n"); diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java index 0f776db9c..8fc389e5b 100644 --- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java @@ -386,7 +386,7 @@ public class AjdeInteractionTestbed extends TestCase { * Helper method for dumping info about which files were compiled and woven during the last build. */ public String printCompiledAndWovenFiles(String projectName) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if (getCompiledFiles(projectName).size() == 0 && getWovenClasses(projectName).size() == 0) { sb.append("No files were compiled or woven\n"); } diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java index f3dd09c4d..5a3cab221 100644 --- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java @@ -62,7 +62,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio public String getClasspath() { log("ICompilerConfiguration.getClasspath()"); // AJDT has all the output directories on it's classpath - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); List<File> allOutputPaths = getOutputLocationManager().getAllOutputLocations(); for (File dir: allOutputPaths) { sb.append(File.pathSeparator + dir.getAbsolutePath()); diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index b132bfc92..4249f1578 100644 --- a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -2208,7 +2208,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa } private String toString(List<ResolvedMember> list) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (ResolvedMember m : list) { sb.append(m).append("\n"); } @@ -2216,7 +2216,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa } private String typeListToString(List<String> list) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (String m : list) { sb.append(m).append("\n"); } @@ -2224,7 +2224,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa } private String toString(List<ResolvedMember> one, List<ResolvedMember> two, boolean shouldIncludeGenerics) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("Through iterator\n"); for (ResolvedMember m : one) { sb.append(m).append("\n"); @@ -2237,7 +2237,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa } private String typeListsToString(List<String> one, List<String> two) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("Through iterator\n"); for (String m : one) { sb.append(">" + m).append("\n"); @@ -3901,7 +3901,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa */ private List<String> getRelatedElements(AsmManager model, IProgramElement programElement, int expected) { List<String> relatedElements = getRelatedElements(model, programElement); - StringBuffer debugString = new StringBuffer(); + StringBuilder debugString = new StringBuilder(); if (relatedElements != null) { for (String element : relatedElements) { debugString.append(model.getHierarchy().findElementForHandle(element).toLabelString()).append("\n"); |