Community
Participate
Working Groups
Using latest, I can compile that code successfully, but it should report a name clash. public enum X { ; public int compareTo(Object o) { return 0; } }
I20041208-1200: I guess this is the same problem: Eclipse compiles without error and makes all m(..) override. Javac 1.5.0 spits errors (inline comments). package override2; public class Override2 { public static void main(String[] args) { A a= new A(); B b= new B(); C c= new C(); a.m(new Integer(1)); b.m(new Integer(2)); // c.m(new Integer(3)); // after uncommenting, javac says: // reference to m is ambiguous, both method m(java.lang.Object) in override2.B // and method <E>m(E) in override2.C match a= b; a.m(new Integer(11)); a= c; a.m(new Integer(12)); b= c; b.m(new Integer(21)); } } class A { public <E extends Object> void m(E e) { System.out.println("A: " + e); } } class B extends A { public void m(Object e) { System.out.println("B: " + e); } } class C extends B { // javac says: name clash: <E>m(E) in override2.C and m(java.lang.Object) in // override2.B have the same erasure, yet neither overrides the other public <E extends Object> void m(E e) { System.out.println("C: " + e); } }
Reworked our name clash detection. Added MethodVerify test035
Verified in I20050215-2300