On Feb 13, 2008, at 10:00 AM, [EMAIL PROTECTED] wrote:
Greetings,
I am trying to put a joinpoint on a java.util.ArrayList class.
But on runtime the advice is never executed.
Did I miss something, or is it simply impossible to put a joinpoint
on a Java API class ?
Here is my aspect code :
pointcut grouik() : get(* java.util.ArrayList.*);
after() returning() : grouik() {
System.out.println("grouik");
}
This join point attempts to call reads of any fields of an ArrayList
object. If that's what you meant, by default, AJ won't insert advice
in JDK classes. This was primarily because of Sun's licensing
restrictions about modifying the byte code of the JVM and libraries.
There are workarounds documented on the net. The licensing restriction
is more or less going away since Java is transitioning to open source.
However, if you meant "match all field reads in my classes of type
ArrayList", it would be
pointcut grouik(): get (java.util.ArrayList ...*.*)
(The three dots mean: ".." any packages, arbitrarily deep + "." the
usually package separator - before the first "*" for matching any
class/interface)
Hope that helps.
dean
Thanks in advance.
Laurent Delaforge
Attention:
L'integrite de ce message n'etant pas assuree sur Internet, les
societes du groupe ODDO ne peuvent etre tenues responsables de son
contenu. Ce message et les eventuels fichiers attaches contiennent
des informations confidentielles. Au cas ou il ne vous serait pas
destine, nous vous remercions de bien vouloir le supprimer et en
aviser l'expediteur.
This message and the files that may be attached to it contain
confidential information. The ODDO group may not be held responsible
for their contents, whose accuracy and completeness cannot be
guaranteed over the internet. If the message is not addressed to
you, kindly delete it and notify the sender.
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Dean Wampler, Ph.D.
dean at objectmentor.com
http://www.objectmentor.com
See also:
http://www.aspectprogramming.com AOP advocacy site
http://aquarium.rubyforge.org AOP for Ruby
http://www.contract4j.org Design by Contract for Java5
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users