import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.flow.FlowInfo;
import org.aspectj.org.eclipse.jdt.internal.compiler.flow.InitializationFlowContext;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope;
addAnnotation(annotation);
if (symbolicDeclare==null) return; // there is an error that will already be getting reported (e.g. incorrect pattern on decaf/decac)
symbolicDeclare.setAnnotationString(annotation.toString());
- symbolicDeclare.setAnnotationMethod(new String(selector));
+
}
public void analyseCode(ClassScope classScope,
}
this.annotations[0] = ann;
}
+
+ public void postParse(TypeDeclaration typeDec) {
+ super.postParse(typeDec);
+ ((DeclareAnnotation)declareDecl).setAnnotationMethod(new String(selector));
+ }
}
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.CompilationUnitDeclaration;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
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;
/**
* Constructor for IntraTypeDeclaration.
*/
- static int counter = 0; //XXX evil
public DeclareDeclaration(CompilationResult result, Declare symbolicDeclare) {
super(result);
+
this.declareDecl = symbolicDeclare;
if (declareDecl != null) {
// AMC added init of declarationSourceXXX fields which are used
declarationSourceEnd = sourceEnd = declareDecl.getEnd();
}
//??? we might need to set parameters to be empty
- this.returnType = TypeReference.baseTypeReference(T_void, 0);
-
- 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)
- if (symbolicDeclare!=null) {
- String suffix = symbolicDeclare.getNameSuffix();
- if (suffix.length()!=0) {
- sb.append("_");
- sb.append(suffix);
- }
- }
- sb.append("_");
- sb.append(counter++);
- this.selector = sb.toString().toCharArray();
+ this.returnType = TypeReference.baseTypeReference(T_void, 0);
}
return super.generateInfoAttributes(classFile,true);
}
+ public void postParse(TypeDeclaration typeDec) {
+ super.postParse(typeDec);
+ int declareSequenceNumberInType = ((AspectDeclaration)typeDec).declareCounter++;
+ //FIXME asc the name should perhaps include the hashcode of the pattern (type/sig) for binary compatibility reasons!
+ StringBuffer sb = new StringBuffer();
+ 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)
+ if (declareDecl!=null) {
+ String suffix = declareDecl.getNameSuffix();
+ if (suffix.length()!=0) {
+ sb.append("_");
+ sb.append(suffix);
+ }
+ }
+ sb.append("_");
+ sb.append(declareSequenceNumberInType);
+ this.selector = sb.toString().toCharArray();
+ }
}