Date: Tue, 11 Mar 2003 18:37:57 -0500 (EST) From: C. Scott Ananian To: jsr14-prototype-comments@sun.com Subject: Bug in interface inheritance. The attached gzipped tar file demonstrates a bug in the JSR-14 compiler version 1.3. It consists of the following java files: ------- HArrayMethod.java ------ package harpoon.ClassFile; class HArrayMethod extends HMethodImpl { public HArrayMethod() { } } ------- HMember.java ------ package harpoon.ClassFile; public interface HMember extends java.lang.Comparable<HMember> { public abstract int compareTo(HMember o); } ------- HMethod.java ------ package harpoon.ClassFile; public interface HMethod extends HMember { } ------- HMethodImpl.java ------ package harpoon.ClassFile; abstract class HMethodImpl implements HMethod, java.io.Serializable, java.lang.Comparable<HMember> { public int compareTo(HMember o) { return 0; } } ------------------- Note that HArrayMethod implements Comparable<HMember>, but not directly. When compiled as followes, the compiler gives the following error message (to reproduce, run 'make' in the directory contained in the included tgz) ---------- cananian@skiffserv:~/JSR14/JSR14BUG1$ make /home/cananian/jsr14_adding_generics-1_3-ea/scripts/javac -d . -g -source 1.5 *.java /home/cananian/jsr14_adding_generics-1_3-ea/scripts/javac -d . -g -source 1.5 HArrayMethod.java HArrayMethod.java:3: harpoon.ClassFile.HArrayMethod is not abstract and does not override abstract method compareTo(java.lang.Object) in java.lang.Comparable class HArrayMethod extends HMethodImpl { ^ 1 error make: *** [bug] Error 1 cananian@skiffserv:~/JSR14/JSR14BUG1$ ------------ Note that, in this case, the bug doesn't occur when compiling HArrayMethod with other files, only when compiling it separately. However, in the original use which this testcase was derived from exactly the opposite occured: the compiler would indicate an error *unless* the file was compiled separately. This bug appears to be quite sensitive. I hope this allows you to find and fix the bug! --scott operation nuclear operative cracking Ft. Meade Cocaine TASS terrorist class struggle Yeltsin arrangements anthrax Albanian smuggle Israel ( http://cscott.net/ ) [ Part 2, "" Application/OCTET-STREAM (Name: "JSR14BUG1.tgz") ] [ 814bytes. ]