Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] AspectJ semantics with args() and || pointcuts

Hi all,

I have a small test program to play with this that is causing me
confusion:

I have a base class:

public class BC {

  public void test1(int x, int z) {
  }

  public void test2(int y, int z) {
  }

  public static void main (String[] args) {

    BC test = new BC();

    System.out.println("--test1(10,12)");
    test.test1(10,12);
    System.out.println("--test2(11,13)");
    test.test2(11,13);
  }
}

And an aspect:


public aspect Aspect {

  before (int x, int y): (args(x,y) && execution(void BC.test1(..))) ||
(args(y,x) && execution(void BC.test2(..))) {
    System.out.println("[3] x: " + x + "; y: " + y);
  }
}

And the output I get from compiling this is:

--test1(10,12)
[3] x: 12; y: 10
--test2(11,13)
[3] x: 13; y: 11

When I would expect:

--test1(10,12)
[3] x: 10; y: 12
--test2(11,13)
[3] x: 13; y: 11


Is this a bug, or semantically correct?  Is there a document that is
more detailed than the programmer's guide that covers the semantics of
pointcuts like the one above?

I'm using AspectJ Compiler 1.5.1a built on Monday Apr 10, 2006 at
10:52:04 GMT


Thanks,
ryan




Back to the top