/* testing the "if" pointcut */ public class aif { public static int x = 0; public static boolean stop = false; public static void main(String[] args) { while(!stop && x<1000) x++; System.out.println("loop stoped when x got to "+x); } // main } aspect weridloop { before() : execution(void aif.main(..)) && if (aif.x>=0) { System.out.println("x is now "+aif.x); aif.stop = true; } } /* Don't use "if (aif.x>=10)" by itself - you'll get an overflow error. Use it in conjunction (&&) with some signature based point cut. The variable whose value is being tested does not have to be static. You can also do ... target(a) && (if a.x>=10) ... */