* be a side-effect of DNF rewriting).
*/
private void rewritePointcuts(List/*ShadowMunger*/ shadowMungers) {
PointcutRewriter rewriter = new PointcutRewriter();
for (Iterator iter = shadowMungers.iterator(); iter.hasNext();) {
ShadowMunger munger = (ShadowMunger) iter.next();
Pointcut p = munger.getPointcut();
Pointcut newP = rewriter.rewrite(p);
// validateBindings now whilst we still have around the pointcut
// that resembles what the user actually wrote in their program
// text.
if (munger instanceof Advice) {
Advice advice = (Advice) munger;
if (advice.getSignature() != null) {
final int numFormals;
final String names[];
//ATAJ for @AJ aspect, the formal have to be checked according to the argument number
// since xxxJoinPoint presence or not have side effects
if (advice.getConcreteAspect().isAnnotationStyleAspect()) {
numFormals = advice.getBaseParameterCount();
int numArgs = advice.getSignature().getParameterTypes().length;
if (numFormals > 0) {
names = advice.getSignature().getParameterNames(world);
validateBindings(newP,p,numArgs,names);
}
} else {
numFormals = advice.getBaseParameterCount();
if (numFormals > 0) {
names = advice.getBaseParameterNames(world);
validateBindings(newP,p,numFormals,names);
}
}
}
}
munger.setPointcut(newP);
}
// now that we have optimized individual pointcuts, optimize
// across the set of pointcuts....
// Use a map from key based on pc equality, to value based on
// pc identity.
Map/*<Pointcut,Pointcut>*/ pcMap = new HashMap();
for (Iterator iter = shadowMungers.iterator(); iter.hasNext();) {
ShadowMunger munger = (ShadowMunger) iter.next();
Pointcut p = munger.getPointcut();
munger.setPointcut(shareEntriesFromMap(p,pcMap));
}
}