Two small caveats here: you can advise
reflective calls but you need to advise calls to java.lang.reflect.Method.invoke
instead of the calls to the called type (and you need to do some runtime work
to figure out which calls match). I also would say that whatever code has the
join point (shadow) is the “code to be advised” but I’d agree
if you said “method to be advised.”
Ron
From:
aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of doug.gschwind@xxxxxxxxxxx
Sent: Monday, March 12, 2007 12:57
PM
To: aspectj-users@xxxxxxxxxxx;
aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users]
[Newbie] Difference between "call" and"execution" pointcut
types
The difference lies in how the advised code is woven.
For the execution pointcut type, the code being advised must be woven.
Meaning the bytecode for the affected classes/methods in
com.mycompany.webservices.impl..* will need to be modified by the AspectJ
compiler from what straight javac would otherwise produce.
For the call pointcut type, the client code calling the code to be
advised must be woven. Meaning the bytecode for clients of
com.mycompany.webservices.impl..* must be woven, where again the client
bytecode is modified by the AspectJ compiler from what straight javac would
otherwise produce.
Additionally, if you are trying to advise code that is called
reflectively, you will need to use an execution pointcut type and weave
appropriately, as the call pointcut type just won't detect those invocations.
-------------- Original message --------------
From: "Joshua White" <gemini929@xxxxxxxxx>
What is the difference between the "call" and
"execution" pointcut types? Is there different Signature
requirements for each?
When I use the following:
execution(*
com.mycompany.webservices.impl..*(..) throws java.rmi.RemoteException);
I can advise the classes without a problem. However, when I
use:
call(*
com.mycompany.webservices.impl..*(..) throws java.rmi.RemoteException);
The actuall call gets skipped. What's the difference between
the two?
Regards,
Joshua