Actually, you already did this. The problem is just that AJDT don't have the 
ability to show the match of cflow correctly. As Eric said, cflow need to be 
determined dynamically during the run-time, but AJDT cannot predict exactly 
what happens in the run time, so it marks all possible points which are 
possible in the cflow of the pointcut, which may confuse you.

Try run the following code, you will see you did right and AJDT did wrong.

package controlFlowPointcutsExamples;

public class Test {
        static void add() {
        }
        
        public static void main(String[] args) {
                System.out.println("before foo");
                foo();
                System.out.println("after foo");
        }

        static void foo() {
                System.out.println("execution foo");
                add();
        }
}

package controlFlowPointcutsExamples;

public aspect TestAspect {
        pointcut fooPC() : execution(void 
controlFlowPointcutsExamples.Test.foo());

        before() :
           cflow(fooPC())
           && !within(TestAspect)
    {
                System.out.println("before cflow execution(void 
controlFlowPointcutsExamples.Test.foo()). JoinPoint: " + thisJoinPoint);
        }
}


--
Dehua (Andy) Zhang
Sable Research Group, McGill University
Montréal, Québec, Canada
http://www.cs.mcgill.ca/~dzhang25





-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Chrys
Sent: Wed 5/30/2007 17:25
To: [email protected]
Subject: Re: [aspectj-users] Problems with cflow in eclipse
 

So what can i do to correct that so that it doesn't match anywhere? I want
that pointcut to match anything that is in the control flow of foo().



Eric Bodden-2 wrote:
> 
> Well, all you are saying is 1.) advise *everything* that is not within
> TestAspect but 2.) only if it is in the control flow of fooPC(). The
> latter (2.) requires a runtime check because AJDT does not perform a
> control flow analysis for obvious reasons. Hence, from a static
> (compile-time) point of view this pointcut could match anywhere.
> 
> Eric
> 
> On 28/05/07, Chrys <[EMAIL PROTECTED]> wrote:
>>
>> Hello. I am using eclipse 3.2.2 and ajdt1.5.4. I have the following
>> problem
>> with cflow.
>> Example:
>>
>> package controlFlowPointcutsExamples;
>>
>> public class Test
>> {
>>         public static void main(String[] args)
>>         {
>>                 foo();
>>         }
>>
>>         static void foo()
>>         {
>>
>>         }
>> }
>>
>>
>> package controlFlowPointcutsExamples;
>> public aspect TestAspect
>> {
>>         pointcut fooPC() : execution(void
>> controlFlowPointcutsExamples.Test.foo());
>>
>>          before() :
>>                 cflow(fooPC())
>>                 && !within(TestAspect)
>>                 {
>>
>>                 }
>>
>> }
>>
>> When i try the above example eclipse goes crazy and the before() advice
>> advises join points in other classes and other packages aswell. Am i
>> doing
>> something wrong?
>> --
>> View this message in context:
>> http://www.nabble.com/Problems-with-cflow-in-eclipse-tf3830336.html#a10843762
>> 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
>>
> 
> 
> -- 
> Eric Bodden
> Sable Research Group
> McGill University, Montréal, Canada
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Problems-with-cflow-in-eclipse-tf3830336.html#a10882960
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


_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to