annotation style binding is not great when if() pointcuts are involved. There is a compiler limitation that requires reference pointcuts to always bind variables that are used in if() pointcut support methods. This does not work:
@Aspect class Azpect {
@Pointcut("this(f) && if()") public static boolean method(Foo f) { return f.isTrue();}
@Before("method(*) && execution(* *.run(..))") public void beforeAdvice() {}
}
You are forced to bind o in the method beforeAdvice() - code style does not have this restriction. Compiling the above will give something like:
Missing binding for if() pointcut method (method). Parameter 1 (D d) must be bound - even in reference pointcuts (compiler limitation)
annotation style binding is not great when
if()
pointcuts are involved. There is a compiler limitation that requires reference pointcuts to always bind variables that are used inif()
pointcut support methods. This does not work:You are forced to bind o in the method
beforeAdvice()
- code style does not have this restriction. Compiling the above will give something like: