Hi all,

I'm trying to trigger all calls/sets from an annotated parameter within a
method. Consider the following example:

public class A {

    public void foo(@MyAnno B b1, B b2){
        b1.bar();         //this should trigger
        b1.field = 42;  //this should trigger

        b2.bar();         //should not trigger
        b2.field = 42;  //should not trigger
    }
}

public class B {
    public int field;
    public void bar() {    }
}

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
public @interface MyAnno {
}


So far I have the following aspect. But of course this triggers all calls
and sets from all method parameters.

@Aspect
public class MyAspect {
    @Before("cflowbelow(execution(* *.*(..,@MyAnno (*),..))) && (call(*
*(..)) || set(* *)) && !within(MyAspect)")
    public void belowAdvice() {
        System.out.println("triggered");
    }
}

Is there any way to only trigger the calls and sets from the annotated (in
my case b1) parameter within a method (foo())?


Thanks in advance!

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

Reply via email to