Bug 82102

Summary: Should not compile related methods with different signatures but same erasures
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2005-01-03 14:25:18 EST
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 + ")");
    }
}
Comment 1 Kent Johnson CLA 2005-01-06 15:58:45 EST
Added MethodVerify test027
Comment 2 David Audel CLA 2005-02-15 13:02:03 EST
Verified in I20050214-0927