Skip to main content

[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)?

Paulo Alexandre Corigo Zenida wrote:
> 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() {
>     ...
> }

This is perfectly possible by exposing the rt.jar to the weaver and add
the woven classes to the bootclasspath. Adding methods to
java.lang.String? No problem, works fine. :)
However it is mostly _impractical_, because of licensing restrictions and
the need to control the VM startup otions. The first may not be a problem
for much longer, but the second problem makes weaving JDK classes useless
for libraries or anything based on service containers (OSGi, "J2EE"). It
would be wicked cool if the OSGi-AOP integration would eventually allow
this, maybe someone from the team can chime in?

-h



Back to the top