From 5b0b6b07d2b581cddd1bac4a2a6b12cd4ac02b07 Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Thu, 13 Jun 2013 12:29:45 -0700 Subject: Preserve ordering of declare annotation when removing and adding annotations Issue: 407739 --- .../src/org/aspectj/weaver/CrosscuttingMembers.java | 7 ++++--- .../src/org/aspectj/weaver/CrosscuttingMembersSet.java | 16 +++++++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'org.aspectj.matcher') 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 declareDominates = new ArrayList(4); // These are like declare parents type mungers - private Set declareAnnotationsOnType = new HashSet(); - private Set declareAnnotationsOnField = new HashSet(); - private Set declareAnnotationsOnMethods = new HashSet(); + private Set declareAnnotationsOnType = new LinkedHashSet(); + private Set declareAnnotationsOnField = new LinkedHashSet(); + private Set declareAnnotationsOnMethods = new LinkedHashSet(); // declareAnnotationsOnMethods includes constructors too private Set declareTypeEow = new HashSet(); 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 getDeclareAnnotationOnTypes() { if (declareAnnotationOnTypes == null) { - Set ret = new HashSet(); + Set ret = new LinkedHashSet(); for (Iterator 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 getDeclareAnnotationOnFields() { if (declareAnnotationOnFields == null) { - Set ret = new HashSet(); + Set ret = new LinkedHashSet(); for (Iterator 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 getDeclareAnnotationOnMethods() { if (declareAnnotationOnMethods == null) { - Set ret = new HashSet(); + Set ret = new LinkedHashSet(); for (Iterator i = members.values().iterator(); i.hasNext();) { ret.addAll(i.next().getDeclareAnnotationOnMethods()); } -- cgit v1.2.3