diff options
author | acolyer <acolyer> | 2005-08-11 14:57:28 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-08-11 14:57:28 +0000 |
commit | 3d2da2a1ae1bb15072b48c8e49e857fd47ba56a6 (patch) | |
tree | dda4ec21674bdae032f89c01e44b0e8b70a1de8a | |
parent | 96817d501c231a90f813add999a2a24fcc8780a1 (diff) | |
download | aspectj-3d2da2a1ae1bb15072b48c8e49e857fd47ba56a6.tar.gz aspectj-3d2da2a1ae1bb15072b48c8e49e857fd47ba56a6.zip |
fixed completely broken implementation of findAspectDeclaringParents and made sure that no declares can end up in the list of declares known to the world twice (this needed because declares are now added from concrete aspects so two concrete sub-aspects of the same abstract aspect will both pick up the same super declare)
-rw-r--r-- | weaver/src/org/aspectj/weaver/CrosscuttingMembersSet.java | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/weaver/src/org/aspectj/weaver/CrosscuttingMembersSet.java b/weaver/src/org/aspectj/weaver/CrosscuttingMembersSet.java index 4ca7ff8ab..33319a80a 100644 --- a/weaver/src/org/aspectj/weaver/CrosscuttingMembersSet.java +++ b/weaver/src/org/aspectj/weaver/CrosscuttingMembersSet.java @@ -135,22 +135,24 @@ public class CrosscuttingMembersSet { public List getDeclareSofts() { if (declareSofts == null) { - ArrayList ret = new ArrayList(); + Set ret = new HashSet(); for (Iterator i = members.values().iterator(); i.hasNext(); ) { ret.addAll(((CrosscuttingMembers)i.next()).getDeclareSofts()); } - declareSofts = ret; + declareSofts = new ArrayList(); + declareSofts.addAll(ret); } return declareSofts; } public List getDeclareParents() { if (declareParents == null) { - ArrayList ret = new ArrayList(); + Set ret = new HashSet(); for (Iterator i = members.values().iterator(); i.hasNext(); ) { ret.addAll(((CrosscuttingMembers)i.next()).getDeclareParents()); } - declareParents = ret; + declareParents = new ArrayList(); + declareParents.addAll(ret); } return declareParents; } @@ -158,22 +160,24 @@ public class CrosscuttingMembersSet { // DECAT Merge multiple together public List getDeclareAnnotationOnTypes() { if (declareAnnotationOnTypes == null) { - ArrayList ret = new ArrayList(); + Set ret = new HashSet(); for (Iterator i = members.values().iterator(); i.hasNext(); ) { ret.addAll(((CrosscuttingMembers)i.next()).getDeclareAnnotationOnTypes()); } - declareAnnotationOnTypes = ret; + declareAnnotationOnTypes = new ArrayList(); + declareAnnotationOnTypes.addAll(ret); } return declareAnnotationOnTypes; } public List getDeclareAnnotationOnFields() { if (declareAnnotationOnFields == null) { - ArrayList ret = new ArrayList(); + Set ret = new HashSet(); for (Iterator i = members.values().iterator(); i.hasNext(); ) { ret.addAll(((CrosscuttingMembers)i.next()).getDeclareAnnotationOnFields()); } - declareAnnotationOnFields = ret; + declareAnnotationOnFields = new ArrayList(); + declareAnnotationOnFields.addAll(ret); } return declareAnnotationOnFields; } @@ -183,11 +187,12 @@ public class CrosscuttingMembersSet { */ public List getDeclareAnnotationOnMethods() { if (declareAnnotationOnMethods == null) { - ArrayList ret = new ArrayList(); + Set ret = new HashSet(); for (Iterator i = members.values().iterator(); i.hasNext(); ) { ret.addAll(((CrosscuttingMembers)i.next()).getDeclareAnnotationOnMethods()); } - declareAnnotationOnMethods = ret; + declareAnnotationOnMethods = new ArrayList(); + declareAnnotationOnMethods.addAll(ret); } return declareAnnotationOnMethods; } @@ -205,13 +210,12 @@ public class CrosscuttingMembersSet { public ResolvedType findAspectDeclaringParents(DeclareParents p) { - Set result = new HashSet(); Set keys = this.members.keySet(); for (Iterator iter = keys.iterator(); iter.hasNext();) { ResolvedType element = (ResolvedType) iter.next(); for (Iterator i = ((CrosscuttingMembers)members.get(element)).getDeclareParents().iterator(); i.hasNext(); ) { DeclareParents dp = (DeclareParents)i.next(); - return element; + if (dp.equals(p)) return element; } } return null; |