Thank you very much for your answer - A last question, is it necessary to have 2 separated and distincts files for binary weaving, because as you have seen with the Worbench, the aspectJ classes and the source code are into the same project (WAR) and ultimely inside the same EAR. So in our case it would be : ajc -aspectpath workbench.jar -inpath workbench.jar -outjar workbench2.jar
Thank you in advance - JA De : Andy Clement <[email protected]> A : [email protected] Date : 2012-05-08 20:52 Objet : Re: [aspectj-users] Differences and impacts between .aj classes vs Java class with AspectJ annotation Envoyé par : [email protected] Hi, The only docs we really have are more on how-to-use-it rather than the trade offs: http://www.eclipse.org/aspectj/doc/released/adk15notebook/ataspectj.html The two styles are called code-style (using the real AspectJ keywords) and annotation-style (using the annotations). > When we use @annotations, do we need to compile with the AspectJ compiler ? > or the Javac compiler call the AspectJ compiler ? When you use the annotation style, the code remains 'pure java' and so you can build it with javac. However, this does not cause the weaver to be invoked, so the aspects are only built they are not applied/woven. The AspectJ weaver is a bytecode based weaver. Regardless of which style you use (code or annotation), they will be compiled to binary form before the weaver applies them. So, basically, I'm saying that choosing annotation style still needs the weaver to be run at some point, and there are two options: - after running javac to build the source, do a binary weave with the AspectJ compiler: ajc -aspectpath compiledAspects.jar -inpath codeToBeWoven.jar -outjar wovenCode.jar - use loadtime weaving, the weaver will run as the code is loaded and the aspects will be woven into their targets. > When a project is compile with the aspectJ compiler, do we need a runtime ? > and by Annotation? It seems that using annotation means Load-time weaving > and it requires 2 jars (aspectJ runtime and the weaver). It that true ? For either style the final woven code will have dependencies on aspectjrt.jar - this small jar contains the runtime dependencies (like the implementation of 'thisJoinPoint'). And yes, for loadtime weaving, you will initially need the weaver itself, which is aspectjweaver.jar, and that can be run as a javaagent. Andy _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
