[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Confused by cflow interaction - totally new confusion
|
> 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 middle 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 getOne() : call (public void one());
pointcut matchPrint() : getPrint() && cflow(getTwo() && getOne()) && !within(FlowAspect);
before() : matchPrint() {
System.out.println("before matchPrint");
}
}
Now I actually am confused by the cflow pointcut vs. the visualizer :-) With the example above, I'm not seeing the before advice executed as I would expect from the text. I.e. when I look at the console I expect to see:
before matchPrint
two
and I just see
two
It seems like the cflow(getTwo() && getOne()) isn't working to bind the advice to execution flow that I'm trying to describe. What am I missing?
thanks,
Keith S.