[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Pointcut on interface rather than on class

Hi.

In  InternalOrder.update(..) do you call super.update(..) ? I think
that's what's triggering the repeated advice invocation. Note that the
execution shadow is woven inside *each* class that implements
AuthOrder.

A work-around in that case would be to use "&& !cflow(execution(*
AuthOrder.update(..)))".

Eric

On 10/12/2007, Sylvain RICHET <srichet@xxxxxxxxxxxx> wrote:
> Hi,
>
> My object hierarchy is :
>
>     Order            (Interface, with a method "update(...)")
>     AuthOrder        (class, implements "Order")
>     AuthOrderWithPWPolicy    (class, extends "AuthOrder")
>     InternalOrder        (class, extends "AuthOrderWithPWPolicy")
>
>
> In one of my Aspects, I have defined a pointcut like this :
>
>     [...]
>     pointcut updateOrderHook(Map<String,String[]> params) :
>         execution(* AuthOrder.update(..)) && args(params);
>     [...]
>
>
>
> In this case, when method "update()" is invoked on InternalOrder object,
> /*then the "code advice", attached to pointcut, is invoked 3 times !!!*/
>
>
> BUT, if i change my poincut like this :
>     [...]
>     pointcut updateOrderHook(Map<String,String[]> params) :
>         execution(* InternalOrder.update(..)) && args(params);
>     [...]
>
>     (Here, the pointcut is settled on final (leaf) object ....)
>
> ... then the "code advice" is invoked one time only.
> (this is what i want)
>
>
> So, my question is : how to deal with this ?
> Is there any way to control more precisely the pointcuts on interfaces ?
>
> Thanks in advance
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada