Community
Participate
Working Groups
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.
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.
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).
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.
we tried with the 1.1beta4 release and it worked fine. Thanks a lot.
It's great to see how bugs like this are fixed for us by building on the eclipse compiler base in 1.1.