Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Troubles with packages and pointcuts

Hi Cyrill,

Is ContractShowCase a type with default (package only) visibility? If so, an aspect in another package can't normally see it. However, you can make the pointcut match by using a fully qualified name, e.g.,

public pointcut targetPointcut() : execution(*  x.y.z.ContractShowCase.dummyMethod(..));

Ron Bodkin
Chief Technology Officer
New Aspects of Software
o: (415) 824-4690
m: (415) 509-2895


> ------------Original Message------------
> From: Cyrill Rüttimann <ruettimac@xxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Thu, Oct-28-2004 10:06 AM
> Subject: [aspectj-users] Troubles with packages and pointcuts
>
> Hi,
> 
> I have troubles with packages. My pointcuts only advice the method if 
> the pointcut is in the same package as the advices method. I have no 
> glue why. Following my setup:
> 
> 
> Library with an abstract aspect (AbstractContractAspect). The library 
> is in the classpath of the application.
> 
> public abstract aspect AbstractContractAspect {
> 
>      /**
>       * Abstract pointcut. This pointcut has to be implemented by the 
> concrete
>       * class to advice a method call.
>       *
>       * @since 25.10.2004
>       */
>      public abstract pointcut targetPointcut();
> 
> 
> 
> 
> The application implements the abstract aspect in package x.y.aspect. 
>  From there I implement the pointcut for method xy in package x.y.
> 
> public pointcut targetPointcut() : execution(* 
> ContractShowCase.dummyMethod(..));
> 
> 
> But the method will not be adviced. I have to modify the pointuct as 
> follows:
> 
> public pointcut targetPointcut() : execution(* *.dummyMethod(..));
> 
> or place the aspect in the same package as the class with the advices 
> method. Then the first version of the pointcut work.
> 
> 
> For me, that is not the normal behaviour. Right? Any hints?
> 
> aspectj 1.2, AJDT 1.1.12
> 
> If you like, I can send you an eclipse project off list.
> 
> 
> Regards,
> 
> Cyrill
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> 



Back to the top