Community
Participate
Working Groups
Sample input: public class Main { public static void main(String args[]) {} } public aspect LoadTime { before() : execution(* main(..)) { System.out.println("load time weaving: running main"); } } aspect BuildTime { before() : execution(* main(..)) { System.out.println("running main"); } } In META-INF/aop.xml: <aspectj> <weaver options="-proceedOnError"/> <aspects> <aspect name="LoadTime"/> </aspects> </aspectj> ajc -Xreweavable Main.aj BuildTime.aj ajc LoadTime.aj Then: java Main produces: running main java -javaagent:...\aspectjweaver.jar Main produces: load time weaving: running main So the load-time weaving has rewoven Main and prevented the original advice from running. java
Further investigation reveals the following cause for the problem: the originally woven aspect isn't listed in the aspects section of the aop.xml file. A work-around that fixes the problem is to list the originally woven aspect there. I believe that load-time weaving HAS to honor reweavable aspects that aren't explicitly listed, rather than (silently!) stripping them out.
tagging with M4...
See bug 104218 which now ensures an error is issued in this situation and bug 95516 which will esnure the necessary aop.xml file is always generated.
deps
closing this one, tracking under 104218 instead *** This bug has been marked as a duplicate of 104218 ***