Bug 83904

Summary: [compiler][1.5] Y<T> should be uniquely defined in the same signature
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Olivier Thomann CLA 2005-01-27 23:25:55 EST
The following code should not compile.

class Y<T extends Number> {
}

public class X {
    public static void main(String argv[]) {
        m(new Y<Short>(), new Y<Integer>());
    }

    public static <T extends Number> void m(Y<T> x, Y<T> y) {
    }
}

Because Y<T> has two definitions.

Replacing the method invocation of m with:
        m(new Y<Integer>(), new Y<Integer>());

compile fine.
Comment 1 Philipe Mulet CLA 2005-01-28 04:38:58 EST
I believe we infer T to be: ? extends Number
Comment 2 Philipe Mulet CLA 2005-01-28 05:08:16 EST
Actually we do infer: Y<Number&Comparable<?...>>
Comment 3 Philipe Mulet CLA 2005-01-28 10:48:01 EST
Intersection type did not play well in type argument containment check.
Added GenericTypeTest#test483.
Fixed
Comment 4 Jerome Lanneluc CLA 2005-02-15 06:32:30 EST
Verified in I20050214