Community
Participate
Working Groups
I20041221-0800 The compiler should not compile related methods with different signatures but same erasures. Eclipse compiles the example below without errors and prints "InvertedPair#setA(1.1)" when run. Javac says: "name clash: setA(A) in InvertedPair<A,B> and setA(A) in Pair<B,A> have the same erasure, yet neither overrides the other" public class P { public static void main(String[] args) { Pair<Double, Integer> p= new InvertedPair<Integer, Double>(); p.setA(new Double(1.1)); } } class Pair<A, B> { public void setA(A a) { System.out.println("Pair#setA(" + a + ")"); } } class InvertedPair<A, B> extends Pair<B, A> { public void setA(A a) { System.out.println("InvertedPair#setA(" + a + ")"); } }
Added MethodVerify test027
Verified in I20050214-0927