Difference in Intercepting method-call

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Difference in Intercepting method-call

Omar Javed

Hi Andy,

I am having an issue in understanding why one of the method call is intercepted and why the other is not. In the first case, for pointcut definition, all method calls to hasNext is intercepted which also intercepts "hasNext" method whose object is of type "org.apache.fop.fo.FONode$FONodeIterator"

The  hierarchy is:-

public interface FONodeIterator extends ListIterator{


Now the aspect code is as follows:-

pointcut HasNext_hasnext(Iterator i) : (call(* Iterator.hasNext()) && target(i));

after (Iterator i) : HasNext_hasnext(i) {

//advice code


Similarly, consider following as the second case, pointcut intercepting "put" method, but it does not intercept "put" method whose object is of type ConcurrentMap 

Code is :- 

pointcut UnsafeMapIterator_updateMap(Map map) : (call(* Map.put*(..))  && target(map));

after (Map map) : UnsafeMapIterator_updateMap(map) {

//advice code


If I use subtype pattern e.g. call(* Map+.put*(..), then ConcurrentMap.put method-call will also be intercepted. This just confuses me even more, because if subtype pattern is used to intercept all methods in class or subtype of it,then I don't understand why in the first case "org.apache.fop.fo.FONode$FONodeIterator.hasNext" is intercepted. I have also used -showWeaveInfo to confirm the behaviour.



aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit