Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] This operator and pointcut negation doubts

> In fact !publicCallsAndCallers(*) allows me to reuse pointcuts with
> parameters denied.
> However my first problem persists. Shouldn't "publicCallsAndCallers" be
> capturing all of the pointcuts in the first place?

Note that a pointcut this(foo) only matches if the executing object is of type Foo (assuming that foo is declared as type Foo). So this(..) does matching and binding both at the same time! (the same holds for target and args and for the variables bound by after-returning advice)

pointcut publicCallsAndCallers(Object caller): call(public * *.*.*(..)) && this(caller) && !within(Doubts);

This point cut matches whenever "this", i.e. the executing object (the actual runtime type, not the declared type) is of type Object. This is indeed always the case - with one exception: calls made from static methods, because there is no caller object and hence, this(Object) (which is the "matching part" of this(caller)) will not match.

Even if you use publicCallsAndCallers(*) you are just ignoring the variable binding, *not* the matching part. Hence, it will still match no static calls.

Cheers,
Eric

--
Eric Bodden
Sable Research Group, McGill University
Montréal, Québec, Canada






Back to the top