Bug 30612 - AbstractMethodError when runing JRE1.4 on sources compiled with AspecJ
Summary: AbstractMethodError when runing JRE1.4 on sources compiled with AspecJ
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-30 10:44 EST by jerome CLA
Modified: 2003-02-26 13:28 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jerome CLA 2003-01-30 10:44:58 EST
This problem can be reproduced easily. Here is the code:
--------------------------------------------------------------------
public interface TopInterface extends Cloneable {
    public Object clone();
}
public interface SubInterface extends TopInterface {
}
public class ConcreteClass implements SubInterface {
    public Object clone() {
	ConcreteClass clone = null;
	try {
	    clone = (ConcreteClass)super.clone();
	} catch (CloneNotSupportedException e) {
	    return null;
	}
	return clone;
    }
	
    public String toString() {
	return "Concrete Class: " + getClass().getName();
    }
}
public class  TestClass {
    public static void main(String[] args) {
	SubInterface sub = new ConcreteClass();
	SubInterface sub2 = (SubInterface)sub.clone();
	System.out.println(sub2.toString());
    }
}
---------------------------------------------------------------------------
Now compile this using AspectJ with JDK1.3.1_04 or JDK1.4.0, ANT 1.5. (my 
command line looks like this: java org.aspectj.tools.ant.taskdefs.Ajc ......)

And run the TestClass above:
- with JRE1.3.1_04 you get "Concrete Class: ConcreteClass"
- with JRE1.4.0 you get "java.lang.AbstractMethodError at TestClass.main
(TestClass.java:4)"

-----------------------------------------------------------------------------

I don't know if this is a bug in the compilation or in the VM (as it's a 
runtime problem), but I tested compiling the test with JDK javac (1.3.0_04 and 
1.4.0) and then it worked fine. So I guess this has to do with AspectJ.
Comment 1 Jim Hugunin CLA 2003-02-13 16:06:33 EST
This is a bug in the pure Java part of the compiler which almost certainly 
means that it's in the pure eclipse code that we depend on.

You should try the various eclipse code generation options for the compiler, 
such as -1.4 to see if it will generate code that is more compatible with your 
JVM.  It would also be helpful if you could search the core eclipse bug 
database to see if this is a known bug over there.
Comment 2 jerome CLA 2003-02-14 09:00:30 EST
I'm not sure I understand how the compiler depends on eclipse code, but I 
looked for that bug on eclipse as well and couldn't find anything related.
I also tried the 1.4 flag with no result. However, the ajc "-usejavac" flag 
fixed the problem (which make sense if this is a compiler issue).
Comment 3 Jim Hugunin CLA 2003-02-14 13:16:34 EST
What version of the compiler are you using?  It sounds like you're using the 
1.0.6 release of ajc -- which has no dependencies on eclipse.

Please try the latest 1.1beta4 release to see if you still have this problem.  
There are currently no resources to support the 1.0.6 release of ajc, but the 
source code is available if you want to look into the problem further.
Comment 4 jerome CLA 2003-02-24 05:56:54 EST
we tried with the 1.1beta4 release and it worked fine.
Thanks a lot.
Comment 5 Jim Hugunin CLA 2003-02-26 13:28:18 EST
It's great to see how bugs like this are fixed for us by building on the 
eclipse compiler base in 1.1.