]> source.dussan.org Git - aspectj.git/commitdiff
Java5 upgrades
authoraclement <aclement>
Wed, 9 Sep 2009 19:10:19 +0000 (19:10 +0000)
committeraclement <aclement>
Wed, 9 Sep 2009 19:10:19 +0000 (19:10 +0000)
org.aspectj.matcher/.isJava5 [new file with mode: 0644]
org.aspectj.matcher/src/org/aspectj/weaver/AbstractAnnotationAJ.java
org.aspectj.matcher/src/org/aspectj/weaver/Advice.java
org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java
org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembersSet.java
org.aspectj.matcher/src/org/aspectj/weaver/Lint.java
org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMemberImpl.java
org.aspectj.matcher/src/org/aspectj/weaver/Shadow.java
org.aspectj.matcher/src/org/aspectj/weaver/World.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareAnnotation.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java

diff --git a/org.aspectj.matcher/.isJava5 b/org.aspectj.matcher/.isJava5
new file mode 100644 (file)
index 0000000..c18a7b8
--- /dev/null
@@ -0,0 +1 @@
+.isJava5
\ No newline at end of file
index f9922cf97892a07689bb7d85ce46de1fb0609d66..3f694873a8e3809a56903494b4fb3d1539b29abb 100644 (file)
@@ -17,7 +17,7 @@ public abstract class AbstractAnnotationAJ implements AnnotationAJ {
 
        protected final ResolvedType type;
 
-       private Set supportedTargets = null; // @target meta annotation
+       private Set<String> supportedTargets = null; // @target meta annotation
 
        public AbstractAnnotationAJ(ResolvedType type) {
                this.type = type;
@@ -84,7 +84,7 @@ public abstract class AbstractAnnotationAJ implements AnnotationAJ {
                if (supportedTargets == null) {
                        AnnotationAJ atTargetAnnotation = retrieveAnnotationOnAnnotation(UnresolvedType.AT_TARGET);
                        if (atTargetAnnotation == null) {
-                               supportedTargets = Collections.EMPTY_SET;
+                               supportedTargets = Collections.emptySet();
                        } else {
                                supportedTargets = atTargetAnnotation.getTargets();
                        }
@@ -97,8 +97,8 @@ public abstract class AbstractAnnotationAJ implements AnnotationAJ {
        public final String getValidTargets() {
                StringBuffer sb = new StringBuffer();
                sb.append("{");
-               for (Iterator iter = supportedTargets.iterator(); iter.hasNext();) {
-                       String evalue = (String) iter.next();
+               for (Iterator<String> iter = supportedTargets.iterator(); iter.hasNext();) {
+                       String evalue = iter.next();
                        sb.append(evalue);
                        if (iter.hasNext()) {
                                sb.append(",");
index be57b8421de2934fa75407c37eb0b9a3f7d78d53..4a0c4d8f3e36a310b4ac1b6e9e297bf0e270ea5e 100644 (file)
@@ -43,9 +43,8 @@ public abstract class Advice extends ShadowMunger {
 
        protected boolean hasMatchedAtLeastOnce = false;
 
-       protected List/* Lint.Kind */suppressedLintKinds = null; // based on
-       // annotations on
-       // this advice
+       // based on annotations on this advice
+       protected List<Lint.Kind> suppressedLintKinds = null;
 
        public ISourceLocation lastReportedMonitorExitJoinpointLocation = null;
 
@@ -106,6 +105,7 @@ public abstract class Advice extends ShadowMunger {
                }
        }
 
+       @Override
        public boolean match(Shadow shadow, World world) {
                if (super.match(shadow, world)) {
                        if (shadow.getKind() == Shadow.ExceptionHandler) {
@@ -380,6 +380,7 @@ public abstract class Advice extends ShadowMunger {
                }
        }
 
+       @Override
        public Pointcut getPointcut() {
                return pointcut;
        }
@@ -390,6 +391,7 @@ public abstract class Advice extends ShadowMunger {
         * @param fromType is guaranteed to be a non-abstract aspect
         * @param clause has been concretized at a higher level
         */
+       @Override
        public ShadowMunger concretize(ResolvedType fromType, World world, PerClause clause) {
                // assert !fromType.isAbstract();
                Pointcut p = pointcut.concretize(fromType, getDeclaringType(), signature.getArity(), this);
@@ -414,6 +416,7 @@ public abstract class Advice extends ShadowMunger {
 
        // ---- from object
 
+       @Override
        public String toString() {
                StringBuffer sb = new StringBuffer();
                sb.append("(").append(getKind()).append(extraParametersToString());
@@ -430,6 +433,7 @@ public abstract class Advice extends ShadowMunger {
        }
 
        // XXX this perhaps ought to take account of the other fields in advice ...
+       @Override
        public boolean equals(Object other) {
                if (!(other instanceof Advice)) {
                        return false;
@@ -448,6 +452,7 @@ public abstract class Advice extends ShadowMunger {
 
        private volatile int hashCode = 0;
 
+       @Override
        public int hashCode() {
                if (hashCode == 0) {
                        int result = 17;
index 96f39c70994c8e9dd0a0983c8a0d0181bcfbcaee..2bf8f0f48b1d4be940e9db3a77f372bb5aac6983 100644 (file)
@@ -47,18 +47,18 @@ public class CrosscuttingMembers {
 
        private PerClause perClause;
 
-       private List shadowMungers = new ArrayList(4);
-       private List typeMungers = new ArrayList(4);
-       private List lateTypeMungers = new ArrayList(0);
+       private List<ShadowMunger> shadowMungers = new ArrayList<ShadowMunger>(4);
+       private List<ConcreteTypeMunger> typeMungers = new ArrayList<ConcreteTypeMunger>(4);
+       private List<ConcreteTypeMunger> lateTypeMungers = new ArrayList<ConcreteTypeMunger>(0);
 
-       private Set declareParents = new HashSet();
-       private Set declareSofts = new HashSet();
-       private List declareDominates = new ArrayList(4);
+       private Set<DeclareParents> declareParents = new HashSet<DeclareParents>();
+       private Set<DeclareSoft> declareSofts = new HashSet<DeclareSoft>();
+       private List<Declare> declareDominates = new ArrayList<Declare>(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<DeclareAnnotation> declareAnnotationsOnType = new HashSet<DeclareAnnotation>();
+       private Set<DeclareAnnotation> declareAnnotationsOnField = new HashSet<DeclareAnnotation>();
+       private Set<DeclareAnnotation> declareAnnotationsOnMethods = new HashSet<DeclareAnnotation>();
        // declareAnnotationsOnMethods includes constructors too
 
        private boolean shouldConcretizeIfNeeded = true;
@@ -81,9 +81,9 @@ public class CrosscuttingMembers {
                shadowMungers.add(m);
        }
 
-       public void addShadowMungers(Collection c) {
-               for (Iterator i = c.iterator(); i.hasNext();) {
-                       addShadowMunger((ShadowMunger) i.next());
+       public void addShadowMungers(Collection<ShadowMunger> c) {
+               for (ShadowMunger munger : c) {
+                       addShadowMunger(munger);
                }
        }
 
@@ -94,7 +94,7 @@ public class CrosscuttingMembers {
                addConcreteShadowMunger(m.concretize(inAspect, world, perClause));
        }
 
-       public void addTypeMungers(Collection c) {
+       public void addTypeMungers(Collection<ConcreteTypeMunger> c) {
                typeMungers.addAll(c);
        }
 
@@ -105,7 +105,7 @@ public class CrosscuttingMembers {
                typeMungers.add(m);
        }
 
-       public void addLateTypeMungers(Collection c) {
+       public void addLateTypeMungers(Collection<ConcreteTypeMunger> c) {
                lateTypeMungers.addAll(c);
        }
 
@@ -177,8 +177,8 @@ public class CrosscuttingMembers {
                }
                // Check we haven't already got a munger for this:
                String signatureToLookFor = typeToExpose.getSignature();
-               for (Iterator iterator = typeMungers.iterator(); iterator.hasNext();) {
-                       ConcreteTypeMunger cTM = (ConcreteTypeMunger) iterator.next();
+               for (Iterator<ConcreteTypeMunger> iterator = typeMungers.iterator(); iterator.hasNext();) {
+                       ConcreteTypeMunger cTM = iterator.next();
                        ResolvedTypeMunger rTM = cTM.getMunger();
                        if (rTM != null && rTM instanceof ExposeTypeMunger) {
                                String exposedType = ((ExposeTypeMunger) rTM).getExposedTypeSignature();
@@ -205,10 +205,9 @@ public class CrosscuttingMembers {
                addTypeMunger(world.getWeavingSupport().concreteTypeMunger(new PrivilegedAccessMunger(member), inAspect));
        }
 
-       public Collection getCflowEntries() {
-               ArrayList ret = new ArrayList();
-               for (Iterator i = shadowMungers.iterator(); i.hasNext();) {
-                       ShadowMunger m = (ShadowMunger) i.next();
+       public Collection<ShadowMunger> getCflowEntries() {
+               List<ShadowMunger> ret = new ArrayList<ShadowMunger>();
+               for (ShadowMunger m : shadowMungers) {
                        if (m instanceof Advice) {
                                Advice a = (Advice) m;
                                if (a.getKind().isCflow()) {
@@ -246,10 +245,9 @@ public class CrosscuttingMembers {
 
                if (careAboutShadowMungers) {
                        // bug 129163: use set equality rather than list equality
-                       Set theseShadowMungers = new HashSet();
-                       Set theseInlinedAroundMungers = new HashSet();
-                       for (Iterator iter = shadowMungers.iterator(); iter.hasNext();) {
-                               ShadowMunger munger = (ShadowMunger) iter.next();
+                       Set<ShadowMunger> theseShadowMungers = new HashSet<ShadowMunger>();
+                       Set<ShadowMunger> theseInlinedAroundMungers = new HashSet<ShadowMunger>();
+                       for (ShadowMunger munger : shadowMungers) {
                                if (munger instanceof Advice) {
                                        Advice adviceMunger = (Advice) munger;
                                        // bug 154054: if we're around advice that has been inlined
@@ -264,12 +262,11 @@ public class CrosscuttingMembers {
                                        theseShadowMungers.add(munger);
                                }
                        }
-                       Set tempSet = new HashSet();
+                       Set<ShadowMunger> tempSet = new HashSet<ShadowMunger>();
                        tempSet.addAll(other.shadowMungers);
-                       Set otherShadowMungers = new HashSet();
-                       Set otherInlinedAroundMungers = new HashSet();
-                       for (Iterator iter = tempSet.iterator(); iter.hasNext();) {
-                               ShadowMunger munger = (ShadowMunger) iter.next();
+                       Set<ShadowMunger> otherShadowMungers = new HashSet<ShadowMunger>();
+                       Set<ShadowMunger> otherInlinedAroundMungers = new HashSet<ShadowMunger>();
+                       for (ShadowMunger munger : tempSet) {
                                if (munger instanceof Advice) {
                                        Advice adviceMunger = (Advice) munger;
                                        // bug 154054: if we're around advice that has been inlined
@@ -294,10 +291,9 @@ public class CrosscuttingMembers {
                        // bug 158573 - if there are no changes then preserve whether
                        // or not a particular shadowMunger has matched something.
                        if (!changed) {
-                               for (Iterator iter = shadowMungers.iterator(); iter.hasNext();) {
-                                       ShadowMunger munger = (ShadowMunger) iter.next();
+                               for (ShadowMunger munger : shadowMungers) {
                                        int i = other.shadowMungers.indexOf(munger);
-                                       ShadowMunger otherMunger = (ShadowMunger) other.shadowMungers.get(i);
+                                       ShadowMunger otherMunger = other.shadowMungers.get(i);
                                        if (munger instanceof Advice) {
                                                ((Advice) otherMunger).setHasMatchedSomething(((Advice) munger).hasMatchedSomething());
                                        }
@@ -314,10 +310,10 @@ public class CrosscuttingMembers {
                // if we dont care about shadow mungers then ignore those
                // typeMungers which are created to help with the implementation
                // of shadowMungers
-               Set theseTypeMungers = new HashSet();
-               Set otherTypeMungers = new HashSet();
+               Set<Object> theseTypeMungers = new HashSet<Object>();
+               Set<Object> otherTypeMungers = new HashSet<Object>();
                if (!careAboutShadowMungers) {
-                       for (Iterator iter = typeMungers.iterator(); iter.hasNext();) {
+                       for (Iterator<ConcreteTypeMunger> iter = typeMungers.iterator(); iter.hasNext();) {
                                Object o = iter.next();
                                if (o instanceof ConcreteTypeMunger) {
                                        ConcreteTypeMunger typeMunger = (ConcreteTypeMunger) o;
@@ -329,7 +325,7 @@ public class CrosscuttingMembers {
                                }
                        }
 
-                       for (Iterator iter = other.typeMungers.iterator(); iter.hasNext();) {
+                       for (Iterator<ConcreteTypeMunger> iter = other.typeMungers.iterator(); iter.hasNext();) {
                                Object o = iter.next();
                                if (o instanceof ConcreteTypeMunger) {
                                        ConcreteTypeMunger typeMunger = (ConcreteTypeMunger) o;
@@ -353,11 +349,10 @@ public class CrosscuttingMembers {
                } else {
                        boolean shouldOverwriteThis = false;
                        boolean foundInequality = false;
-                       for (Iterator iter = theseTypeMungers.iterator(); iter.hasNext() && !foundInequality;) {
+                       for (Iterator<Object> iter = theseTypeMungers.iterator(); iter.hasNext() && !foundInequality;) {
                                Object thisOne = iter.next();
                                boolean foundInOtherSet = false;
-                               for (Iterator iterator = otherTypeMungers.iterator(); iterator.hasNext();) {
-                                       Object otherOne = iterator.next();
+                               for (Object otherOne : otherTypeMungers) {
                                        if (thisOne instanceof ConcreteTypeMunger) {
                                                if (((ConcreteTypeMunger) thisOne).shouldOverwrite()) {
                                                        shouldOverwriteThis = true;
@@ -406,16 +401,16 @@ public class CrosscuttingMembers {
                        // the up front comparison
                        if (!careAboutShadowMungers) {
                                // this means we are in front end compilation and if the differences are purely mixin parents, we can continue OK
-                               Set trimmedThis = new HashSet();
-                               for (Iterator iterator = declareParents.iterator(); iterator.hasNext();) {
-                                       DeclareParents decp = (DeclareParents) iterator.next();
+                               Set<DeclareParents> trimmedThis = new HashSet<DeclareParents>();
+                               for (Iterator<DeclareParents> iterator = declareParents.iterator(); iterator.hasNext();) {
+                                       DeclareParents decp = iterator.next();
                                        if (!decp.isMixin()) {
                                                trimmedThis.add(decp);
                                        }
                                }
-                               Set trimmedOther = new HashSet();
-                               for (Iterator iterator = other.declareParents.iterator(); iterator.hasNext();) {
-                                       DeclareParents decp = (DeclareParents) iterator.next();
+                               Set<DeclareParents> trimmedOther = new HashSet<DeclareParents>();
+                               for (Iterator<DeclareParents> iterator = other.declareParents.iterator(); iterator.hasNext();) {
+                                       DeclareParents decp = iterator.next();
                                        if (!decp.isMixin()) {
                                                trimmedOther.add(decp);
                                        }
@@ -454,14 +449,14 @@ public class CrosscuttingMembers {
                return changed;
        }
 
-       private boolean equivalent(Set theseInlinedAroundMungers, Set otherInlinedAroundMungers) {
+       private boolean equivalent(Set<ShadowMunger> theseInlinedAroundMungers, Set<ShadowMunger> otherInlinedAroundMungers) {
                if (theseInlinedAroundMungers.size() != otherInlinedAroundMungers.size()) {
                        return false;
                }
-               for (Iterator iter = theseInlinedAroundMungers.iterator(); iter.hasNext();) {
+               for (Iterator<ShadowMunger> iter = theseInlinedAroundMungers.iterator(); iter.hasNext();) {
                        Advice thisAdvice = (Advice) iter.next();
                        boolean foundIt = false;
-                       for (Iterator iterator = otherInlinedAroundMungers.iterator(); iterator.hasNext();) {
+                       for (Iterator<ShadowMunger> iterator = otherInlinedAroundMungers.iterator(); iterator.hasNext();) {
                                Advice otherAdvice = (Advice) iterator.next();
                                if (thisAdvice.equals(otherAdvice)) {
                                        if (thisAdvice.getSignature() instanceof ResolvedMemberImpl) {
@@ -500,42 +495,42 @@ public class CrosscuttingMembers {
                }
        }
 
-       public List getDeclareDominates() {
+       public List<Declare> getDeclareDominates() {
                return declareDominates;
        }
 
-       public Collection getDeclareParents() {
+       public Collection<DeclareParents> getDeclareParents() {
                return declareParents;
        }
 
-       public Collection getDeclareSofts() {
+       public Collection<DeclareSoft> getDeclareSofts() {
                return declareSofts;
        }
 
-       public List getShadowMungers() {
+       public List<ShadowMunger> getShadowMungers() {
                return shadowMungers;
        }
 
-       public List getTypeMungers() {
+       public List<ConcreteTypeMunger> getTypeMungers() {
                return typeMungers;
        }
 
-       public List getLateTypeMungers() {
+       public List<ConcreteTypeMunger> getLateTypeMungers() {
                return lateTypeMungers;
        }
 
-       public Collection getDeclareAnnotationOnTypes() {
+       public Collection<DeclareAnnotation> getDeclareAnnotationOnTypes() {
                return declareAnnotationsOnType;
        }
 
-       public Collection getDeclareAnnotationOnFields() {
+       public Collection<DeclareAnnotation> getDeclareAnnotationOnFields() {
                return declareAnnotationsOnField;
        }
 
        /**
         * includes declare @method and @constructor
         */
-       public Collection getDeclareAnnotationOnMethods() {
+       public Collection<DeclareAnnotation> getDeclareAnnotationOnMethods() {
                return declareAnnotationsOnMethods;
        }
 
index 5371e0bc2cc67553d1c058e09b7c7b1635b1bf22..66a8a8e87230a074be0342c39272ccc979a733f0 100644 (file)
@@ -22,6 +22,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.aspectj.weaver.patterns.DeclareAnnotation;
 import org.aspectj.weaver.patterns.DeclareParents;
 import org.aspectj.weaver.patterns.IVerificationRequired;
 import org.aspectj.weaver.tools.Trace;
@@ -40,19 +41,19 @@ public class CrosscuttingMembersSet {
        private transient World world;
 
        // FIXME AV - ? we may need a sequencedHashMap there to ensure source based precedence for @AJ advice
-       private final Map /* ResolvedType (the aspect) > CrosscuttingMembers */members = new HashMap();
+       private final Map /* ResolvedType (the aspect) > CrosscuttingMembers */<ResolvedType, CrosscuttingMembers> members = new HashMap<ResolvedType, CrosscuttingMembers>();
 
        // List of things to be verified once the type system is 'complete'
-       private transient List /* IVerificationRequired */verificationList = null;
+       private transient List /* IVerificationRequired */<IVerificationRequired> verificationList = null;
 
-       private List /* ShadowMunger */shadowMungers = null;
+       private List<ShadowMunger> shadowMungers = null;
        private List typeMungers = null;
        private List lateTypeMungers = null;
        private List declareSofts = null;
        private List declareParents = null;
        private List declareAnnotationOnTypes = null;
        private List declareAnnotationOnFields = null;
-       private List declareAnnotationOnMethods = null; // includes constructors
+       private List<DeclareAnnotation> declareAnnotationOnMethods = null; // includes constructors
        private List declareDominates = null;
        private boolean changedSinceLastReset = false;
 
@@ -75,7 +76,7 @@ public class CrosscuttingMembersSet {
                }
 
                boolean change = false;
-               CrosscuttingMembers xcut = (CrosscuttingMembers) members.get(aspectType);
+               CrosscuttingMembers xcut = members.get(aspectType);
                if (xcut == null) {
                        members.put(aspectType, aspectType.collectCrosscuttingMembers(inWeavingPhase));
                        clearCaches();
@@ -105,17 +106,17 @@ public class CrosscuttingMembersSet {
 
        private boolean addOrReplaceDescendantsOf(ResolvedType aspectType, boolean inWeavePhase) {
                // System.err.println("Looking at descendants of "+aspectType.getName());
-               Set knownAspects = members.keySet();
-               Set toBeReplaced = new HashSet();
-               for (Iterator it = knownAspects.iterator(); it.hasNext();) {
-                       ResolvedType candidateDescendant = (ResolvedType) it.next();
+               Set<ResolvedType> knownAspects = members.keySet();
+               Set<ResolvedType> toBeReplaced = new HashSet<ResolvedType>();
+               for (Iterator<ResolvedType> it = knownAspects.iterator(); it.hasNext();) {
+                       ResolvedType candidateDescendant = it.next();
                        if ((candidateDescendant != aspectType) && (aspectType.isAssignableFrom(candidateDescendant))) {
                                toBeReplaced.add(candidateDescendant);
                        }
                }
                boolean change = false;
-               for (Iterator it = toBeReplaced.iterator(); it.hasNext();) {
-                       ResolvedType next = (ResolvedType) it.next();
+               for (Iterator<ResolvedType> it = toBeReplaced.iterator(); it.hasNext();) {
+                       ResolvedType next = it.next();
                        boolean thisChange = addOrReplaceAspect(next, inWeavePhase);
                        change = change || thisChange;
                }
@@ -126,7 +127,7 @@ public class CrosscuttingMembersSet {
                if (!members.containsKey(aspectType)) {
                        return;
                }
-               CrosscuttingMembers xcut = (CrosscuttingMembers) members.get(aspectType);
+               CrosscuttingMembers xcut = members.get(aspectType);
                xcut.addDeclares(aspectType.collectDeclares(true));
        }
 
@@ -161,8 +162,8 @@ public class CrosscuttingMembersSet {
        public List getShadowMungers() {
                if (shadowMungers == null) {
                        ArrayList ret = new ArrayList();
-                       for (Iterator i = members.values().iterator(); i.hasNext();) {
-                               ret.addAll(((CrosscuttingMembers) i.next()).getShadowMungers());
+                       for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+                               ret.addAll(i.next().getShadowMungers());
                        }
                        shadowMungers = ret;
                }
@@ -172,8 +173,8 @@ public class CrosscuttingMembersSet {
        public List getTypeMungers() {
                if (typeMungers == null) {
                        ArrayList ret = new ArrayList();
-                       for (Iterator i = members.values().iterator(); i.hasNext();) {
-                               ret.addAll(((CrosscuttingMembers) i.next()).getTypeMungers());
+                       for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+                               ret.addAll(i.next().getTypeMungers());
                        }
                        typeMungers = ret;
                }
@@ -183,8 +184,8 @@ public class CrosscuttingMembersSet {
        public List getLateTypeMungers() {
                if (lateTypeMungers == null) {
                        ArrayList ret = new ArrayList();
-                       for (Iterator i = members.values().iterator(); i.hasNext();) {
-                               ret.addAll(((CrosscuttingMembers) i.next()).getLateTypeMungers());
+                       for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+                               ret.addAll(i.next().getLateTypeMungers());
                        }
                        lateTypeMungers = ret;
                }
@@ -194,8 +195,8 @@ public class CrosscuttingMembersSet {
        public List getDeclareSofts() {
                if (declareSofts == null) {
                        Set ret = new HashSet();
-                       for (Iterator i = members.values().iterator(); i.hasNext();) {
-                               ret.addAll(((CrosscuttingMembers) i.next()).getDeclareSofts());
+                       for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+                               ret.addAll(i.next().getDeclareSofts());
                        }
                        declareSofts = new ArrayList();
                        declareSofts.addAll(ret);
@@ -206,8 +207,8 @@ public class CrosscuttingMembersSet {
        public List getDeclareParents() {
                if (declareParents == null) {
                        Set ret = new HashSet();
-                       for (Iterator i = members.values().iterator(); i.hasNext();) {
-                               ret.addAll(((CrosscuttingMembers) i.next()).getDeclareParents());
+                       for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+                               ret.addAll(i.next().getDeclareParents());
                        }
                        declareParents = new ArrayList();
                        declareParents.addAll(ret);
@@ -219,8 +220,8 @@ public class CrosscuttingMembersSet {
        public List getDeclareAnnotationOnTypes() {
                if (declareAnnotationOnTypes == null) {
                        Set ret = new HashSet();
-                       for (Iterator i = members.values().iterator(); i.hasNext();) {
-                               ret.addAll(((CrosscuttingMembers) i.next()).getDeclareAnnotationOnTypes());
+                       for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+                               ret.addAll(i.next().getDeclareAnnotationOnTypes());
                        }
                        declareAnnotationOnTypes = new ArrayList();
                        declareAnnotationOnTypes.addAll(ret);
@@ -231,8 +232,8 @@ public class CrosscuttingMembersSet {
        public List getDeclareAnnotationOnFields() {
                if (declareAnnotationOnFields == null) {
                        Set ret = new HashSet();
-                       for (Iterator i = members.values().iterator(); i.hasNext();) {
-                               ret.addAll(((CrosscuttingMembers) i.next()).getDeclareAnnotationOnFields());
+                       for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+                               ret.addAll(i.next().getDeclareAnnotationOnFields());
                        }
                        declareAnnotationOnFields = new ArrayList();
                        declareAnnotationOnFields.addAll(ret);
@@ -243,13 +244,13 @@ public class CrosscuttingMembersSet {
        /**
         * Return an amalgamation of the declare @method/@constructor statements.
         */
-       public List getDeclareAnnotationOnMethods() {
+       public List<DeclareAnnotation> getDeclareAnnotationOnMethods() {
                if (declareAnnotationOnMethods == null) {
-                       Set ret = new HashSet();
-                       for (Iterator i = members.values().iterator(); i.hasNext();) {
-                               ret.addAll(((CrosscuttingMembers) i.next()).getDeclareAnnotationOnMethods());
+                       Set<DeclareAnnotation> ret = new HashSet<DeclareAnnotation>();
+                       for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+                               ret.addAll(i.next().getDeclareAnnotationOnMethods());
                        }
-                       declareAnnotationOnMethods = new ArrayList();
+                       declareAnnotationOnMethods = new ArrayList<DeclareAnnotation>();
                        declareAnnotationOnMethods.addAll(ret);
                }
                return declareAnnotationOnMethods;
@@ -258,8 +259,8 @@ public class CrosscuttingMembersSet {
        public List getDeclareDominates() {
                if (declareDominates == null) {
                        ArrayList ret = new ArrayList();
-                       for (Iterator i = members.values().iterator(); i.hasNext();) {
-                               ret.addAll(((CrosscuttingMembers) i.next()).getDeclareDominates());
+                       for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
+                               ret.addAll(i.next().getDeclareDominates());
                        }
                        declareDominates = ret;
                }
@@ -267,10 +268,10 @@ public class CrosscuttingMembersSet {
        }
 
        public ResolvedType findAspectDeclaringParents(DeclareParents p) {
-               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();) {
+               Set<ResolvedType> keys = this.members.keySet();
+               for (Iterator<ResolvedType> iter = keys.iterator(); iter.hasNext();) {
+                       ResolvedType element = iter.next();
+                       for (Iterator i = members.get(element).getDeclareParents().iterator(); i.hasNext();) {
                                DeclareParents dp = (DeclareParents) i.next();
                                if (dp.equals(p)) {
                                        return element;
@@ -295,7 +296,7 @@ public class CrosscuttingMembersSet {
         */
        public void recordNecessaryCheck(IVerificationRequired verification) {
                if (verificationList == null) {
-                       verificationList = new ArrayList();
+                       verificationList = new ArrayList<IVerificationRequired>();
                }
                verificationList.add(verification);
        }
@@ -307,8 +308,8 @@ public class CrosscuttingMembersSet {
                if (verificationList == null) {
                        return;
                }
-               for (Iterator iter = verificationList.iterator(); iter.hasNext();) {
-                       IVerificationRequired element = (IVerificationRequired) iter.next();
+               for (Iterator<IVerificationRequired> iter = verificationList.iterator(); iter.hasNext();) {
+                       IVerificationRequired element = iter.next();
                        element.verify();
                }
                verificationList = null;
index f4e77eb2b6375a2e7aa60294bf5b0fc38a5548c7..70d3c9106e2ae48f414f37992e6c6299d132e747 100644 (file)
@@ -30,7 +30,7 @@ import org.aspectj.weaver.tools.Trace;
 import org.aspectj.weaver.tools.TraceFactory;
 
 public class Lint {
-       /* private */Map kinds = new HashMap();
+       Map<String, Lint.Kind> kinds = new HashMap<String, Lint.Kind>();
        /* private */World world;
 
        public final Kind invalidAbsoluteTypeName = new Kind("invalidAbsoluteTypeName", "no match for this type name: {0}");
@@ -155,8 +155,7 @@ public class Lint {
        }
 
        private void setAll(IMessage.Kind messageKind) {
-               for (Iterator i = kinds.values().iterator(); i.hasNext();) {
-                       Kind kind = (Kind) i.next();
+               for (Kind kind : kinds.values()) {
                        kind.setKind(messageKind);
                }
        }
@@ -215,7 +214,7 @@ public class Lint {
        public void setFromProperties(Properties properties) {
                for (Iterator i = properties.entrySet().iterator(); i.hasNext();) {
                        Map.Entry entry = (Map.Entry) i.next();
-                       Kind kind = (Kind) kinds.get(entry.getKey());
+                       Kind kind = kinds.get(entry.getKey());
                        if (kind == null) {
                                MessageUtil.error(world.getMessageHandler(), WeaverMessages.format(WeaverMessages.XLINT_KEY_ERROR, entry.getKey()));
                        } else {
@@ -224,12 +223,12 @@ public class Lint {
                }
        }
 
-       public Collection allKinds() {
+       public Collection<Kind> allKinds() {
                return kinds.values();
        }
 
        public Kind getLintKind(String name) {
-               return (Kind) kinds.get(name);
+               return kinds.get(name);
        }
 
        // temporarily suppress the given lint messages
@@ -244,17 +243,13 @@ public class Lint {
 
        // remove any suppression of lint warnings in place
        public void clearAllSuppressions() {
-               for (Iterator iter = kinds.values().iterator(); iter.hasNext();) {
-                       Kind k = (Kind) iter.next();
+               for (Kind k : kinds.values()) {
                        k.setSuppressed(false);
                }
        }
 
-       public void clearSuppressions(Collection lintKind) {
-               if (lintKind.isEmpty())
-                       return;
-               for (Iterator iter = lintKind.iterator(); iter.hasNext();) {
-                       Kind k = (Kind) iter.next();
+       public void clearSuppressions(Collection<Lint.Kind> lintKinds) {
+               for (Kind k : lintKinds) {
                        k.setSuppressed(false);
                }
        }
@@ -272,7 +267,7 @@ public class Lint {
        }
 
        public Kind fromKey(String lintkey) {
-               return (Lint.Kind) kinds.get(lintkey);
+               return kinds.get(lintkey);
        }
 
        public class Kind {
index 46d6ab1f88ad5d1bb1a6cf6ee46a3a40cbd40aa0..9a3c2bf5e5e429a57b592a34ca01a88423a0b528 100644 (file)
@@ -39,7 +39,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
         */
        protected ResolvedMember backingGenericMember = null;
 
-       protected Set annotationTypes = null;
+       protected Set<UnresolvedType> annotationTypes = null;
        protected ResolvedType[][] parameterAnnotationTypes = null;
 
        // Some members are 'created' to represent other things (for example ITDs).
@@ -231,16 +231,19 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
 
        // ----
 
+       @Override
        public final int getModifiers(World world) {
                return modifiers;
        }
 
+       @Override
        public final int getModifiers() {
                return modifiers;
        }
 
        // ----
 
+       @Override
        public final UnresolvedType[] getExceptions(World world) {
                return getExceptions();
        }
@@ -302,9 +305,10 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
                        }
                        return backingGenericMember.getAnnotationTypes();
                }
-               if (annotationTypes == null)
+               if (annotationTypes == null) {
                        return null;
-               return (ResolvedType[]) annotationTypes.toArray(new ResolvedType[] {});
+               }
+               return annotationTypes.toArray(new ResolvedType[] {});
        }
 
        public String getAnnotationDefaultValue() {
@@ -312,6 +316,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
                                "You should resolve this member and call getAnnotationDefaultValue() on the result...");
        }
 
+       @Override
        public AnnotationAJ[] getAnnotations() {
                if (backingGenericMember != null)
                        return backingGenericMember.getAnnotations();
@@ -319,8 +324,9 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
        }
 
        public void setAnnotationTypes(UnresolvedType[] annotationtypes) {
-               if (annotationTypes == null)
-                       annotationTypes = new HashSet();
+               if (annotationTypes == null) {
+                       annotationTypes = new HashSet<UnresolvedType>();
+               }
                for (int i = 0; i < annotationtypes.length; i++) {
                        UnresolvedType typeX = annotationtypes[i];
                        annotationTypes.add(typeX);
@@ -343,8 +349,9 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
        public void addAnnotation(AnnotationAJ annotation) {
                // FIXME asc only allows for annotation types, not instances - should
                // it?
-               if (annotationTypes == null)
-                       annotationTypes = new HashSet();
+               if (annotationTypes == null) {
+                       annotationTypes = new HashSet<UnresolvedType>();
+               }
                annotationTypes.add(annotation.getType());
        }
 
@@ -509,6 +516,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
 
        // OPTIMIZE dont like how resolve(world) on ResolvedMemberImpl does
        // something different to world.resolve(member)
+       @Override
        public ResolvedMember resolve(World world) {
                // make sure all the pieces of a resolvedmember really are resolved
                try {
@@ -519,9 +527,10 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
                        }
                        world.setTypeVariableLookupScope(this);
                        if (annotationTypes != null) {
-                               Set r = new HashSet();
-                               for (Iterator iter = annotationTypes.iterator(); iter.hasNext();) {
-                                       UnresolvedType element = (UnresolvedType) iter.next();
+                               Set<UnresolvedType> r = new HashSet<UnresolvedType>();
+                               for (UnresolvedType element : annotationTypes) {
+                                       // for (Iterator iter = annotationTypes.iterator(); iter.hasNext();) {
+                                       // UnresolvedType element = (UnresolvedType) iter.next();
                                        r.add(world.resolve(element));
                                }
                                annotationTypes = r;
@@ -556,6 +565,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
                parameterNames = pnames;
        }
 
+       @Override
        public final String[] getParameterNames(World world) {
                return getParameterNames();
        }
@@ -638,6 +648,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
        /**
         * Get the UnresolvedType for the return type, taking generic signature into account
         */
+       @Override
        public UnresolvedType getGenericReturnType() {
                return getReturnType();
        }
@@ -645,6 +656,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
        /**
         * Get the TypeXs of the parameter types, taking generic signature into account
         */
+       @Override
        public UnresolvedType[] getGenericParameterTypes() {
                return getParameterTypes();
        }
index 1b025182ae7e1d7979079f22bc3819b3a1066594..290c7a7fa76a310fd70dd180c70ce726d7d83f1d 100644 (file)
@@ -44,7 +44,7 @@ public abstract class Shadow {
        private Member matchingSignature;
        private ResolvedMember resolvedSignature;
        protected final Shadow enclosingShadow;
-       protected List mungers = Collections.EMPTY_LIST;
+       protected List<ShadowMunger> mungers = Collections.emptyList();
 
        public int shadowId = nextShadowID++; // every time we build a shadow, it gets a new id
 
@@ -59,7 +59,7 @@ public abstract class Shadow {
 
        public abstract World getIWorld();
 
-       public List /* ShadowMunger */getMungers() {
+       public List<ShadowMunger> getMungers() {
                return mungers;
        }
 
index f8fd2a310631ee5061cbb11bf76066f08e8539a4..178ff97228162f86f31d7c79c9ddcc0bb8bd74ee 100644 (file)
@@ -36,6 +36,7 @@ import org.aspectj.bridge.IMessage.Kind;
 import org.aspectj.bridge.context.PinpointingMessageHandler;
 import org.aspectj.util.IStructureModel;
 import org.aspectj.weaver.UnresolvedType.TypeKind;
+import org.aspectj.weaver.patterns.DeclareAnnotation;
 import org.aspectj.weaver.patterns.DeclarePrecedence;
 import org.aspectj.weaver.patterns.Pointcut;
 import org.aspectj.weaver.patterns.TypePattern;
@@ -657,7 +658,7 @@ public abstract class World implements Dump.INode {
                return crosscuttingMembersSet.getDeclareAnnotationOnFields();
        }
 
-       public List getDeclareAnnotationOnMethods() {
+       public List<DeclareAnnotation> getDeclareAnnotationOnMethods() {
                return crosscuttingMembersSet.getDeclareAnnotationOnMethods();
        }
 
@@ -1173,6 +1174,7 @@ public abstract class World implements Dump.INode {
                                aspect2 = a2;
                        }
 
+                       @Override
                        public boolean equals(Object obj) {
                                if (!(obj instanceof PrecedenceCacheKey))
                                        return false;
@@ -1180,6 +1182,7 @@ public abstract class World implements Dump.INode {
                                return (aspect1 == other.aspect1 && aspect2 == other.aspect2);
                        }
 
+                       @Override
                        public int hashCode() {
                                return aspect1.hashCode() + aspect2.hashCode();
                        }
index 668d7ebaa99394c5465919e931cdad1c4b6267ff..09752cc417989a3c76ea56892630578b286775d7 100644 (file)
@@ -290,7 +290,7 @@ public class DeclareAnnotation extends Declare {
                }
        }
 
-       public AnnotationAJ getAnnotationX() {
+       public AnnotationAJ getAnnotation() {
                ensureAnnotationDiscovered();
                return annotation;
        }
index 5abdc74918c0a2c0abb563bb7c236e9bc40dd96d..d40a6a6efca601d574b555859877a35640751f92 100644 (file)
@@ -213,7 +213,7 @@ public class PatternParser {
        }
 
        public DeclarePrecedence parseDominates() {
-               List l = new ArrayList();
+               List<TypePattern> l = new ArrayList<TypePattern>();
                do {
                        l.add(parseTypePattern());
                } while (maybeEat(","));
@@ -236,7 +236,7 @@ public class PatternParser {
                }
                boolean isExtends = t.getString().equals("extends");
 
-               List l = new ArrayList();
+               List<TypePattern> l = new ArrayList<TypePattern>();
                do {
                        l.add(parseTypePattern());
                } while (maybeEat(","));
@@ -593,8 +593,8 @@ public class PatternParser {
                return new PointcutDesignatorHandlerBasedPointcut(pcExpr, world);
        }
 
-       public List parseDottedIdentifier() {
-               List ret = new ArrayList();
+       public List<String> parseDottedIdentifier() {
+               List<String> ret = new ArrayList<String>();
                ret.add(parseIdentifier());
                while (maybeEat(".")) {
                        ret.add(parseIdentifier());
@@ -761,7 +761,7 @@ public class PatternParser {
        // PVAL cope with annotation values at other places in this code
        public AnnotationTypePattern maybeParseSingleAnnotationPattern() {
                AnnotationTypePattern ret = null;
-               Map values = null;
+               Map<String, String> values = null;
                // LALR(2) - fix by making "!@" a single token
                int startIndex = tokenSource.getIndex();
                if (maybeEat("!")) {
@@ -812,8 +812,8 @@ public class PatternParser {
 
        // Parse annotation values. In an expression in @A(a=b,c=d) this method will be
        // parsing the a=b,c=d.)
-       public Map/* String,String */parseAnnotationValues() {
-               Map values = new HashMap();
+       public Map/* String,String */<String, String>parseAnnotationValues() {
+               Map<String, String> values = new HashMap<String, String>();
                boolean seenDefaultValue = false;
                do {
                        String possibleKeyString = parseAnnotationNameValuePattern();
@@ -853,7 +853,7 @@ public class PatternParser {
                                return parseHasFieldTypePattern();
                }
 
-               List names = parseDottedNamePattern();
+               List<NamePattern> names = parseDottedNamePattern();
 
                int dim = 0;
                while (maybeEat("[")) {
@@ -875,7 +875,7 @@ public class PatternParser {
                boolean isVarArgs = maybeEat("...");
 
                // ??? what about the source location of any's????
-               if (names.size() == 1 && ((NamePattern) names.get(0)).isAny() && dim == 0 && !isVarArgs && typeParameters == null)
+               if (names.size() == 1 && names.get(0).isAny() && dim == 0 && !isVarArgs && typeParameters == null)
                        return TypePattern.ANY;
 
                // Notice we increase the dimensions if varargs is set. this is to allow type matching to
@@ -910,7 +910,7 @@ public class PatternParser {
        }
 
        public TypePattern parseGenericsWildcardTypePattern() {
-               List names = new ArrayList();
+               List<NamePattern> names = new ArrayList<NamePattern>();
                names.add(new NamePattern("?"));
                TypePattern upperBound = null;
                TypePattern[] additionalInterfaceBounds = new TypePattern[0];
@@ -1018,8 +1018,8 @@ public class PatternParser {
        // return p;
        // }
 
-       public List parseDottedNamePattern() {
-               List names = new ArrayList();
+       public List<NamePattern> parseDottedNamePattern() {
+               List<NamePattern> names = new ArrayList<NamePattern>();
                StringBuffer buf = new StringBuffer();
                IToken previous = null;
                boolean justProcessedEllipsis = false; // Remember if we just dealt with an ellipsis (PR61536)
@@ -1224,7 +1224,7 @@ public class PatternParser {
        }
 
        public TypePatternList parseArgumentsPattern(boolean parameterAnnotationsPossible) {
-               List patterns = new ArrayList();
+               List<TypePattern> patterns = new ArrayList<TypePattern>();
                eat("(");
 
                // ()
@@ -1245,7 +1245,7 @@ public class PatternParser {
        }
 
        public AnnotationPatternList parseArgumentsAnnotationPattern() {
-               List patterns = new ArrayList();
+               List<AnnotationTypePattern> patterns = new ArrayList<AnnotationTypePattern>();
                eat("(");
                if (maybeEat(")")) {
                        return new AnnotationPatternList();
@@ -1269,8 +1269,8 @@ public class PatternParser {
                IToken t = tokenSource.peek();
                if (t.isIdentifier() && t.getString().equals("throws")) {
                        tokenSource.next();
-                       List required = new ArrayList();
-                       List forbidden = new ArrayList();
+                       List<TypePattern> required = new ArrayList<TypePattern>();
+                       List<TypePattern> forbidden = new ArrayList<TypePattern>();
                        do {
                                boolean isForbidden = maybeEat("!");
                                // ???might want an error for a second ! without a paren
@@ -1404,7 +1404,7 @@ public class PatternParser {
        public TypeVariablePatternList maybeParseTypeVariableList() {
                if (!maybeEat("<"))
                        return null;
-               List typeVars = new ArrayList();
+               List<TypeVariablePattern> typeVars = new ArrayList<TypeVariablePattern>();
                TypeVariablePattern t = parseTypeVariable();
                typeVars.add(t);
                while (maybeEat(",")) {
@@ -1421,7 +1421,7 @@ public class PatternParser {
        public String[] maybeParseSimpleTypeVariableList() {
                if (!maybeEat("<"))
                        return null;
-               List typeVarNames = new ArrayList();
+               List<String> typeVarNames = new ArrayList<String>();
                do {
                        typeVarNames.add(parseIdentifier());
                } while (maybeEat(","));
@@ -1434,7 +1434,7 @@ public class PatternParser {
        public TypePatternList maybeParseTypeParameterList() {
                if (!maybeEat("<"))
                        return null;
-               List typePats = new ArrayList();
+               List<TypePattern> typePats = new ArrayList<TypePattern>();
                do {
                        TypePattern tp = parseTypePattern(true, false);
                        typePats.add(tp);
@@ -1460,7 +1460,7 @@ public class PatternParser {
        }
 
        private TypePattern[] maybeParseAdditionalInterfaceBounds() {
-               List boundsList = new ArrayList();
+               List<TypePattern> boundsList = new ArrayList<TypePattern>();
                while (maybeEat("&")) {
                        TypePattern tp = parseTypePattern();
                        boundsList.add(tp);