Bug 83904 - [compiler][1.5] Y<T> should be uniquely defined in the same signature
Summary: [compiler][1.5] Y<T> should be uniquely defined in the same signature
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: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-27 23:25 EST by Olivier Thomann CLA
Modified: 2005-02-15 06:32 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 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