Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] execution join points and overridden methods

I'm a bit surprised by this behavior (from ajc 1.2):

public class A1 {
  public void f() {
    System.out.println("A1.f()");
  }
}

public class A2 extends A1 {
  public void f() {
    System.out.println("A2.f()");
  }
}

aspect A {
  before(): execution(void A1.f()) {
    System.out.println("before A1.f()");
  }
  before(): execution(void A2.f()) {
    System.out.println("before A2.f()");
  }
}

public class Test {
  public static void main(String[] args) {
    A2 a2 = new A2();
    a2.f();
  }
}

Output:

before A1.f()
before A2.f()
A2.f()

Why does the A1.f() execution pointcut match if that method is not executed?

--dougo@xxxxxxxxx


Back to the top