aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoraclement <aclement>2006-02-22 15:01:47 +0000
committeraclement <aclement>2006-02-22 15:01:47 +0000
commit3099912b8a003eb5a32f25fe23d72094b0469abd (patch)
tree1d465e584935b458f2e5a0c06113349cc978c737 /org.aspectj.ajdt.core
parentfa70cf3ef1caaf4711be2337447004dd5b70dbc7 (diff)
downloadaspectj-3099912b8a003eb5a32f25fe23d72094b0469abd.tar.gz
aspectj-3099912b8a003eb5a32f25fe23d72094b0469abd.zip
optimization: less ArrayList garbage creation!
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjMethodDeclaration.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjMethodDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjMethodDeclaration.java
index 21e009f67..10b4d042c 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjMethodDeclaration.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjMethodDeclaration.java
@@ -13,10 +13,10 @@ package org.aspectj.ajdt.internal.compiler.ast;
import java.util.ArrayList;
import java.util.List;
-import org.aspectj.weaver.AjAttribute;
import org.aspectj.org.eclipse.jdt.internal.compiler.ClassFile;
import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
+import org.aspectj.weaver.AjAttribute;
/**
* Root class for all MethodDeclaration objects created by the parser.
@@ -26,7 +26,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
*/
public class AjMethodDeclaration extends MethodDeclaration {
- private List attributes = new ArrayList();
+ private List attributes = null;
/**
* @param compilationResult
@@ -38,6 +38,7 @@ public class AjMethodDeclaration extends MethodDeclaration {
// general purpose hook to add an AjAttribute to this method
// used by @AspectJ visitor to add pointcut attribute to @Advice
protected void addAttribute(EclipseAttributeAdapter eaa) {
+ if (attributes==null) attributes = new ArrayList();
attributes.add(eaa);
}
@@ -46,7 +47,7 @@ public class AjMethodDeclaration extends MethodDeclaration {
*/
protected int generateInfoAttributes(ClassFile classFile,boolean addAjSynthetic) {
// add extra attributes into list then call 2-arg version of generateInfoAttributes...
- List extras = attributes;
+ List extras = (attributes==null?new ArrayList():attributes);
addDeclarationStartLineAttribute(extras,classFile);
if (addAjSynthetic) {
extras.add(new EclipseAttributeAdapter(new AjAttribute.AjSynthetic()));