Hi, > My objective is to find all the method calls which are in the control flow of > HelloWorld.main(). But I'm not interested in the method calls related to any > types in the package java.lang.*
> pointcut methodTracker(): > cflow(helloWorldTracker()) > && !within(java.lang..*) && !within(HelloWorldTracer); First, you need to scope your pointcut so that it catches calls and not everything else (all the other join point kinds): pointcut methodTracker(): call(* *(..)) && cflow(helloWorldTracker()) && !within(java.lang..*) && !within(HelloWorldTracer); Now you say you aren't interested in calls to java.lang, so lets add that: pointcut methodTracker(): call(* *(..)) && !call(* java.lang..*(..)) && cflow(helloWorldTracker()) && !within(HelloWorldTracer); That would seem to do what you want, calls to anything apart from calls to java.lang. Andy On 18 October 2011 07:46, Dinesh Kumar <vdineshme...@gmail.com> wrote: > I have captured my problem in the following sample code. HelloWorld class is > my source which needs to be instrumented by HelloWorldTracer aspect. My > objective is to find all the method calls which are in the control flow of > HelloWorld.main(). But I'm not interested in the method calls related to any > types in the package java.lang.* (eg: java.lang.StringBuilder). > > package com.abc; > > public class HelloWorld { > > public static void main(String args[]) { > StringBuilder str = new StringBuilder(); > str.toString(); > Sample.testMethod(); > } > } > > package com.abc; > > public class Sample { > > public static void testMethod() > { > StringBuilder str = new StringBuilder(); > str.toString(); > } > > } > > > public aspect HelloWorldTracer { > > pointcut helloWorldTracker() : > execution(* com.sybase.HelloWorld.main(..)) && within(com.abc..*) > && !within(HelloWorldTracer); > > pointcut methodTracker(): > cflow(helloWorldTracker()) > && !within(java.lang..*) && !within(HelloWorldTracer); > > Object around(): methodTracker() > { > > System.out.println("Inside advice..." + > thisJoinPointStaticPart.getSignature().toString() ); > Object o = proceed(); > return o; > } > > } > > Using the poincuts mentioned above the type StringBuilder is also getting > adviced even though !within(java.lang..*) has been explicitly specified in > methodTracker() pointcut. I also tried !within(java.lang.StringBuilder) and > !executoin(String java.langStringBuilder.toString(..)) as well, but in vain. > Any help in restricting the types from java.lang..* from getting adviced > will be appreciated. > > > _______________________________________________ > aspectj-users mailing list > aspectj-users@eclipse.org > https://dev.eclipse.org/mailman/listinfo/aspectj-users > > _______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org https://dev.eclipse.org/mailman/listinfo/aspectj-users