Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] CFlow semantic and help

some more thoughts came later.

I think the stateful aspect proposed doesn't solve the problem, which probably i badly explained.

The fact is that i'd like to catch EXACTLY a single execution of a(), followed by a single execution of b()
followed by a single execution of c().

With the enum type proposed, i would catch AB*C (expressed with regex-similar notation).

some non-deterministic automa (multi-threading?) parsing a stack maybe fit my need.

Suggestions?

Thanks,
Valerio

Kevin Viggers ha scritto:

Hi Valerio,

The boolean expression used in the if pointcut can (to quote the quick reference):

"... only access static members, variables bound in the same pointcut, and thisJoinPoint forms."

In your case the use of aspectOf() should do the trick.


        after(): a() && if(aspectOf().state==State.initial) {
            this.state = State.matchedA;
        }

        after(): b() && if(aspectOf().state==State.matchedA) {
            this.state = State.matchedB; // <<< must be B
        }

        after(): c() && if(aspectOf().state==State.matchedB) {
            this.state = State.matchedC; // <<< must be C
        }





Back to the top