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 /weaver/src/main | |
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 'weaver/src/main')
15 files changed, 26 insertions, 26 deletions
diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java b/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java index 7fb18abcd..58af6d64f 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java @@ -856,7 +856,7 @@ public class AtAjAttributes { * @return a nicely formatted method string, for example: int X.foo(java.lang.String) */ public static String getMethodForMessage(AjAttributeMethodStruct methodstructure) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("Method '"); sb.append(methodstructure.method.getReturnType().toString()); sb.append(" ").append(methodstructure.enclosingType).append(".").append(methodstructure.method.getName()); @@ -1533,7 +1533,7 @@ public class AtAjAttributes { * @return a readable representation of a method */ private static String methodToString(Method method) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(method.getName()); sb.append(method.getSignature()); return sb.toString(); @@ -1811,7 +1811,7 @@ public class AtAjAttributes { args.add(st.nextToken()); } if (args.size() != method.getArgumentTypes().length) { - StringBuffer shortString = new StringBuffer().append(lastbit(method.getReturnType().toString())).append(" ") + StringBuilder shortString = new StringBuilder().append(lastbit(method.getReturnType().toString())).append(" ") .append(method.getName()); if (method.getArgumentTypes().length > 0) { shortString.append("("); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAnnotation.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAnnotation.java index 0db2ba905..3cce9afb5 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAnnotation.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAnnotation.java @@ -45,7 +45,7 @@ public class BcelAnnotation extends AbstractAnnotationAJ { } public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); List<NameValuePair> nvPairs = bcelAnnotation.getValues(); sb.append("Anno[" + getTypeSignature() + " " + (isRuntimeVisible() ? "rVis" : "rInvis")); if (nvPairs.size() > 0) { @@ -104,7 +104,7 @@ public class BcelAnnotation extends AbstractAnnotationAJ { */ @Override public String stringify() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("@").append(type.getClassName()); List<NameValuePair> values = bcelAnnotation.getValues(); if (values != null && values.size() != 0) { diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java index 4aa8d2485..3ffe74773 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java @@ -856,7 +856,7 @@ class BcelClassWeaver implements IClassWeaver { checkForOverride(interfaceType, name, psig, rsig, bridgeToCandidate.getAccessFlags(), clazz.getPackageName(), bm, overriddenMethodsCollector); for (ResolvedMember overriddenMethod : overriddenMethodsCollector) { - String key = new StringBuffer().append(overriddenMethod.getName()).append(overriddenMethod.getSignatureErased()).toString(); // pr237419 + String key = new StringBuilder().append(overriddenMethod.getName()).append(overriddenMethod.getSignatureErased()).toString(); // pr237419 boolean alreadyHaveABridgeMethod = methodsSet.contains(key); if (!alreadyHaveABridgeMethod) { if (bridges== null) { @@ -1103,7 +1103,7 @@ class BcelClassWeaver implements IClassWeaver { private void reportMethodCtorWeavingMessage(LazyClassGen clazz, ResolvedMember member, DeclareAnnotation decaM, int memberLineNumber) { if (!getWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) { - StringBuffer parmString = new StringBuffer("("); + StringBuilder parmString = new StringBuilder("("); UnresolvedType[] paramTypes = member.getParameterTypes(); for (int i = 0; i < paramTypes.length; i++) { UnresolvedType type = paramTypes[i]; @@ -1118,7 +1118,7 @@ class BcelClassWeaver implements IClassWeaver { } parmString.append(")"); String methodName = member.getName(); - StringBuffer sig = new StringBuffer(); + StringBuilder sig = new StringBuilder(); sig.append(org.aspectj.apache.bcel.classfile.Utility.accessToString(member.getModifiers())); sig.append(" "); sig.append(member.getReturnType().toString()); @@ -1128,7 +1128,7 @@ class BcelClassWeaver implements IClassWeaver { sig.append(methodName.equals("<init>") ? "new" : methodName); sig.append(parmString); - StringBuffer loc = new StringBuffer(); + StringBuilder loc = new StringBuilder(); if (clazz.getFileName() == null) { loc.append("no debug info available"); } else { diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java index c5c7cfbd6..c78011405 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java @@ -52,7 +52,7 @@ public class BcelGenericSignatureToTypeXConverter { // each type in the hierarchy may have type arguments // first build the 'raw type' signature - StringBuffer sig = new StringBuffer(); + StringBuilder sig = new StringBuilder(); sig.append(aClassTypeSignature.outerType.identifier.replace(';', ' ').trim()); for (int i = 0; i < aClassTypeSignature.nestedTypes.length; i++) { sig.append("$"); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java index c64ffde82..4d2e2bc88 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java @@ -2403,7 +2403,7 @@ public class BcelShadow extends Shadow { // rather than fail. If a bug is raised reporting unknown as a local variable name // then investigate the joinpoint giving rise to the ResolvedMember and why it has // no parameter names specified - argumentName = new StringBuffer("unknown").append(argNumber).toString(); + argumentName = new StringBuilder("unknown").append(argNumber).toString(); } else { argumentName = parameterNames.get(argNumber); } diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java index b8552dbb2..fc2a2451a 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java @@ -616,7 +616,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger { * Creates a nice signature for the ctor, something like "(int,Integer,String)" */ private String createReadableCtorSig(ResolvedType newParent, ConstantPool cpg, InvokeInstruction invokeSpecial) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); Type[] ctorArgs = invokeSpecial.getArgumentTypes(cpg); sb.append(newParent.getClassName()); sb.append("("); @@ -1338,7 +1338,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger { // Unlike toString() on a member, this does not include the declaring type private String stringifyMember(ResolvedMember member) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append(member.getReturnType().getName()); buf.append(' '); buf.append(member.getName()); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java index 12b8cb2c0..51f0a8c6c 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java @@ -400,7 +400,7 @@ public class BcelWeaver { if (filename.endsWith(".class")) { ReferenceType type = this.addClassFile(classFile, false); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(inFile.getAbsolutePath()); sb.append("!"); sb.append(entry.getName()); @@ -472,7 +472,7 @@ public class BcelWeaver { if (filename.endsWith(".class")) { // System.err.println( // "BCELWeaver: processing class from input directory "+classFile); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(inPathDir.getAbsolutePath()); sb.append("!"); sb.append(filename); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java index e7fdb4a10..7c4509e71 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java @@ -229,7 +229,7 @@ public class BcelWorld extends World implements Repository { * Ensure we report a nice source location - particular in the case where the source info is missing (binary weave). */ private String beautifyLocation(ISourceLocation isl) { - StringBuffer nice = new StringBuffer(); + StringBuilder nice = new StringBuilder(); if (isl == null || isl.getSourceFile() == null || isl.getSourceFile().getName().contains("no debug info available")) { nice.append("no debug info available"); } else { @@ -464,7 +464,7 @@ public class BcelWorld extends World implements Repository { if (resolvedTypeFromTypeMap != null && !(resolvedTypeFromTypeMap instanceof ReferenceType)) { // what on earth is it then? See pr 112243 - StringBuffer exceptionText = new StringBuffer(); + StringBuilder exceptionText = new StringBuilder(); exceptionText.append("Found invalid (not a ReferenceType) entry in the type map. "); exceptionText.append("Signature=[" + signature + "] Found=[" + resolvedTypeFromTypeMap + "] Class=[" + resolvedTypeFromTypeMap.getClass() + "]"); throw new BCException(exceptionText.toString()); @@ -500,7 +500,7 @@ public class BcelWorld extends World implements Repository { if (resolvedTypeFromTypeMap != null && !(resolvedTypeFromTypeMap instanceof ReferenceType)) { // what on earth is it then? See pr 112243 - StringBuffer exceptionText = new StringBuffer(); + StringBuilder exceptionText = new StringBuilder(); exceptionText.append("Found invalid (not a ReferenceType) entry in the type map. "); exceptionText.append("Signature=[" + signature + "] Found=[" + resolvedTypeFromTypeMap + "] Class=[" + resolvedTypeFromTypeMap.getClass() + "]"); throw new BCException(exceptionText.toString()); @@ -686,7 +686,7 @@ public class BcelWorld extends World implements Repository { @Override public String toString() { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append("BcelWorld("); // buf.append(shadowMungerMap); buf.append(")"); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java b/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java index a090e7189..c76e91956 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java @@ -156,7 +156,7 @@ public class ClassPathManager { @Override public String toString() { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); boolean start = true; for (Entry entry : entries) { if (start) { diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java index 80eb20acf..4a0ed1358 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java @@ -675,7 +675,7 @@ public final class LazyClassGen { } if (needAttribute) { - StringBuffer signature = new StringBuffer(); + StringBuilder signature = new StringBuilder(); // first, the type variables... if (myType != null) { TypeVariable[] tVars = myType.getTypeVariables(); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java index a6c8dd2ea..022345d40 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -553,7 +553,7 @@ public final class LazyMethodGen implements Traceable { public String toShortString() { String access = org.aspectj.apache.bcel.classfile.Utility.accessToString(getAccessFlags()); - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); if (!access.equals("")) { buf.append(access); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java b/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java index d9fc3396b..eea6c3d72 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java @@ -111,7 +111,7 @@ public class Utility { * Ensure we report a nice source location - particular in the case where the source info is missing (binary weave). */ public static String beautifyLocation(ISourceLocation isl) { - StringBuffer nice = new StringBuffer(); + StringBuilder nice = new StringBuilder(); if (isl == null || isl.getSourceFile() == null || isl.getSourceFile().getName().contains("no debug info available")) { nice.append("no debug info available"); } else { diff --git a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/LightXMLParser.java b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/LightXMLParser.java index 119ba8a51..3d3fba430 100644 --- a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/LightXMLParser.java +++ b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/LightXMLParser.java @@ -411,7 +411,7 @@ public class LightXMLParser { private void mapEntity(StringBuffer buf) throws Exception { char c = this.NULL_CHAR; - StringBuffer keyBuf = new StringBuffer(); + StringBuilder keyBuf = new StringBuilder(); while (true) { c = this.getNextChar(); if (c == ';') { diff --git a/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java b/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java index 0dbae4188..387844777 100644 --- a/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java +++ b/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java @@ -221,7 +221,7 @@ public class AsmRelationshipProvider { } else { IProgramElement programElement = model.getHierarchy().getRoot(); // =Foo/,<g(G.class[G - StringBuffer phantomHandle = new StringBuffer(); + StringBuilder phantomHandle = new StringBuilder(); // =Foo phantomHandle.append(programElement.getHandleIdentifier()); diff --git a/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipUtils.java b/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipUtils.java index 053a88abe..b21e7e2e0 100644 --- a/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipUtils.java +++ b/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipUtils.java @@ -52,7 +52,7 @@ public class AsmRelationshipUtils { * and a named pointcut called p() will return 'p()..' */ public static String genPointcutDetails(Pointcut pcd) { - StringBuffer details = new StringBuffer(); + StringBuilder details = new StringBuilder(); if (pcd instanceof ReferencePointcut) { ReferencePointcut rp = (ReferencePointcut) pcd; details.append(rp.name).append(DOUBLE_DOTS); |