Bug 112476

Summary: "declare parents" does not work with bytecode weaving
Product: [Tools] AspectJ Reporter: Alessandro Di Bella <aldib>
Component: CompilerAssignee: Andrew Clement <aclement>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2    
Version: DEVELOPMENT   
Target Milestone: 1.5.0RC1   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
test case none

Description Alessandro Di Bella CLA 2005-10-13 09:44:09 EDT
1. download and unpack http://www.fuurou.org/downloads/aspectjtest.zip (I 
couldn't find a way of attaching it) 
2. copy the aspectj jars into the lib directory 
3. run ant 
 
The ant file executes both source code and byte code weaving and then it 
veryfies that the class hierarchy was changed. As you can see from the output 
in case of source weaving the test is: 
 
[java] Is [class lib.C] subcass of [class weaved.SuperC]? true 
 
while when weaving bytecode: 
 
[java] Is [class lib.C] subcass of [class weaved.SuperC]? false
Comment 1 Alessandro Di Bella CLA 2005-10-13 09:47:09 EDT
Created attachment 28234 [details]
test case

Same as http://www.fuurou.org/downloads/aspectjtest.zip, I did	not see the
attachment option before
Comment 2 Andrew Clement CLA 2005-10-28 07:15:44 EDT
fix available.
Comment 3 Andrew Clement CLA 2005-11-02 11:19:11 EST
i think I put that comment in the wrong bug - let me double check.
Comment 4 Andrew Clement CLA 2005-11-04 05:51:31 EST
something funny is going on.

There is a bug, and I've fixed it - but I couldnt recreate it with the ANT
build.xml as-is.  When I run the ant script, I get the same output as you:

[java] Is [class lib.C] subcass of [class weaved.SuperC]? false

However, the reason it says 'false' is that this command:

<java classname="weaved.SuperC">
        <classpath>
                <path refid="aspectj.classpath"/>
                <pathelement path="${classes.dir}"/>
                <pathelement location="${dist.dir}/weaved-lib.jar"/>
        </classpath>
</java>

puts classes ahead of weaved-lib in order to find weaved.SuperC - and for some
reason 'classes' still contains lib/A.class lib/B.class and lib/C.class - when
they should have been deleted earlier.  When the old version of lib/C.class is
loaded from classes, it reports that its new parent isnt SuperC.  

The bug was incorrectly modifying super calls - we omitted the package name if
the new parent was in a package which caused a hideous verifyerror.  If you want
to see the verifyerror, change the order in the task above to:

        <classpath>
                <path refid="aspectj.classpath"/>
                <pathelement location="${dist.dir}/weaved-lib.jar"/>
                <pathelement path="${classes.dir}"/>
        </classpath>

I've put tests in the suite for this - but I'm not going to spend time debugging
the ant any further.  I've no idea why the javac task that is told to compile
src/weaved/* also compiles src/lib/*...

fix checked in.
Comment 5 Andrew Clement CLA 2005-11-05 05:40:27 EST
fix is available.