Hi Andy,
Thanks for the reply.
Yes, mergeTransmissions() has a call into it to the advice.
I removed the target and changed "after returning" to "after" advice type which 
is as follows:-                                    pointcut 
SafeSyncMap_syncCreateIter() : call(* Collection+.iterator())  && 
MOP_CommonPointCut();                      after () : 
SafeSyncMap_syncCreateIter() {                        
System.out.println(thisEnclosingJoinPointStaticPart.toString());                
     }
With this aspect, the advice still does not get called. For my understanding, I 
saw the byte code of couple of classes having the same target of a method call 
In only one case, the advice is called while for the other cases, advice code 
is not called, even though they all have the same target. 
Are there any other tests , other than verifying target of a method call? 
Regards,
Omar


From: [email protected]
Date: Mon, 18 Apr 2016 08:05:39 -0700
To: [email protected]
Subject: Re: [aspectj-users] Classes instrumented but the advice code is not    
executed.

Hi Omar,
So the method mergeTransmissions() has a call into it to the advice?  Normally 
I verify what is woven using -showWeaveInfo rather than introspecting byte 
code. Just because it is woven doesn’t mean it will be called because your 
advice may have caused pre-conditions to be inserted for anything that could 
not be statically determined when matching your pointcut.
For example there may be places where we cannot tell if the target of the call 
is a Set at compile time, so for the ‘target’ component of your pointcut a test 
will be inserted into the code that verifies if the target is a Set, and if it 
is then we may call the advice (The call(..) component may be inserting other 
tests).
Break your pointcut down into pieces to help you understand it - for example 
remove that target (and the associated mapSet handling) - does the advice then 
get called? If so it is because the collection being operated on is not a Set.
cheers,Andy

On Apr 18, 2016, at 1:51 AM, Omar Javed <[email protected]> wrote:Hi, I 
am using AspectJ version 1.8.9  and I am using the following aspect to 
instrument classes in dacapo-benchmark (avrora).   import java.util.*; aspect 
BaseAspect {pointcut notwithin() :!within(sun..*) &&!within(java..*) 
&&!within(javax..*) &&!within(com.sun..*) &&!within(org.apache.commons..*) 
&&!within(org.apache.geronimo..*) &&!within(net.sf.cglib..*);} public aspect 
UnionJoinPointsAspect {pointcut MOP_CommonPointCut() : !adviceexecution() && 
BaseAspect.notwithin();                pointcut SafeSyncMap_syncCreateIter(Set 
mapSet) : (call(* Collection+.iterator()) && target(mapSet)) && 
MOP_CommonPointCut();after (Set mapSet) returning (Iterator iter) : 
SafeSyncMap_syncCreateIter(mapSet) 
{System.out.println(thisEnclosingJoinPointStaticPart.toString()); }} When 
dumping with AspectJ weaver using (<dump> with beforeandafter options in 
aop-ajc.xml). I could see the class being instrumented e.g. 
avrora.sim.radio.Medium$BasicArbitrator  and the aspect is woven in 
methodmergeTransmissions(avrora.sim.radio.Medium$Receiver, java.util.List, 
long, int) but  advice code (which is the reflective information) cannot be 
seen in the output, which only shows the following:-  ===== DaCapo 9.12 avrora 
starting =====execution(boolean 
org.dacapo.harness.Benchmark.validate(String))===== DaCapo 9.12 avrora PASSED 
in 1874 msec =====execution(void 
org.dacapo.harness.Benchmark.postIterationCleanup(String)) Regards,
Omar 
 _______________________________________________aspectj-users mailing 
[email protected] change your delivery options, retrieve your 
password, or unsubscribe from this list, 
visithttps://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users                          
          
_______________________________________________
aspectj-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to