http://abc.comlab.ox.ac.uk/cgi-bin/bugzilla/show_bug.cgi?id=20
Summary: around and || in pointcuts
Product: abc
Version: unspecified
Platform: Other
OS/Version: Linux
Status: NEW
Severity: major
Priority: P3
Component: AspectJ compiler
AssignedTo: abc-bugs@comlab.ox.ac.uk
ReportedBy: Oege.de.Moor@comlab.ox.ac.uk
Around advice doesn't work properly in the presence of disjunction in the pointcut. In
the example program below, there are three pieces of advice. The first has a disjunction
in it; the second and third just write out the two disjuncts separately. The output we get
is
>pickup
<pickup
>combined
>drop
<drop
<combined
whereas it should have read:
>combined
>pickup
<pickup
<combined
>combined
>drop
<drop
<combined
That is, the combined pointcut should match whenever either of the disjuncts match.
However, as the above example shows, it only works when the second disjunct matches.
ajc compiles and runs this program fine.
It would be nice if this were fixed soon, as this idiom is used all over the place in the
practical assignment I am preparing.
---------------------------------------
aspect Aspect {
void around(Ant a) :
call (void Command.step(..)) &&
(target(PickUp) || target(Drop)) &&
args(a)
{
System.out.println(">combined");
proceed(a);
System.out.println("<combined");
}
void around(Ant a) :
call (void Command.step(..)) &&
target(PickUp) && args(a)
{
System.out.println(">pickup");
proceed(a);
System.out.println("<pickup");
}
void around(Ant a) :
call (void Command.step(..)) &&
target(Drop) && args(a)
{
System.out.println(">drop");
proceed(a);
System.out.println("<drop");
}
}
class Ant {}
abstract class Command {
public abstract void step(Ant a);
}
class PickUp extends Command {
public void step(Ant a) {}
}
class Drop extends Command {
public void step(Ant a) {}
}
public class AltAround {
public static void main(String[] args) {
Command c1 = new PickUp();
Command c2 = new Drop();
Ant a = new Ant();
c1.step(a);
c2.step(a);
}
}
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
Received on Wed Sep 22 18:49:18 2004
This archive was generated by hypermail 2.1.8 : Wed Sep 22 2004 - 22:00:02 BST