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

} }


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

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

return "ERROR: file \"" + filePath + "\" does not exist."; return "ERROR: file \"" + filePath + "\" does not exist.";
} }
BufferedReader reader = new BufferedReader(new FileReader(file)); BufferedReader reader = new BufferedReader(new FileReader(file));
StringBuffer contents = new StringBuffer();
StringBuilder contents = new StringBuilder();
String line = reader.readLine(); String line = reader.readLine();
int numLines = 0; int numLines = 0;
while (line != null) { while (line != null) {

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

return "none"; return "none";
} }


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

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

public void testClasspath() { public void testClasspath() {
String classpath = compilerConfig.getClasspath(); String classpath = compilerConfig.getClasspath();
List<String> found = genAjBuildConfig().getClasspath(); List<String> found = genAjBuildConfig().getClasspath();
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
for (Iterator<String> iterator = found.iterator(); iterator.hasNext();) { for (Iterator<String> iterator = found.iterator(); iterator.hasNext();) {
String name = iterator.next(); String name = iterator.next();
sb.append(name); sb.append(name);

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

} }


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

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

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

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

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

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

String name = decl.toSignatureString(); String name = decl.toSignatureString();
int classEndIndex = contents.indexOf(name + "</B><DT>"); int classEndIndex = contents.indexOf(name + "</B><DT>");
if (classEndIndex != -1) { if (classEndIndex != -1) {
StringBuffer sb = new StringBuffer(contents.substring(secondClassStartIndex, classEndIndex));
StringBuilder sb = new StringBuilder(contents.substring(secondClassStartIndex, classEndIndex));
sb.replace(0, 5, "aspect"); sb.replace(0, 5, "aspect");
fileContents.delete(secondClassStartIndex, classEndIndex); fileContents.delete(secondClassStartIndex, classEndIndex);
fileContents.insert(secondClassStartIndex, sb.toString()); fileContents.insert(secondClassStartIndex, sb.toString());
parent = parent.getParent(); parent = parent.getParent();
names.add(parent.toLinkLabelString()); names.add(parent.toLinkLabelString());
} }
StringBuffer sbuff = new StringBuffer();
StringBuilder sbuff = new StringBuilder();
for (int i = names.size() - 1; i >= 0; i--) { for (int i = names.size() - 1; i >= 0; i--) {
String element = (String) names.get(i); String element = (String) names.get(i);
if (i == 0) { if (i == 0) {


// need to replace " with quot; otherwise the links wont work // need to replace " with quot; otherwise the links wont work
// for 'matches declare' relationship // for 'matches declare' relationship
StringBuffer sb = new StringBuffer(currDecl.toLabelString());
StringBuilder sb = new StringBuilder(currDecl.toLabelString());
int nextQuote = sb.toString().indexOf("\""); int nextQuote = sb.toString().indexOf("\"");
while (nextQuote != -1) { while (nextQuote != -1) {
sb.deleteCharAt(nextQuote); sb.deleteCharAt(nextQuote);
* @return String consisting of multiple "../" parts, one for each component part of the input <code>packagePath</code>. * @return String consisting of multiple "../" parts, one for each component part of the input <code>packagePath</code>.
*/ */
private static String getRelativePathFromHere(String packagePath) { private static String getRelativePathFromHere(String packagePath) {
StringBuffer result = new StringBuffer("");
StringBuilder result = new StringBuilder("");
if (packagePath != null && (packagePath.contains("/"))) { if (packagePath != null && (packagePath.contains("/"))) {
StringTokenizer sTok = new StringTokenizer(packagePath, "/", false); StringTokenizer sTok = new StringTokenizer(packagePath, "/", false);
while (sTok.hasMoreTokens()) { while (sTok.hasMoreTokens()) {
} }


static String generateHREFName(IProgramElement decl) { static String generateHREFName(IProgramElement decl) {
StringBuffer hrefLinkBuffer = new StringBuffer();
StringBuilder hrefLinkBuffer = new StringBuilder();
char[] declChars = decl.toLabelString().toCharArray(); char[] declChars = decl.toLabelString().toCharArray();
for (char declChar : declChars) { for (char declChar : declChars) {
if (declChar == '"') { if (declChar == '"') {

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

if (indexFile.exists()) { if (indexFile.exists()) {
BufferedReader indexFileReader = new BufferedReader(new FileReader(indexFile)); BufferedReader indexFileReader = new BufferedReader(new FileReader(indexFile));
// StringBuffer greatly reduces the time it takes to remove generated tags // 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(); String line = indexFileReader.readLine();
while (line != null) { while (line != null) {
int indexStart = line.indexOf(Config.DECL_ID_STRING); int indexStart = line.indexOf(Config.DECL_ID_STRING);

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

} }


public static String genSignature(IProgramElement node) { public static String genSignature(IProgramElement node) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();


String accessibility = node.getAccessibility().toString(); String accessibility = node.getAccessibility().toString();
if (!accessibility.equals("package")) { if (!accessibility.equals("package")) {

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

for (IRelationship ir : rels) { for (IRelationship ir : rels) {
List<String> targets = ir.getTargets(); List<String> targets = ir.getTargets();
for (String thid : targets) { for (String thid : targets) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
if (modelFilter == null || modelFilter.wantsHandleIds()) { if (modelFilter == null || modelFilter.wantsHandleIds()) {
sb.append("Hid:" + (ctr++) + ":"); sb.append("Hid:" + (ctr++) + ":");
} }
// unexpected - time to give up // unexpected - time to give up
return ""; return "";
} }
StringBuffer qualifiedTypeNameFromHandle = new StringBuffer();
StringBuilder qualifiedTypeNameFromHandle = new StringBuilder();
if (hasPackage != -1) { if (hasPackage != -1) {
int classfileLoc = handle.indexOf(HandleProviderDelimiter.CLASSFILE.getDelimiter(), hasPackage); int classfileLoc = handle.indexOf(HandleProviderDelimiter.CLASSFILE.getDelimiter(), hasPackage);
qualifiedTypeNameFromHandle.append(handle.substring(hasPackage + 1, classfileLoc)); qualifiedTypeNameFromHandle.append(handle.substring(hasPackage + 1, classfileLoc));
} }


public String toString() { public String toString() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("Model node summary:\n"); sb.append("Model node summary:\n");
Enumeration<String> nodeKeys = nodeTypeCount.keys(); Enumeration<String> nodeKeys = nodeTypeCount.keys();
while (nodeKeys.hasMoreElements()) { while (nodeKeys.hasMoreElements()) {

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

if (end != -1) { if (end != -1) {
configFile = configFile.substring(start + 1, end); configFile = configFile.substring(start + 1, end);
} else { } else {
configFile = new StringBuffer("=").append(configFile.substring(start + 1)).toString();
configFile = new StringBuilder("=").append(configFile.substring(start + 1)).toString();
} }
ipe.setHandleIdentifier(configFile); ipe.setHandleIdentifier(configFile);
return configFile; return configFile;
} else if (ipe.getKind() == IProgramElement.Kind.SOURCE_FOLDER) { } else if (ipe.getKind() == IProgramElement.Kind.SOURCE_FOLDER) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(createHandleIdentifier(ipe.getParent())).append("/"); sb.append(createHandleIdentifier(ipe.getParent())).append("/");
// pr249216 - escape any embedded slashes // pr249216 - escape any embedded slashes
String folder = ipe.getName(); String folder = ipe.getName();
parent = ipe.getParent().getParent(); parent = ipe.getParent().getParent();
} }


StringBuffer handle = new StringBuffer();
StringBuilder handle = new StringBuilder();
// add the handle for the parent // add the handle for the parent
handle.append(createHandleIdentifier(parent)); handle.append(createHandleIdentifier(parent));
// add the correct delimiter for this ipe // add the correct delimiter for this ipe
} }
List<String> sourceRefs = ipe.getParameterSignaturesSourceRefs(); List<String> sourceRefs = ipe.getParameterSignaturesSourceRefs();
List<char[]> parameterTypes = ipe.getParameterSignatures(); List<char[]> parameterTypes = ipe.getParameterSignatures();
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
if (sourceRefs != null) { if (sourceRefs != null) {
for (String sourceRef : sourceRefs) { for (String sourceRef : sourceRefs) {
sb.append(HandleProviderDelimiter.getDelimiter(ipe)); sb.append(HandleProviderDelimiter.getDelimiter(ipe));

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

// not parameterized // not parameterized
return new StringBuilder("L").append(name.replace('.', '/')).append(';').toString(); return new StringBuilder("L").append(name.replace('.', '/')).append(';').toString();
} else { } else {
StringBuffer nameBuff = new StringBuffer();
StringBuilder nameBuff = new StringBuilder();
int nestLevel = 0; int nestLevel = 0;
nameBuff.append("L"); nameBuff.append("L");
for (int i = 0; i < name.length(); i++) { for (int i = 0; i < name.length(); i++) {
case '<': case '<':
nameBuff.append("<"); nameBuff.append("<");
nestLevel++; nestLevel++;
StringBuffer innerBuff = new StringBuffer();
StringBuilder innerBuff = new StringBuilder();
while (nestLevel > 0) { while (nestLevel > 0) {
c = name.charAt(++i); c = name.charAt(++i);
if (c == '<') { if (c == '<') {
} }
if (c == ',' && nestLevel == 1) { if (c == ',' && nestLevel == 1) {
nameBuff.append(nameToSignature(innerBuff.toString())); nameBuff.append(nameToSignature(innerBuff.toString()));
innerBuff = new StringBuffer();
innerBuff = new StringBuilder();
} else { } else {
if (nestLevel > 0) { if (nestLevel > 0) {
innerBuff.append(c); innerBuff.append(c);
} }


public String toSignatureString(boolean getFullyQualifiedArgTypes) { public String toSignatureString(boolean getFullyQualifiedArgTypes) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(name); sb.append(name);


List<char[]> ptypes = getParameterTypes(); List<char[]> ptypes = getParameterTypes();

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



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


/** /**
* Dump line number table attribute to file stream in binary format. * Dump line number table attribute to file stream in binary format.
*
*
* @param file Output file stream * @param file Output file stream
* @throws IOException * @throws IOException
*/ */
@Override @Override
public final String toString() { public final String toString() {
unpack(); unpack();
StringBuffer buf = new StringBuffer();
StringBuffer line = new StringBuffer();
StringBuilder buf = new StringBuilder();
StringBuilder line = new StringBuilder();


for (int i = 0; i < numBootstrapMethods; i++) { for (int i = 0; i < numBootstrapMethods; i++) {
BootstrapMethod bm = bootstrapMethods[i]; BootstrapMethod bm = bootstrapMethods[i];
line.append(arg).append("(").append(getConstantPool().getConstant(arg)).append(") "); line.append(arg).append("(").append(getConstantPool().getConstant(arg)).append(") ");
} }
} }
if (i < numBootstrapMethods - 1) { if (i < numBootstrapMethods - 1) {
line.append(", "); line.append(", ");
} }

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

* This class represents a chunk of Java byte code contained in a method. It is instantiated by the * 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, * <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. * 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 * 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. * <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 $ * @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> * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Attribute * @see Attribute
/** /**
* Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the * 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. * hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
*
*
* @param v Visitor object * @param v Visitor object
*/ */
@Override @Override


/** /**
* Dump code attribute to file stream in binary format. * Dump code attribute to file stream in binary format.
*
*
* @param file Output file stream * @param file Output file stream
* @throws IOException * @throws IOException
*/ */
* @return String representation of code chunk. * @return String representation of code chunk.
*/ */
public final String toString(boolean verbose) { 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)); + ")\n" + Utility.codeToString(code, cpool, 0, -1, verbose));


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

/** /**
* Get string from constant pool and bypass the indirection of `ConstantClass' and `ConstantString' objects. I.e. these classes * 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. * 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 index Index in constant pool
* @param tag Tag of expected constant, either ConstantClass or ConstantString * @param tag Tag of expected constant, either ConstantClass or ConstantString
* @return Contents of string reference * @return Contents of string reference
str = (constantToString(((ConstantCP) c).getClassIndex(), Constants.CONSTANT_Class) + "." + constantToString( str = (constantToString(((ConstantCP) c).getClassIndex(), Constants.CONSTANT_Class) + "." + constantToString(
((ConstantCP) c).getNameAndTypeIndex(), Constants.CONSTANT_NameAndType)); ((ConstantCP) c).getNameAndTypeIndex(), Constants.CONSTANT_NameAndType));
break; break;
case Constants.CONSTANT_InvokeDynamic: case Constants.CONSTANT_InvokeDynamic:
ConstantInvokeDynamic cID = ((ConstantInvokeDynamic)c); ConstantInvokeDynamic cID = ((ConstantInvokeDynamic)c);
return "#"+cID.getBootstrapMethodAttrIndex()+"."+constantToString(cID.getNameAndTypeIndex(), Constants.CONSTANT_NameAndType); return "#"+cID.getBootstrapMethodAttrIndex()+"."+constantToString(cID.getNameAndTypeIndex(), Constants.CONSTANT_NameAndType);


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


for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
assert c.tag == Constants.CONSTANT_Utf8; assert c.tag == Constants.CONSTANT_Utf8;
return (ConstantUtf8) c; return (ConstantUtf8) c;
} }
public ConstantModule getConstantModule(int index) { public ConstantModule getConstantModule(int index) {
Constant c = getConstant(index); Constant c = getConstant(index);
assert c != null; assert c != null;


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


for (int i = 1; i < poolSize; i++) for (int i = 1; i < poolSize; i++)
buf.append(i + ")" + pool[i] + "\n"); buf.append(i + ")" + pool[i] + "\n");


public int lookupFieldref(String searchClassname, String searchFieldname, String searchSignature) { public int lookupFieldref(String searchClassname, String searchFieldname, String searchSignature) {
searchClassname = searchClassname.replace('.', '/'); 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); Integer pos = fieldCache.get(k);
if (pos != null) if (pos != null)
return pos; return pos;


return addNameAndType(u8.getValue(), u8_2.getValue()); return addNameAndType(u8.getValue(), u8_2.getValue());
} }
case Constants.CONSTANT_InvokeDynamic: { case Constants.CONSTANT_InvokeDynamic: {
ConstantInvokeDynamic cid = (ConstantInvokeDynamic)c; ConstantInvokeDynamic cid = (ConstantInvokeDynamic)c;
int index1 = cid.getBootstrapMethodAttrIndex(); int index1 = cid.getBootstrapMethodAttrIndex();
int index2 = addNameAndType(name.getValue(), signature.getValue()); int index2 = addNameAndType(name.getValue(), signature.getValue());
return addInvokeDynamic(index1,index2); return addInvokeDynamic(index1,index2);
} }
case Constants.CONSTANT_MethodHandle: case Constants.CONSTANT_MethodHandle:
ConstantMethodHandle cmh = (ConstantMethodHandle)c; ConstantMethodHandle cmh = (ConstantMethodHandle)c;
return addMethodHandle(cmh.getReferenceKind(),addConstant(constants[cmh.getReferenceIndex()],cp)); return addMethodHandle(cmh.getReferenceKind(),addConstant(constants[cmh.getReferenceIndex()],cp));


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


public int lookupMethodref(String searchClassname, String searchMethodName, String searchSignature) { 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); Integer cached = methodCache.get(key);
if (cached != null) if (cached != null)
return cached; return cached;
public String getPackageName(int packageIndex) { public String getPackageName(int packageIndex) {
return getConstantPackage(packageIndex).getPackageName(this); return getConstantPackage(packageIndex).getPackageName(this);
} }
}
}

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

* This class represents the table of exceptions that are thrown by a method. This attribute may be used once per method. The name * 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 * 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). * 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 $ * @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> * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Code * @see Code


/** /**
* Construct object from file stream. * Construct object from file stream.
*
*
* @param name_index Index in constant pool * @param name_index Index in constant pool
* @param length Content length in bytes * @param length Content length in bytes
* @param file Input stream * @param file Input stream
/** /**
* Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the * 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. * hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
*
*
* @param v Visitor object * @param v Visitor object
*/ */
@Override @Override


/** /**
* Dump exceptions attribute to file stream in binary format. * Dump exceptions attribute to file stream in binary format.
*
*
* @param file Output file stream * @param file Output file stream
* @throws IOException * @throws IOException
*/ */
*/ */
@Override @Override
public final String toString() { public final String toString() {
StringBuffer buf = new StringBuffer("");
StringBuilder buf = new StringBuilder("");
String str; String str;


for (int i = 0; i < number_of_exceptions; i++) { 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

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

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

/** /**
* 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 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. * 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 $ * @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> * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Attribute * @see Attribute


/** /**
* Construct object from file stream. * Construct object from file stream.
*
*
* @param name_index Index in constant pool to CONSTANT_Utf8 * @param name_index Index in constant pool to CONSTANT_Utf8
* @param length Content length in bytes * @param length Content length in bytes
* @param file Input stream * @param file Input stream
/** /**
* Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the * 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. * hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
*
*
* @param v Visitor object * @param v Visitor object
*/ */
@Override @Override


/** /**
* Dump source file attribute to file stream in binary format. * Dump source file attribute to file stream in binary format.
*
*
* @param file Output file stream * @param file Output file stream
* @throws IOException * @throws IOException
*/ */
*/ */
@Override @Override
public final String toString() { public final String toString() {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();


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

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

/** /**
* Represents a Java class, i.e., the data structures, constant pool, fields, methods and commands contained in a Java .class file. * 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. * 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 * 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. * 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 $ * @version $Id: JavaClass.java,v 1.22 2009/09/15 19:40:14 aclement Exp $
* @see org.aspectj.apache.bcel.generic.ClassGen * @see org.aspectj.apache.bcel.generic.ClassGen
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
/** /**
* Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the * 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. * hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
*
*
* @param v Visitor object * @param v Visitor object
*/ */
public void accept(ClassVisitor v) { public void accept(ClassVisitor v) {


/** /**
* Dump class to a file. * Dump class to a file.
*
*
* @param file Output file * @param file Output file
* @throws IOException * @throws IOException
*/ */


/** /**
* Dump class to a file named file_name. * Dump class to a file named file_name.
*
*
* @param file_name Output file name * @param file_name Output file name
* @exception IOException * @exception IOException
*/ */
String access = Utility.accessToString(modifiers, true); String access = Utility.accessToString(modifiers, true);
access = access.equals("") ? "" : access + " "; 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'); + Utility.compactClassName(superclassname, false) + '\n');
int size = interfaces.length; int size = interfaces.length;




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


while (tok.hasMoreTokens()) { while (tok.hasMoreTokens()) {
buf.append("\t" + tok.nextToken() + "\n"); buf.append("\t" + tok.nextToken() + "\n");


/** /**
* Equivalent to runtime "instanceof" operator. * Equivalent to runtime "instanceof" operator.
*
*
* @return true if this JavaClass is derived from teh super class * @return true if this JavaClass is derived from teh super class
*/ */
public final boolean instanceOf(JavaClass 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

/** /**
* This class represents a table of line numbers for debugging purposes. This attribute is used by the <em>Code</em> attribute. It * 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. * contains pairs of PCs and line numbers.
*
*
* @version $Id: LineNumberTable.java,v 1.8 2009/09/15 19:40:12 aclement Exp $ * @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> * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Code changes: asc Feb06 Made unpacking lazy * @see Code changes: asc Feb06 Made unpacking lazy


/** /**
* Construct object from file stream. * Construct object from file stream.
*
*
* @param name_index Index of name * @param name_index Index of name
* @param length Content length in bytes * @param length Content length in bytes
* @param file Input stream * @param file Input stream
/** /**
* Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the * 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. * hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
*
*
* @param v Visitor object * @param v Visitor object
*/ */
@Override @Override


/** /**
* Dump line number table attribute to file stream in binary format. * Dump line number table attribute to file stream in binary format.
*
*
* @param file Output file stream * @param file Output file stream
* @throws IOException * @throws IOException
*/ */
@Override @Override
public final String toString() { public final String toString() {
unpack(); unpack();
StringBuffer buf = new StringBuffer();
StringBuffer line = new StringBuffer();
StringBuilder buf = new StringBuilder();
StringBuilder line = new StringBuilder();


for (int i = 0; i < tableLength; i++) { for (int i = 0; i < tableLength; i++) {
line.append(table[i].toString()); line.append(table[i].toString());


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

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

*/ */
@Override @Override
public final String toString() { public final String toString() {
StringBuffer buf = new StringBuffer("");
StringBuilder buf = new StringBuilder("");
unpack(); unpack();
for (int i = 0; i < localVariableTableLength; i++) { for (int i = 0; i < localVariableTableLength; i++) {
buf.append(localVariableTable[i].toString()); buf.append(localVariableTable[i].toString());

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

*/ */
@Override @Override
public final String toString() { public final String toString() {
StringBuffer buf = new StringBuffer("");
StringBuilder buf = new StringBuilder("");


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

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

/** /**
* This class represents the method info structure, i.e., the representation for a method in the class. See JVM specification for * 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. * 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 $ * @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> * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/ */
public final String toString() { public final String toString() {
ConstantUtf8 c; ConstantUtf8 c;
String name, signature, access; // Short cuts to constant pool String name, signature, access; // Short cuts to constant pool
StringBuffer buf;
StringBuilder buf;


access = Utility.accessToString(modifiers); access = Utility.accessToString(modifiers);


name = c.getValue(); name = c.getValue();


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


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

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

/** /**
* Indicates all the packages of a module that are exported or opened by the module attribute. * 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 * http://cr.openjdk.java.net/~mr/jigsaw/spec/java-se-9-jvms-diffs.pdf 4.7.26
*
*
* @author Andy Clement * @author Andy Clement
*/ */
public final class ModulePackages extends Attribute { public final class ModulePackages extends Attribute {


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

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



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


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

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



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


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

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

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


/** /**
* Construct object from file stream. * Construct object from file stream.
*
*
* @param name_index Index in constant pool to CONSTANT_Utf8 * @param name_index Index in constant pool to CONSTANT_Utf8
* @param length Content length in bytes * @param length Content length in bytes
* @param file Input stream * @param file Input stream
/** /**
* Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the * 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. * hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
*
*
* @param v Visitor object * @param v Visitor object
*/ */
@Override @Override


/** /**
* Dump source file attribute to file stream in binary format. * Dump source file attribute to file stream in binary format.
*
*
* @param file Output file stream * @param file Output file stream
* @throws IOException * @throws IOException
*/ */
// System.out.println("return from ident:" + (char)ch); // System.out.println("return from ident:" + (char)ch);


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


int count = 1; int count = 1;
while (Character.isJavaIdentifierPart((char) ch)) { while (Character.isJavaIdentifierPart((char) ch)) {
return; return;
} }


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


do { do {

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

* This class represents a stack map attribute used for preverification of Java classes for the <a href="http://java.sun.com/j2me/"> * 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 * 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 * 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 $ * @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> * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Code * @see Code


/* /*
* @param name_index Index of name * @param name_index Index of name
*
*
* @param length Content length in bytes * @param length Content length in bytes
*
*
* @param map Table of stack map entries * @param map Table of stack map entries
*
*
* @param constant_pool Array of constants * @param constant_pool Array of constants
*/ */
public StackMap(int name_index, int length, StackMapEntry[] map, ConstantPool constant_pool) { public StackMap(int name_index, int length, StackMapEntry[] map, ConstantPool constant_pool) {


/** /**
* Construct object from file stream. * Construct object from file stream.
*
*
* @param name_index Index of name * @param name_index Index of name
* @param length Content length in bytes * @param length Content length in bytes
* @param file Input stream * @param file Input stream


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


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

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

* *
* @param file Output file stream * @param file Output file stream
* @throws IOException * @throws IOException
*/
*/
public final void dump(DataOutputStream file) throws IOException public final void dump(DataOutputStream file) throws IOException
{ {
file.writeShort(byte_code_offset); file.writeShort(byte_code_offset);


/** /**
* @return String representation. * @return String representation.
*/
*/
public final String toString() { 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) { if(number_of_locals > 0) {
buf.append(", locals={"); buf.append(", locals={");


buf.append(")"); buf.append(")");


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






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


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

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

* specification states "A class member that does not appear in the source code must be marked using a Synthetic attribute." It may * 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 * 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. * from the <em>Attribute.readAttribute()</em> method.
*
*
* @version $Id: Synthetic.java,v 1.5 2009/09/15 19:40:12 aclement Exp $ * @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> * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Attribute * @see Attribute
this(c.getNameIndex(), c.getLength(), c.getBytes(), c.getConstantPool()); this(c.getNameIndex(), c.getLength(), c.getBytes(), c.getConstantPool());
} }


//
//
// public Synthetic(ConstantPoolGen cpool) { // public Synthetic(ConstantPoolGen cpool) {
// super(Constants.ATTR_SYNTHETIC, cpool.addUtf8("Synthetic"), 0, cpool); // super(Constants.ATTR_SYNTHETIC, cpool.addUtf8("Synthetic"), 0, cpool);
// ConstantPoolGen cpg = myGen.getConstantPool(); // ConstantPoolGen cpg = myGen.getConstantPool();


/** /**
* Construct object from file stream. * Construct object from file stream.
*
*
* @param name_index Index in constant pool to CONSTANT_Utf8 * @param name_index Index in constant pool to CONSTANT_Utf8
* @param length Content length in bytes * @param length Content length in bytes
* @param file Input stream * @param file Input stream
/** /**
* Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the * 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. * hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
*
*
* @param v Visitor object * @param v Visitor object
*/ */
@Override @Override


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


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

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



/** /**
* Utility functions that do not really belong to any class in particular. * 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 $ * @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> * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*
*
* modified: Andy Clement 2-mar-05 Removed unnecessary static and optimized * modified: Andy Clement 2-mar-05 Removed unnecessary static and optimized
*/ */
public abstract class Utility { public abstract class Utility {


/** /**
* Convert bit field of flags into string such as 'static final'. * Convert bit field of flags into string such as 'static final'.
*
*
* @param access_flags Access flags * @param access_flags Access flags
* @return String representation of flags * @return String representation of flags
*/ */


/** /**
* Convert bit field of flags into string such as 'static final'. * 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 * 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'. * because SUN used the same value for the flags 'ACC_SUPER' and 'ACC_SYNCHRONIZED'.
*
*
* @param access_flags Access flags * @param access_flags Access flags
* @param for_class access flags are for class qualifiers ? * @param for_class access flags are for class qualifiers ?
* @return String representation of flags * @return String representation of flags
*/ */
public static final String accessToString(int access_flags, boolean for_class) { public static final String accessToString(int access_flags, boolean for_class) {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();


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


try { try {


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


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


try { try {
index = str.indexOf(old); index = str.indexOf(old);


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


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


brackets = new StringBuffer(); // Accumulate []'s
brackets = new StringBuilder(); // Accumulate []'s
// Count opening brackets and look for optional size argument // Count opening brackets and look for optional size argument
for (n = 0; signature.charAt(n) == '['; n++) { for (n = 0; signature.charAt(n) == '['; n++) {
brackets.append("[]"); brackets.append("[]");


/** /**
* Return type of method signature as a byte value as defined in <em>Constants</em> * Return type of method signature as a byte value as defined in <em>Constants</em>
*
*
* @param signature in format described above * @param signature in format described above
* @return type of method signature * @return type of method signature
* @see Constants * @see Constants


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


for (int i = 0; i < bytes.length; i++) { for (int i = 0; i < bytes.length; i++) {
short b = byteToShort(bytes[i]); short b = byteToShort(bytes[i]);


/** /**
* Return a string for an integer justified left or right and filled up with 'fill' characters if necessary. * Return a string for an integer justified left or right and filled up with 'fill' characters if necessary.
*
*
* @param i integer to format * @param i integer to format
* @param length length of desired string * @param length length of desired string
* @param left_justify format left or right * @param left_justify format left or right


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


for (char c : ch) { for (char c : ch) {
switch (c) { switch (c) {


/** /**
* Converts a list of AnnotationGen objects into a set of attributes that can be attached to the class file. * 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 cp The constant pool gen where we can create the necessary name refs
* @param annotations A list of AnnotationGen objects * @param annotations A list of AnnotationGen objects
*/ */


/** /**
* Return type of signature as a byte value as defined in <em>Constants</em> * Return type of signature as a byte value as defined in <em>Constants</em>
*
*
* @param signature in format described above * @param signature in format described above
* @return type of signature * @return type of signature
* @see Constants * @see Constants


/** /**
* Disassemble a stream of byte codes and return the string representation. * Disassemble a stream of byte codes and return the string representation.
*
*
* @param bytes stream of bytes * @param bytes stream of bytes
* @param constant_pool Array of constants * @param constant_pool Array of constants
* @param verbose be verbose, e.g. print constant pool index * @param verbose be verbose, e.g. print constant pool index
int index, vindex, constant; int index, vindex, constant;
int[] match, jump_table; int[] match, jump_table;
int no_pad_bytes = 0, offset; 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 * Special case: Skip (0-3) padding bytes, i.e., the following bytes are 4-byte-aligned
+ bytes.readUnsignedByte()); // Last byte is a reserved + bytes.readUnsignedByte()); // Last byte is a reserved
// space // space
break; break;
case Constants.INVOKEDYNAMIC://http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html#jvms-6.5.invokedynamic case Constants.INVOKEDYNAMIC://http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html#jvms-6.5.invokedynamic
index = bytes.readUnsignedShort(); index = bytes.readUnsignedShort();
bytes.readUnsignedShort(); // zeroes bytes.readUnsignedShort(); // zeroes
buf.append("\t" + constant_pool.constantToString(index) + (verbose ? " (" + index + ")" : "")); buf.append("\t" + constant_pool.constantToString(index) + (verbose ? " (" + index + ")" : ""));
break; break;
// Operands are references to items in constant pool // Operands are references to items in constant pool
case Constants.LDC_W: case Constants.LDC_W:
case Constants.LDC2_W: case Constants.LDC2_W:


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

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



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

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



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


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

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



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

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

*/ */
@Override @Override
public String stringifyValue() { public String stringifyValue() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(typeIdx, Constants.CONSTANT_Utf8); ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(typeIdx, Constants.CONSTANT_Utf8);
sb.append(cu8.getValue()); sb.append(cu8.getValue());
cu8 = (ConstantUtf8) cpool.getConstant(valueIdx, Constants.CONSTANT_Utf8); 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



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

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

*/ */
import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.Constants;


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


this.dimensions = dimensions + array.dimensions; this.dimensions = dimensions + array.dimensions;
basic_type = array.basic_type; basic_type = array.basic_type;
break; break;
case Constants.T_VOID: case Constants.T_VOID:
throw new ClassGenException("Invalid type: void[]"); throw new ClassGenException("Invalid type: void[]");


break; break;
} }


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



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

/** /**
* Template class for building up a field. The only extraordinary thing one can do is to add a constant value attribute to a field * 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). * (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 $ * @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> * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Field * @see Field
/** /**
* Declare a field. If it is static (isStatic() == true) and has a basic type like int or String it may have an initial value * 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(). * associated with it as defined by setInitValue().
*
*
* @param modifiers access qualifiers * @param modifiers access qualifiers
* @param type field type * @param type field type
* @param name field name * @param name field name


/** /**
* Instantiate from existing field. * Instantiate from existing field.
*
*
* @param field Field object * @param field Field object
* @param cp constant pool (must contain the same entries as the field's constant pool) * @param cp constant pool (must contain the same entries as the field's constant pool)
*/ */
String signature = type.toString(); String signature = type.toString();
String name = getName(); 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(); String value = getInitialValue();


if (value != null) { if (value != null) {

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



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


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

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



/** /**
* Class for instructions that use an index into the constant pool such as LDC, INVOKEVIRTUAL, etc. * 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 $ * @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> * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/ */


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

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

* inserted, moved, deleted, etc.. Instructions are being wrapped into <a href="InstructionHandle.html">InstructionHandles</a> * 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 * 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. * 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>. * 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 $ * @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 <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @author Abraham Nevado * @author Abraham Nevado


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


/** /**
* Initialize instruction list from byte array. * Initialize instruction list from byte array.
*
*
* @param code byte array containing the instructions * @param code byte array containing the instructions
*/ */
public InstructionList(byte[] code) { public InstructionList(byte[] code) {


/** /**
* Append another list after instruction (handle) ih contained in this list. Consumes argument list, i.e., it becomes empty. * 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 appendTo where to append the instruction list
* @param appendee Instruction list to append to this one * @param appendee Instruction list to append to this one
* @return instruction handle pointing to the <B>first</B> appended instruction * @return instruction handle pointing to the <B>first</B> appended instruction


/** /**
* Append another list after instruction i contained in this list. Consumes argument list, i.e., it becomes empty. * 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 i where to append the instruction list
* @param il Instruction list to append to this one * @param il Instruction list to append to this one
* @return instruction handle pointing to the <B>first</B> appended instruction * @return instruction handle pointing to the <B>first</B> appended instruction


/** /**
* Append another list to this one. Consumes argument list, i.e., it becomes empty. * Append another list to this one. Consumes argument list, i.e., it becomes empty.
*
*
* @param il list to append to end of this list * @param il list to append to end of this list
* @return instruction handle of the <B>first</B> appended instruction * @return instruction handle of the <B>first</B> appended instruction
*/ */


/** /**
* Append an instruction to the end of this list. * Append an instruction to the end of this list.
*
*
* @param ih instruction to append * @param ih instruction to append
*/ */
private void append(InstructionHandle ih) { private void append(InstructionHandle ih) {


/** /**
* Append an instruction to the end of this list. * Append an instruction to the end of this list.
*
*
* @param i instruction to append * @param i instruction to append
* @return instruction handle of the appended instruction * @return instruction handle of the appended instruction
*/ */


/** /**
* Append a branch instruction to the end of this list. * Append a branch instruction to the end of this list.
*
*
* @param i branch instruction to append * @param i branch instruction to append
* @return branch instruction handle of the appended instruction * @return branch instruction handle of the appended instruction
*/ */


/** /**
* Append a single instruction j after another instruction i, which must be in this list of course! * Append a single instruction j after another instruction i, which must be in this list of course!
*
*
* @param i Instruction in list * @param i Instruction in list
* @param j Instruction to append after i in list * @param j Instruction to append after i in list
* @return instruction handle of the first appended instruction * @return instruction handle of the first appended instruction


/** /**
* Append an instruction after instruction (handle) ih contained in this list. * Append an instruction after instruction (handle) ih contained in this list.
*
*
* @param ih where to append the instruction list * @param ih where to append the instruction list
* @param i Instruction to append * @param i Instruction to append
* @return instruction handle pointing to the <B>first</B> appended instruction * @return instruction handle pointing to the <B>first</B> appended instruction


/** /**
* Append an instruction after instruction (handle) ih contained in this list. * Append an instruction after instruction (handle) ih contained in this list.
*
*
* @param ih where to append the instruction list * @param ih where to append the instruction list
* @param i Instruction to append * @param i Instruction to append
* @return instruction handle pointing to the <B>first</B> appended instruction * @return instruction handle pointing to the <B>first</B> appended instruction


/** /**
* Insert another list before Instruction handle ih contained in this list. Consumes argument list, i.e., it becomes empty. * 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 i where to append the instruction list
* @param il Instruction list to insert * @param il Instruction list to insert
* @return instruction handle of the first inserted instruction * @return instruction handle of the first inserted instruction


/** /**
* Insert another list. * Insert another list.
*
*
* @param il list to insert before start of this list * @param il list to insert before start of this list
* @return instruction handle of the first inserted instruction * @return instruction handle of the first inserted instruction
*/ */


/** /**
* Insert an instruction at start of this list. * Insert an instruction at start of this list.
*
*
* @param ih instruction to insert * @param ih instruction to insert
*/ */
private void insert(InstructionHandle ih) { private void insert(InstructionHandle ih) {


/** /**
* Insert another list before Instruction i contained in this list. Consumes argument list, i.e., it becomes empty. * 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 i where to append the instruction list
* @param il Instruction list to insert * @param il Instruction list to insert
* @return instruction handle pointing to the first inserted instruction, i.e., il.getStart() * @return instruction handle pointing to the first inserted instruction, i.e., il.getStart()


/** /**
* Insert an instruction at start of this list. * Insert an instruction at start of this list.
*
*
* @param i instruction to insert * @param i instruction to insert
* @return instruction handle of the inserted instruction * @return instruction handle of the inserted instruction
*/ */


/** /**
* Insert a branch instruction at start of this list. * Insert a branch instruction at start of this list.
*
*
* @param i branch instruction to insert * @param i branch instruction to insert
* @return branch instruction handle of the appended instruction * @return branch instruction handle of the appended instruction
*/ */


/** /**
* Insert a single instruction j before another instruction i, which must be in this list of course! * Insert a single instruction j before another instruction i, which must be in this list of course!
*
*
* @param i Instruction in list * @param i Instruction in list
* @param j Instruction to insert before i in list * @param j Instruction to insert before i in list
* @return instruction handle of the first inserted instruction * @return instruction handle of the first inserted instruction


/** /**
* Insert an instruction before instruction (handle) ih contained in this list. * Insert an instruction before instruction (handle) ih contained in this list.
*
*
* @param ih where to insert to the instruction list * @param ih where to insert to the instruction list
* @param i Instruction to insert * @param i Instruction to insert
* @return instruction handle of the first inserted instruction * @return instruction handle of the first inserted instruction


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


/** /**
* Move a single instruction (handle) to a new location. * Move a single instruction (handle) to a new location.
*
*
* @param ih moved instruction * @param ih moved instruction
* @param target new location of moved instruction * @param target new location of moved instruction
*/ */


/** /**
* Remove from instruction 'prev' to instruction 'next' both contained in this list. * 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 * If careAboutLostTargeters is true then this method will throw a TargetLostException when one of the removed instruction
* handles is still being targeted. * handles is still being targeted.
*
*
* @param prev where to start deleting (predecessor, exclusive) * @param prev where to start deleting (predecessor, exclusive)
* @param next where to end deleting (successor, exclusive) * @param next where to end deleting (successor, exclusive)
*/ */
ih.getInstruction().dispose(); // e.g. BranchInstructions release their targets 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) { for (InstructionHandle ih = first; ih != null; ih = next) {
next = ih.next; next = ih.next;
length--; length--;


/** /**
* Remove instruction from this list. The corresponding Instruction handles must not be reused! * Remove instruction from this list. The corresponding Instruction handles must not be reused!
*
*
* @param ih instruction (handle) to remove * @param ih instruction (handle) to remove
*/ */
public void delete(InstructionHandle ih) throws TargetLostException { public void delete(InstructionHandle ih) throws TargetLostException {


/** /**
* Remove instruction from this list. The corresponding Instruction handles must not be reused! * Remove instruction from this list. The corresponding Instruction handles must not be reused!
*
*
* @param i instruction to remove * @param i instruction to remove
*/ */
// public void delete(Instruction i) throws TargetLostException { // public void delete(Instruction i) throws TargetLostException {
/** /**
* Remove instructions from instruction `from' to instruction `to' contained in this list. The user must ensure that `from' is * 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! * an instruction before `to', or risk havoc. The corresponding Instruction handles must not be reused!
*
*
* @param from where to start deleting (inclusive) * @param from where to start deleting (inclusive)
* @param to where to end deleting (inclusive) * @param to where to end deleting (inclusive)
*/ */
/** /**
* Remove instructions from instruction `from' to instruction `to' contained in this list. The user must ensure that `from' is * 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! * an instruction before `to', or risk havoc. The corresponding Instruction handles must not be reused!
*
*
* @param from where to start deleting (inclusive) * @param from where to start deleting (inclusive)
* @param to where to end deleting (inclusive) * @param to where to end deleting (inclusive)
*/ */


/** /**
* Search for given Instruction reference, start at beginning of list. * Search for given Instruction reference, start at beginning of list.
*
*
* @param i instruction to search for * @param i instruction to search for
* @return instruction found on success, null otherwise * @return instruction found on success, null otherwise
*/ */


/** /**
* Search for given Instruction reference, start at end of list * Search for given Instruction reference, start at end of list
*
*
* @param i instruction to search for * @param i instruction to search for
* @return instruction found on success, null otherwise * @return instruction found on success, null otherwise
*/ */


/** /**
* Give all instructions their position number (offset in byte stream), i.e., make the list ready to be dumped. * 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 * @param check Perform sanity checks, e.g. if all targeted instructions really belong to this list
*/ */
public void setPositions(boolean check) { public void setPositions(boolean check) {


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


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


/** /**
* Redirect all references from old_target to new_target, i.e., update targets of branch instructions. * 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 old_target the old target instruction handle
* @param new_target the new target instruction handle * @param new_target the new target instruction handle
*/ */


/** /**
* Redirect all references of local variables from old_target to new_target. * Redirect all references of local variables from old_target to new_target.
*
*
* @param lg array of local variables * @param lg array of local variables
* @param old_target the old target instruction handle * @param old_target the old target instruction handle
* @param new_target the new target instruction handle * @param new_target the new target instruction handle


/** /**
* Redirect all references of exception handlers from old_target to new_target. * Redirect all references of exception handlers from old_target to new_target.
*
*
* @param exceptions array of exception handlers * @param exceptions array of exception handlers
* @param old_target the old target instruction handle * @param old_target the old target instruction handle
* @param new_target the new 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



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


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


/** /**
* Dump instruction as byte code to stream out. * Dump instruction as byte code to stream out.
*
*
* @param out Output stream * @param out Output stream
*/ */
public void dump(DataOutputStream out) throws IOException { public void dump(DataOutputStream out) throws IOException {
* @return mnemonic for instruction * @return mnemonic for instruction
*/ */
public String toString(boolean verbose) { public String toString(boolean verbose) {
StringBuffer buf = new StringBuffer(super.toString(verbose));
StringBuilder buf = new StringBuilder(super.toString(verbose));


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

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

* Template class for building up a method. This is done by defining exception handlers, adding thrown exceptions, local variables * 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 * and attributes, whereas the 'LocalVariableTable' and 'LineNumberTable' attributes will be set automatically for the code. Use
* stripAttributes() if you don't like this. * 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 * 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. * 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 $ * @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="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @author <A HREF="http://www.vmeng.com/beard">Patrick C. Beard</A> [setMaxStack()] * @author <A HREF="http://www.vmeng.com/beard">Patrick C. Beard</A> [setMaxStack()]
* Declare method. If the method is non-static the constructor automatically declares a local variable `$this' in slot 0. The * 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 * 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. * 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 * 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. * however if you remove that local variable, too.
*
*
* @param access_flags access qualifiers * @param access_flags access qualifiers
* @param return_type method type * @param return_type method type
* @param arg_types argument types * @param arg_types argument types
// throw new ClassGenException("'void' is an illegal argument type for a method"); // throw new ClassGenException("'void' is an illegal argument type for a method");
// } // }
// } // }
//
//
// if(arg_names != null) { // Names for variables provided? // if(arg_names != null) { // Names for variables provided?
// if(size != arg_names.length) // if(size != arg_names.length)
// throw new ClassGenException("Mismatch in argument array lengths: " + // throw new ClassGenException("Mismatch in argument array lengths: " +


/** /**
* Instantiate from existing method. * Instantiate from existing method.
*
*
* @param m method * @param m method
* @param class_name class name containing this method * @param class_name class name containing this method
* @param cp constant pool * @param cp constant pool


/** /**
* Adds a local variable to this method and assigns an index automatically. * Adds a local variable to this method and assigns an index automatically.
*
*
* @param name variable name * @param name variable name
* @param type variable type * @param type variable type
* @param start from where the variable is valid, if this is null, it is valid from the start * @param start from where the variable is valid, if this is null, it is valid from the start
/* /*
* 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 * 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. * list.
*
*
* @return array of declared local variables sorted by index * @return array of declared local variables sorted by index
*/ */
public LocalVariableGen[] getLocalVariables() { public LocalVariableGen[] getLocalVariables() {


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


/** /**
* Add an exception possibly thrown by this method. * Add an exception possibly thrown by this method.
*
*
* @param class_name (fully qualified) name of exception * @param class_name (fully qualified) name of exception
*/ */
public void addException(String class_name) { public void addException(String class_name) {
* Add an attribute to the code. Currently, the JVM knows about the LineNumberTable, LocalVariableTable and StackMap attributes, * 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 * 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. * ignored by the JVM but do no harm.
*
*
* @param a attribute to be added * @param a attribute to be added
*/ */
public void addCodeAttribute(Attribute a) { public void addCodeAttribute(Attribute a) {
/** /**
* Get method object. Never forget to call setMaxStack() or setMaxStack(max), respectively, before calling this method (the same * Get method object. Never forget to call setMaxStack() or setMaxStack(max), respectively, before calling this method (the same
* applies for max locals). * applies for max locals).
*
*
* @return method object * @return method object
*/ */
public Method getMethod() { public Method getMethod() {
public void setMaxLocals() { public void setMaxLocals() {
setMaxLocals(false); setMaxLocals(false);
} }
/** /**
* Compute maximum number of local variables. * Compute maximum number of local variables.
*
*
* @param respectLocalVariableTable if true and the local variable table indicates more are in use * @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. * than the code suggests, respect the higher value from the local variable table data.
*/ */


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


/** /**
* Return string representation close to declaration format, `public static void main(String[]) throws IOException', e.g. * Return string representation close to declaration format, `public static void main(String[]) throws IOException', e.g.
*
*
* @return String representation of the method. * @return String representation of the method.
*/ */
@Override @Override


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


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


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

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



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


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

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

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


/** /**
* Convert signature to a Type object. * Convert signature to a Type object.
*
*
* @param signature signature string such as Ljava/lang/String; * @param signature signature string such as Ljava/lang/String;
* @return type object * @return type object
*/ */


/** /**
* Convert return value of a method (signature) to a Type object. * Convert return value of a method (signature) to a Type object.
*
*
* @param signature signature string such as (Ljava/lang/String;)V * @param signature signature string such as (Ljava/lang/String;)V
* @return return type * @return return type
*/ */


/** /**
* Convert arguments of a method (signature) to an array of Type objects. * Convert arguments of a method (signature) to an array of Type objects.
*
*
* @param signature signature string such as (Ljava/lang/String;)V * @param signature signature string such as (Ljava/lang/String;)V
* @return array of argument types * @return array of argument types
*/ */


/** /**
* Convert runtime java.lang.Class to BCEL Type object. * Convert runtime java.lang.Class to BCEL Type object.
*
*
* @param cl Java class * @param cl Java class
* @return corresponding Type object * @return corresponding Type object
*/ */
} }


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


for (Class param : params) { for (Class param : params) {
} }


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


for (Class<?> param : params) { for (Class<?> param : params) {

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



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

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

list.add(ext_dir.toString() + File.separatorChar + extension); list.add(ext_dir.toString() + File.separatorChar + extension);
} }


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


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

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

} }


protected String dumpAnnotations(AnnotationGen[] as) { protected String dumpAnnotations(AnnotationGen[] as) {
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
result.append("["); result.append("[");
for (int i = 0; i < as.length; i++) { for (int i = 0; i < as.length; i++) {
AnnotationGen annotation = as[i]; AnnotationGen annotation = as[i];
} }


protected String dumpAnnotations(List<AnnotationGen> as) { protected String dumpAnnotations(List<AnnotationGen> as) {
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
result.append("["); result.append("[");
for (int i = 0; i < as.size(); i++) { for (int i = 0; i < as.size(); i++) {
AnnotationGen annotation = as.get(i); AnnotationGen annotation = as.get(i);
} }


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

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

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


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


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

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

if (null == loc) { if (null == loc) {
return "((ISourceLocation) null)"; return "((ISourceLocation) null)";
} }
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();


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

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



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

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

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

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

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


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

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

ex.fillInStackTrace(); ex.fillInStackTrace();
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
ex.printStackTrace(new PrintWriter(sw)); ex.printStackTrace(new PrintWriter(sw));
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(CompilationAndWeavingContext.getCurrentContext()); sb.append(CompilationAndWeavingContext.getCurrentContext());
sb.append(sw.toString()); sb.append(sw.toString());
IMessage pinpointedMessage = new PinpointedMessage(message,sb.toString()); IMessage pinpointedMessage = new PinpointedMessage(message,sb.toString());

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



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

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

public static String stringFromStream(InputStream stream) throws IOException { public static String stringFromStream(InputStream stream) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(stream, "US-ASCII")); BufferedReader reader = new BufferedReader(new InputStreamReader(stream, "US-ASCII"));


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


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

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



protected void writeContents(ZipOutputStream zOut) throws IOException { protected void writeContents(ZipOutputStream zOut) throws IOException {
// write to a StringBuffer // write to a StringBuffer
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
buf.append(contentsBytes); buf.append(contentsBytes);
buf.append(NEWLINE); buf.append(NEWLINE);
for (String name : contentsNames) { for (String name : contentsNames) {


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

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

target.setName(resultTargetName); target.setName(resultTargetName);


Result[] reqs = result.getRequired(); Result[] reqs = result.getRequired();
StringBuffer depends = new StringBuffer();
StringBuilder depends = new StringBuilder();
boolean first = true; boolean first = true;
for (Result reqResult : reqs) { for (Result reqResult : reqs) {
if (!first) { if (!first) {
} catch (BuildException e) { } catch (BuildException e) {
throw e; throw e;
} catch (Throwable t) { } catch (Throwable t) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("classpath="); sb.append("classpath=");
sb.append(url); sb.append(url);
throw new BuildException(sb.toString(), t); throw new BuildException(sb.toString(), t);

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



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

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

String stripTags(String input, final String SOURCE, String stripTags(String input, final String SOURCE,
final String START, final String END) { final String START, final String END) {
if (null == input) return input; if (null == input) return input;
StringBuffer buffer = new StringBuffer(input.length());
StringBuilder buffer = new StringBuilder(input.length());
String result = input; String result = input;
int curLoc = 0; int curLoc = 0;
while (true) { while (true) {

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

// copy binaries (but not module flag files) // copy binaries (but not module flag files)
String excludes = null; String excludes = null;
{ {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
for (ProductModule productModule : productModules) { for (ProductModule productModule : productModules) {
if (0 < buf.length()) { if (0 < buf.length()) {
buf.append(","); buf.append(",");

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

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

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

Reader reader = null; Reader reader = null;
try { try {
String author = null; String author = null;
StringBuffer sampleCode = new StringBuffer();
StringBuilder sampleCode = new StringBuilder();
String anchorName = null; String anchorName = null;
String anchorTitle = null; String anchorTitle = null;
ArrayList<String> flags = new ArrayList<>(); ArrayList<String> flags = new ArrayList<>();
} }
} }
// build up prefix // build up prefix
StringBuffer branchAnchor = new StringBuffer();
StringBuilder branchAnchor = new StringBuilder();
for (int i = 0; i < firstDiff;) { for (int i = 0; i < firstDiff;) {
branchAnchor.append(parts[i]); branchAnchor.append(parts[i]);
i++; i++;
if (from.length != to.length) { if (from.length != to.length) {
throw new IllegalArgumentException("unmatched from/to"); throw new IllegalArgumentException("unmatched from/to");
} }
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
int LEN = source.length(); int LEN = source.length();
int start = 0; int start = 0;
for (int i = 0; i < LEN; i++) { for (int i = 0; i < LEN; i++) {

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

} }


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

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

if (!Util.delete(file)) { if (!Util.delete(file)) {
File[] list = file.listFiles(); File[] list = file.listFiles();
if (!Util.isEmpty(list)) { if (!Util.isEmpty(list)) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("warning: BuildModuleTest unable to delete "); sb.append("warning: BuildModuleTest unable to delete ");
sb.append(file.toString()); sb.append(file.toString());
sb.append("\n"); // XXX platform sb.append("\n"); // XXX platform

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

} }
} }
if (!badModules.isEmpty()) { if (!badModules.isEmpty()) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
for (Module module: badModules) { for (Module module: badModules) {
System.err.println(module.toLongString()); System.err.println(module.toLongString());
sb.append("\n"); sb.append("\n");

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

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

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

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

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

} else if (arg.equals("-bootclasspath")) { } else if (arg.equals("-bootclasspath")) {
if (args.size() > nextArgIndex) { if (args.size() > nextArgIndex) {
String bcpArg = args.get(nextArgIndex).getValue(); String bcpArg = args.get(nextArgIndex).getValue();
StringBuffer bcp = new StringBuffer();
StringBuilder bcp = new StringBuilder();
StringTokenizer strTok = new StringTokenizer(bcpArg, File.pathSeparator); StringTokenizer strTok = new StringTokenizer(bcpArg, File.pathSeparator);
while (strTok.hasMoreTokens()) { while (strTok.hasMoreTokens()) {
bcp.append(makeFile(strTok.nextToken())); bcp.append(makeFile(strTok.nextToken()));
} else if (arg.equals("-classpath") || arg.equals("-cp")) { } else if (arg.equals("-classpath") || arg.equals("-cp")) {
if (args.size() > nextArgIndex) { if (args.size() > nextArgIndex) {
String cpArg = args.get(nextArgIndex).getValue(); String cpArg = args.get(nextArgIndex).getValue();
StringBuffer cp = new StringBuffer();
StringBuilder cp = new StringBuilder();
StringTokenizer strTok = new StringTokenizer(cpArg, File.pathSeparator); StringTokenizer strTok = new StringTokenizer(cpArg, File.pathSeparator);
while (strTok.hasMoreTokens()) { while (strTok.hasMoreTokens()) {
cp.append(makeFile(strTok.nextToken())); cp.append(makeFile(strTok.nextToken()));
} else if (arg.equals("-extdirs")) { } else if (arg.equals("-extdirs")) {
if (args.size() > nextArgIndex) { if (args.size() > nextArgIndex) {
String extdirsArg = args.get(nextArgIndex).getValue(); String extdirsArg = args.get(nextArgIndex).getValue();
StringBuffer ed = new StringBuffer();
StringBuilder ed = new StringBuilder();
StringTokenizer strTok = new StringTokenizer(extdirsArg, File.pathSeparator); StringTokenizer strTok = new StringTokenizer(extdirsArg, File.pathSeparator);
while (strTok.hasMoreTokens()) { while (strTok.hasMoreTokens()) {
ed.append(makeFile(strTok.nextToken())); ed.append(makeFile(strTok.nextToken()));

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

pipelineOutput = new Hashtable(); pipelineOutput = new Hashtable();
} }
pipelineOutput.put("filesContainingAspects", Integer.toString(toWaitFor)); pipelineOutput.put("filesContainingAspects", Integer.toString(toWaitFor));
StringBuffer order = new StringBuffer();
StringBuilder order = new StringBuilder();
order.append("["); order.append("[");
for (int i = 0; i < units.length; i++) { for (int i = 0; i < units.length; i++) {
if (i != 0) { if (i != 0) {

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

AjClassFile ajcf = new AjClassFile(key, result.getBytes()); AjClassFile ajcf = new AjClassFile(key, result.getBytes());
lastReturnedResult.result().record(ajcf.fileName(), ajcf); lastReturnedResult.result().record(ajcf.fileName(), ajcf);
if (!weaverMessageHandler.isIgnoring(IMessage.INFO) || progressListener != null) { 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()) msg.append(progressPhasePrefix).append(result.getClassName()).append(" (from ").append(nowProcessing.fileName())
.append(")"); .append(")");
weaverMessageHandler.handleMessage(MessageUtil.info(msg.toString())); weaverMessageHandler.handleMessage(MessageUtil.info(msg.toString()));

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

usedBinarySourceFileName); usedBinarySourceFileName);
problem.setSeeAlsoProblems(seeAlso); problem.setSeeAlsoProblems(seeAlso);


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

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

} }


private String buildArgNameRepresentation() { private String buildArgNameRepresentation() {
StringBuffer args = new StringBuffer();
StringBuilder args = new StringBuilder();
int numArgsWeCareAbout = getDeclaredParameterCount(); int numArgsWeCareAbout = getDeclaredParameterCount();
if (this.arguments != null) { if (this.arguments != null) {
for (int i = 0; i < numArgsWeCareAbout; i++) { 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

DeclareParents dp = (DeclareParents) declareDecl; DeclareParents dp = (DeclareParents) declareDecl;
String childPattern = dp.getChild().toString(); String childPattern = dp.getChild().toString();
Collection parentPatterns = dp.getParents().getExactTypes(); Collection parentPatterns = dp.getParents().getExactTypes();
StringBuffer parents = new StringBuffer();
StringBuilder parents = new StringBuilder();
for (Iterator iter = parentPatterns.iterator(); iter.hasNext();) { for (Iterator iter = parentPatterns.iterator(); iter.hasNext();) {
UnresolvedType urt = ((UnresolvedType) iter.next()); UnresolvedType urt = ((UnresolvedType) iter.next());
parents.append(urt.getName()); parents.append(urt.getName());
super.postParse(typeDec); super.postParse(typeDec);
int declareSequenceNumberInType = ((AspectDeclaration) typeDec).declareCounter++; int declareSequenceNumberInType = ((AspectDeclaration) typeDec).declareCounter++;
// FIXME asc the name should perhaps include the hashcode of the pattern (type/sig) for binary compatibility reasons! // 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"); sb.append("ajc$declare");
// Declares can choose to provide a piece of the name - to enable // 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) // 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





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

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

} }


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

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

} }


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

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

if ((bits & TagBits.AnnotationForType) != 0) { if ((bits & TagBits.AnnotationForType) != 0) {
s.add("TYPE"); s.add("TYPE");
} }
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("{"); sb.append("{");
for (Iterator<String> iter = s.iterator(); iter.hasNext();) { for (Iterator<String> iter = s.iterator(); iter.hasNext();) {
String element = iter.next(); String element = iter.next();

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

QualifiedNameReference qnr = (QualifiedNameReference) e; QualifiedNameReference qnr = (QualifiedNameReference) e;
if (qnr.binding instanceof FieldBinding) { if (qnr.binding instanceof FieldBinding) {
FieldBinding fb = (FieldBinding) qnr.binding; FieldBinding fb = (FieldBinding) qnr.binding;
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(fb.declaringClass.signature()); sb.append(fb.declaringClass.signature());
sb.append(fb.name); sb.append(fb.name);
return sb.toString(); return sb.toString();

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



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


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

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

} }


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


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


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

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

} }


private String typesAsString(boolean isVarargs, TypeBinding[] types, boolean makeShort) { 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++) { for (int i = 0, length = types.length; i < length; i++) {
if (i != 0) if (i != 0)
buffer.append(", "); //$NON-NLS-1$ buffer.append(", "); //$NON-NLS-1$
ex.fillInStackTrace(); ex.fillInStackTrace();
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
ex.printStackTrace(new PrintWriter(sw)); ex.printStackTrace(new PrintWriter(sw));
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(CompilationAndWeavingContext.getCurrentContext()); sb.append(CompilationAndWeavingContext.getCurrentContext());
sb.append(sw.toString()); sb.append(sw.toString());
problem = new PinpointedProblem(problem, sb.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



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

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

if (buildConfig == null || buildConfig.getFullClasspath() == null) { if (buildConfig == null || buildConfig.getFullClasspath() == null) {
return ""; return "";
} }
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
boolean first = true; boolean first = true;
for (String s : buildConfig.getFullClasspath()) { for (String s : buildConfig.getFullClasspath()) {
if (first) { if (first) {


@Override @Override
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
buf.append("AjBuildManager("); buf.append("AjBuildManager(");
buf.append(")"); buf.append(")");
return buf.toString(); return buf.toString();


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

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



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



@Override @Override
public String toString() { 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? // 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(")"); sb.append("AjState(").append((buildConfig == null ? "NULLCONFIG" : buildConfig.getConfigFile().toString())).append(")");
return sb.toString(); return sb.toString();
// } // }


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

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

node.setCorrespondingType(ad.returnType.toString()); // returnTypeToString(0)); node.setCorrespondingType(ad.returnType.toString()); // returnTypeToString(0));
} }


StringBuffer details = new StringBuffer();
StringBuilder details = new StringBuilder();
if (ad.pointcutDesignator != null) { if (ad.pointcutDesignator != null) {
details.append(AsmRelationshipUtils.genPointcutDetails(ad.pointcutDesignator.getPointcut())); details.append(AsmRelationshipUtils.genPointcutDetails(ad.pointcutDesignator.getPointcut()));
} else { } else {
node.setName(name + AsmRelationshipUtils.DECLARE_PARENTS); node.setName(name + AsmRelationshipUtils.DECLARE_PARENTS);


String kindOfDP = null; String kindOfDP = null;
StringBuffer details = new StringBuffer("");
StringBuilder details = new StringBuilder("");
TypePattern[] newParents = dp.getParents().getTypePatterns(); TypePattern[] newParents = dp.getParents().getTypePatterns();
for (int i = 0; i < newParents.length; i++) { for (int i = 0; i < newParents.length; i++) {
TypePattern tp = newParents[i]; TypePattern tp = newParents[i];
} }


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

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

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

* @see java.lang.Object#toString() * @see java.lang.Object#toString()
*/ */
public String toString() { public String toString() {
StringBuffer buf = new StringBuffer("EclipseClassPathManager: ");
StringBuilder buf = new StringBuilder("EclipseClassPathManager: ");
buf.append(nameEnv.toString()); buf.append(nameEnv.toString());
return buf.toString(); return buf.toString();
} }

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

} }


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

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

public static String render(IMessage message) { public static String render(IMessage message) {
// IMessage.Kind kind = message.getKind(); // IMessage.Kind kind = message.getKind();


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

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



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


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


classfile.append("// Auto-generated" + NL); classfile.append("// Auto-generated" + NL);
classfile.append("package " + OUTPUT_PACKAGE + ";" + NL + NL); classfile.append("package " + OUTPUT_PACKAGE + ";" + NL + NL);
} }


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


try { try {
testFiles.append("// Auto generated" + NL); testFiles.append("// Auto generated" + NL);
System.exit(-1); System.exit(-1);
} }


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


try { try {
testFiles.append("// Auto generated" + NL); testFiles.append("// Auto generated" + NL);
} }
} }


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


for(int i = 0; i < NUMCLASSES; i++) for(int i = 0; i < NUMCLASSES; i++)
buildList.append("C" + i + ".java" + NL); buildList.append("C" + i + ".java" + NL);


private static void createAllAspects(String adviceType, int pointcut) { 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. // 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"; 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

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

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

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




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

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

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

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

* {@inheritDoc} * {@inheritDoc}
*/ */
public final String getValidTargets() { public final String getValidTargets() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("{"); sb.append("{");
for (Iterator<String> iter = supportedTargets.iterator(); iter.hasNext();) { for (Iterator<String> iter = supportedTargets.iterator(); iter.hasNext();) {
String evalue = iter.next(); String evalue = iter.next();

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



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

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

} else { } else {
args = new UnresolvedType[] { fieldDeclaringType }; args = new UnresolvedType[] { fieldDeclaringType };
} }
StringBuffer name = new StringBuffer("ajc$get$");
StringBuilder name = new StringBuilder("ajc$get$");
name.append(field.getName()); name.append(field.getName());
return new ResolvedMemberImpl(Member.METHOD, fieldDeclaringType, PUBLIC_STATIC, field.getReturnType(), name.toString(), return new ResolvedMemberImpl(Member.METHOD, fieldDeclaringType, PUBLIC_STATIC, field.getReturnType(), name.toString(),
args); args);
} else { } else {
args = new UnresolvedType[] { fieldDeclaringType, field.getType() }; args = new UnresolvedType[] { fieldDeclaringType, field.getType() };
} }
StringBuffer name = new StringBuffer("ajc$set$");
StringBuilder name = new StringBuilder("ajc$set$");
name.append(field.getName()); name.append(field.getName());
return new ResolvedMemberImpl(Member.METHOD, fieldDeclaringType, PUBLIC_STATIC, UnresolvedType.VOID, name.toString(), return new ResolvedMemberImpl(Member.METHOD, fieldDeclaringType, PUBLIC_STATIC, UnresolvedType.VOID, name.toString(),
args); 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