From: aclement Date: Tue, 15 Sep 2009 16:39:40 +0000 (+0000) Subject: more aop.xml compile time config stuff X-Git-Tag: V1_6_6~42 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f5aab0994645ac03545fbab7b74fcb6e42968bc5;p=aspectj.git more aop.xml compile time config stuff --- diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembersSet.java b/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembersSet.java index 40e4576cf..aef04dd98 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembersSet.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembersSet.java @@ -22,8 +22,10 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.aspectj.weaver.patterns.Declare; import org.aspectj.weaver.patterns.DeclareAnnotation; import org.aspectj.weaver.patterns.DeclareParents; +import org.aspectj.weaver.patterns.DeclareSoft; import org.aspectj.weaver.patterns.IVerificationRequired; import org.aspectj.weaver.tools.Trace; import org.aspectj.weaver.tools.TraceFactory; @@ -47,14 +49,14 @@ public class CrosscuttingMembersSet { private transient List /* IVerificationRequired */ verificationList = null; private List shadowMungers = null; - private List typeMungers = null; + private List typeMungers = null; private List lateTypeMungers = null; - private List declareSofts = 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 declareDominates = null; + private List declareDominates = null; private boolean changedSinceLastReset = false; public CrosscuttingMembersSet(World world) { @@ -159,9 +161,9 @@ public class CrosscuttingMembersSet { declareDominates = null; } - public List getShadowMungers() { + public List getShadowMungers() { if (shadowMungers == null) { - ArrayList ret = new ArrayList(); + List ret = new ArrayList(); for (Iterator i = members.values().iterator(); i.hasNext();) { ret.addAll(i.next().getShadowMungers()); } @@ -170,9 +172,9 @@ public class CrosscuttingMembersSet { return shadowMungers; } - public List getTypeMungers() { + public List getTypeMungers() { if (typeMungers == null) { - ArrayList ret = new ArrayList(); + List ret = new ArrayList(); for (Iterator i = members.values().iterator(); i.hasNext();) { ret.addAll(i.next().getTypeMungers()); } @@ -192,13 +194,13 @@ public class CrosscuttingMembersSet { return lateTypeMungers; } - public List getDeclareSofts() { + public List getDeclareSofts() { if (declareSofts == null) { - Set ret = new HashSet(); + Set ret = new HashSet(); for (Iterator i = members.values().iterator(); i.hasNext();) { ret.addAll(i.next().getDeclareSofts()); } - declareSofts = new ArrayList(); + declareSofts = new ArrayList(); declareSofts.addAll(ret); } return declareSofts; @@ -256,9 +258,9 @@ public class CrosscuttingMembersSet { return declareAnnotationOnMethods; } - public List getDeclareDominates() { + public List getDeclareDominates() { if (declareDominates == null) { - ArrayList ret = new ArrayList(); + List ret = new ArrayList(); for (Iterator i = members.values().iterator(); i.hasNext();) { ret.addAll(i.next().getDeclareDominates()); } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/World.java b/org.aspectj.matcher/src/org/aspectj/weaver/World.java index 178ff9722..cdb01a1c8 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/World.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/World.java @@ -867,12 +867,12 @@ public abstract class World implements Dump.INode { public final static int USE_WEAK_REFS = 1; // Collected asap public final static int USE_SOFT_REFS = 2; // Collected when short on // memory - List addedSinceLastDemote; + List addedSinceLastDemote; public int policy = USE_SOFT_REFS; // Map of types that never get thrown away - final Map /* String -> ResolvedType */tMap = new HashMap(); + final Map tMap = new HashMap(); // Map of types that may be ejected from the cache if we need space final Map expendableMap = Collections.synchronizedMap(new WeakHashMap()); @@ -888,7 +888,7 @@ public abstract class World implements Dump.INode { private static Trace trace = TraceFactory.getTraceFactory().getTrace(World.TypeMap.class); TypeMap(World w) { - addedSinceLastDemote = new ArrayList(); + addedSinceLastDemote = new ArrayList(); this.w = w; memoryProfiling = false;// !w.getMessageHandler().isIgnoring(Message. // INFO); @@ -907,15 +907,10 @@ public abstract class World implements Dump.INode { return 0; } int demotionCounter = 0; - Iterator iter = addedSinceLastDemote.iterator(); - do { - if (!iter.hasNext()) { - break; - } - String key = (String) iter.next(); - ResolvedType type = (ResolvedType) tMap.get(key); + for (String key : addedSinceLastDemote) { + ResolvedType type = tMap.get(key); if (type != null && !type.isAspect() && !type.equals(UnresolvedType.OBJECT) && !type.isPrimitiveType()) { - List typeMungers = type.getInterTypeMungers(); + List typeMungers = type.getInterTypeMungers(); if (typeMungers == null || typeMungers.size() == 0) { tMap.remove(key); if (!expendableMap.containsKey(key)) { @@ -928,7 +923,7 @@ public abstract class World implements Dump.INode { demotionCounter++; } } - } while (true); + } if (debugDemotion) { System.out.println("Demoted " + demotionCounter + " types. Types remaining in fixed set #" + tMap.keySet().size()); } @@ -1008,7 +1003,7 @@ public abstract class World implements Dump.INode { addedSinceLastDemote.add(key); } - return (ResolvedType) tMap.put(key, type); + return tMap.put(key, type); } } @@ -1035,7 +1030,7 @@ public abstract class World implements Dump.INode { */ public ResolvedType get(String key) { checkq(); - ResolvedType ret = (ResolvedType) tMap.get(key); + ResolvedType ret = tMap.get(key); if (ret == null) { if (policy == USE_WEAK_REFS) { WeakReference ref = (WeakReference) expendableMap.get(key); @@ -1043,9 +1038,9 @@ public abstract class World implements Dump.INode { ret = (ResolvedType) ref.get(); } } else if (policy == USE_SOFT_REFS) { - SoftReference ref = (SoftReference) expendableMap.get(key); + SoftReference ref = (SoftReference) expendableMap.get(key); if (ref != null) { - ret = (ResolvedType) ref.get(); + ret = ref.get(); } } else { return (ResolvedType) expendableMap.get(key); @@ -1056,7 +1051,7 @@ public abstract class World implements Dump.INode { /** Remove a type from the map */ public ResolvedType remove(String key) { - ResolvedType ret = (ResolvedType) tMap.remove(key); + ResolvedType ret = tMap.remove(key); if (ret == null) { if (policy == USE_WEAK_REFS) { WeakReference wref = (WeakReference) expendableMap.remove(key);