Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Confused by cflow interaction

Keith,

I'll see if I can take a look at this over the weekend and get back to you.

Nick
On Mar 26, 2004, at 1:53 PM, SADER, KEITH D (CONTRACTOR) wrote:

Greetings,

I've been working my way through the Gradecki and Leseicki book _Mastering AspectJ_ and I've come across some confusing behavior doing a cflow example. The example I speak of is divided over pp. 111-112.

public class Flow{
    public void two() {
        System.out.println("two");
    }

    public void one() {
        two();
    }

    public static void main(String args[]) {
        new Flow().one();// shortened from the book
    }
}

My aspect is as follows from the bottom of pg. 111 to the top of pg. 112

public aspect FlowAspect {
    // renamed like the next example on pg. 112
pointcut getPrint() : call (void java.io.PrintStream.println(String));
    pointcut getTwo() : call (public void two());
pointcut matchPrint() : getPrint() && cflow(getTwo()) && !within(FlowAspect);

    before() : matchPrint() {
        System.out.println("before matchPrint");
    }

When I build this in Eclipse 2.1.3 using ajdt 1.1.4 it shows that not only does this aspect advise my Flow class, but it also advises other System.out.prinln() calls in other classes and aspects as shown in the aspect view after doing a 'Project | Rebuild All'

I would have thought that the matchPrint() joinpoint would have excluded any System.out.println() call that didn't occur within a method "two()" (two() isn't defined for any of my other classes).

What am I missing/failing to understand?

thanks,
---
Keith Sader
Nash Resources Group sub-contracting for Computer Sciences Corporation
IAD:TFAS
Tel: 816.926.3742
Email:keith.d.sader@xxxxxxxx
Technical Debt: During the planning or execution of a software project, decisions are made to defer necessary work. For example: i.) It's too late in the cycle to upgrade to the new release of the compiler. We'll do it next time around. ii.)We're not completely conforming to the UI guidelines. We'll get to it next time. iii.)We don't have time to uncruft (refactor) the hyper-widget code. Punt until next time.
http://www.c2.com/cgi/wiki?TechnicalDebt
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users




Back to the top