aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorAndrey Turbanov <turbanoff@gmail.com>2021-11-20 17:16:22 +0300
committerAndrey Turbanov <turbanoff@gmail.com>2021-11-20 17:22:06 +0300
commitb1c52e2f5eb624037b8c799c20fbd1b4fd611d9a (patch)
tree33d7b6e8f733f20514f46e7871b29e26de47913d /util
parent0f85ca109b9e6ab849e201e76f62d5023cbfcb98 (diff)
downloadaspectj-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 'util')
-rw-r--r--util/src/main/java/org/aspectj/util/FileUtil.java4
-rw-r--r--util/src/main/java/org/aspectj/util/GenericSignature.java10
-rw-r--r--util/src/main/java/org/aspectj/util/GenericSignatureParser.java16
-rw-r--r--util/src/main/java/org/aspectj/util/LangUtil.java2
-rw-r--r--util/src/test/java/org/aspectj/util/FileUtilTest.java4
-rw-r--r--util/src/test/java/org/aspectj/util/GenericSignatureParserTest.java2
6 files changed, 19 insertions, 19 deletions
diff --git a/util/src/main/java/org/aspectj/util/FileUtil.java b/util/src/main/java/org/aspectj/util/FileUtil.java
index cf798617d..c572e5950 100644
--- a/util/src/main/java/org/aspectj/util/FileUtil.java
+++ b/util/src/main/java/org/aspectj/util/FileUtil.java
@@ -336,7 +336,7 @@ public class FileUtil {
if (null == infix) {
infix = File.pathSeparator;
}
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
boolean first = true;
for (String path : paths) {
if (null == path) {
@@ -1131,7 +1131,7 @@ public class FileUtil {
*/
public static String readAsString(File file) throws IOException {
BufferedReader r = new BufferedReader(new FileReader(file));
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
while (true) {
int ch = r.read();
if (ch == -1) {
diff --git a/util/src/main/java/org/aspectj/util/GenericSignature.java b/util/src/main/java/org/aspectj/util/GenericSignature.java
index f128ba4a5..e68a78b7e 100644
--- a/util/src/main/java/org/aspectj/util/GenericSignature.java
+++ b/util/src/main/java/org/aspectj/util/GenericSignature.java
@@ -27,7 +27,7 @@ public class GenericSignature {
public ClassTypeSignature[] superInterfaceSignatures = ClassTypeSignature.NONE;
public String toString() {
- StringBuffer ret = new StringBuffer();
+ StringBuilder ret = new StringBuilder();
ret.append(formalTypeParameters.toString());
ret.append(superclassSignature.toString());
for (ClassTypeSignature superInterfaceSignature : superInterfaceSignatures) {
@@ -52,7 +52,7 @@ public class GenericSignature {
}
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (formalTypeParameters.length > 0) {
sb.append("<");
for (FormalTypeParameter formalTypeParameter : formalTypeParameters) {
@@ -84,7 +84,7 @@ public class GenericSignature {
public FieldTypeSignature[] interfaceBounds;
public String toString() {
- StringBuffer ret = new StringBuffer();
+ StringBuilder ret = new StringBuilder();
ret.append("T");
ret.append(identifier);
ret.append(":");
@@ -208,7 +208,7 @@ public class GenericSignature {
}
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(identifier);
if (typeArguments.length > 0) {
sb.append("<");
@@ -240,7 +240,7 @@ public class GenericSignature {
public String toString() {
if (isWildcard)
return "*";
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
if (isPlus)
sb.append("+");
if (isMinus)
diff --git a/util/src/main/java/org/aspectj/util/GenericSignatureParser.java b/util/src/main/java/org/aspectj/util/GenericSignatureParser.java
index ba45ecc99..101984cb6 100644
--- a/util/src/main/java/org/aspectj/util/GenericSignatureParser.java
+++ b/util/src/main/java/org/aspectj/util/GenericSignatureParser.java
@@ -318,7 +318,7 @@ public class GenericSignatureParser {
char[] chars = signatureString.toCharArray();
int index = 0;
List<String> tokens = new ArrayList<>();
- StringBuffer identifier = new StringBuffer();
+ StringBuilder identifier = new StringBuilder();
boolean inParens = false;
boolean inArray = false;
boolean couldSeePrimitive = false;
@@ -327,32 +327,32 @@ public class GenericSignatureParser {
case '<':
if (identifier.length() > 0)
tokens.add(identifier.toString());
- identifier = new StringBuffer();
+ identifier = new StringBuilder();
tokens.add("<");
break;
case '>':
if (identifier.length() > 0)
tokens.add(identifier.toString());
- identifier = new StringBuffer();
+ identifier = new StringBuilder();
tokens.add(">");
break;
case ':':
if (identifier.length() > 0)
tokens.add(identifier.toString());
- identifier = new StringBuffer();
+ identifier = new StringBuilder();
tokens.add(":");
break;
case '/':
if (identifier.length() > 0)
tokens.add(identifier.toString());
- identifier = new StringBuffer();
+ identifier = new StringBuilder();
tokens.add("/");
couldSeePrimitive = false;
break;
case ';':
if (identifier.length() > 0)
tokens.add(identifier.toString());
- identifier = new StringBuffer();
+ identifier = new StringBuilder();
tokens.add(";");
couldSeePrimitive = true;
inArray = false;
@@ -360,7 +360,7 @@ public class GenericSignatureParser {
case '^':
if (identifier.length() > 0)
tokens.add(identifier.toString());
- identifier = new StringBuffer();
+ identifier = new StringBuilder();
tokens.add("^");
break;
case '+':
@@ -375,7 +375,7 @@ public class GenericSignatureParser {
case '.':
if (identifier.length() > 0)
tokens.add(identifier.toString());
- identifier = new StringBuffer();
+ identifier = new StringBuilder();
couldSeePrimitive = false;
tokens.add(".");
break;
diff --git a/util/src/main/java/org/aspectj/util/LangUtil.java b/util/src/main/java/org/aspectj/util/LangUtil.java
index 187b895b2..bea034d87 100644
--- a/util/src/main/java/org/aspectj/util/LangUtil.java
+++ b/util/src/main/java/org/aspectj/util/LangUtil.java
@@ -805,7 +805,7 @@ public class LangUtil {
if (LangUtil.isEmpty(in) || LangUtil.isEmpty(sought)) {
return in;
}
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
final int len = sought.length();
int start = 0;
int loc;
diff --git a/util/src/test/java/org/aspectj/util/FileUtilTest.java b/util/src/test/java/org/aspectj/util/FileUtilTest.java
index 3bd1ef4e4..e6ab241cc 100644
--- a/util/src/test/java/org/aspectj/util/FileUtilTest.java
+++ b/util/src/test/java/org/aspectj/util/FileUtilTest.java
@@ -487,7 +487,7 @@ public class FileUtilTest extends TestCase {
final String prefix = new File(tempDir, "testLineSeek").getPath();
// setup files 0..MAX with 2*MAX lines
String[] sources = new String[MAX];
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (int i = 0; i < sources.length; i++) {
sources[i] = new File(prefix + i).getPath();
sb.append("not matched");
@@ -604,7 +604,7 @@ public class FileUtilTest extends TestCase {
public void testPipe() {
String str = "The quick brown fox jumped over the lazy dog";
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (int i = 0; i < 4096; i++) {
sb.append(str);
}
diff --git a/util/src/test/java/org/aspectj/util/GenericSignatureParserTest.java b/util/src/test/java/org/aspectj/util/GenericSignatureParserTest.java
index e336392e3..bad45fe65 100644
--- a/util/src/test/java/org/aspectj/util/GenericSignatureParserTest.java
+++ b/util/src/test/java/org/aspectj/util/GenericSignatureParserTest.java
@@ -216,7 +216,7 @@ public class GenericSignatureParserTest extends TestCase {
}
private String tokensToString(String[] tokens) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(tokens[0]);
for (int i = 1; i < tokens.length; i++) {
sb.append(",");