Bug 108888 - Load Time Weaving not Interoperating with Build Time Weaving
Summary: Load Time Weaving not Interoperating with Build Time Weaving
Status: RESOLVED DUPLICATE of bug 104218
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.5.0 M4   Edit
Assignee: Alexandre Vasseur CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 104218
Blocks:
  Show dependency tree
 
Reported: 2005-09-06 19:50 EDT by Ron Bodkin CLA
Modified: 2005-10-24 05:50 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ron Bodkin CLA 2005-09-06 19:50:03 EDT
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
Comment 1 Ron Bodkin CLA 2005-09-06 20:14:08 EDT
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.
Comment 2 Adrian Colyer CLA 2005-09-08 04:14:53 EDT
tagging with M4...
Comment 3 Matthew Webster CLA 2005-09-14 13:01:41 EDT
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.
Comment 4 Alexandre Vasseur CLA 2005-09-30 05:55:29 EDT
deps
Comment 5 Alexandre Vasseur CLA 2005-10-24 05:50:25 EDT
closing this one, tracking under 104218 instead

*** This bug has been marked as a duplicate of 104218 ***