Spot on, thanks. I was just trying to do it using cflow but had mis-placed the args pcd.
Adrian Colyer-2 wrote: > > The args pcd matches against the argument at the join point. For a > call join point, that's always the call being made. > > You can use cflow to solve this problem though: > > pointcut executionOfBaseMethod(ArgClass a, ArgClass b) : > execution(private static Z X.m1(ArgClass, ArgClass)) && > args(a,b); > > pointcut callsToYFromPrivateBaseMethod(ArgClass a, ArgClass b) : > call(* Y.*(..)) && > cflow(executionOfBaseMethod(a,b); > > If you want only calls directly withincode of the base method you can > further restrict with by adding: > > && withincode(private static Z X.m1(..)) > > to the callsToYFromPrivateBaseMethod pointcut defined above. > > If you want the arguments as passed in to the base method execution, > *and* the arguments passed on the call to Y you can write: > > pointcut callsToYFromPrivateBaseMethod( > ArgClass m1a, ArgClass m2b, ArgClass ya, ArgClass yb) : > call(* Y.*(..)) && > args(ya,yb) && > cflow(executionOfBaseMethod(a,b); > > etc. > > Regards, Adrian. > > > On Tue, Feb 13, 2007 at 04:35:28AM -0800, bora.erbas wrote: >> >> I felt like I should add some more details. >> This is the problem I need to solve: >> In a specific (private static) method call of a class (e.g. X.m1) I need >> to >> list all the calls which has a target class of some type (e.g. Y). >> But at the same time I need to capture the arguments to X.m1(arg1, arg2) >> as >> well. But when capturing the arguments for the X.m1 the captured calls to >> class Y are also confined to the calls with the same type/order of the >> arguments of X.m1. So I want to list all calls to the methods of class Y >> with any arguments. Is this possible using AspectJ constructs? >> >> pointcut withinPrivateBaseMethod(ArgClass a, ArgClass b) : >> withincode(private static Z X.m1(ArgClass, ArgClass)) && >> args(a, b); >> >> pointcut allCallsToYFromPrivateBaseMethod(ArgClass a, ArgClass b) : >> withinPrivateBaseMethod(a, b) && >> call(* Y.*(..)); >> >> >> So this has the problem I mentioned above. >> Any ideas? >> Cheers. > > -- > Adrian Colyer > CTO > Interface21 Limited > http://www.interface21.com > > Registered in England and Wales: No. 5187766 Registered Office: Summit > House, 2-2A Highfield Road, Dartford, Kent, DA1 2JY, UK > > E-mails should be checked by the recipient to ensure that there are no > viruses and Interface21 does not accept any responsibility if this is > not done. Any views or opinions presented are solely those of the > author and do not necessarily represent those of Interface21. > > > > > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > > -- View this message in context: http://www.nabble.com/Re%3A-Capture-args-with-withincode-and-call--tf3220855.html#a8945281 Sent from the AspectJ - users mailing list archive at Nabble.com. _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
