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 <omarjave...@outlook.com> 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 method
> mergeTransmissions(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 list
> aspectj-users@eclipse.org <mailto:aspectj-users@eclipse.org>
> To change your delivery options, retrieve your password, or unsubscribe from 
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/aspectj-users 
> <https://dev.eclipse.org/mailman/listinfo/aspectj-users>
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
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