Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] LTW requirements for annotation-style @Aspect s compiled with javac

AspectJ 1.6.10.  I spent some time recently trying to work out why my
annotation-style advice was only load-time weaving correctly when I used the
ajc compiler – when I compiled the advice with javac it did not weave
correctly.

I eventually found my answer in this post [1], specifically:

"Prior to AspectJ 1.6.8, the weaver would also weave any annotation style
aspects regardless - this is in order to ensure they are 'finished off'.  If
you have compiled an annotation style aspect with javac it will be
incomplete and unusable and must go through the weaver to be finished off
correctly - these aspects are not used apart 
from being 'finished off' by the weaver." ... "it will now only finish them
off if you list them in the aop.xml."

Prior to this my (incorrect) understanding was that the advice itself
wouldn't need special treatment at LTW-time - it appears this was masked by
a previous auto-annotation-search behaviour of LTW.  I added the _advice_
class (compiled with javac and assembled into a JAR together with
META-INF/aop.xml) to the <weaver> in aop.xml and voila, LTW works with the
javac compiler.

This exercise sparked the following questions for me:

1) Is the no-search and explicit weaver-need for the annotation-based advice
behaviour change in 1.6.8 mentioned anywhere in the changes docs?  I
couldn't spot it in the 1.6.8 README [2].  Might be a good one to point out
somewhere if not already noted, perhaps a FAQ entry for those using
annotation-style javac-compiled advice.
2) To me it seems like the bulk of aop.xml examples are either pre this
change, or expect non-annotation-based advice or use of the ajc compiler
(which does the advice-weaving).  I reckon most if not all examples of
aop.xml I've encountered do not include weaving directives for the advice
itself, only for the classes to be woven/advised at load-tim.  It might be
worth having such an example with a commented <weaver> inclusion for an
annotation-style javac-compiled advice.

I appreciate that many folks just use the ajc compiler and that
runtime-behaviour should be optimized for this, so I understand the
motivation for the change.

As always thanks for the great software.

Brett

[1]
http://aspectj.2085585.n4.nabble.com/How-to-debug-aspectjweaver-for-LTW-td2084056.html
[2] http://eclipse.org/aspectj/doc/released/README-168.html

-- 
View this message in context: http://aspectj.2085585.n4.nabble.com/LTW-requirements-for-annotation-style-Aspect-s-compiled-with-javac-tp3042139p3042139.html
Sent from the AspectJ - users mailing list archive at Nabble.com.


Back to the top