aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoraclement <aclement>2005-03-10 17:24:08 +0000
committeraclement <aclement>2005-03-10 17:24:08 +0000
commit7ea7e3091003ec5c500671d1038c761bda752b45 (patch)
tree671084509d5892c3da20b5bb1614556b02e47a61 /org.aspectj.ajdt.core
parent6c05b25f69b1478b1336744ab69b3f2659d4ea68 (diff)
downloadaspectj-7ea7e3091003ec5c500671d1038c761bda752b45.tar.gz
aspectj-7ea7e3091003ec5c500671d1038c761bda752b45.zip
Declare annotation: changed to allow a more meaningful name for the generated method.
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java32
1 files changed, 27 insertions, 5 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java
index 8796a3409..99b67c713 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java
@@ -16,16 +16,18 @@ package org.aspectj.ajdt.internal.compiler.ast;
//import java.util.List;
import org.aspectj.ajdt.internal.compiler.lookup.EclipseScope;
-import org.aspectj.weaver.AjAttribute;
-import org.aspectj.weaver.patterns.Declare;
-import org.aspectj.weaver.patterns.FormalBinding;
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.*;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope;
import org.aspectj.org.eclipse.jdt.internal.compiler.parser.Parser;
+import org.aspectj.weaver.AjAttribute;
+import org.aspectj.weaver.patterns.Declare;
+import org.aspectj.weaver.patterns.FormalBinding;
public class DeclareDeclaration extends AjMethodDeclaration {
+
public Declare declareDecl;
/**
@@ -43,7 +45,19 @@ public class DeclareDeclaration extends AjMethodDeclaration {
}
//??? we might need to set parameters to be empty
this.returnType = TypeReference.baseTypeReference(T_void, 0);
- this.selector = ("ajc$declare_"+counter++).toCharArray(); //??? performance
+
+ StringBuffer sb = new StringBuffer();
+ sb.append("ajc$declare");
+ // Declares can choose to provide a piece of the name - to enable
+ // them to be easily distinguised at weave time (e.g. see declare annotation)
+ String suffix = symbolicDeclare.getNameSuffix();
+ if (suffix.length()!=0) {
+ sb.append("_");
+ sb.append(suffix);
+ }
+ sb.append("_");
+ sb.append(counter++);
+ this.selector = sb.toString().toCharArray();
}
@@ -107,5 +121,13 @@ public class DeclareDeclaration extends AjMethodDeclaration {
}
return output;
}
+
+ /**
+ * We need the ajc$declare method that is created to represent this declare to
+ * be marked as synthetic
+ */
+ protected int generateInfoAttributes(ClassFile classFile) {
+ return super.generateInfoAttributes(classFile,true);
+ }
}