Community
Participate
Working Groups
if the constant is: private static final boolean enabled = false; and the pointcut is public foo(): execution(* *(..)) && if(enabled); then we should do enough analysis of the reference to enabled to know not to weave, particularly as this is the recommended way to turn off aspects.
Not entirely trivial due to the body of the if being processed as a real method (given the name if_XXX). However, I've implemented this now - for both FALSE (so we never weave) and TRUE (so we always weave and don't even call the if). I had to add some information to the serialized form of an if pointcut, but luckily the bit flag had 2 spare bits I could use to represent this.