[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-dev] if (false) pointcut and the empty set
|
Hi all,
This is a minor feature request, but something I'd like to see. Sometimes
I want to disable a pointcut in my development (essentially commenting it
out). I used to do this by making the pointcut be "if (false)" but this
creates errors for after advice when expection handlers are present:
~> /cygdrive/c/aspectj1.1.1rc1/bin/ajc -version
AspectJ Compiler 1.1.1rc1
~> cat IfFalse.java
public aspect IfFalse {
static public void main(String[] args) {
try {
throw new Exception();
}
catch (Exception e) {
e.printStackTrace();
}
}
after(): if (false) {
}
}
~> /cygdrive/c/aspectj1.1.1rc1/bin/ajc IfFalse.java
C:\Documents and Settings\Macneil Shonle\IfFalse.java:11 Only before
advice is supported on handler join points (compiler limitation)
C:\Documents and Settings\Macneil Shonle\IfFalse.java:6 Only before advice
is supported on handler join points (compiler limitation)
2 warnings
---
As a work around I create a dummy method that no one calls, and make the
point cut be calls to that method. But it seems that a special case like
if (false) should be treated like an empty pointcut. (I could also use
other versions of the empty set, such as a pointcut like call(* *.*(..))
&& !call(* *.*(..)).) Am I missing another way to say the empty set? Is
there a reason if (false) shouldn't be thought of as the empty set?
Thanks,
Macneil