private List declareSofts = new ArrayList(0);
private List declareDominates = new ArrayList(4);
+ // These are like declare parents type mungers
+ private List declareAnnotationsOnType = new ArrayList();
+ private List declareAnnotationsOnField = new ArrayList();
+ private List declareAnnotationsOnMethods = new ArrayList(); // includes ctors
public CrosscuttingMembers(ResolvedTypeX inAspect) {
this.inAspect = inAspect;
declareSofts.add(new DeclareSoft(d.getException(), concretePointcut));
addConcreteShadowMunger(m);
} else if (declare instanceof DeclareAnnotation) {
- System.err.println("Need to implement CrosscuttingMembers.addDeclare for annotations");
+ // FIXME asc perf Possible Improvement. Investigate why this is called twice in a weave ?
+ DeclareAnnotation da = (DeclareAnnotation)declare;
+ da.setAspect(this.inAspect);
+ if (da.isDeclareAtType()) {
+ declareAnnotationsOnType.add(da);
+ } else if (da.isDeclareAtField()) {
+ declareAnnotationsOnField.add(da);
+ } else if (da.isDeclareAtMethod() || da.isDeclareAtConstuctor()) {
+ declareAnnotationsOnMethods.add(da);
+ }
} else {
throw new RuntimeException("unimplemented");
}
declareSofts = other.declareSofts;
}
+ // DECAT for when attempting to replace an aspect
+ if (!declareAnnotationsOnType.equals(other.declareAnnotationsOnType)) {
+ changed = true;
+ declareAnnotationsOnType = other.declareAnnotationsOnType;
+ }
+
+ if (!declareAnnotationsOnField.equals(other.declareAnnotationsOnField)) {
+ changed = true;
+ declareAnnotationsOnField = other.declareAnnotationsOnField;
+ }
+
+ if (!declareAnnotationsOnMethods.equals(other.declareAnnotationsOnMethods)) {
+ changed = true;
+ declareAnnotationsOnMethods = other.declareAnnotationsOnMethods;
+ }
+
return changed;
}
public List getTypeMungers() {
return typeMungers;
}
+
+ public List getDeclareAnnotationOnTypes() {
+ return declareAnnotationsOnType;
+ }
+
+ public List getDeclareAnnotationOnFields() {
+ return declareAnnotationsOnField;
+ }
+
+ /**
+ * includes declare @method and @constructor
+ */
+ public List getDeclareAnnotationOnMethods() {
+ return declareAnnotationsOnMethods;
+ }
}
private List typeMungers = null;
private List declareSofts = null;
private List declareParents = null;
+ private List declareAnnotationOnTypes = null;
+ private List declareAnnotationOnFields = null;
+ private List declareAnnotationOnMethods= null; // includes ctors
private List declareDominates = null;
public CrosscuttingMembersSet(World world) {
return declareParents;
}
+ // DECAT Merge multiple together
+ public List getDeclareAnnotationOnTypes() {
+ if (declareAnnotationOnTypes == null) {
+ ArrayList ret = new ArrayList();
+ for (Iterator i = members.values().iterator(); i.hasNext(); ) {
+ ret.addAll(((CrosscuttingMembers)i.next()).getDeclareAnnotationOnTypes());
+ }
+ declareAnnotationOnTypes = ret;
+ }
+ return declareAnnotationOnTypes;
+ }
+
+ public List getDeclareAnnotationOnFields() {
+ if (declareAnnotationOnFields == null) {
+ ArrayList ret = new ArrayList();
+ for (Iterator i = members.values().iterator(); i.hasNext(); ) {
+ ret.addAll(((CrosscuttingMembers)i.next()).getDeclareAnnotationOnFields());
+ }
+ declareAnnotationOnFields = ret;
+ }
+ return declareAnnotationOnFields;
+ }
+
+ /**
+ * Return an amalgamation of the declare @method/@constructor statements.
+ */
+ public List getDeclareAnnotationOnMethods() {
+ if (declareAnnotationOnMethods == null) {
+ ArrayList ret = new ArrayList();
+ for (Iterator i = members.values().iterator(); i.hasNext(); ) {
+ ret.addAll(((CrosscuttingMembers)i.next()).getDeclareAnnotationOnMethods());
+ }
+ declareAnnotationOnMethods = ret;
+ }
+ return declareAnnotationOnMethods;
+ }
+
public List getDeclareDominates() {
if (declareDominates == null) {
ArrayList ret = new ArrayList();
public List getDeclareParents() {
return crosscuttingMembersSet.getDeclareParents();
}
+
+ public List getDeclareAnnotationOnTypes() {
+ return crosscuttingMembersSet.getDeclareAnnotationOnTypes();
+ }
+
+ public List getDeclareAnnotationOnFields() {
+ return crosscuttingMembersSet.getDeclareAnnotationOnFields();
+ }
+
+ public List getDeclareAnnotationOnMethods() {
+ return crosscuttingMembersSet.getDeclareAnnotationOnMethods();
+ }
public List getDeclareSoft() {
return crosscuttingMembersSet.getDeclareSofts();