Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Call pointcut and inhteritance

Hi andrew,

 Thanks for the answer!

All the best,
Henrique

On Tue, Mar 23, 2010 at 11:57 AM, Andrew Eisenberg <andrew@xxxxxxxxxxxx> wrote:
If you could use execution instead of call, then the solution would be
easy.  One of the main reasons to use call pointcuts is to take
advantage of polymorphic calls as below.  When you don't want to do
that, you could do something like:

pointcut callMeth() : execution(public void A.m()) && within(A);

Of course, this will not work with call joinpoints.  And
unfortunately, I can't think of a clean way of doing what you want.

2010/3/22 Henrique Rebêlo <hemr@xxxxxxxxxxx>:
> Hi all,
>
> Consider the following simple hierarchy:
>
> class A { public void m() {} }
> class B extends A { public void m() {} }
> class C extends B { public void m() }
>
> along with the simple call pointcut
>
> pointcut callMeth() : call (public void A.m());
>
> The call pointcut callMeth() will match any call to A.m() but it includes
> all m's calls in subtypes of A.
>
> The question is: Is there a straightforward solution to avoid matches in
> subtypes of A (and without using any special variable such as
> thisJoinPointStaticPart)?
>
> I know that we can explicitly eliminate all descendants of A:
>
> pointcut callMeth() : call (public void A.m()) &&
>                              !call (public void B.m()) &&
>                              !call (public void C.m()) ;
>
> but, Is there another way?
>
>
> Kind Regards,
> Henrique
>
>
> --
> ...............................................................................................................................
> Henrique Rebelo
> http://www.cin.ufpe.br/~hemr
> Informatics Center, UFPE, Brazil
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



--
...............................................................................................................................
Henrique Rebelo
http://www.cin.ufpe.br/~hemr
Informatics Center, UFPE, Brazil

Back to the top