boolean isBelow;// Is this cflowbelow?
private int[] freeVars;
- private static Hashtable cflowFields = new Hashtable();
- private static Hashtable cflowBelowFields = new Hashtable();
/**
* Used to indicate that we're in the context of a cflow when concretizing if's
if (freeVars==null || freeVars.length == 0) { // No state, so don't use a stack, use a counter.
ResolvedMember localCflowField = null;
- Object field = getCflowfield(concreteEntry,concreteAspect,"counter");
+ Object field = getCflowfield(xcut, concreteEntry, concreteAspect, "counter");
// Check if we have already got a counter for this cflow pointcut
if (field != null) {
concreteAspect.crosscuttingMembers.addConcreteShadowMunger(
Advice.makeCflowEntry(world,concreteEntry,isBelow,localCflowField,freeVars==null?0:freeVars.length,innerCflowEntries,inAspect));
- putCflowfield(concreteEntry,concreteAspect,localCflowField,"counter"); // Remember it
+ putCflowfield(xcut,concreteEntry,concreteAspect,localCflowField,"counter"); // Remember it
}
Pointcut ret = new ConcreteCflowPointcut(localCflowField, null,true);
slots.add(slot);
}
ResolvedMember localCflowField = null;
- Object field = getCflowfield(concreteEntry,concreteAspect,"stack");
+ Object field = getCflowfield(xcut,concreteEntry,concreteAspect,"stack");
if (field != null) {
localCflowField = (ResolvedMember)field;
} else {
concreteAspect.crosscuttingMembers.addTypeMunger(
world.makeCflowStackFieldAdder(localCflowField));
- putCflowfield(concreteEntry,concreteAspect,localCflowField,"stack");
+ putCflowfield(xcut,concreteEntry,concreteAspect,localCflowField,"stack");
}
Pointcut ret = new ConcreteCflowPointcut(localCflowField, slots,false);
ret.copyLocationFrom(this);
}
- public static void clearCaches() {
- cflowFields.clear();
- cflowBelowFields.clear();
- }
private String getKey(Pointcut p,ResolvedType a,String stackOrCounter) {
StringBuffer sb = new StringBuffer();
return sb.toString();
}
- private Object getCflowfield(Pointcut pcutkey, ResolvedType concreteAspect,String stackOrCounter) {
+ private Object getCflowfield(CrosscuttingMembers xcut, Pointcut pcutkey, ResolvedType concreteAspect,String stackOrCounter) {
String key = getKey(pcutkey,concreteAspect,stackOrCounter);
Object o =null;
- if (isBelow) o = cflowBelowFields.get(key);
- else o = cflowFields.get(key);
+ if (isBelow) o = xcut.getCflowBelowFields().get(key);
+ else o = xcut.getCflowFields().get(key);
//System.err.println("Retrieving for key "+key+" returning "+o);
return o;
}
- private void putCflowfield(Pointcut pcutkey,ResolvedType concreteAspect,Object o,String stackOrCounter) {
+ private void putCflowfield(CrosscuttingMembers xcut, Pointcut pcutkey,ResolvedType concreteAspect,Object o,String stackOrCounter) {
String key = getKey(pcutkey,concreteAspect,stackOrCounter);
//System.err.println("Storing cflow field for key"+key);
if (isBelow) {
- cflowBelowFields.put(key,o);
+ xcut.getCflowBelowFields().put(key,o);
} else {
- cflowFields.put(key,o);
+ xcut.getCflowFields().put(key,o);
}
}
return visitor.visit(this, data);
}
- public static void clearCaches(ResolvedType aspectType) {
- //System.err.println("Wiping entries starting "+aspectType.getName());
- String key = aspectType.getName()+"::";
- wipeKeys(key,cflowFields);
- wipeKeys(key,cflowBelowFields);
- }
-
- private static void wipeKeys(String keyPrefix,Hashtable ht) {
- Enumeration keys = ht.keys();
- List forRemoval = new ArrayList();
- while (keys.hasMoreElements()) {
- String s = (String)keys.nextElement();
- if (s.startsWith(keyPrefix)) forRemoval.add(s);
- }
- for (Iterator iter = forRemoval.iterator(); iter.hasNext();) {
- String element = (String) iter.next();
- ht.remove(element);
- }
- }
}