Skip to main content

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

Hi -

> OK, thanks.  Actually, it looks like A1.f() only matches if there is
> actually an f() defined in A1; otherwise you'd have to use A1+.f().
> Is that right?  

Yes.

> Is this specified somewhere in the language semantics
> (or any other docs)?

The programming guide, semantics appendix is typically laconic:

  At a method execution join point, the signature [is] a method 
  signature whose qualifying type is the declaring type of 
  the method.

So in our example, the declaring type is A1. (I should have said 
"declared in A1" rather than "defined in A1"; though both are true, 
declare is what matters.)  Same result if A1 were an interface.  

Wes

> ------------Original Message------------
> From: Doug Orleans <dougo@xxxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Sun, Aug-15-2004 8:39 PM
> Subject: Re: [aspectj-users] execution join points and overridden methods
>
> Wes Isberg writes:
>  > This has been the behavior since (at least) AspectJ 1.0.
>  > 
>  > In this code
>  > 
>  > > public class A1 { public void f() {} }
>  > > public class A2 extends A1 { public void f() {} }
>  > 
>  > the method-signature 'void f()' is defined in A1 and 
>  > overridden in A2.  So 
>  > 
>  >    execution(void A1.f())
>  > 
>  > will pick out any f() implemented in A1 or any subclass of A1.
>  > We did it this way to satisfy the Liskov substitution principle, 
>  > so advice on a method also works for any implementation of it.
>  > If A2 did not extend A1, then the pointcut would not match.
>  > 
>  > To define a pointcut for lexical per-class behavior, use
>  > && within(A1).
> 
> OK, thanks.  Actually, it looks like A1.f() only matches if there is
> actually an f() defined in A1; otherwise you'd have to use A1+.f().
> Is that right?  Is this specified somewhere in the language semantics
> (or any other docs)?
> 
> --dougo@xxxxxxxxx
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 




Back to the top