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 /ajdoc | |
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 'ajdoc')
3 files changed, 7 insertions, 7 deletions
diff --git a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java index 8d36a2433..b512332fa 100644 --- a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java +++ b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java @@ -283,7 +283,7 @@ class HtmlDecorator { String name = decl.toSignatureString(); int classEndIndex = contents.indexOf(name + "</B><DT>"); if (classEndIndex != -1) { - StringBuffer sb = new StringBuffer(contents.substring(secondClassStartIndex, classEndIndex)); + StringBuilder sb = new StringBuilder(contents.substring(secondClassStartIndex, classEndIndex)); sb.replace(0, 5, "aspect"); fileContents.delete(secondClassStartIndex, classEndIndex); fileContents.insert(secondClassStartIndex, sb.toString()); @@ -618,7 +618,7 @@ class HtmlDecorator { parent = parent.getParent(); names.add(parent.toLinkLabelString()); } - StringBuffer sbuff = new StringBuffer(); + StringBuilder sbuff = new StringBuilder(); for (int i = names.size() - 1; i >= 0; i--) { String element = (String) names.get(i); if (i == 0) { @@ -634,7 +634,7 @@ class HtmlDecorator { // need to replace " with quot; otherwise the links wont work // for 'matches declare' relationship - StringBuffer sb = new StringBuffer(currDecl.toLabelString()); + StringBuilder sb = new StringBuilder(currDecl.toLabelString()); int nextQuote = sb.toString().indexOf("\""); while (nextQuote != -1) { sb.deleteCharAt(nextQuote); @@ -778,7 +778,7 @@ class HtmlDecorator { * @return String consisting of multiple "../" parts, one for each component part of the input <code>packagePath</code>. */ private static String getRelativePathFromHere(String packagePath) { - StringBuffer result = new StringBuffer(""); + StringBuilder result = new StringBuilder(""); if (packagePath != null && (packagePath.contains("/"))) { StringTokenizer sTok = new StringTokenizer(packagePath, "/", false); while (sTok.hasMoreTokens()) { @@ -839,7 +839,7 @@ class HtmlDecorator { } static String generateHREFName(IProgramElement decl) { - StringBuffer hrefLinkBuffer = new StringBuffer(); + StringBuilder hrefLinkBuffer = new StringBuilder(); char[] declChars = decl.toLabelString().toCharArray(); for (char declChar : declChars) { if (declChar == '"') { diff --git a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java index 763a5f5d2..313c1af3b 100644 --- a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java +++ b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java @@ -334,7 +334,7 @@ public class Main implements Config { if (indexFile.exists()) { BufferedReader indexFileReader = new BufferedReader(new FileReader(indexFile)); // StringBuffer greatly reduces the time it takes to remove generated tags - StringBuffer indexFileBuffer = new StringBuffer((int) indexFile.length()); + StringBuilder indexFileBuffer = new StringBuilder((int) indexFile.length()); String line = indexFileReader.readLine(); while (line != null) { int indexStart = line.indexOf(Config.DECL_ID_STRING); diff --git a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/StructureUtil.java b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/StructureUtil.java index b615078ba..a6490bd52 100644 --- a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/StructureUtil.java +++ b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/StructureUtil.java @@ -112,7 +112,7 @@ public class StructureUtil { } public static String genSignature(IProgramElement node) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); String accessibility = node.getAccessibility().toString(); if (!accessibility.equals("package")) { |