[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ews.eclipse.technology.aspectj] Re: Is there any usage like the following in AspectJ?

The short answer is no ;).

However, I'm also struggling to understand your intended semantics. A pointcut is a member of a class or aspect (declared using the pointcut keyword). Join points are the things that pointcuts match, and join points are runtime entities.

The pointcut expression:

execution(A.method1()) && within(B)

will match the execution join point for the method method1() defined in the type B, assuming that B extends A directly or indirectly.

The pointcut

cflow( execution(A.method1()) && within(B) )

matches a join point in the control flow of the execution of B.method1(), including the execution of B.method1() itself.

So:

if ( exists ( cflow( execution(A.method1()) && within(B) ) ) )

matches any join point, iff it can be statically determined that there is at least one join point matched by the pointcut expression "cflow( execution(A.method1()) && within(B) )" ?? (is that what you intended?).

Without making whole program assumptions (and thus prohibiting separate and incremental compilation) this would be impossible to implement. It would be very hard even with a whole program assumption. (cflow is the primary source of difficulty - if the pointcut expression inside an "exists" was restricted to the same subset of pcds as declare warning and error the problem becomes much more tractable once more).

Regards, Adrian.

Zifu Yang wrote:
pointcut mypointcut(): execution(A.method1()) && if (exists(cflow(execution(A.method1()) && within(B)))

My question is about the "exists". Is there any way to know if some pointcut exists or not when defining
the pointcut?
My intention is that I want to generate execution(A.method1()) depending on if cflow(execution(A.method1()) && within(B)) exists.


As we know, "thisJoinPoint" can give us some useful information.
But I really hope there is some usuage model for getting information from any join point,not only for thisJoinPoint in an
advice block.
for example, mypointcut().getXXXXX().