Chapter 11. Other Changes in AspectJ 5

Table of Contents

Declare Soft


AspectJ 5 is more liberal than AspectJ 1.2.1 in accepting pointcut expressions that bind context variables in more than one location. For example, AspectJ 1.2.1 does not allow:

       	pointcut foo(Foo foo) : (execution(* *(..)) && this(foo) ) ||
       	                                (set(* *) && target(foo));

whereas this expression is permitted in AspectJ 5. Each context variable must be bound exactly once in each branch of a disjunction, and the disjunctive branches must be mutually exclusive. In the above example for instance, no join point can be both an execution join point and a set join point so the two branches are mutually exclusive.