Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] cflow joinpoint confusion

Can you provide a running example?

offhand, if you really mean

> I would like to capture the call to Test2.returnInt() 
> from the function Test.callx() 

then do this:

from: int around() : cflow(exec()) && callx() 
  to: int around() : exec() && callx() 
i.e., int around() : withincode(int callx()) && call(int returnInt())

Without a working code sample, I can't tell if you're using
recursion.  For that, see the FAQ entry on using cflow to 
pick out the topmost recursive call.

hth - Wes

------------Original Message------------
From: Irum Godil <softwarengineer2004@xxxxxxxxx>
To: "AJDT USER" <aspectj-users@xxxxxxxxxxx>
Date: Sun, Jan-30-2005 1:41 PM
Subject: [aspectj-users] cflow joinpoint confusion
Hi, 

I have the following code structure:

 public class Test {
     public static int callx() {
        return Test2.returnInt();
     }
     
     public static int callAgain() {
        returnTest2.returnInt();
      }
} 


public class Test2 {
     public static int returnInt() {
         return 2;
     }
}

I would like to capture the call to Test2.returnInt() from the function Test.callx() For that I wrote the following pointcuts and advice:

pointcut exec() : withincode(public static int callx());
pointcut callx() : call(public static int returnInt());
    
    int around() : cflow(exec()) && callx() {
        System.out.println("Passed around it");
        return -1;
    }
Since I am doing cflow(exec()) && callx() I would assume that only one call to "returnInt()" i.e. the one inside function "callx()" would be captured. But AspectJ captures both the calls to "returnInt( ) " i.e the one in "callx( )" and in "callAgain( )". 
Can someone please tell me what am I doing wrong and how can I capture only one pointcut i.e. the one inside of callx( ). 
Thanks a lot in advance for all your help. 
Irum Godil. 



Do you Yahoo!?
Yahoo! Mail - You care about security. So do we. 




Back to the top