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;
private transient List /* IVerificationRequired */<IVerificationRequired> verificationList = null;
private List<ShadowMunger> shadowMungers = null;
- private List typeMungers = null;
+ private List<ConcreteTypeMunger> typeMungers = null;
private List<ConcreteTypeMunger> lateTypeMungers = null;
- private List declareSofts = null;
+ private List<DeclareSoft> declareSofts = null;
private List<DeclareParents> declareParents = null;
private List<DeclareAnnotation> declareAnnotationOnTypes = null;
private List<DeclareAnnotation> declareAnnotationOnFields = null;
private List<DeclareAnnotation> declareAnnotationOnMethods = null; // includes constructors
- private List declareDominates = null;
+ private List<Declare> declareDominates = null;
private boolean changedSinceLastReset = false;
public CrosscuttingMembersSet(World world) {
declareDominates = null;
}
- public List getShadowMungers() {
+ public List<ShadowMunger> getShadowMungers() {
if (shadowMungers == null) {
- ArrayList ret = new ArrayList();
+ List<ShadowMunger> ret = new ArrayList<ShadowMunger>();
for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
ret.addAll(i.next().getShadowMungers());
}
return shadowMungers;
}
- public List getTypeMungers() {
+ public List<ConcreteTypeMunger> getTypeMungers() {
if (typeMungers == null) {
- ArrayList ret = new ArrayList();
+ List<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>();
for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
ret.addAll(i.next().getTypeMungers());
}
return lateTypeMungers;
}
- public List getDeclareSofts() {
+ public List<DeclareSoft> getDeclareSofts() {
if (declareSofts == null) {
- Set ret = new HashSet();
+ Set<DeclareSoft> ret = new HashSet<DeclareSoft>();
for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
ret.addAll(i.next().getDeclareSofts());
}
- declareSofts = new ArrayList();
+ declareSofts = new ArrayList<DeclareSoft>();
declareSofts.addAll(ret);
}
return declareSofts;
return declareAnnotationOnMethods;
}
- public List getDeclareDominates() {
+ public List<Declare> getDeclareDominates() {
if (declareDominates == null) {
- ArrayList ret = new ArrayList();
+ List<Declare> ret = new ArrayList<Declare>();
for (Iterator<CrosscuttingMembers> i = members.values().iterator(); i.hasNext();) {
ret.addAll(i.next().getDeclareDominates());
}
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<String> addedSinceLastDemote;
public int policy = USE_SOFT_REFS;
// Map of types that never get thrown away
- final Map /* String -> ResolvedType */tMap = new HashMap();
+ final Map<String, ResolvedType> tMap = new HashMap<String, ResolvedType>();
// Map of types that may be ejected from the cache if we need space
final Map expendableMap = Collections.synchronizedMap(new WeakHashMap());
private static Trace trace = TraceFactory.getTraceFactory().getTrace(World.TypeMap.class);
TypeMap(World w) {
- addedSinceLastDemote = new ArrayList();
+ addedSinceLastDemote = new ArrayList<String>();
this.w = w;
memoryProfiling = false;// !w.getMessageHandler().isIgnoring(Message.
// INFO);
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<ConcreteTypeMunger> typeMungers = type.getInterTypeMungers();
if (typeMungers == null || typeMungers.size() == 0) {
tMap.remove(key);
if (!expendableMap.containsKey(key)) {
demotionCounter++;
}
}
- } while (true);
+ }
if (debugDemotion) {
System.out.println("Demoted " + demotionCounter + " types. Types remaining in fixed set #" + tMap.keySet().size());
}
addedSinceLastDemote.add(key);
}
- return (ResolvedType) tMap.put(key, type);
+ return tMap.put(key, type);
}
}
*/
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);
ret = (ResolvedType) ref.get();
}
} else if (policy == USE_SOFT_REFS) {
- SoftReference ref = (SoftReference) expendableMap.get(key);
+ SoftReference<ResolvedType> ref = (SoftReference) expendableMap.get(key);
if (ref != null) {
- ret = (ResolvedType) ref.get();
+ ret = ref.get();
}
} else {
return (ResolvedType) expendableMap.get(key);
/** 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);