diff options
author | Andy Clement <andrew.clement@gmail.com> | 2013-06-13 12:29:45 -0700 |
---|---|---|
committer | Andy Clement <andrew.clement@gmail.com> | 2013-06-13 12:29:45 -0700 |
commit | 5b0b6b07d2b581cddd1bac4a2a6b12cd4ac02b07 (patch) | |
tree | d70190d982a521f6392c71946c7a92e466e81b93 /org.aspectj.matcher | |
parent | 31d8e259e5cd8b1b4810d69bbf4b9ea45ae4a4c8 (diff) | |
download | aspectj-5b0b6b07d2b581cddd1bac4a2a6b12cd4ac02b07.tar.gz aspectj-5b0b6b07d2b581cddd1bac4a2a6b12cd4ac02b07.zip |
Preserve ordering of declare annotation when removing and adding annotations
Issue: 407739
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r-- | org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java | 7 | ||||
-rw-r--r-- | org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembersSet.java | 16 |
2 files changed, 15 insertions, 8 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java b/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java index 87e32b273..8e41c0a82 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java @@ -16,6 +16,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -58,9 +59,9 @@ public class CrosscuttingMembers { private List<Declare> declareDominates = new ArrayList<Declare>(4); // These are like declare parents type mungers - private Set<DeclareAnnotation> declareAnnotationsOnType = new HashSet<DeclareAnnotation>(); - private Set<DeclareAnnotation> declareAnnotationsOnField = new HashSet<DeclareAnnotation>(); - private Set<DeclareAnnotation> declareAnnotationsOnMethods = new HashSet<DeclareAnnotation>(); + private Set<DeclareAnnotation> declareAnnotationsOnType = new LinkedHashSet<DeclareAnnotation>(); + private Set<DeclareAnnotation> declareAnnotationsOnField = new LinkedHashSet<DeclareAnnotation>(); + private Set<DeclareAnnotation> declareAnnotationsOnMethods = new LinkedHashSet<DeclareAnnotation>(); // declareAnnotationsOnMethods includes constructors too private Set<DeclareTypeErrorOrWarning> declareTypeEow = new HashSet<DeclareTypeErrorOrWarning>(); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembersSet.java b/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembersSet.java index 59bd2c097..3937830cd 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembersSet.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembersSet.java @@ -18,6 +18,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -286,10 +287,12 @@ public class CrosscuttingMembersSet { return declareParents; } - // DECAT Merge multiple together + /** + * @return an amalgamation of the declare @type statements. + */ public List<DeclareAnnotation> getDeclareAnnotationOnTypes() { if (declareAnnotationOnTypes == null) { - Set<DeclareAnnotation> ret = new HashSet<DeclareAnnotation>(); + Set<DeclareAnnotation> ret = new LinkedHashSet<DeclareAnnotation>(); for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) { ret.addAll(i.next().getDeclareAnnotationOnTypes()); } @@ -299,9 +302,12 @@ public class CrosscuttingMembersSet { return declareAnnotationOnTypes; } + /** + * @return an amalgamation of the declare @field statements. + */ public List<DeclareAnnotation> getDeclareAnnotationOnFields() { if (declareAnnotationOnFields == null) { - Set<DeclareAnnotation> ret = new HashSet<DeclareAnnotation>(); + Set<DeclareAnnotation> ret = new LinkedHashSet<DeclareAnnotation>(); for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) { ret.addAll(i.next().getDeclareAnnotationOnFields()); } @@ -312,11 +318,11 @@ public class CrosscuttingMembersSet { } /** - * Return an amalgamation of the declare @method/@constructor statements. + * @return an amalgamation of the declare @method/@constructor statements. */ public List<DeclareAnnotation> getDeclareAnnotationOnMethods() { if (declareAnnotationOnMethods == null) { - Set<DeclareAnnotation> ret = new HashSet<DeclareAnnotation>(); + Set<DeclareAnnotation> ret = new LinkedHashSet<DeclareAnnotation>(); for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) { ret.addAll(i.next().getDeclareAnnotationOnMethods()); } |