[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Advising all calls to all methods within a certain package

On Mon 23.Jun'08 at 14:46:51 -0700, Andy Clement wrote:
2008/6/23 Raffi Takvor Khatchadourian <khatchad@xxxxxxxxxxxxxxxxxx>:
On Mon 23.Jun'08 at 11:26:04 -0700, Andy Clement wrote:

Thanks for the help but this seems odd that something that can be resolved statically would require a dynamic check.

What about this:

public class A { public static void main(String []argv) { callit(new
packageOne.P()); callit(new packageTwo.Q()); // where packageTwo.Q
extends packageOne.P }

 public static void callit(P p) { p.m(); } }

and pointcut:

call(* packageOne..*.*(..))

But here packageOne is a type name and not a package name.

No, packageOne is a package name. it reads any type in package packageOne or any sub package of packageOne.

I think you want to use within() and execution() for your use case:

execution(* *(..)) && within(java.io..*)

Perhaps, but I find it somewhat frustrating that, when writing pointcut expressions, I am not able to talk about the compile time target for method calls.