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 /asm | |
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 'asm')
3 files changed, 11 insertions, 11 deletions
diff --git a/asm/src/main/java/org/aspectj/asm/AsmManager.java b/asm/src/main/java/org/aspectj/asm/AsmManager.java index e81b91b4d..5a94c69fb 100644 --- a/asm/src/main/java/org/aspectj/asm/AsmManager.java +++ b/asm/src/main/java/org/aspectj/asm/AsmManager.java @@ -511,7 +511,7 @@ public class AsmManager implements IStructureModel { for (IRelationship ir : rels) { List<String> targets = ir.getTargets(); for (String thid : targets) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if (modelFilter == null || modelFilter.wantsHandleIds()) { sb.append("Hid:" + (ctr++) + ":"); } @@ -637,7 +637,7 @@ public class AsmManager implements IStructureModel { // unexpected - time to give up return ""; } - StringBuffer qualifiedTypeNameFromHandle = new StringBuffer(); + StringBuilder qualifiedTypeNameFromHandle = new StringBuilder(); if (hasPackage != -1) { int classfileLoc = handle.indexOf(HandleProviderDelimiter.CLASSFILE.getDelimiter(), hasPackage); qualifiedTypeNameFromHandle.append(handle.substring(hasPackage + 1, classfileLoc)); @@ -1196,7 +1196,7 @@ public class AsmManager implements IStructureModel { } public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("Model node summary:\n"); Enumeration<String> nodeKeys = nodeTypeCount.keys(); while (nodeKeys.hasMoreElements()) { diff --git a/asm/src/main/java/org/aspectj/asm/internal/JDTLikeHandleProvider.java b/asm/src/main/java/org/aspectj/asm/internal/JDTLikeHandleProvider.java index 0c8271441..c7f24bc08 100644 --- a/asm/src/main/java/org/aspectj/asm/internal/JDTLikeHandleProvider.java +++ b/asm/src/main/java/org/aspectj/asm/internal/JDTLikeHandleProvider.java @@ -60,12 +60,12 @@ public class JDTLikeHandleProvider implements IElementHandleProvider { if (end != -1) { configFile = configFile.substring(start + 1, end); } else { - configFile = new StringBuffer("=").append(configFile.substring(start + 1)).toString(); + configFile = new StringBuilder("=").append(configFile.substring(start + 1)).toString(); } ipe.setHandleIdentifier(configFile); return configFile; } else if (ipe.getKind() == IProgramElement.Kind.SOURCE_FOLDER) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(createHandleIdentifier(ipe.getParent())).append("/"); // pr249216 - escape any embedded slashes String folder = ipe.getName(); @@ -86,7 +86,7 @@ public class JDTLikeHandleProvider implements IElementHandleProvider { parent = ipe.getParent().getParent(); } - StringBuffer handle = new StringBuffer(); + StringBuilder handle = new StringBuilder(); // add the handle for the parent handle.append(createHandleIdentifier(parent)); // add the correct delimiter for this ipe @@ -133,7 +133,7 @@ public class JDTLikeHandleProvider implements IElementHandleProvider { } List<String> sourceRefs = ipe.getParameterSignaturesSourceRefs(); List<char[]> parameterTypes = ipe.getParameterSignatures(); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if (sourceRefs != null) { for (String sourceRef : sourceRefs) { sb.append(HandleProviderDelimiter.getDelimiter(ipe)); diff --git a/asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java b/asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java index 06dd1c6c6..02500018f 100644 --- a/asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java +++ b/asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java @@ -436,7 +436,7 @@ public class ProgramElement implements IProgramElement { // not parameterized return new StringBuilder("L").append(name.replace('.', '/')).append(';').toString(); } else { - StringBuffer nameBuff = new StringBuffer(); + StringBuilder nameBuff = new StringBuilder(); int nestLevel = 0; nameBuff.append("L"); for (int i = 0; i < name.length(); i++) { @@ -448,7 +448,7 @@ public class ProgramElement implements IProgramElement { case '<': nameBuff.append("<"); nestLevel++; - StringBuffer innerBuff = new StringBuffer(); + StringBuilder innerBuff = new StringBuilder(); while (nestLevel > 0) { c = name.charAt(++i); if (c == '<') { @@ -459,7 +459,7 @@ public class ProgramElement implements IProgramElement { } if (c == ',' && nestLevel == 1) { nameBuff.append(nameToSignature(innerBuff.toString())); - innerBuff = new StringBuffer(); + innerBuff = new StringBuilder(); } else { if (nestLevel > 0) { innerBuff.append(c); @@ -623,7 +623,7 @@ public class ProgramElement implements IProgramElement { } public String toSignatureString(boolean getFullyQualifiedArgTypes) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(name); List<char[]> ptypes = getParameterTypes(); |