Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Is It Possible For Two PointCut To Go Infinite Loop?

Sorry this the right code:

aspect GuavaAspect{ 
        
        public boolean trackState; 
        declare precedence : GuavaAspect, *;	
        protected pointcut traceMethods() :(execution(*
junit.framework.TestCase+.*(..))&& within(com.google..*) &&
!cflow(within(GuavaAspect))); 
        protected pointcut traceMethods2() :(execution(* *(..)) &&
within(com.google..*) && !cflow(within(GuavaAspect))); 
        
        before() : traceMethods2() { 
                        if(trackState){ 
                                //do something here 
                        } 
                } 
        before() : traceMethods() { 
                Signature sig = thisJoinPointStaticPart.getSignature(); 
                String testCaseName=sig.getName(); 
                if(testCaseName.length()>=4){ 
                        String test=testCaseName.substring(0, 4); 
                        if(test.equals("test")){	
                                trackState=true; 
                        } 
                } 
        } 
        after()  : traceMethods(){ 
                trackState=false; 
                Signature sig = thisJoinPointStaticPart.getSignature(); 
                String testCaseName=sig.getName(); 
                if(testCaseName.length()>=4){ 
                        String test=testCaseName.substring(0, 4); 
                        if(test.equals("test")){	
                                try{ 
                                        //write to file 
                                } 
                                catch(Exception e){ 
                                        e.printStackTrace(); 
                                } 
                        } 
                } 
        } 
        }	

forgot to add the pointcut on com.google source package. The idea is to
track the list of methods happening inside a test case and write to a file. 



--
View this message in context: http://aspectj.2085585.n4.nabble.com/Is-It-Possible-For-Two-PointCut-To-Go-Infinite-Loop-tp4651983p4651987.html
Sent from the AspectJ - users mailing list archive at Nabble.com.


Back to the top