[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Cannot catch calling super method

super calls cannot be matched with the call() pcd, execution() will match it.

From the AspectJ doc:

The join points defined by AspectJ are: Method call When a method is called, not including super calls of non-static methods.

there was a recent thread about why this is the case and discussion
about perhaps addressing it...

Andy.

On 22/06/06, Gu Dake <folklayer@xxxxxxxxxxx> wrote:

The following aspect caught "another()", but did not catch "super.another()". Anything wrong? This really does not make sense.


======================================================

package test;

public aspect MyAspect {
    pointcut catchCall(): !within(MyAspect) && call(* *.*(..));
before(): catchCall() {
    System.out.println(thisJoinPointStaticPart);
}
}

======================================================
package test;
class A {
 public void another(){
 }
}
public class B extends A {
 public void method() {
  super.another();
  another();
 }

 public static void main(String[] args) {
   new B().method();
 }}

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users