aspect initialization { // the following advice forces the initial value of ax to be 1, being // careful to not apply it to recursive calls int around(int n, int ax) : call(int base.fact(int,int)) && args(n,ax) && !withincode(int base.fact(int,int)) { return proceed(n,1); } int around(int a, int b) : call(int base.fib(..)) && args(int,a,b) && !withincode(int base.fib(..)) { return proceed(1,1); } } /* an alternative way to write the above advice is: int around (int n, base b) : call(int base.fact(int,int)) && !withincode(int base.fact(int,int)) && !within(initialization) && args(n,..) && target(b) { return b.fact(n,1) } The "target" pointcut picks out the object that the call to fact was invoked on. */