Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] problems with load-time weaving

I seem to remember someone on the list having trouble with that syntax:

get(!static * (Cart||Coor||Imprime||Main).*)

try:
1. switch to code style and try it out in AJDT or on the command line
to see if you get a sensible error message
2. split up that pointcut: get(!static * Cart.*) || get(!static * Coor.*) etc

Andy.

On 04/12/2007, Hugo Sobral <hugo_sobral@xxxxxxxxxxx> wrote:
> I have the simple code:
>
>
>
> import org.aspectj.lang.JoinPoint;
> import org.aspectj.lang.annotation.Aspect;
> import org.aspectj.lang.annotation.Pointcut;
>
> @Aspect
> public abstract class dynAbstract {
>
>
>
>
>  @Pointcut
>  abstract void fieldGet();
>
>
>  @Pointcut
>  abstract void fieldSet();
>
>
>  @Pointcut
>  abstract void methodCall();
>
>
>  @after("fieldGet()")
>  public Object aroundFieldGet(JoinPoint thisJoinPoint) throws
> RuntimeException
>  {
>  System.out.println("get");
>
>
>  }
>
>
>  @after("fieldSet()")
>  public void aroundFieldSet(JoinPoint thisJoinPoint) throws RuntimeException
>  {
>  System.out.println("set");
>
>
>  }
>
>
>  @after("methodCall()")
>  public Object aroundMethodCall(JoinPoint thisJoinPoint) throws
> RuntimeException
>  {
>  System.out.println("metodo");
>  }
>
>
> }
>
>
> and the aop.xml:
>
>
> <aspectj>
>  <aspects>
>
>
>  <aspect name="dynAbstract"/>
>
>
>  <concrete-aspect name="bar" extends="dynAbstract">
>
>
>  <pointcut name="fieldGet" expression="get(!static *
> (Cart||Coor||Imprime||Main).*)"/>
>  <pointcut name="fieldSet" expression="set(!static *
> (Cart||Coor||Imprime||Main).*)"/>
>  <pointcut name="methodCall" expression="call(!static *
> (Cart||Coor||Imprime||Main).*(..))"/>
>
>
>  </concrete-aspect>
>  </aspects>
>
>
>     <weaver options="-verbose">
>
>     </weaver>
>
>
> </aspectj>
>
>
>
> and when I am running the program:
>
>
>
> public class Main {
>
>
>  public static void main(String[] args) {
>
>
>
>
>  while(true)
>  {
>
>
>  Coor p = new Coor(0.1, 0.2);
>  System.out.println(p.a);
>
>  }
>  }
> }
>
>
> it prints this:
>
>
> info AspectJ Weaver Version 1.5.2 built on Thursday Jun 29, 2006 at 15:31:04
> GMT
> info register classloader
> org.aspectj.weaver.loadtime.WeavingURLClassLoader
> info using configuration
> /Users/hugosobral/Documents/runtime-New_configuration/teste/META-INF/aop.xml
> info register aspect pt.utl.ist.dynAbstract
> info generating class 'bar'
> info weaving 'Main'
> info weaving 'Coor'
> 0.1
> 0.1
> ...
>
>
> but has you can see, it should print get between 0.1
>
>
> what is the problem?
>
>
> thanks in advance
>
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top