[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Is this possible with AspectJ (or AOP in general)?

Hello Ernii,

As far as I know, it is not possible for AspectJ to do weaving in JDK classes. From what you have described, I suppose what you are defining in your pointcut is something like:

public pointcut myPointcut() :
    execution(public void java.awt.Component+.paint(java.awt.Graphics));

before() :
    myPointcut() {
    ...
}

The previous will try to do weaving on the callee code, i.e., on the Swing class that, if belongs to the JDK, will not be weaved. You will only have success for your own classes extending Swing ones or calls to Swing methods that occur within your own project.

I hope this helps. Regards,

Paulo Zenida


Citando ernii <ernii_23@xxxxxxx>:


Hello,

I'm new to AOP and trying to understand wether I can do the thinks I want to
do with AOP (especially AspectJ wich seems to be the most complete solution
- and I really like eclipse ;)

I would like to add some general behaviour while painting to all swing
components that I am using in my program ... not only the onces I create in
my project.

So I tried to make a pointcut at void
java.awt.Component.paint(java.awt.Graphics) and that worked only with
classes within my project that have overriden the paint method.... is there
a way (I thought with load- or runtime weaving it should be possible) to do
that? Do I need to configure the LTW or is it just not possible?

Thanks

ernii
--
View this message in context: http://www.nabble.com/Is-this-possible-with-AspectJ-%28or-AOP-in-general%29--tf3204488.html#a8898438
Sent from the AspectJ - users mailing list archive at Nabble.com.


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users