I have come up with the following pointcut that I use for tracing method entry/exit. It's not broken and also does what I want but: 1- I find it looks clumsy or could be more elegant; and 2- I don't know if it is bulletproof.
// tracing the execution of all methods except:
// - toString and descendants
// - methods identified with @NotTraced and descendants
pointcut theMethod() :
within(*.*) &&
!within(tracing.*)
&& execution(* *(..))
&& !adviceexecution()
&& !cflow(adviceexecution())
&& !execution( String *.toString() )
&& !cflow(execution( String *.toString() ))
&& !execution( @NotTraced * *(..) )
&& !cflow(execution( @NotTraced * *(..) ));
Any thoughts?
It is far more complicated than it needs to be.
I would split it up into two parts:
You can then use an
&&
to have the two pointcuts in the same aspect.This way you can have more flexibility, in case you need to use one of these elsewhere.
I would start off very simple, and use AJDT in Eclipse, to monitor what joinpoints are being affected, to have the minimum needed to get what you wanted.
Now, it seems you have redundancy here, for example
!adviceexecution()
and!cflow(adviceexecution)
, as you have cflow and execution repeated in three different places.AJDT will be your friend here, as it is hard to tell exactly what you may be excluding that you want, for example.
Keep it very simple, to avoid any unwanted effects.