[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Behavior of wultiple proceeds on the same jp but different argument values

Hi all, 

 I came across some weird behavior. I have an aspect with one pcd and a 
 bunch of around advice on that pcd. e.g. 

 aspect Test { pointcut pc(A n, A current): call(* A.method(A)) && args(n)
                                  && target(current);
                                  

          void around(A n, A current):pc(n,current){ 
             System.out.println("around 1");
             System.out.println("advice first arg "+ n.x);
             System.out.println("advice second arg "+ current.x);
             System.out.println("");
             proceed(current,n);
             }

  // the same advice as the one above is copied over each time reversing 
  //the values passed to proceed e.g. proceed(n,current) everytime 

  My A object has an integer field x. I have the receiver with x=0 and the 
  argument to the method "method(A)" with x = 1. 

  I expected to see a sequence of interleaving 0's and 1's. However I only 
  see the switch after 2 advice 

  I get 1,0,0,1,0,1,1,0,1,0,0,1,0,1 ... 

  So the switch happens after 2 pieces of advice get to execute. Is this 
  correct ? 

  Thanks

  -- Theo
  PS. The code is attached 

Attachment: madvice.tar.gz
Description: Binary data