Browse Source

Replace uses of StringBuffer with StringBuilder.

StringBuffer is a legacy synchronized class. StringBuilder is a direct replacement to StringBuffer which generally have better performance.
tags/V1_9_8
Andrey Turbanov 2 years ago
parent
commit
b1c52e2f5e
100 changed files with 353 additions and 353 deletions
  1. 1
    1
      ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserCompilerConfiguration.java
  2. 1
    1
      ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BasicEditor.java
  3. 1
    1
      ajde.core/src/main/java/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java
  4. 1
    1
      ajde.core/src/test/java/org/aspectj/ajde/core/tests/AjConfigTest.java
  5. 1
    1
      ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java
  6. 1
    1
      ajde/src/main/java/org/aspectj/ajde/Ajde.java
  7. 1
    1
      ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java
  8. 5
    5
      ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java
  9. 1
    1
      ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java
  10. 1
    1
      ajdoc/src/main/java/org/aspectj/tools/ajdoc/StructureUtil.java
  11. 3
    3
      asm/src/main/java/org/aspectj/asm/AsmManager.java
  12. 4
    4
      asm/src/main/java/org/aspectj/asm/internal/JDTLikeHandleProvider.java
  13. 4
    4
      asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java
  14. 15
    15
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/BootstrapMethods.java
  15. 8
    8
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Code.java
  16. 14
    14
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ConstantPool.java
  17. 5
    5
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ExceptionTable.java
  18. 2
    2
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Field.java
  19. 5
    5
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/InnerClasses.java
  20. 8
    8
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java
  21. 7
    7
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/LineNumberTable.java
  22. 1
    1
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/LocalVariableTable.java
  23. 1
    1
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/LocalVariableTypeTable.java
  24. 3
    3
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Method.java
  25. 2
    2
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ModulePackages.java
  26. 3
    3
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/NestHost.java
  27. 3
    3
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/NestMembers.java
  28. 7
    7
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Signature.java
  29. 8
    8
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/StackMap.java
  30. 6
    6
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/StackMapEntry.java
  31. 6
    6
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Synthetic.java
  32. 32
    32
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Utility.java
  33. 1
    1
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationElementValue.java
  34. 2
    2
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationGen.java
  35. 1
    1
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ArrayElementValue.java
  36. 1
    1
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/EnumElementValue.java
  37. 1
    1
      bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/NameValuePair.java
  38. 6
    6
      bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ArrayType.java
  39. 4
    4
      bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGen.java
  40. 4
    4
      bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Instruction.java
  41. 4
    4
      bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionCP.java
  42. 41
    41
      bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java
  43. 6
    6
      bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionSelect.java
  44. 18
    18
      bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java
  45. 2
    2
      bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ObjectType.java
  46. 8
    8
      bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Type.java
  47. 4
    4
      bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassLoaderRepository.java
  48. 1
    1
      bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java
  49. 3
    3
      bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/BcelTestCase.java
  50. 2
    2
      bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParsingTest.java
  51. 3
    3
      bridge/src/main/java/org/aspectj/bridge/MessageUtil.java
  52. 1
    1
      bridge/src/main/java/org/aspectj/bridge/SourceLocation.java
  53. 2
    2
      bridge/src/main/java/org/aspectj/bridge/WeaveMessage.java
  54. 2
    2
      bridge/src/main/java/org/aspectj/bridge/context/CompilationAndWeavingContext.java
  55. 1
    1
      bridge/src/main/java/org/aspectj/bridge/context/PinpointingMessageHandler.java
  56. 1
    1
      bridge/src/test/java/org/aspectj/bridge/MessageTest.java
  57. 2
    2
      build/src/main/java/$installer$/org/aspectj/Main.java
  58. 2
    2
      build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AJInstaller.java
  59. 2
    2
      build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java
  60. 1
    1
      build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/Checklics.java
  61. 1
    1
      build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/StripNonBodyHtml.java
  62. 1
    1
      build/src/main/java/org/aspectj/internal/tools/build/Builder.java
  63. 1
    1
      build/src/main/java/org/aspectj/internal/tools/build/Module.java
  64. 3
    3
      build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java
  65. 1
    1
      build/src/main/java/org/aspectj/internal/tools/build/Util.java
  66. 1
    1
      build/src/test/java/org/aspectj/internal/build/BuildModuleTest.java
  67. 1
    1
      build/src/test/java/org/aspectj/internal/build/ModulesTest.java
  68. 2
    2
      loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
  69. 1
    1
      loadtime/src/main/java/org/aspectj/weaver/loadtime/ConcreteAspectCodeGen.java
  70. 3
    3
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java
  71. 1
    1
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java
  72. 1
    1
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/WeaverAdapter.java
  73. 1
    1
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java
  74. 1
    1
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java
  75. 2
    2
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java
  76. 1
    1
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/IfPseudoToken.java
  77. 1
    1
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java
  78. 1
    1
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/PointcutDesignator.java
  79. 1
    1
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
  80. 1
    1
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java
  81. 1
    1
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java
  82. 4
    4
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/PushinCollector.java
  83. 2
    2
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java
  84. 1
    1
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java
  85. 3
    3
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
  86. 1
    1
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java
  87. 2
    2
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjState.java
  88. 3
    3
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java
  89. 4
    4
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java
  90. 1
    1
      org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/EclipseClassPathManager.java
  91. 1
    1
      org.aspectj.ajdt.core/src/main/java/org/aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java
  92. 1
    1
      org.aspectj.ajdt.core/src/main/java/org/aspectj/tools/ajc/Main.java
  93. 5
    5
      org.aspectj.ajdt.core/src/test/java/WeaveTest.java
  94. 3
    3
      org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java
  95. 3
    3
      org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java
  96. 1
    1
      org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/CompilationResult.java
  97. 1
    1
      org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractAnnotationAJ.java
  98. 1
    1
      org.aspectj.matcher/src/main/java/org/aspectj/weaver/Advice.java
  99. 2
    2
      org.aspectj.matcher/src/main/java/org/aspectj/weaver/AjcMemberMaker.java
  100. 0
    0
      org.aspectj.matcher/src/main/java/org/aspectj/weaver/AnnotationNameValuePair.java

+ 1
- 1
ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserCompilerConfiguration.java View File

@@ -36,7 +36,7 @@ public class BrowserCompilerConfiguration implements ICompilerConfiguration {
}

public String getClasspath() {
StringBuffer classpath = new StringBuffer();
StringBuilder classpath = new StringBuilder();
String userPath = preferencesAdapter.getProjectPreference(PreferenceStoreConstants.BUILD_CLASSPATH);
if (userPath != null && userPath.trim().length() != 0) {
classpath.append(userPath);

+ 1
- 1
ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BasicEditor.java View File

@@ -156,7 +156,7 @@ public class BasicEditor implements EditorAdapter {
return "ERROR: file \"" + filePath + "\" does not exist.";
}
BufferedReader reader = new BufferedReader(new FileReader(file));
StringBuffer contents = new StringBuffer();
StringBuilder contents = new StringBuilder();
String line = reader.readLine();
int numLines = 0;
while (line != null) {

+ 1
- 1
ajde.core/src/main/java/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java View File

@@ -175,7 +175,7 @@ public class AjdeCoreBuildManager {
return "none";
}

StringBuffer formattedOptions = new StringBuffer();
StringBuilder formattedOptions = new StringBuilder();
for (Object option : options) {
String o = option.toString();
if (formattedOptions.length() > 0) {

+ 1
- 1
ajde.core/src/test/java/org/aspectj/ajde/core/tests/AjConfigTest.java View File

@@ -145,7 +145,7 @@ public class AjConfigTest extends AjdeCoreTestCase {
public void testClasspath() {
String classpath = compilerConfig.getClasspath();
List<String> found = genAjBuildConfig().getClasspath();
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
for (Iterator<String> iterator = found.iterator(); iterator.hasNext();) {
String name = iterator.next();
sb.append(name);

+ 1
- 1
ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java View File

@@ -394,7 +394,7 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase {
}

private String stringify(List<String> l) {
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
for (String str: l) {
result.append(str);
result.append("\n");

+ 1
- 1
ajde/src/main/java/org/aspectj/ajde/Ajde.java View File

@@ -258,7 +258,7 @@ public class Ajde {
if (LangUtil.isEmpty(mainClass)) {
showWarningMessage("No main class specified");
} else {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
List outputDirs = compilerConfig.getOutputLocationManager().getAllOutputLocations();
for (Object outputDir : outputDirs) {
File dir = (File) outputDir;

+ 1
- 1
ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java View File

@@ -185,7 +185,7 @@ class LstBuildConfigFileUpdater {
*/
public void writeConfigFile(String filePath, List<String> fileContents) {
Set<String> contentsSet = new TreeSet<>(fileContents);
StringBuffer fileContentsSB = new StringBuffer();
StringBuilder fileContentsSB = new StringBuilder();
for (String s : contentsSet) {
fileContentsSB.append(s.toString());
fileContentsSB.append("\n");

+ 5
- 5
ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java View File

@@ -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 == '"') {

+ 1
- 1
ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java View File

@@ -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);

+ 1
- 1
ajdoc/src/main/java/org/aspectj/tools/ajdoc/StructureUtil.java View File

@@ -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")) {

+ 3
- 3
asm/src/main/java/org/aspectj/asm/AsmManager.java View File

@@ -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()) {

+ 4
- 4
asm/src/main/java/org/aspectj/asm/internal/JDTLikeHandleProvider.java View File

@@ -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));

+ 4
- 4
asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java View File

@@ -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();

+ 15
- 15
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/BootstrapMethods.java View File

@@ -63,7 +63,7 @@ import org.aspectj.apache.bcel.Constants;

/**
* Represents the BootstrapMethods attribute in Java 7 classes.
*
*
* @author Andy Clement
*/
public final class BootstrapMethods extends Attribute {
@@ -98,7 +98,7 @@ public final class BootstrapMethods extends Attribute {
file.readFully(data);
isInPackedState = true;
}
public static class BootstrapMethod {
private int bootstrapMethodRef;
private int[] bootstrapArguments;
@@ -106,7 +106,7 @@ public final class BootstrapMethods extends Attribute {
BootstrapMethod(DataInputStream file) throws IOException {
this(file.readUnsignedShort(), readBootstrapArguments(file));
}
private static int[] readBootstrapArguments(DataInputStream dis) throws IOException {
int numBootstrapMethods = dis.readUnsignedShort();
int[] bootstrapArguments = new int[numBootstrapMethods];
@@ -115,16 +115,16 @@ public final class BootstrapMethods extends Attribute {
}
return bootstrapArguments;
}
public BootstrapMethod(int bootstrapMethodRef, int[] bootstrapArguments) {
this.bootstrapMethodRef = bootstrapMethodRef;
this.bootstrapArguments = bootstrapArguments;
}
public int getBootstrapMethodRef() {
return bootstrapMethodRef;
}
public int[] getBootstrapArguments() {
return bootstrapArguments;
}
@@ -137,15 +137,15 @@ public final class BootstrapMethods extends Attribute {
file.writeShort(bootstrapArgument);
}
}
public final int getLength() {
return 2 /*bootstrapMethodRef*/+
2 /*number of arguments*/+
2 * bootstrapArguments.length;
}
}
// Unpacks the byte array into the table
private void unpack() {
if (isInPackedState) {
@@ -169,7 +169,7 @@ public final class BootstrapMethods extends Attribute {
/**
* Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the
* hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
*
*
* @param v Visitor object
*/
@Override
@@ -180,7 +180,7 @@ public final class BootstrapMethods extends Attribute {

/**
* Dump line number table attribute to file stream in binary format.
*
*
* @param file Output file stream
* @throws IOException
*/
@@ -210,8 +210,8 @@ public final class BootstrapMethods extends Attribute {
@Override
public final String toString() {
unpack();
StringBuffer buf = new StringBuffer();
StringBuffer line = new StringBuffer();
StringBuilder buf = new StringBuilder();
StringBuilder line = new StringBuilder();

for (int i = 0; i < numBootstrapMethods; i++) {
BootstrapMethod bm = bootstrapMethods[i];
@@ -228,8 +228,8 @@ public final class BootstrapMethods extends Attribute {
line.append(arg).append("(").append(getConstantPool().getConstant(arg)).append(") ");
}
}
if (i < numBootstrapMethods - 1) {
line.append(", ");
}

+ 8
- 8
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Code.java View File

@@ -64,10 +64,10 @@ import org.aspectj.apache.bcel.Constants;
* This class represents a chunk of Java byte code contained in a method. It is instantiated by the
* <em>Attribute.readAttribute()</em> method. A <em>Code</em> attribute contains informations about operand stack, local variables,
* byte code and the exceptions handled within this method.
*
*
* This attribute has attributes itself, namely <em>LineNumberTable</em> which is used for debugging purposes and
* <em>LocalVariableTable</em> which contains information about the local variables.
*
*
* @version $Id: Code.java,v 1.9 2009/10/05 17:35:36 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Attribute
@@ -149,7 +149,7 @@ public final class Code extends Attribute {
/**
* Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the
* hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
*
*
* @param v Visitor object
*/
@Override
@@ -159,7 +159,7 @@ public final class Code extends Attribute {

/**
* Dump code attribute to file stream in binary format.
*
*
* @param file Output file stream
* @throws IOException
*/
@@ -309,9 +309,9 @@ public final class Code extends Attribute {
* @return String representation of code chunk.
*/
public final String toString(boolean verbose) {
StringBuffer buf;
StringBuilder buf;

buf = new StringBuffer("Code(max_stack = " + maxStack + ", max_locals = " + maxLocals + ", code_length = " + code.length
buf = new StringBuilder("Code(max_stack = " + maxStack + ", max_locals = " + maxLocals + ", code_length = " + code.length
+ ")\n" + Utility.codeToString(code, cpool, 0, -1, verbose));

if (exceptionTable.length > 0) {
@@ -348,7 +348,7 @@ public final class Code extends Attribute {
// Code c = (Code)clone();
// c.code = (byte[])code.clone();
// c.cpool = constant_pool;
//
//
// c.exceptionTable = new CodeException[exceptionTable.length];
// for(int i=0; i < exceptionTable.length; i++)
// c.exceptionTable[i] = exceptionTable[i].copy();
@@ -365,7 +365,7 @@ public final class Code extends Attribute {
* whether two pieces of code are equivalent.
*/
public String getCodeString() {
StringBuffer codeString = new StringBuffer();
StringBuilder codeString = new StringBuilder();
codeString.append("Code(max_stack = ").append(maxStack);
codeString.append(", max_locals = ").append(maxLocals);
codeString.append(", code_length = ").append(code.length).append(")\n");

+ 14
- 14
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ConstantPool.java View File

@@ -136,7 +136,7 @@ public class ConstantPool implements Node {
/**
* Get string from constant pool and bypass the indirection of `ConstantClass' and `ConstantString' objects. I.e. these classes
* have an index field that points to another entry of the constant pool of type `ConstantUtf8' which contains the real data.
*
*
* @param index Index in constant pool
* @param tag Tag of expected constant, either ConstantClass or ConstantString
* @return Contents of string reference
@@ -207,7 +207,7 @@ public class ConstantPool implements Node {
str = (constantToString(((ConstantCP) c).getClassIndex(), Constants.CONSTANT_Class) + "." + constantToString(
((ConstantCP) c).getNameAndTypeIndex(), Constants.CONSTANT_NameAndType));
break;
case Constants.CONSTANT_InvokeDynamic:
ConstantInvokeDynamic cID = ((ConstantInvokeDynamic)c);
return "#"+cID.getBootstrapMethodAttrIndex()+"."+constantToString(cID.getNameAndTypeIndex(), Constants.CONSTANT_NameAndType);
@@ -237,7 +237,7 @@ public class ConstantPool implements Node {

private static final String escape(String str) {
int len = str.length();
StringBuffer buf = new StringBuffer(len + 5);
StringBuilder buf = new StringBuilder(len + 5);
char[] ch = str.toCharArray();

for (int i = 0; i < len; i++) {
@@ -296,7 +296,7 @@ public class ConstantPool implements Node {
assert c.tag == Constants.CONSTANT_Utf8;
return (ConstantUtf8) c;
}
public ConstantModule getConstantModule(int index) {
Constant c = getConstant(index);
assert c != null;
@@ -323,7 +323,7 @@ public class ConstantPool implements Node {

@Override
public String toString() {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();

for (int i = 1; i < poolSize; i++)
buf.append(i + ")" + pool[i] + "\n");
@@ -441,7 +441,7 @@ public class ConstantPool implements Node {

public int lookupFieldref(String searchClassname, String searchFieldname, String searchSignature) {
searchClassname = searchClassname.replace('.', '/');
String k = new StringBuffer().append(searchClassname).append(searchFieldname).append(searchSignature).toString();
String k = new StringBuilder().append(searchClassname).append(searchFieldname).append(searchSignature).toString();
Integer pos = fieldCache.get(k);
if (pos != null)
return pos;
@@ -621,7 +621,7 @@ public class ConstantPool implements Node {

return addNameAndType(u8.getValue(), u8_2.getValue());
}
case Constants.CONSTANT_InvokeDynamic: {
ConstantInvokeDynamic cid = (ConstantInvokeDynamic)c;
int index1 = cid.getBootstrapMethodAttrIndex();
@@ -631,7 +631,7 @@ public class ConstantPool implements Node {
int index2 = addNameAndType(name.getValue(), signature.getValue());
return addInvokeDynamic(index1,index2);
}
case Constants.CONSTANT_MethodHandle:
ConstantMethodHandle cmh = (ConstantMethodHandle)c;
return addMethodHandle(cmh.getReferenceKind(),addConstant(constants[cmh.getReferenceIndex()],cp));
@@ -650,7 +650,7 @@ public class ConstantPool implements Node {

case Constants.CONSTANT_Integer:
return addInteger(((ConstantInteger) c).getValue());
case Constants.CONSTANT_MethodType:
ConstantMethodType cmt = (ConstantMethodType)c;
return addMethodType(addConstant(constants[cmt.getDescriptorIndex()],cp));
@@ -689,14 +689,14 @@ public class ConstantPool implements Node {
throw new RuntimeException("Unknown constant type " + c);
}
}
public int addMethodHandle(byte referenceKind, int referenceIndex) {
adjustSize();
int ret = poolSize;
pool[poolSize++] = new ConstantMethodHandle(referenceKind, referenceIndex);
return ret;
}
public int addMethodType(int descriptorIndex) {
adjustSize();
int ret = poolSize;
@@ -718,7 +718,7 @@ public class ConstantPool implements Node {
pool[poolSize++] = new ConstantMethodref(class_index, name_and_type_index);
return ret;
}
public int addInvokeDynamic(int bootstrapMethodIndex, int constantNameAndTypeIndex) {
adjustSize();
int ret = poolSize;
@@ -768,7 +768,7 @@ public class ConstantPool implements Node {
}

public int lookupMethodref(String searchClassname, String searchMethodName, String searchSignature) {
String key = new StringBuffer().append(searchClassname).append(searchMethodName).append(searchSignature).toString();
String key = new StringBuilder().append(searchClassname).append(searchMethodName).append(searchSignature).toString();
Integer cached = methodCache.get(key);
if (cached != null)
return cached;
@@ -813,4 +813,4 @@ public class ConstantPool implements Node {
public String getPackageName(int packageIndex) {
return getConstantPackage(packageIndex).getPackageName(this);
}
}
}

+ 5
- 5
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ExceptionTable.java View File

@@ -64,7 +64,7 @@ import org.aspectj.apache.bcel.Constants;
* This class represents the table of exceptions that are thrown by a method. This attribute may be used once per method. The name
* of this class is <em>ExceptionTable</em> for historical reasons; The Java Virtual Machine Specification, Second Edition defines
* this attribute using the name <em>Exceptions</em> (which is inconsistent with the other classes).
*
*
* @version $Id: ExceptionTable.java,v 1.5 2009/09/15 19:40:12 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Code
@@ -94,7 +94,7 @@ public final class ExceptionTable extends Attribute {

/**
* Construct object from file stream.
*
*
* @param name_index Index in constant pool
* @param length Content length in bytes
* @param file Input stream
@@ -114,7 +114,7 @@ public final class ExceptionTable extends Attribute {
/**
* Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the
* hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
*
*
* @param v Visitor object
*/
@Override
@@ -124,7 +124,7 @@ public final class ExceptionTable extends Attribute {

/**
* Dump exceptions attribute to file stream in binary format.
*
*
* @param file Output file stream
* @throws IOException
*/
@@ -173,7 +173,7 @@ public final class ExceptionTable extends Attribute {
*/
@Override
public final String toString() {
StringBuffer buf = new StringBuffer("");
StringBuilder buf = new StringBuilder("");
String str;

for (int i = 0; i < number_of_exceptions; i++) {

+ 2
- 2
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Field.java View File

@@ -61,7 +61,7 @@ import org.aspectj.apache.bcel.generic.Type;
/**
* This class represents the field info structure, i.e., the representation for a variable in the class. See JVM specification for
* details.
*
*
* @version $Id: Field.java,v 1.6 2009/09/15 03:33:52 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
@@ -103,7 +103,7 @@ public final class Field extends FieldOrMethod {
@Override
public final String toString() {
// Get names from constant pool
StringBuffer buf = new StringBuffer(Utility.accessToString(modifiers));
StringBuilder buf = new StringBuilder(Utility.accessToString(modifiers));
if (buf.length() > 0) {
buf.append(" ");
}

+ 5
- 5
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/InnerClasses.java View File

@@ -63,7 +63,7 @@ import org.aspectj.apache.bcel.Constants;
/**
* This class is derived from <em>Attribute</em> and denotes that this class is an Inner class of another. to the source file of
* this class. It is instantiated from the <em>Attribute.readAttribute()</em> method.
*
*
* @version $Id: InnerClasses.java,v 1.5 2009/09/15 19:40:12 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Attribute
@@ -94,7 +94,7 @@ public final class InnerClasses extends Attribute {

/**
* Construct object from file stream.
*
*
* @param name_index Index in constant pool to CONSTANT_Utf8
* @param length Content length in bytes
* @param file Input stream
@@ -114,7 +114,7 @@ public final class InnerClasses extends Attribute {
/**
* Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the
* hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
*
*
* @param v Visitor object
*/
@Override
@@ -124,7 +124,7 @@ public final class InnerClasses extends Attribute {

/**
* Dump source file attribute to file stream in binary format.
*
*
* @param file Output file stream
* @throws IOException
*/
@@ -157,7 +157,7 @@ public final class InnerClasses extends Attribute {
*/
@Override
public final String toString() {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();

for (int i = 0; i < number_of_classes; i++)
buf.append(inner_classes[i].toString(cpool) + "\n");

+ 8
- 8
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java View File

@@ -77,10 +77,10 @@ import org.aspectj.apache.bcel.util.SyntheticRepository;
/**
* Represents a Java class, i.e., the data structures, constant pool, fields, methods and commands contained in a Java .class file.
* See <a href="ftp://java.sun.com/docs/specs/">JVM specification</a> for details.
*
*
* The intent of this class is to represent a parsed or otherwise existing class file. Those interested in programatically
* generating classes should see the <a href="../generic/ClassGen.html">ClassGen</a> class.
*
*
* @version $Id: JavaClass.java,v 1.22 2009/09/15 19:40:14 aclement Exp $
* @see org.aspectj.apache.bcel.generic.ClassGen
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
@@ -185,7 +185,7 @@ public class JavaClass extends Modifiers implements Cloneable, Node {
/**
* Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the
* hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
*
*
* @param v Visitor object
*/
public void accept(ClassVisitor v) {
@@ -194,7 +194,7 @@ public class JavaClass extends Modifiers implements Cloneable, Node {

/**
* Dump class to a file.
*
*
* @param file Output file
* @throws IOException
*/
@@ -209,7 +209,7 @@ public class JavaClass extends Modifiers implements Cloneable, Node {

/**
* Dump class to a file named file_name.
*
*
* @param file_name Output file name
* @exception IOException
*/
@@ -523,7 +523,7 @@ public class JavaClass extends Modifiers implements Cloneable, Node {
String access = Utility.accessToString(modifiers, true);
access = access.equals("") ? "" : access + " ";

StringBuffer buf = new StringBuffer(access + Utility.classOrInterface(modifiers) + " " + classname + " extends "
StringBuilder buf = new StringBuilder(access + Utility.classOrInterface(modifiers) + " " + classname + " extends "
+ Utility.compactClassName(superclassname, false) + '\n');
int size = interfaces.length;

@@ -580,7 +580,7 @@ public class JavaClass extends Modifiers implements Cloneable, Node {

private static final String indent(Object obj) {
StringTokenizer tok = new StringTokenizer(obj.toString(), "\n");
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();

while (tok.hasMoreTokens()) {
buf.append("\t" + tok.nextToken() + "\n");
@@ -671,7 +671,7 @@ public class JavaClass extends Modifiers implements Cloneable, Node {

/**
* Equivalent to runtime "instanceof" operator.
*
*
* @return true if this JavaClass is derived from teh super class
*/
public final boolean instanceOf(JavaClass super_class) {

+ 7
- 7
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/LineNumberTable.java View File

@@ -64,7 +64,7 @@ import org.aspectj.apache.bcel.Constants;
/**
* This class represents a table of line numbers for debugging purposes. This attribute is used by the <em>Code</em> attribute. It
* contains pairs of PCs and line numbers.
*
*
* @version $Id: LineNumberTable.java,v 1.8 2009/09/15 19:40:12 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Code changes: asc Feb06 Made unpacking lazy
@@ -94,7 +94,7 @@ public final class LineNumberTable extends Attribute {

/**
* Construct object from file stream.
*
*
* @param name_index Index of name
* @param length Content length in bytes
* @param file Input stream
@@ -132,7 +132,7 @@ public final class LineNumberTable extends Attribute {
/**
* Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the
* hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
*
*
* @param v Visitor object
*/
@Override
@@ -143,7 +143,7 @@ public final class LineNumberTable extends Attribute {

/**
* Dump line number table attribute to file stream in binary format.
*
*
* @param file Output file stream
* @throws IOException
*/
@@ -184,8 +184,8 @@ public final class LineNumberTable extends Attribute {
@Override
public final String toString() {
unpack();
StringBuffer buf = new StringBuffer();
StringBuffer line = new StringBuffer();
StringBuilder buf = new StringBuilder();
StringBuilder line = new StringBuilder();

for (int i = 0; i < tableLength; i++) {
line.append(table[i].toString());
@@ -208,7 +208,7 @@ public final class LineNumberTable extends Attribute {

/**
* Map byte code positions to source code lines.
*
*
* @param pos byte code offset
* @return corresponding line in source code
*/

+ 1
- 1
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/LocalVariableTable.java View File

@@ -177,7 +177,7 @@ public class LocalVariableTable extends Attribute {
*/
@Override
public final String toString() {
StringBuffer buf = new StringBuffer("");
StringBuilder buf = new StringBuilder("");
unpack();
for (int i = 0; i < localVariableTableLength; i++) {
buf.append(localVariableTable[i].toString());

+ 1
- 1
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/LocalVariableTypeTable.java View File

@@ -104,7 +104,7 @@ public class LocalVariableTypeTable extends Attribute {
*/
@Override
public final String toString() {
StringBuffer buf = new StringBuffer("");
StringBuilder buf = new StringBuilder("");

for (int i = 0; i < local_variable_type_table_length; i++) {
buf.append(local_variable_type_table[i].toString());

+ 3
- 3
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Method.java View File

@@ -67,7 +67,7 @@ import org.aspectj.apache.bcel.generic.Type;
/**
* This class represents the method info structure, i.e., the representation for a method in the class. See JVM specification for
* details. A method has access flags, a name, a signature and a number of attributes.
*
*
* @version $Id: Method.java,v 1.11 2009/09/15 19:40:12 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
@@ -151,7 +151,7 @@ public final class Method extends FieldOrMethod {
public final String toString() {
ConstantUtf8 c;
String name, signature, access; // Short cuts to constant pool
StringBuffer buf;
StringBuilder buf;

access = Utility.accessToString(modifiers);

@@ -163,7 +163,7 @@ public final class Method extends FieldOrMethod {
name = c.getValue();

signature = Utility.methodSignatureToString(signature, name, access, true, getLocalVariableTable());
buf = new StringBuffer(signature);
buf = new StringBuilder(signature);

for (Attribute a : attributes) {
if (!((a instanceof Code) || (a instanceof ExceptionTable)))

+ 2
- 2
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/ModulePackages.java View File

@@ -62,7 +62,7 @@ import org.aspectj.apache.bcel.Constants;
/**
* Indicates all the packages of a module that are exported or opened by the module attribute.
* http://cr.openjdk.java.net/~mr/jigsaw/spec/java-se-9-jvms-diffs.pdf 4.7.26
*
*
* @author Andy Clement
*/
public final class ModulePackages extends Attribute {
@@ -116,7 +116,7 @@ public final class ModulePackages extends Attribute {

@Override
public final String toString() {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
for (int packageIndex : packageIndices) {
buf.append(cpool.getPackageName(packageIndex) + "\n");
}

+ 3
- 3
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/NestHost.java View File

@@ -62,7 +62,7 @@ import org.aspectj.apache.bcel.Constants;

/**
* https://docs.oracle.com/javase/specs/jvms/se11/html/jvms-4.html#jvms-4.7.28
*
*
* @see Attribute
*/
public final class NestHost extends Attribute {
@@ -100,7 +100,7 @@ public final class NestHost extends Attribute {
public final void setHostClassIndex(int hostClassIndex) {
this.hostClassIndex = hostClassIndex;
}
public final String getHostClassName() {
ConstantClass constantClass = (ConstantClass)cpool.getConstant(hostClassIndex,Constants.CONSTANT_Class);
return constantClass.getClassname(cpool);
@@ -108,7 +108,7 @@ public final class NestHost extends Attribute {

@Override
public final String toString() {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
buf.append("NestHost(");
ConstantClass constantClass = (ConstantClass)cpool.getConstant(hostClassIndex,Constants.CONSTANT_Class);
buf.append(constantClass.getClassname(cpool));

+ 3
- 3
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/NestMembers.java View File

@@ -62,7 +62,7 @@ import org.aspectj.apache.bcel.Constants;

/**
* https://docs.oracle.com/javase/specs/jvms/se11/html/jvms-4.html#jvms-4.7.29
*
*
* @see Attribute
*/
public final class NestMembers extends Attribute {
@@ -109,7 +109,7 @@ public final class NestMembers extends Attribute {
this.classes = inner_classes;
numberOfClasses = (inner_classes == null) ? 0 : inner_classes.length;
}
public final String[] getClassesNames() {
String[] result = new String[numberOfClasses];
for (int i = 0; i < numberOfClasses; i++) {
@@ -121,7 +121,7 @@ public final class NestMembers extends Attribute {

@Override
public final String toString() {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
for (int i = 0; i < numberOfClasses; i++) {
ConstantClass constantClass = (ConstantClass)cpool.getConstant(classes[i],Constants.CONSTANT_Class);
buf.append(constantClass.getClassname(cpool)).append(" ");

+ 7
- 7
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Signature.java View File

@@ -52,7 +52,7 @@ package org.aspectj.apache.bcel.classfile;
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*
* Extended by Adrian Colyer, June 2005 to support unpacking of Signature
* attribute
*/
@@ -67,7 +67,7 @@ import org.aspectj.apache.bcel.Constants;
/**
* This class is derived from <em>Attribute</em> and represents a reference to a <href="http://wwwipd.ira.uka.de/~pizza/gj/">GJ</a>
* attribute.
*
*
* @version $Id: Signature.java,v 1.11 2009/09/15 19:40:12 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Attribute
@@ -85,7 +85,7 @@ public final class Signature extends Attribute {

/**
* Construct object from file stream.
*
*
* @param name_index Index in constant pool to CONSTANT_Utf8
* @param length Content length in bytes
* @param file Input stream
@@ -110,7 +110,7 @@ public final class Signature extends Attribute {
/**
* Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the
* hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
*
*
* @param v Visitor object
*/
@Override
@@ -121,7 +121,7 @@ public final class Signature extends Attribute {

/**
* Dump source file attribute to file stream in binary format.
*
*
* @param file Output file stream
* @throws IOException
*/
@@ -192,7 +192,7 @@ public final class Signature extends Attribute {
// System.out.println("return from ident:" + (char)ch);

if (!identStart(ch)) {
StringBuffer buf2 = new StringBuffer();
StringBuilder buf2 = new StringBuilder();

int count = 1;
while (Character.isJavaIdentifierPart((char) ch)) {
@@ -216,7 +216,7 @@ public final class Signature extends Attribute {
return;
}

StringBuffer buf2 = new StringBuffer();
StringBuilder buf2 = new StringBuilder();
ch = in.read();

do {

+ 8
- 8
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/StackMap.java View File

@@ -64,7 +64,7 @@ import org.aspectj.apache.bcel.Constants;
* This class represents a stack map attribute used for preverification of Java classes for the <a href="http://java.sun.com/j2me/">
* Java 2 Micro Edition</a> (J2ME). This attribute is used by the <a href="http://java.sun.com/products/cldc/">KVM</a> and contained
* within the Code attribute of a method. See CLDC specification 5.3.1.2
*
*
* @version $Id: StackMap.java,v 1.6 2009/09/15 19:40:12 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Code
@@ -77,11 +77,11 @@ public final class StackMap extends Attribute {

/*
* @param name_index Index of name
*
*
* @param length Content length in bytes
*
*
* @param map Table of stack map entries
*
*
* @param constant_pool Array of constants
*/
public StackMap(int name_index, int length, StackMapEntry[] map, ConstantPool constant_pool) {
@@ -92,7 +92,7 @@ public final class StackMap extends Attribute {

/**
* Construct object from file stream.
*
*
* @param name_index Index of name
* @param length Content length in bytes
* @param file Input stream
@@ -111,7 +111,7 @@ public final class StackMap extends Attribute {

/**
* Dump line number table attribute to file stream in binary format.
*
*
* @param file Output file stream
* @throws IOException
*/
@@ -144,7 +144,7 @@ public final class StackMap extends Attribute {
*/
@Override
public final String toString() {
StringBuffer buf = new StringBuffer("StackMap(");
StringBuilder buf = new StringBuilder("StackMap(");

for (int i = 0; i < map_length; i++) {
buf.append(map[i].toString());
@@ -176,7 +176,7 @@ public final class StackMap extends Attribute {
/**
* Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the
* hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
*
*
* @param v Visitor object
*/
@Override

+ 6
- 6
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/StackMapEntry.java View File

@@ -113,7 +113,7 @@ public final class StackMapEntry implements Cloneable {
*
* @param file Output file stream
* @throws IOException
*/
*/
public final void dump(DataOutputStream file) throws IOException
{
file.writeShort(byte_code_offset);
@@ -129,9 +129,9 @@ public final class StackMapEntry implements Cloneable {

/**
* @return String representation.
*/
*/
public final String toString() {
StringBuffer buf = new StringBuffer("(offset=" + byte_code_offset);
StringBuilder buf = new StringBuilder("(offset=" + byte_code_offset);

if(number_of_locals > 0) {
buf.append(", locals={");
@@ -159,7 +159,7 @@ public final class StackMapEntry implements Cloneable {

buf.append(")");

return buf.toString();
return buf.toString();
}


@@ -198,12 +198,12 @@ public final class StackMapEntry implements Cloneable {

/**
* @return Constant pool used by this object.
*/
*/
public final ConstantPool getConstantPool() { return constant_pool; }

/**
* @param constant_pool Constant pool to be used for this object.
*/
*/
public final void setConstantPool(ConstantPool constant_pool) {
this.constant_pool = constant_pool;
}

+ 6
- 6
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Synthetic.java View File

@@ -65,7 +65,7 @@ import org.aspectj.apache.bcel.Constants;
* specification states "A class member that does not appear in the source code must be marked using a Synthetic attribute." It may
* appear in the ClassFile attribute table, a field_info table or a method_info table. This class is intended to be instantiated
* from the <em>Attribute.readAttribute()</em> method.
*
*
* @version $Id: Synthetic.java,v 1.5 2009/09/15 19:40:12 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Attribute
@@ -81,7 +81,7 @@ public final class Synthetic extends Attribute {
this(c.getNameIndex(), c.getLength(), c.getBytes(), c.getConstantPool());
}

//
//
// public Synthetic(ConstantPoolGen cpool) {
// super(Constants.ATTR_SYNTHETIC, cpool.addUtf8("Synthetic"), 0, cpool);
// ConstantPoolGen cpg = myGen.getConstantPool();
@@ -102,7 +102,7 @@ public final class Synthetic extends Attribute {

/**
* Construct object from file stream.
*
*
* @param name_index Index in constant pool to CONSTANT_Utf8
* @param length Content length in bytes
* @param file Input stream
@@ -122,7 +122,7 @@ public final class Synthetic extends Attribute {
/**
* Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the
* hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
*
*
* @param v Visitor object
*/
@Override
@@ -132,7 +132,7 @@ public final class Synthetic extends Attribute {

/**
* Dump source file attribute to file stream in binary format.
*
*
* @param file Output file stream
* @throws IOException
*/
@@ -162,7 +162,7 @@ public final class Synthetic extends Attribute {
*/
@Override
public final String toString() {
StringBuffer buf = new StringBuffer("Synthetic");
StringBuilder buf = new StringBuilder("Synthetic");

if (length > 0)
buf.append(" " + Utility.toHexString(bytes));

+ 32
- 32
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Utility.java View File

@@ -74,10 +74,10 @@ import org.aspectj.apache.bcel.util.ByteSequence;

/**
* Utility functions that do not really belong to any class in particular.
*
*
* @version $Id: Utility.java,v 1.14 2009/09/28 16:39:46 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*
*
* modified: Andy Clement 2-mar-05 Removed unnecessary static and optimized
*/
public abstract class Utility {
@@ -91,7 +91,7 @@ public abstract class Utility {

/**
* Convert bit field of flags into string such as 'static final'.
*
*
* @param access_flags Access flags
* @return String representation of flags
*/
@@ -101,16 +101,16 @@ public abstract class Utility {

/**
* Convert bit field of flags into string such as 'static final'.
*
*
* Special case: Classes compiled with new compilers and with the 'ACC_SUPER' flag would be said to be "synchronized". This is
* because SUN used the same value for the flags 'ACC_SUPER' and 'ACC_SYNCHRONIZED'.
*
*
* @param access_flags Access flags
* @param for_class access flags are for class qualifiers ?
* @return String representation of flags
*/
public static final String accessToString(int access_flags, boolean for_class) {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();

int p = 0;
for (int i = 0; p < Constants.MAX_ACC_FLAG; i++) { // Loop through known flags
@@ -136,7 +136,7 @@ public abstract class Utility {
/**
* Disassemble a byte array of JVM byte codes starting from code line 'index' and return the disassembled string representation.
* Decode only 'num' opcodes (including their operands), use -1 if you want to decompile everything.
*
*
* @param code byte code array
* @param constant_pool Array of constants
* @param index offset in `code' array <EM>(number of opcodes, not bytes!)</EM>
@@ -145,7 +145,7 @@ public abstract class Utility {
* @return String representation of byte codes
*/
public static final String codeToString(byte[] code, ConstantPool constant_pool, int index, int length, boolean verbose) {
StringBuffer buf = new StringBuffer(code.length * 20); // Should be sufficient
StringBuilder buf = new StringBuilder(code.length * 20); // Should be sufficient
ByteSequence stream = new ByteSequence(code);

try {
@@ -182,7 +182,7 @@ public abstract class Utility {

/**
* Shorten long class names, <em>java/lang/String</em> becomes <em>String</em>.
*
*
* @param str The long class name
* @return Compacted class name
*/
@@ -193,7 +193,7 @@ public abstract class Utility {
/**
* Shorten long class name <em>str</em>, i.e., chop off the <em>prefix</em>, if the class name starts with this string and the
* flag <em>chopit</em> is true. Slashes <em>/</em> are converted to dots <em>.</em>.
*
*
* @param str The long class name
* @param prefix The prefix the get rid off
* @param chopit Flag that determines whether chopping is executed or not
@@ -217,7 +217,7 @@ public abstract class Utility {
/**
* Shorten long class names, <em>java/lang/String</em> becomes <em>java.lang.String</em>, e.g.. If <em>chopit</em> is
* <em>true</em> the prefix <em>java.lang</em> is also removed.
*
*
* @param str The long class name
* @param chopit Flag that determines whether chopping is executed or not
* @return Compacted class name
@@ -240,7 +240,7 @@ public abstract class Utility {
*/
public static final String methodSignatureToString(String signature, String name, String access, boolean chopit,
LocalVariableTable vars) throws ClassFormatException {
StringBuffer buf = new StringBuffer("(");
StringBuilder buf = new StringBuilder("(");
String type;
int index;
int var_index = (access.contains("static")) ? 0 : 1;
@@ -298,7 +298,7 @@ public abstract class Utility {

/**
* Replace all occurences of <em>old</em> in <em>str</em> with <em>new</em>.
*
*
* @param str String to permute
* @param old String to be replaced
* @param new Replacement string
@@ -306,7 +306,7 @@ public abstract class Utility {
*/
public static final String replace(String str, String old, String new_) {
int index, old_index;
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();

try {
index = str.indexOf(old);
@@ -332,7 +332,7 @@ public abstract class Utility {

/**
* Converts signature to string with all class names compacted.
*
*
* @param signature to convert
* @return Human readable signature
*/
@@ -381,7 +381,7 @@ public abstract class Utility {
int genericEnd = signature.indexOf('>');
// FIXME asc going to need a lot more work in here for generics
ResultHolder rh = signatureToStringInternal(signature.substring(genericStart + 1, genericEnd), chopit);
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(signature.substring(1, genericStart));
sb.append("<").append(rh.getResult()).append(">");
ResultHolder retval = new ResultHolder(compactClassName(sb.toString(), chopit), genericEnd + 1);
@@ -399,10 +399,10 @@ public abstract class Utility {
return ResultHolder.BOOLEAN;

case '[': { // Array declaration
StringBuffer brackets;
StringBuilder brackets;
int consumedChars, n;

brackets = new StringBuffer(); // Accumulate []'s
brackets = new StringBuilder(); // Accumulate []'s
// Count opening brackets and look for optional size argument
for (n = 0; signature.charAt(n) == '['; n++) {
brackets.append("[]");
@@ -426,7 +426,7 @@ public abstract class Utility {

/**
* Return type of method signature as a byte value as defined in <em>Constants</em>
*
*
* @param signature in format described above
* @return type of method signature
* @see Constants
@@ -453,11 +453,11 @@ public abstract class Utility {

/**
* Convert bytes into hexidecimal string
*
*
* @return bytes as hexidecimal string, e.g. 00 FA 12 ...
*/
public static final String toHexString(byte[] bytes) {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();

for (int i = 0; i < bytes.length; i++) {
short b = byteToShort(bytes[i]);
@@ -480,7 +480,7 @@ public abstract class Utility {

/**
* Return a string for an integer justified left or right and filled up with 'fill' characters if necessary.
*
*
* @param i integer to format
* @param length length of desired string
* @param left_justify format left or right
@@ -493,7 +493,7 @@ public abstract class Utility {

/**
* Fillup char with up to length characters with char `fill' and justify it left or right.
*
*
* @param str string to format
* @param length length of desired string
* @param left_justify format left or right
@@ -520,7 +520,7 @@ public abstract class Utility {
*/
public static final String convertString(String label) {
char[] ch = label.toCharArray();
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();

for (char c : ch) {
switch (c) {
@@ -550,7 +550,7 @@ public abstract class Utility {

/**
* Converts a list of AnnotationGen objects into a set of attributes that can be attached to the class file.
*
*
* @param cp The constant pool gen where we can create the necessary name refs
* @param annotations A list of AnnotationGen objects
*/
@@ -747,7 +747,7 @@ public abstract class Utility {

/**
* Return type of signature as a byte value as defined in <em>Constants</em>
*
*
* @param signature in format described above
* @return type of signature
* @see Constants
@@ -816,7 +816,7 @@ public abstract class Utility {

/**
* Disassemble a stream of byte codes and return the string representation.
*
*
* @param bytes stream of bytes
* @param constant_pool Array of constants
* @param verbose be verbose, e.g. print constant pool index
@@ -828,7 +828,7 @@ public abstract class Utility {
int index, vindex, constant;
int[] match, jump_table;
int no_pad_bytes = 0, offset;
StringBuffer buf = new StringBuffer(Constants.OPCODE_NAMES[opcode]);
StringBuilder buf = new StringBuilder(Constants.OPCODE_NAMES[opcode]);

/*
* Special case: Skip (0-3) padding bytes, i.e., the following bytes are 4-byte-aligned
@@ -995,13 +995,13 @@ public abstract class Utility {
+ bytes.readUnsignedByte()); // Last byte is a reserved
// space
break;
case Constants.INVOKEDYNAMIC://http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html#jvms-6.5.invokedynamic
index = bytes.readUnsignedShort();
bytes.readUnsignedShort(); // zeroes
buf.append("\t" + constant_pool.constantToString(index) + (verbose ? " (" + index + ")" : ""));
break;
// Operands are references to items in constant pool
case Constants.LDC_W:
case Constants.LDC2_W:
@@ -1076,13 +1076,13 @@ public abstract class Utility {

/**
* Convert type to Java method signature, e.g. int[] f(java.lang.String x) becomes (Ljava/lang/String;)[I
*
*
* @param returnType what the method returns
* @param argTypes what are the argument types
* @return method signature for given type(s).
*/
public static String toMethodSignature(Type returnType, Type[] argTypes) {
StringBuffer buf = new StringBuffer("(");
StringBuilder buf = new StringBuilder("(");
int length = (argTypes == null) ? 0 : argTypes.length;
for (int i = 0; i < length; i++) {
buf.append(argTypes[i].getSignature());

+ 1
- 1
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationElementValue.java View File

@@ -48,7 +48,7 @@ public class AnnotationElementValue extends ElementValue {

@Override
public String stringifyValue() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(a.getTypeIndex(), Constants.CONSTANT_Utf8);
sb.append(cu8.getValue());
// haven't really tested this values section:

+ 2
- 2
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/AnnotationGen.java View File

@@ -113,7 +113,7 @@ public class AnnotationGen {

@Override
public String toString() {
StringBuffer s = new StringBuffer();
StringBuilder s = new StringBuilder();
s.append("AnnotationGen:[" + getTypeName() + " #" + pairs.size() + " {");
for (int i = 0; i < pairs.size(); i++) {
s.append(pairs.get(i));
@@ -125,7 +125,7 @@ public class AnnotationGen {
}

public String toShortString() {
StringBuffer s = new StringBuffer();
StringBuilder s = new StringBuilder();
s.append("@").append(getTypeName());
if (pairs.size()!=0) {
s.append("(");

+ 1
- 1
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/ArrayElementValue.java View File

@@ -62,7 +62,7 @@ public class ArrayElementValue extends ElementValue {

@Override
public String stringifyValue() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("[");
for (int i = 0; i < evalues.length; i++) {
ElementValue element = evalues[i];

+ 1
- 1
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/EnumElementValue.java View File

@@ -76,7 +76,7 @@ public class EnumElementValue extends ElementValue {
*/
@Override
public String stringifyValue() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(typeIdx, Constants.CONSTANT_Utf8);
sb.append(cu8.getValue());
cu8 = (ConstantUtf8) cpool.getConstant(valueIdx, Constants.CONSTANT_Utf8);

+ 1
- 1
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/annotation/NameValuePair.java View File

@@ -68,7 +68,7 @@ public class NameValuePair {

@Override
public String toString() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(getNameString()).append("=").append(value.stringifyValue());
return sb.toString();
}

+ 6
- 6
bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ArrayType.java View File

@@ -55,7 +55,7 @@ package org.aspectj.apache.bcel.generic;
*/
import org.aspectj.apache.bcel.Constants;

/**
/**
* Denotes array type, such as int[][]
*
* @version $Id: ArrayType.java,v 1.4 2008/08/26 15:02:04 aclement Exp $
@@ -69,7 +69,7 @@ public final class ArrayType extends ReferenceType {
* Convenience constructor for array type, e.g. int[]
*
* @param type array type, e.g. T_INT
*/
*/
public ArrayType(byte type, int dimensions) {
this(BasicType.getType(type), dimensions);
}
@@ -78,7 +78,7 @@ public final class ArrayType extends ReferenceType {
* Convenience constructor for reference array type, e.g. Object[]
*
* @param class_name complete name of class (java.lang.String, e.g.)
*/
*/
public ArrayType(String class_name, int dimensions) {
this(new ObjectType(class_name), dimensions);
}
@@ -87,7 +87,7 @@ public final class ArrayType extends ReferenceType {
* Constructor for array of given type
*
* @param type type of array (may be an array itself)
*/
*/
public ArrayType(Type type, int dimensions) {
super(Constants.T_ARRAY, "<dummy>");

@@ -100,7 +100,7 @@ public final class ArrayType extends ReferenceType {
this.dimensions = dimensions + array.dimensions;
basic_type = array.basic_type;
break;
case Constants.T_VOID:
throw new ClassGenException("Invalid type: void[]");

@@ -110,7 +110,7 @@ public final class ArrayType extends ReferenceType {
break;
}

StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
for(int i=0; i < this.dimensions; i++)
buf.append('[');


+ 4
- 4
bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGen.java View File

@@ -75,7 +75,7 @@ import org.aspectj.apache.bcel.classfile.annotation.RuntimeAnnos;
/**
* Template class for building up a field. The only extraordinary thing one can do is to add a constant value attribute to a field
* (which must of course be compatible with the declared type).
*
*
* @version $Id: FieldGen.java,v 1.11 2011/10/03 22:41:24 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Field
@@ -86,7 +86,7 @@ public class FieldGen extends FieldGenOrMethodGen {
/**
* Declare a field. If it is static (isStatic() == true) and has a basic type like int or String it may have an initial value
* associated with it as defined by setInitValue().
*
*
* @param modifiers access qualifiers
* @param type field type
* @param name field name
@@ -101,7 +101,7 @@ public class FieldGen extends FieldGenOrMethodGen {

/**
* Instantiate from existing field.
*
*
* @param field Field object
* @param cp constant pool (must contain the same entries as the field's constant pool)
*/
@@ -230,7 +230,7 @@ public class FieldGen extends FieldGenOrMethodGen {
String signature = type.toString();
String name = getName();

StringBuffer buf = new StringBuffer(access).append(signature).append(" ").append(name);
StringBuilder buf = new StringBuilder(access).append(signature).append(" ").append(name);
String value = getInitialValue();

if (value != null) {

+ 4
- 4
bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Instruction.java View File

@@ -64,7 +64,7 @@ import org.aspectj.apache.bcel.util.ByteSequence;

/**
* Abstract super class for all Java byte codes.
*
*
* @version $Id: Instruction.java,v 1.10 2011/04/05 15:15:33 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
@@ -86,7 +86,7 @@ public class Instruction implements Cloneable, Serializable, Constants {
/**
* Use with caution, since 'BranchInstruction's have a 'target' reference which is not copied correctly (only basic types are).
* This also applies for 'Select' instructions with their multiple branch targets.
*
*
* @return (shallow) copy of an instruction
*/
// GET RID OF THIS - make it throw an exception and track the callers
@@ -107,7 +107,7 @@ public class Instruction implements Cloneable, Serializable, Constants {

/**
* Read an instruction bytecode from an input stream and return the appropriate object.
*
*
* @param file file to read from
* @return instruction object being read
*/
@@ -439,7 +439,7 @@ public class Instruction implements Cloneable, Serializable, Constants {
*/
public String toString(boolean verbose) {
if (verbose) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(getName()).append("[").append(opcode).append("](size").append(Constants.iLen[opcode]).append(")");
return sb.toString();
} else {

+ 4
- 4
bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionCP.java View File

@@ -70,7 +70,7 @@ import org.aspectj.apache.bcel.classfile.ConstantUtf8;

/**
* Class for instructions that use an index into the constant pool such as LDC, INVOKEVIRTUAL, etc.
*
*
* @version $Id: InstructionCP.java,v 1.6 2009/10/05 17:35:36 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
@@ -111,10 +111,10 @@ public class InstructionCP extends Instruction {

/**
* Long output format:
*
*
* &lt;name of opcode&gt; "["&lt;opcode number&gt;"]" "("&lt;length of instruction&gt;")" "&lt;"&lt; constant pool
* index&gt;"&gt;"
*
*
* @param verbose long/short format switch
* @return mnemonic for instruction
*/
@@ -172,7 +172,7 @@ public class InstructionCP extends Instruction {
// ConstantPool cp = cpg.getConstantPool();
// String name = cp.getConstantString(index, CONSTANT_Class);
if (!name.startsWith("[")) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("L").append(name).append(";");
return Type.getType(sb.toString());
} else {

+ 41
- 41
bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java View File

@@ -74,9 +74,9 @@ import org.aspectj.apache.bcel.util.ByteSequence;
* inserted, moved, deleted, etc.. Instructions are being wrapped into <a href="InstructionHandle.html">InstructionHandles</a>
* objects that are returned upon append/insert operations. They give the user (read only) access to the list structure, such that
* it can be traversed and manipulated in a controlled way.
*
*
* A list is finally dumped to a byte code array with <a href="#getByteCode()">getByteCode</a>.
*
*
* @version $Id: InstructionList.java,v 1.12 2011/09/02 22:33:04 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @author Abraham Nevado
@@ -106,7 +106,7 @@ public class InstructionList implements Serializable {

/**
* Find the target instruction (handle) that corresponds to the given target position (byte code offset).
*
*
* @param ihs array of instruction handles, i.e. il.getInstructionHandles()
* @param pos array of positions corresponding to ihs, i.e. il.getInstructionPositions()
* @param count length of arrays
@@ -143,7 +143,7 @@ public class InstructionList implements Serializable {
/**
* Get instruction handle for instruction at byte code position pos. This only works properly, if the list is freshly
* initialized from a byte array or setPositions() has been called before this method.
*
*
* @param pos byte code position to search for
* @return target position's instruction handle if available
*/
@@ -166,7 +166,7 @@ public class InstructionList implements Serializable {

/**
* Initialize instruction list from byte array.
*
*
* @param code byte array containing the instructions
*/
public InstructionList(byte[] code) {
@@ -248,7 +248,7 @@ public class InstructionList implements Serializable {

/**
* Append another list after instruction (handle) ih contained in this list. Consumes argument list, i.e., it becomes empty.
*
*
* @param appendTo where to append the instruction list
* @param appendee Instruction list to append to this one
* @return instruction handle pointing to the <B>first</B> appended instruction
@@ -283,7 +283,7 @@ public class InstructionList implements Serializable {

/**
* Append another list after instruction i contained in this list. Consumes argument list, i.e., it becomes empty.
*
*
* @param i where to append the instruction list
* @param il Instruction list to append to this one
* @return instruction handle pointing to the <B>first</B> appended instruction
@@ -300,7 +300,7 @@ public class InstructionList implements Serializable {

/**
* Append another list to this one. Consumes argument list, i.e., it becomes empty.
*
*
* @param il list to append to end of this list
* @return instruction handle of the <B>first</B> appended instruction
*/
@@ -326,7 +326,7 @@ public class InstructionList implements Serializable {

/**
* Append an instruction to the end of this list.
*
*
* @param ih instruction to append
*/
private void append(InstructionHandle ih) {
@@ -345,7 +345,7 @@ public class InstructionList implements Serializable {

/**
* Append an instruction to the end of this list.
*
*
* @param i instruction to append
* @return instruction handle of the appended instruction
*/
@@ -376,7 +376,7 @@ public class InstructionList implements Serializable {

/**
* Append a branch instruction to the end of this list.
*
*
* @param i branch instruction to append
* @return branch instruction handle of the appended instruction
*/
@@ -389,7 +389,7 @@ public class InstructionList implements Serializable {

/**
* Append a single instruction j after another instruction i, which must be in this list of course!
*
*
* @param i Instruction in list
* @param j Instruction to append after i in list
* @return instruction handle of the first appended instruction
@@ -400,7 +400,7 @@ public class InstructionList implements Serializable {

/**
* Append an instruction after instruction (handle) ih contained in this list.
*
*
* @param ih where to append the instruction list
* @param i Instruction to append
* @return instruction handle pointing to the <B>first</B> appended instruction
@@ -411,7 +411,7 @@ public class InstructionList implements Serializable {

/**
* Append an instruction after instruction (handle) ih contained in this list.
*
*
* @param ih where to append the instruction list
* @param i Instruction to append
* @return instruction handle pointing to the <B>first</B> appended instruction
@@ -428,7 +428,7 @@ public class InstructionList implements Serializable {

/**
* Insert another list before Instruction handle ih contained in this list. Consumes argument list, i.e., it becomes empty.
*
*
* @param i where to append the instruction list
* @param il Instruction list to insert
* @return instruction handle of the first inserted instruction
@@ -464,7 +464,7 @@ public class InstructionList implements Serializable {

/**
* Insert another list.
*
*
* @param il list to insert before start of this list
* @return instruction handle of the first inserted instruction
*/
@@ -479,7 +479,7 @@ public class InstructionList implements Serializable {

/**
* Insert an instruction at start of this list.
*
*
* @param ih instruction to insert
*/
private void insert(InstructionHandle ih) {
@@ -498,7 +498,7 @@ public class InstructionList implements Serializable {

/**
* Insert another list before Instruction i contained in this list. Consumes argument list, i.e., it becomes empty.
*
*
* @param i where to append the instruction list
* @param il Instruction list to insert
* @return instruction handle pointing to the first inserted instruction, i.e., il.getStart()
@@ -515,7 +515,7 @@ public class InstructionList implements Serializable {

/**
* Insert an instruction at start of this list.
*
*
* @param i instruction to insert
* @return instruction handle of the inserted instruction
*/
@@ -528,7 +528,7 @@ public class InstructionList implements Serializable {

/**
* Insert a branch instruction at start of this list.
*
*
* @param i branch instruction to insert
* @return branch instruction handle of the appended instruction
*/
@@ -540,7 +540,7 @@ public class InstructionList implements Serializable {

/**
* Insert a single instruction j before another instruction i, which must be in this list of course!
*
*
* @param i Instruction in list
* @param j Instruction to insert before i in list
* @return instruction handle of the first inserted instruction
@@ -551,7 +551,7 @@ public class InstructionList implements Serializable {

/**
* Insert an instruction before instruction (handle) ih contained in this list.
*
*
* @param ih where to insert to the instruction list
* @param i Instruction to insert
* @return instruction handle of the first inserted instruction
@@ -562,7 +562,7 @@ public class InstructionList implements Serializable {

/**
* Insert an instruction before instruction (handle) ih contained in this list.
*
*
* @param ih where to insert to the instruction list
* @param i Instruction to insert
* @return instruction handle of the first inserted instruction
@@ -582,7 +582,7 @@ public class InstructionList implements Serializable {
* be after "start" and target must not be located withing this range. If you want to move something to the start of the list
* use null as value for target.<br>
* Any instruction targeters pointing to handles within the block, keep their targets.
*
*
* @param start of moved block
* @param end of moved block
* @param target of moved block
@@ -644,7 +644,7 @@ public class InstructionList implements Serializable {

/**
* Move a single instruction (handle) to a new location.
*
*
* @param ih moved instruction
* @param target new location of moved instruction
*/
@@ -654,10 +654,10 @@ public class InstructionList implements Serializable {

/**
* Remove from instruction 'prev' to instruction 'next' both contained in this list.
*
*
* If careAboutLostTargeters is true then this method will throw a TargetLostException when one of the removed instruction
* handles is still being targeted.
*
*
* @param prev where to start deleting (predecessor, exclusive)
* @param next where to end deleting (successor, exclusive)
*/
@@ -697,7 +697,7 @@ public class InstructionList implements Serializable {
ih.getInstruction().dispose(); // e.g. BranchInstructions release their targets
}

StringBuffer buf = new StringBuffer("{ ");
StringBuilder buf = new StringBuilder("{ ");
for (InstructionHandle ih = first; ih != null; ih = next) {
next = ih.next;
length--;
@@ -757,7 +757,7 @@ public class InstructionList implements Serializable {

/**
* Remove instruction from this list. The corresponding Instruction handles must not be reused!
*
*
* @param ih instruction (handle) to remove
*/
public void delete(InstructionHandle ih) throws TargetLostException {
@@ -766,7 +766,7 @@ public class InstructionList implements Serializable {

/**
* Remove instruction from this list. The corresponding Instruction handles must not be reused!
*
*
* @param i instruction to remove
*/
// public void delete(Instruction i) throws TargetLostException {
@@ -780,7 +780,7 @@ public class InstructionList implements Serializable {
/**
* Remove instructions from instruction `from' to instruction `to' contained in this list. The user must ensure that `from' is
* an instruction before `to', or risk havoc. The corresponding Instruction handles must not be reused!
*
*
* @param from where to start deleting (inclusive)
* @param to where to end deleting (inclusive)
*/
@@ -791,7 +791,7 @@ public class InstructionList implements Serializable {
/**
* Remove instructions from instruction `from' to instruction `to' contained in this list. The user must ensure that `from' is
* an instruction before `to', or risk havoc. The corresponding Instruction handles must not be reused!
*
*
* @param from where to start deleting (inclusive)
* @param to where to end deleting (inclusive)
*/
@@ -810,7 +810,7 @@ public class InstructionList implements Serializable {

/**
* Search for given Instruction reference, start at beginning of list.
*
*
* @param i instruction to search for
* @return instruction found on success, null otherwise
*/
@@ -826,7 +826,7 @@ public class InstructionList implements Serializable {

/**
* Search for given Instruction reference, start at end of list
*
*
* @param i instruction to search for
* @return instruction found on success, null otherwise
*/
@@ -864,7 +864,7 @@ public class InstructionList implements Serializable {

/**
* Give all instructions their position number (offset in byte stream), i.e., make the list ready to be dumped.
*
*
* @param check Perform sanity checks, e.g. if all targeted instructions really belong to this list
*/
public void setPositions(boolean check) {
@@ -972,7 +972,7 @@ public class InstructionList implements Serializable {

/**
* When everything is finished, use this method to convert the instruction list into an array of bytes.
*
*
* @return the byte code ready to be dumped
*/
public byte[] getByteCode() {
@@ -1029,7 +1029,7 @@ public class InstructionList implements Serializable {
* @return String containing all instructions in this list.
*/
public String toString(boolean verbose) {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();

for (InstructionHandle ih = start; ih != null; ih = ih.next) {
buf.append(ih.toString(verbose) + "\n");
@@ -1079,7 +1079,7 @@ public class InstructionList implements Serializable {
/**
* Get positions (offsets) of all instructions in the list. This relies on that the list has been freshly created from an byte
* code array, or that setPositions() has been called. Otherwise this may be inaccurate.
*
*
* @return array containing all instruction's offset in byte code
*/
public int[] getInstructionPositions() {
@@ -1208,7 +1208,7 @@ public class InstructionList implements Serializable {

/**
* Redirect all references from old_target to new_target, i.e., update targets of branch instructions.
*
*
* @param old_target the old target instruction handle
* @param new_target the new target instruction handle
*/
@@ -1239,7 +1239,7 @@ public class InstructionList implements Serializable {

/**
* Redirect all references of local variables from old_target to new_target.
*
*
* @param lg array of local variables
* @param old_target the old target instruction handle
* @param new_target the new target instruction handle
@@ -1261,7 +1261,7 @@ public class InstructionList implements Serializable {

/**
* Redirect all references of exception handlers from old_target to new_target.
*
*
* @param exceptions array of exception handlers
* @param old_target the old target instruction handle
* @param new_target the new target instruction handle

+ 6
- 6
bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionSelect.java View File

@@ -60,7 +60,7 @@ import org.aspectj.apache.bcel.util.ByteSequence;

/**
* Select - Abstract super class for LOOKUPSWITCH and TABLESWITCH instructions.
*
*
* @version $Id: InstructionSelect.java,v 1.4 2009/10/05 17:35:36 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see LOOKUPSWITCH
@@ -79,7 +79,7 @@ public abstract class InstructionSelect extends InstructionBranch {

/**
* (Match, target) pairs for switch. `Match' and `targets' must have the same length of course.
*
*
* @param match array of matching values
* @param targets instruction targets
* @param target default instruction target
@@ -119,11 +119,11 @@ public abstract class InstructionSelect extends InstructionBranch {
/**
* Since this is a variable length instruction, it may shift the following instructions which then need to update their
* position.
*
*
* Called by InstructionList.setPositions when setting the position for every instruction. In the presence of variable length
* instructions `setPositions' performs multiple passes over the instruction list to calculate the correct (byte) positions and
* offsets by calling this function.
*
*
* @param offset additional offset caused by preceding (variable length) instructions
* @param max_offset the maximum offset that may be caused by these instructions
* @return additional offset caused by possible change of this instruction's length
@@ -146,7 +146,7 @@ public abstract class InstructionSelect extends InstructionBranch {

/**
* Dump instruction as byte code to stream out.
*
*
* @param out Output stream
*/
public void dump(DataOutputStream out) throws IOException {
@@ -177,7 +177,7 @@ public abstract class InstructionSelect extends InstructionBranch {
* @return mnemonic for instruction
*/
public String toString(boolean verbose) {
StringBuffer buf = new StringBuffer(super.toString(verbose));
StringBuilder buf = new StringBuilder(super.toString(verbose));

if (verbose) {
for (int i = 0; i < matchLength; i++) {

+ 18
- 18
bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java View File

@@ -79,10 +79,10 @@ import org.aspectj.apache.bcel.classfile.annotation.RuntimeParamAnnos;
* Template class for building up a method. This is done by defining exception handlers, adding thrown exceptions, local variables
* and attributes, whereas the 'LocalVariableTable' and 'LineNumberTable' attributes will be set automatically for the code. Use
* stripAttributes() if you don't like this.
*
*
* While generating code it may be necessary to insert NOP operations. You can use the `removeNOPs' method to get rid off them. The
* resulting method object can be obtained via the `getMethod()' method.
*
*
* @version $Id: MethodGen.java,v 1.17 2011/05/19 23:23:46 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @author <A HREF="http://www.vmeng.com/beard">Patrick C. Beard</A> [setMaxStack()]
@@ -115,10 +115,10 @@ public class MethodGen extends FieldGenOrMethodGen {
* Declare method. If the method is non-static the constructor automatically declares a local variable `$this' in slot 0. The
* actual code is contained in the `il' parameter, which may further manipulated by the user. But he must take care not to
* remove any instruction (handles) that are still referenced from this object.
*
*
* For example one may not add a local variable and later remove the instructions it refers to without causing havoc. It is safe
* however if you remove that local variable, too.
*
*
* @param access_flags access qualifiers
* @param return_type method type
* @param arg_types argument types
@@ -164,7 +164,7 @@ public class MethodGen extends FieldGenOrMethodGen {
// throw new ClassGenException("'void' is an illegal argument type for a method");
// }
// }
//
//
// if(arg_names != null) { // Names for variables provided?
// if(size != arg_names.length)
// throw new ClassGenException("Mismatch in argument array lengths: " +
@@ -192,7 +192,7 @@ public class MethodGen extends FieldGenOrMethodGen {

/**
* Instantiate from existing method.
*
*
* @param m method
* @param class_name class name containing this method
* @param cp constant pool
@@ -362,7 +362,7 @@ public class MethodGen extends FieldGenOrMethodGen {

/**
* Adds a local variable to this method and assigns an index automatically.
*
*
* @param name variable name
* @param type variable type
* @param start from where the variable is valid, if this is null, it is valid from the start
@@ -424,7 +424,7 @@ public class MethodGen extends FieldGenOrMethodGen {
/*
* If the range of the variable has not been set yet, it will be set to be valid from the start to the end of the instruction
* list.
*
*
* @return array of declared local variables sorted by index
*/
public LocalVariableGen[] getLocalVariables() {
@@ -466,7 +466,7 @@ public class MethodGen extends FieldGenOrMethodGen {

/**
* Give an instruction a line number corresponding to the source code line.
*
*
* @param ih instruction to tag
* @return new line number object
* @see LineNumber
@@ -517,7 +517,7 @@ public class MethodGen extends FieldGenOrMethodGen {
/**
* Add an exception handler, i.e., specify region where a handler is active and an instruction where the actual handling is
* done.
*
*
* @param start_pc Start of region (inclusive)
* @param end_pc End of region (inclusive)
* @param handler_pc Where handling is done
@@ -578,7 +578,7 @@ public class MethodGen extends FieldGenOrMethodGen {

/**
* Add an exception possibly thrown by this method.
*
*
* @param class_name (fully qualified) name of exception
*/
public void addException(String class_name) {
@@ -629,7 +629,7 @@ public class MethodGen extends FieldGenOrMethodGen {
* Add an attribute to the code. Currently, the JVM knows about the LineNumberTable, LocalVariableTable and StackMap attributes,
* where the former two will be generated automatically and the latter is used for the MIDP only. Other attributes will be
* ignored by the JVM but do no harm.
*
*
* @param a attribute to be added
*/
public void addCodeAttribute(Attribute a) {
@@ -674,7 +674,7 @@ public class MethodGen extends FieldGenOrMethodGen {
/**
* Get method object. Never forget to call setMaxStack() or setMaxStack(max), respectively, before calling this method (the same
* applies for max locals).
*
*
* @return method object
*/
public Method getMethod() {
@@ -879,10 +879,10 @@ public class MethodGen extends FieldGenOrMethodGen {
public void setMaxLocals() {
setMaxLocals(false);
}
/**
* Compute maximum number of local variables.
*
*
* @param respectLocalVariableTable if true and the local variable table indicates more are in use
* than the code suggests, respect the higher value from the local variable table data.
*/
@@ -966,7 +966,7 @@ public class MethodGen extends FieldGenOrMethodGen {

/**
* Computes stack usage of an instruction list by performing control flow analysis.
*
*
* @return maximum stack depth used by method
*/
public static int getMaxStack(ConstantPool cp, InstructionList il, CodeExceptionGen[] et) {
@@ -1050,7 +1050,7 @@ public class MethodGen extends FieldGenOrMethodGen {

/**
* Return string representation close to declaration format, `public static void main(String[]) throws IOException', e.g.
*
*
* @return String representation of the method.
*/
@Override
@@ -1060,7 +1060,7 @@ public class MethodGen extends FieldGenOrMethodGen {

signature = Utility.methodSignatureToString(signature, name, access, true, getLocalVariableTable(cp));

StringBuffer buf = new StringBuffer(signature);
StringBuilder buf = new StringBuilder(signature);

if (exceptionsThrown.size() > 0) {
for (String s : exceptionsThrown) {

+ 2
- 2
bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ObjectType.java View File

@@ -59,7 +59,7 @@ import org.aspectj.apache.bcel.classfile.JavaClass;

/**
* Denotes reference such as java.lang.String.
*
*
* @version $Id: ObjectType.java,v 1.7 2009/09/28 16:39:46 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
@@ -84,7 +84,7 @@ public class ObjectType extends ReferenceType {
}

private static String toSignature(String classname) {
StringBuffer sig = new StringBuffer();
StringBuilder sig = new StringBuilder();
sig.append("L").append(classname.replace('.', '/'));
sig.append(";");
return sig.toString();

+ 8
- 8
bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/Type.java View File

@@ -67,10 +67,10 @@ import org.aspectj.apache.bcel.classfile.Utility;
/**
* Abstract super class for all possible java types, namely basic types such as int, object types like String and array types, e.g.
* int[]
*
*
* @version $Id: Type.java,v 1.14 2011/09/28 01:14:54 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*
*
* modified: AndyClement 2-mar-05: Removed unnecessary static and optimized
*/
public abstract class Type {
@@ -233,7 +233,7 @@ public abstract class Type {

/**
* Convert signature to a Type object.
*
*
* @param signature signature string such as Ljava/lang/String;
* @return type object
*/
@@ -292,7 +292,7 @@ public abstract class Type {

/**
* Convert return value of a method (signature) to a Type object.
*
*
* @param signature signature string such as (Ljava/lang/String;)V
* @return return type
*/
@@ -308,7 +308,7 @@ public abstract class Type {

/**
* Convert arguments of a method (signature) to an array of Type objects.
*
*
* @param signature signature string such as (Ljava/lang/String;)V
* @return array of argument types
*/
@@ -419,7 +419,7 @@ public abstract class Type {

/**
* Convert runtime java.lang.Class to BCEL Type object.
*
*
* @param cl Java class
* @return corresponding Type object
*/
@@ -463,7 +463,7 @@ public abstract class Type {
}

public static String getSignature(java.lang.reflect.Method meth) {
StringBuffer sb = new StringBuffer("(");
StringBuilder sb = new StringBuilder("(");
Class[] params = meth.getParameterTypes(); // avoid clone

for (Class param : params) {
@@ -476,7 +476,7 @@ public abstract class Type {
}

public static String getSignature(java.lang.reflect.Constructor<?> cons) {
StringBuffer sb = new StringBuffer("(");
StringBuilder sb = new StringBuilder("(");
Class<?>[] params = cons.getParameterTypes(); // avoid clone

for (Class<?> param : params) {

+ 4
- 4
bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassLoaderRepository.java View File

@@ -73,11 +73,11 @@ import org.aspectj.apache.bcel.classfile.JavaClass;

/**
* The repository maintains information about which classes have been loaded.
*
*
* It loads its data from the ClassLoader implementation passed into its constructor.
*
*
* @see org.aspectj.apache.bcel.Repository
*
*
* @version $Id: ClassLoaderRepository.java,v 1.13 2009/09/09 19:56:20 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @author David Dixon-Peugh
@@ -334,7 +334,7 @@ public class ClassLoaderRepository implements Repository {
* Produce a report on cache usage.
*/
public String report() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("BCEL repository report.");
if (useSharedCache)
sb.append(" (shared cache)");

+ 1
- 1
bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java View File

@@ -217,7 +217,7 @@ public class ClassPath implements Serializable {
list.add(ext_dir.toString() + File.separatorChar + extension);
}

StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();

for (Iterator<String> e = list.iterator(); e.hasNext();) {
buf.append(e.next());

+ 3
- 3
bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/BcelTestCase.java View File

@@ -116,7 +116,7 @@ public abstract class BcelTestCase extends TestCase {
}

protected String dumpAnnotations(AnnotationGen[] as) {
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
result.append("[");
for (int i = 0; i < as.length; i++) {
AnnotationGen annotation = as[i];
@@ -129,7 +129,7 @@ public abstract class BcelTestCase extends TestCase {
}

protected String dumpAnnotations(List<AnnotationGen> as) {
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
result.append("[");
for (int i = 0; i < as.size(); i++) {
AnnotationGen annotation = as.get(i);
@@ -142,7 +142,7 @@ public abstract class BcelTestCase extends TestCase {
}

protected String dumpAttributes(Attribute[] as) {
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
result.append("AttributeArray:[");
for (int i = 0; i < as.length; i++) {
Attribute attr = as[i];

+ 2
- 2
bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/GenericSignatureParsingTest.java View File

@@ -324,7 +324,7 @@ public class GenericSignatureParsingTest extends BcelTestCase {
* @return byte code signature
*/
public static String getSignature(String type) {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
char[] chars = type.toCharArray();
boolean char_found = false, delim = false;
int index = -1;
@@ -451,7 +451,7 @@ public class GenericSignatureParsingTest extends BcelTestCase {
*/
public final static String methodTypeToSignature(String returnType, String[] methodArgs) throws ClassFormatException {

StringBuffer buf = new StringBuffer("(");
StringBuilder buf = new StringBuilder("(");

if (methodArgs != null) {
for (String methodArg : methodArgs) {

+ 3
- 3
bridge/src/main/java/org/aspectj/bridge/MessageUtil.java View File

@@ -851,7 +851,7 @@ public class MessageUtil {
if (null == loc) {
return "((ISourceLocation) null)";
}
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();

File sourceFile = loc.getSourceFile();
if (sourceFile != ISourceLocation.NO_FILE) {
@@ -901,7 +901,7 @@ public class MessageUtil {
Throwable thrown = message.getThrown();
ISourceLocation sl = message.getSourceLocation();
IMessage.Kind kind = message.getKind();
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
result.append(kind.toString());
result.append(": ");
if (null != thrown) {
@@ -988,7 +988,7 @@ public class MessageUtil {
if (0 == holder.numMessages(null, false)) {
return "(0 messages)";
}
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
for (IMessage.Kind kind : IMessage.KINDS) {
int num = holder.numMessages(kind, false);
if (0 < num) {

+ 1
- 1
bridge/src/main/java/org/aspectj/bridge/SourceLocation.java View File

@@ -131,7 +131,7 @@ public class SourceLocation implements ISourceLocation {

/** @return String {context\n}{file:}line{:column} */
public String toString() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
if (null != context) {
sb.append(context);
sb.append(LangUtil.EOL);

+ 2
- 2
bridge/src/main/java/org/aspectj/bridge/WeaveMessage.java View File

@@ -57,7 +57,7 @@ public class WeaveMessage extends Message {
* @return new weaving message
*/
public static WeaveMessage constructWeavingMessage(WeaveMessageKind kind, String[] inserts) {
StringBuffer str = new StringBuffer(kind.getMessage());
StringBuilder str = new StringBuilder(kind.getMessage());
int pos = -1;
while ((pos = new String(str).indexOf("%")) != -1) {
int n = Character.getNumericValue(str.charAt(pos + 1));
@@ -77,7 +77,7 @@ public class WeaveMessage extends Message {
*/
public static WeaveMessage constructWeavingMessage(WeaveMessageKind kind, String[] inserts, String affectedtypename,
String aspectname) {
StringBuffer str = new StringBuffer(kind.getMessage());
StringBuilder str = new StringBuilder(kind.getMessage());
int pos = -1;
while ((pos = new String(str).indexOf("%")) != -1) {
int n = Character.getNumericValue(str.charAt(pos + 1));

+ 2
- 2
bridge/src/main/java/org/aspectj/bridge/context/CompilationAndWeavingContext.java View File

@@ -138,7 +138,7 @@ public class CompilationAndWeavingContext {
explanationStack.push(getFormatter(entry).formatEntry(entry.phaseId, data));
}
}
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
while (!explanationStack.isEmpty()) {
sb.append("when ");
sb.append(explanationStack.pop().toString());
@@ -240,7 +240,7 @@ public class CompilationAndWeavingContext {
private static class DefaultFormatter implements ContextFormatter {

public String formatEntry(int phaseId, Object data) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(PHASE_NAMES[phaseId]);
sb.append(" ");
if (data instanceof char[]) {

+ 1
- 1
bridge/src/main/java/org/aspectj/bridge/context/PinpointingMessageHandler.java View File

@@ -44,7 +44,7 @@ public class PinpointingMessageHandler implements IMessageHandler {
ex.fillInStackTrace();
StringWriter sw = new StringWriter();
ex.printStackTrace(new PrintWriter(sw));
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(CompilationAndWeavingContext.getCurrentContext());
sb.append(sw.toString());
IMessage pinpointedMessage = new PinpointedMessage(message,sb.toString());

+ 1
- 1
bridge/src/test/java/org/aspectj/bridge/MessageTest.java View File

@@ -286,7 +286,7 @@ class KindTest {

/** @return error if failed */
String checkExpectedKind(IMessage m) {
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
for (int i = 0; i < KINDS.length; i++) {
if (expected.get(i) != checkKindMethods(m, i)) {
String s = "expected " + expected.get(i)

+ 2
- 2
build/src/main/java/$installer$/org/aspectj/Main.java View File

@@ -799,7 +799,7 @@ abstract class WizardPane {
public static String stringFromStream(InputStream stream) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(stream, "US-ASCII"));

StringBuffer ret = new StringBuffer();
StringBuilder ret = new StringBuilder();
int data;
while ((data = reader.read()) != -1) {
ret.append((char) data);
@@ -827,7 +827,7 @@ abstract class WizardPane {
public static String applyProperties(String text, Map<String,String> map) {
// ${name} -> map.get(name).toString()
int lastIndex = 0;
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();

int startIndex;
while ((startIndex = text.indexOf("${", lastIndex)) != -1) {

+ 2
- 2
build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AJInstaller.java View File

@@ -148,7 +148,7 @@ public class AJInstaller extends MatchingTask {

protected void writeContents(ZipOutputStream zOut) throws IOException {
// write to a StringBuffer
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
buf.append(contentsBytes);
buf.append(NEWLINE);
for (String name : contentsNames) {
@@ -160,7 +160,7 @@ public class AJInstaller extends MatchingTask {

protected void writeManifest(ZipOutputStream zOut) throws IOException {
// write to a StringBuffer
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
buf.append("Manifest-Version: 1.0");
buf.append(NEWLINE);
buf.append("Main-Class: " + MAIN_CLASS);

+ 2
- 2
build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java View File

@@ -92,7 +92,7 @@ public class AntBuilder extends Builder {
target.setName(resultTargetName);

Result[] reqs = result.getRequired();
StringBuffer depends = new StringBuffer();
StringBuilder depends = new StringBuilder();
boolean first = true;
for (Result reqResult : reqs) {
if (!first) {
@@ -616,7 +616,7 @@ public class AntBuilder extends Builder {
} catch (BuildException e) {
throw e;
} catch (Throwable t) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("classpath=");
sb.append(url);
throw new BuildException(sb.toString(), t);

+ 1
- 1
build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/Checklics.java View File

@@ -314,7 +314,7 @@ public class Checklics extends MatchingTask {

private void list() {
Iterator enu = LICENSES.keySet().iterator();
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("known license keys:");
boolean first = true;
while (enu.hasNext()) {

+ 1
- 1
build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/StripNonBodyHtml.java View File

@@ -176,7 +176,7 @@ public class StripNonBodyHtml extends MatchingTask {
String stripTags(String input, final String SOURCE,
final String START, final String END) {
if (null == input) return input;
StringBuffer buffer = new StringBuffer(input.length());
StringBuilder buffer = new StringBuilder(input.length());
String result = input;
int curLoc = 0;
while (true) {

+ 1
- 1
build/src/main/java/org/aspectj/internal/tools/build/Builder.java View File

@@ -473,7 +473,7 @@ public abstract class Builder {
// copy binaries (but not module flag files)
String excludes = null;
{
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
for (ProductModule productModule : productModules) {
if (0 < buf.length()) {
buf.append(",");

+ 1
- 1
build/src/main/java/org/aspectj/internal/tools/build/Module.java View File

@@ -610,7 +610,7 @@ public class Module {
final String DELIM = " \n\t\\<>\"=";
StringTokenizer st = new StringTokenizer(line, DELIM, true);
ArrayList<String> result = new ArrayList<>();
StringBuffer quote = new StringBuffer();
StringBuilder quote = new StringBuilder();
boolean inQuote = false;
while (st.hasMoreTokens()) {
String s = st.nextToken();

+ 3
- 3
build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java View File

@@ -167,7 +167,7 @@ public class SampleGatherer {
Reader reader = null;
try {
String author = null;
StringBuffer sampleCode = new StringBuffer();
StringBuilder sampleCode = new StringBuilder();
String anchorName = null;
String anchorTitle = null;
ArrayList<String> flags = new ArrayList<>();
@@ -747,7 +747,7 @@ class HTMLSamplesRenderer extends SamplesRenderer {
}
}
// build up prefix
StringBuffer branchAnchor = new StringBuffer();
StringBuilder branchAnchor = new StringBuilder();
for (int i = 0; i < firstDiff;) {
branchAnchor.append(parts[i]);
i++;
@@ -991,7 +991,7 @@ class SampleUtil {
if (from.length != to.length) {
throw new IllegalArgumentException("unmatched from/to");
}
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
int LEN = source.length();
int start = 0;
for (int i = 0; i < LEN; i++) {

+ 1
- 1
build/src/main/java/org/aspectj/internal/tools/build/Util.java View File

@@ -151,7 +151,7 @@ public class Util {
}

public static String path(String[] segments) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
if ((null != segments)) {
for (int i = 0; i < segments.length; i++) {
if (0 < i) {

+ 1
- 1
build/src/test/java/org/aspectj/internal/build/BuildModuleTest.java View File

@@ -107,7 +107,7 @@ public class BuildModuleTest extends TestCase {
if (!Util.delete(file)) {
File[] list = file.listFiles();
if (!Util.isEmpty(list)) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("warning: BuildModuleTest unable to delete ");
sb.append(file.toString());
sb.append("\n"); // XXX platform

+ 1
- 1
build/src/test/java/org/aspectj/internal/build/ModulesTest.java View File

@@ -115,7 +115,7 @@ public class ModulesTest extends TestCase {
}
}
if (!badModules.isEmpty()) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
for (Module module: badModules) {
System.err.println(module.toLongString());
sb.append("\n");

+ 2
- 2
loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java View File

@@ -345,7 +345,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor {
* @param definitions
*/
private void registerOptions(final BcelWeaver weaver, final ClassLoader loader, final List<Definition> definitions) {
StringBuffer allOptions = new StringBuffer();
StringBuilder allOptions = new StringBuilder();
for (Definition definition : definitions) {
allOptions.append(definition.getWeaverOptions()).append(' ');
}
@@ -956,7 +956,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor {
@Override
protected String getDumpDir() {
if (dumpDirPerClassloader) {
StringBuffer dir = new StringBuffer();
StringBuilder dir = new StringBuilder();
dir.append("_ajdump").append(File.separator).append(weavingContext.getId());
return dir.toString();
} else {

+ 1
- 1
loadtime/src/main/java/org/aspectj/weaver/loadtime/ConcreteAspectCodeGen.java View File

@@ -321,7 +321,7 @@ public class ConcreteAspectCodeGen {
* @return string repr.
*/
private String stringify() {
StringBuffer sb = new StringBuffer("<concrete-aspect name='");
StringBuilder sb = new StringBuilder("<concrete-aspect name='");
sb.append(concreteAspect.name);
sb.append("' extends='");
sb.append(concreteAspect.extend);

+ 3
- 3
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java View File

@@ -708,7 +708,7 @@ public class BuildArgParser extends Main {
} else if (arg.equals("-bootclasspath")) {
if (args.size() > nextArgIndex) {
String bcpArg = args.get(nextArgIndex).getValue();
StringBuffer bcp = new StringBuffer();
StringBuilder bcp = new StringBuilder();
StringTokenizer strTok = new StringTokenizer(bcpArg, File.pathSeparator);
while (strTok.hasMoreTokens()) {
bcp.append(makeFile(strTok.nextToken()));
@@ -724,7 +724,7 @@ public class BuildArgParser extends Main {
} else if (arg.equals("-classpath") || arg.equals("-cp")) {
if (args.size() > nextArgIndex) {
String cpArg = args.get(nextArgIndex).getValue();
StringBuffer cp = new StringBuffer();
StringBuilder cp = new StringBuilder();
StringTokenizer strTok = new StringTokenizer(cpArg, File.pathSeparator);
while (strTok.hasMoreTokens()) {
cp.append(makeFile(strTok.nextToken()));
@@ -756,7 +756,7 @@ public class BuildArgParser extends Main {
} else if (arg.equals("-extdirs")) {
if (args.size() > nextArgIndex) {
String extdirsArg = args.get(nextArgIndex).getValue();
StringBuffer ed = new StringBuffer();
StringBuilder ed = new StringBuilder();
StringTokenizer strTok = new StringTokenizer(extdirsArg, File.pathSeparator);
while (strTok.hasMoreTokens()) {
ed.append(makeFile(strTok.nextToken()));

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java View File

@@ -230,7 +230,7 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter {
pipelineOutput = new Hashtable();
}
pipelineOutput.put("filesContainingAspects", Integer.toString(toWaitFor));
StringBuffer order = new StringBuffer();
StringBuilder order = new StringBuilder();
order.append("[");
for (int i = 0; i < units.length; i++) {
if (i != 0) {

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/WeaverAdapter.java View File

@@ -199,7 +199,7 @@ public class WeaverAdapter implements IClassFileProvider, IWeaveRequestor, Itera
AjClassFile ajcf = new AjClassFile(key, result.getBytes());
lastReturnedResult.result().record(ajcf.fileName(), ajcf);
if (!weaverMessageHandler.isIgnoring(IMessage.INFO) || progressListener != null) {
StringBuffer msg = new StringBuffer();
StringBuilder msg = new StringBuilder();
msg.append(progressPhasePrefix).append(result.getClassName()).append(" (from ").append(nowProcessing.fileName())
.append(")");
weaverMessageHandler.handleMessage(MessageUtil.info(msg.toString()));

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java View File

@@ -113,7 +113,7 @@ public class WeaverMessageHandler implements IMessageHandler {
usedBinarySourceFileName);
problem.setSeeAlsoProblems(seeAlso);

StringBuffer details = new StringBuffer();
StringBuilder details = new StringBuilder();
// Stick more info in supplementary message info
if (message.getDetails() != null) {
details.append(message.getDetails());

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java View File

@@ -308,7 +308,7 @@ public class AdviceDeclaration extends AjMethodDeclaration {
}

private String buildArgNameRepresentation() {
StringBuffer args = new StringBuffer();
StringBuilder args = new StringBuilder();
int numArgsWeCareAbout = getDeclaredParameterCount();
if (this.arguments != null) {
for (int i = 0; i < numArgsWeCareAbout; i++) {

+ 2
- 2
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java View File

@@ -75,7 +75,7 @@ public class DeclareDeclaration extends AjMethodDeclaration {
DeclareParents dp = (DeclareParents) declareDecl;
String childPattern = dp.getChild().toString();
Collection parentPatterns = dp.getParents().getExactTypes();
StringBuffer parents = new StringBuffer();
StringBuilder parents = new StringBuilder();
for (Iterator iter = parentPatterns.iterator(); iter.hasNext();) {
UnresolvedType urt = ((UnresolvedType) iter.next());
parents.append(urt.getName());
@@ -174,7 +174,7 @@ public class DeclareDeclaration extends AjMethodDeclaration {
super.postParse(typeDec);
int declareSequenceNumberInType = ((AspectDeclaration) typeDec).declareCounter++;
// FIXME asc the name should perhaps include the hashcode of the pattern (type/sig) for binary compatibility reasons!
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("ajc$declare");
// Declares can choose to provide a piece of the name - to enable
// them to be easily distinguised at weave time (e.g. see declare annotation)

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/IfPseudoToken.java View File

@@ -139,7 +139,7 @@ public class IfPseudoToken extends PseudoToken {


// create a more stable name 277508
StringBuffer ifSelector = new StringBuffer();
StringBuilder ifSelector = new StringBuilder();
ifSelector.append("ajc$if$");
if (nameSuffix == null || nameSuffix.length()==0) {
boolean computedName = false;

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java View File

@@ -146,7 +146,7 @@ public class PointcutDeclaration extends AjMethodDeclaration {
}

private String buildArgNameRepresentation() {
StringBuffer args = new StringBuffer();
StringBuilder args = new StringBuilder();
if (this.arguments != null) {
for (int i = 0; i < this.arguments.length; i++) {
if (i != 0)

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/PointcutDesignator.java View File

@@ -97,7 +97,7 @@ public class PointcutDesignator extends ASTNode {
}

public String getPointcutDeclarationText() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
PseudoToken[] toks = tokens.tokens;
for (int i = 0; i < (toks.length - 1); i++) {
sb.append(toks[i].getString());

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java View File

@@ -942,7 +942,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
if ((bits & TagBits.AnnotationForType) != 0) {
s.add("TYPE");
}
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("{");
for (Iterator<String> iter = s.iterator(); iter.hasNext();) {
String element = iter.next();

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java View File

@@ -171,7 +171,7 @@ public class EclipseResolvedMember extends ResolvedMemberImpl {
QualifiedNameReference qnr = (QualifiedNameReference) e;
if (qnr.binding instanceof FieldBinding) {
FieldBinding fb = (FieldBinding) qnr.binding;
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(fb.declaringClass.signature());
sb.append(fb.name);
return sb.toString();

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java View File

@@ -123,7 +123,7 @@ public class EclipseSourceLocation implements ISourceLocation {

/** @return String {file:}line{:column} */
public String toString() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();

if (getSourceFile() != ISourceLocation.NO_FILE) {
sb.append(getSourceFile().getPath());

+ 4
- 4
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/PushinCollector.java View File

@@ -133,7 +133,7 @@ public class PushinCollector {
}

// Process all types working from end to start as whatever we do (insert-wise) will affect locations later in the file
StringBuffer sourceContents = new StringBuffer();
StringBuilder sourceContents = new StringBuilder();
// put the whole original file in the buffer
boolean changed = false;
sourceContents.append(compilationUnitDeclaration.compilationResult.compilationUnit.getContents());
@@ -165,8 +165,8 @@ public class PushinCollector {
TypeReference sr = sourceTypeBinding.scope.referenceContext.superclass;
TypeReference[] trs = sourceTypeBinding.scope.referenceContext.superInterfaces;
List<ExactTypePattern> newParents = additionalParents.get(sourceTypeBinding);
StringBuffer extendsString = new StringBuffer();
StringBuffer implementsString = new StringBuffer();
StringBuilder extendsString = new StringBuilder();
StringBuilder implementsString = new StringBuilder();
if (newParents != null && newParents.size() > 0) {
for (ExactTypePattern newParent : newParents) {
ResolvedType newParentType = newParent.getExactType().resolve(world);
@@ -272,7 +272,7 @@ public class PushinCollector {
}

private String getOutputFileFor(CompilationUnitDeclaration unit) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();

// Create the directory portion of the output location
if (specifiedOutputDirectory != null) {

+ 2
- 2
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java View File

@@ -456,7 +456,7 @@ public class AjProblemReporter extends ProblemReporter {
}

private String typesAsString(boolean isVarargs, TypeBinding[] types, boolean makeShort) {
StringBuffer buffer = new StringBuffer(10);
StringBuilder buffer = new StringBuilder(10);
for (int i = 0, length = types.length; i < length; i++) {
if (i != 0)
buffer.append(", "); //$NON-NLS-1$
@@ -661,7 +661,7 @@ public class AjProblemReporter extends ProblemReporter {
ex.fillInStackTrace();
StringWriter sw = new StringWriter();
ex.printStackTrace(new PrintWriter(sw));
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(CompilationAndWeavingContext.getCurrentContext());
sb.append(sw.toString());
problem = new PinpointedProblem(problem, sb.toString());

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java View File

@@ -98,7 +98,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags {

@Override
public String toString() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("BuildConfig[" + (configFile == null ? "null" : configFile.getAbsoluteFile().toString()) + "] #Files="
+ files.size() + " AopXmls=#" + xmlfiles.size());
return sb.toString();

+ 3
- 3
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java View File

@@ -1301,7 +1301,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour
if (buildConfig == null || buildConfig.getFullClasspath() == null) {
return "";
}
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
boolean first = true;
for (String s : buildConfig.getFullClasspath()) {
if (first) {
@@ -1393,7 +1393,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour

@Override
public String toString() {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
buf.append("AjBuildManager(");
buf.append(")");
return buf.toString();
@@ -1531,7 +1531,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour

@Override
public String formatEntry(int phaseId, Object data) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
if (phaseId == CompilationAndWeavingContext.BATCH_BUILD) {
sb.append("batch building ");
} else {

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java View File

@@ -286,7 +286,7 @@ public class AjCompilerOptions extends CompilerOptions {

@Override
public String toString() {
StringBuffer buf = new StringBuffer(super.toString());
StringBuilder buf = new StringBuilder(super.toString());
// now add AspectJ additional options
buf.append("\n\tAspectJ Specific Options:");
buf.append("\n\t- terminate after compilation: ").append(this.terminateAfterCompilation ? ENABLED : DISABLED); //$NON-NLS-1$

+ 2
- 2
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjState.java View File

@@ -802,7 +802,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe

@Override
public String toString() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
// null config means failed build i think as it is only set on successful full build?
sb.append("AjState(").append((buildConfig == null ? "NULLCONFIG" : buildConfig.getConfigFile().toString())).append(")");
return sb.toString();
@@ -2189,7 +2189,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe
// }

private String stringifySet(Set<?> l) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("{");
for (Iterator<?> iter = l.iterator(); iter.hasNext();) {
Object el = iter.next();

+ 3
- 3
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java View File

@@ -70,7 +70,7 @@ public class AsmElementFormatter {
node.setCorrespondingType(ad.returnType.toString()); // returnTypeToString(0));
}

StringBuffer details = new StringBuffer();
StringBuilder details = new StringBuilder();
if (ad.pointcutDesignator != null) {
details.append(AsmRelationshipUtils.genPointcutDetails(ad.pointcutDesignator.getPointcut()));
} else {
@@ -110,7 +110,7 @@ public class AsmElementFormatter {
node.setName(name + AsmRelationshipUtils.DECLARE_PARENTS);

String kindOfDP = null;
StringBuffer details = new StringBuffer("");
StringBuilder details = new StringBuilder("");
TypePattern[] newParents = dp.getParents().getTypePatterns();
for (int i = 0; i < newParents.length; i++) {
TypePattern tp = newParents[i];
@@ -248,7 +248,7 @@ public class AsmElementFormatter {
}

private String genDecaLabel(DeclareAnnotation deca) {
StringBuffer sb = new StringBuffer("");
StringBuilder sb = new StringBuilder("");
sb.append(deca.getPatternAsString());
sb.append(" : ");
sb.append(deca.getAnnotationString());

+ 4
- 4
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java View File

@@ -249,7 +249,7 @@ public class AsmHierarchyBuilder extends ASTVisitor {
if (unitPackage == null) {
pkgName = "";
} else {
StringBuffer nameBuffer = new StringBuffer();
StringBuilder nameBuffer = new StringBuilder();
final char[][] importName = unitPackage.getImportName();
final int last = importName.length - 1;
for (int i = 0; i < importName.length; i++) {
@@ -357,7 +357,7 @@ public class AsmHierarchyBuilder extends ASTVisitor {
String packageString = packageDecl.toString();
ProgramElement packageDeclaration = new ProgramElement(activeStructureModel, packageString,
IProgramElement.Kind.PACKAGE_DECLARATION, makeLocation(packageDecl), 0, null, null);
StringBuffer packageSourceDeclaration = new StringBuffer();
StringBuilder packageSourceDeclaration = new StringBuilder();
packageSourceDeclaration.append("package ");
packageSourceDeclaration.append(packageString);
packageSourceDeclaration.append(";");
@@ -914,7 +914,7 @@ public class AsmHierarchyBuilder extends ASTVisitor {
if (star != 0 && (comment[star - 1] == '/') && (comment[star + 1] == '*')
&& (star - 2 < 0 || comment[star - 2] != '/')) {
boolean completed = false;
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < comment.length && !completed; i++) {
char curr = comment[i];
if (curr == '/' && sb.length() > 2 && sb.charAt(sb.length() - 1) == '*') {
@@ -985,7 +985,7 @@ public class AsmHierarchyBuilder extends ASTVisitor {
stack.push(null); // a little weird but does the job
return true;
}
StringBuffer argumentsSignature = new StringBuffer();
StringBuilder argumentsSignature = new StringBuilder();
argumentsSignature.append("(");
if (constructorDeclaration.arguments != null) {
for (int i = 0; i < constructorDeclaration.arguments.length; i++) {

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/EclipseClassPathManager.java View File

@@ -90,7 +90,7 @@ public class EclipseClassPathManager extends ClassPathManager {
* @see java.lang.Object#toString()
*/
public String toString() {
StringBuffer buf = new StringBuffer("EclipseClassPathManager: ");
StringBuilder buf = new StringBuilder("EclipseClassPathManager: ");
buf.append(nameEnv.toString());
return buf.toString();
}

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java View File

@@ -695,7 +695,7 @@ public class AjASTConverter extends ASTConverter {
}

private String updateString(String message) {
StringBuffer sb = new StringBuffer(message);
StringBuilder sb = new StringBuilder(message);
int nextQuote = sb.toString().indexOf("\"");
while (nextQuote != -1) {
sb.insert(nextQuote, "\\");

+ 1
- 1
org.aspectj.ajdt.core/src/main/java/org/aspectj/tools/ajc/Main.java View File

@@ -554,7 +554,7 @@ public class Main {
public static String render(IMessage message) {
// IMessage.Kind kind = message.getKind();

StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
String text = message.getMessage();
if (text.equals(AbortException.NO_MESSAGE_TEXT)) {
text = null;

+ 5
- 5
org.aspectj.ajdt.core/src/test/java/WeaveTest.java View File

@@ -237,7 +237,7 @@ public class WeaveTest {

for(int classcounter = 0; classcounter < NUMCLASSES; classcounter++) {

StringBuffer classfile = new StringBuffer(1000);
StringBuilder classfile = new StringBuilder(1000);

classfile.append("// Auto-generated" + NL);
classfile.append("package " + OUTPUT_PACKAGE + ";" + NL + NL);
@@ -281,7 +281,7 @@ public class WeaveTest {
}

if (INCLUDE_TEST_CLASSES) {
StringBuffer testFiles = new StringBuffer(1000);
StringBuilder testFiles = new StringBuilder(1000);

try {
testFiles.append("// Auto generated" + NL);
@@ -307,7 +307,7 @@ public class WeaveTest {
System.exit(-1);
}

testFiles = new StringBuffer(1000);
testFiles = new StringBuilder(1000);

try {
testFiles.append("// Auto generated" + NL);
@@ -334,7 +334,7 @@ public class WeaveTest {
}
}

StringBuffer buildList = new StringBuffer(100);
StringBuilder buildList = new StringBuilder(100);

for(int i = 0; i < NUMCLASSES; i++)
buildList.append("C" + i + ".java" + NL);
@@ -392,7 +392,7 @@ public class WeaveTest {

private static void createAllAspects(String adviceType, int pointcut) {

StringBuffer aspectFile = new StringBuffer(1000);
StringBuilder aspectFile = new StringBuilder(1000);

// Capitalises the first char in the adviceType String, and then adds "Advice" to it.
String adviceName = (char)(adviceType.charAt(0) - 32) + adviceType.substring(1) + "Advice";

+ 3
- 3
org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/compiler/batch/IncrementalCase.java View File

@@ -48,7 +48,7 @@ public class IncrementalCase { // XXX NOT bound to junit - bridge tests?
IncrementalCase me = new IncrementalCase();
MessageHandler h = new MessageHandler();
// boolean result;
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
for (String arg : args) {
sb.append("\n###### results for " + arg);
sb.append("\n" + me.run(new File(arg), h) + ": " + h);
@@ -177,7 +177,7 @@ public class IncrementalCase { // XXX NOT bound to junit - bridge tests?
log("verifyCompile - def ", def, handler);
log("verifyCompile - command ", commandLine.toString(), handler);
log("verifyCompile - messages ", compilerMessages, handler);
StringBuffer failures = new StringBuffer();
StringBuilder failures = new StringBuilder();
if (def.expectFail == result) {
failures.append("iteration " + iteration +
" expected to " + (def.expectFail ? "fail\n" : "pass"));
@@ -303,7 +303,7 @@ public class IncrementalCase { // XXX NOT bound to junit - bridge tests?
}
boolean result = true;
final int[] exp = new int[expected.length];
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("[");
for (int i = 0; i < exp.length; i++) {
String s = expected[i];

+ 3
- 3
org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java View File

@@ -144,7 +144,7 @@ public abstract class AjcTestCase extends TestCase {
*/
public Message(int line, String srcFile, String text, ISourceLocation[] seeAlso) {
this.line = line;
StringBuffer srcFileName = new StringBuffer();
StringBuilder srcFileName = new StringBuilder();
if (srcFile != null) {
char[] chars = srcFile.toCharArray();
for (char c : chars) {
@@ -230,7 +230,7 @@ public abstract class AjcTestCase extends TestCase {
*/
@Override
public String toString() {
StringBuffer buff = new StringBuffer();
StringBuilder buff = new StringBuilder();
buff.append("message ");
if (sourceFileName != null) {
buff.append("in file ");
@@ -704,7 +704,7 @@ public abstract class AjcTestCase extends TestCase {
ByteArrayOutputStream baosErr = new ByteArrayOutputStream();


StringBuffer command = new StringBuffer();
StringBuilder command = new StringBuilder();
command.append("java -classpath ");
command.append(cp.toString());
command.append(" ");

+ 1
- 1
org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/CompilationResult.java View File

@@ -153,7 +153,7 @@ public class CompilationResult {
*/
@Override
public String toString() {
StringBuffer buff = new StringBuffer();
StringBuilder buff = new StringBuilder();
buff.append("AspectJ Compilation Result:\n");
int totalMessages = infoMessages.size() + warningMessages.size() + errorMessages.size() + failMessages.size() + weaveMessages.size();
buff.append(totalMessages);

+ 1
- 1
org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractAnnotationAJ.java View File

@@ -95,7 +95,7 @@ public abstract class AbstractAnnotationAJ implements AnnotationAJ {
* {@inheritDoc}
*/
public final String getValidTargets() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("{");
for (Iterator<String> iter = supportedTargets.iterator(); iter.hasNext();) {
String evalue = iter.next();

+ 1
- 1
org.aspectj.matcher/src/main/java/org/aspectj/weaver/Advice.java View File

@@ -429,7 +429,7 @@ public abstract class Advice extends ShadowMunger {

@Override
public String toString() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("(").append(getKind()).append(extraParametersToString());
sb.append(": ").append(pointcut).append("->").append(signature).append(")");
return sb.toString();

+ 2
- 2
org.aspectj.matcher/src/main/java/org/aspectj/weaver/AjcMemberMaker.java View File

@@ -255,7 +255,7 @@ public class AjcMemberMaker {
} else {
args = new UnresolvedType[] { fieldDeclaringType };
}
StringBuffer name = new StringBuffer("ajc$get$");
StringBuilder name = new StringBuilder("ajc$get$");
name.append(field.getName());
return new ResolvedMemberImpl(Member.METHOD, fieldDeclaringType, PUBLIC_STATIC, field.getReturnType(), name.toString(),
args);
@@ -289,7 +289,7 @@ public class AjcMemberMaker {
} else {
args = new UnresolvedType[] { fieldDeclaringType, field.getType() };
}
StringBuffer name = new StringBuffer("ajc$set$");
StringBuilder name = new StringBuilder("ajc$set$");
name.append(field.getName());
return new ResolvedMemberImpl(Member.METHOD, fieldDeclaringType, PUBLIC_STATIC, UnresolvedType.VOID, name.toString(),
args);

+ 0
- 0
org.aspectj.matcher/src/main/java/org/aspectj/weaver/AnnotationNameValuePair.java View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save