Bug 82102 - Should not compile related methods with different signatures but same erasures
Summary: Should not compile related methods with different signatures but same erasures
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-03 14:25 EST by Markus Keller CLA
Modified: 2005-02-15 13:02 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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