| Summary: | [1.5][compiler] Invalid Type Mismatch error | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Corey <corey> |
| Component: | Core | Assignee: | Srikanth Sankaran <srikanth_sankaran> |
| Status: | VERIFIED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | amj87.iitr, Olivier_Thomann |
| Version: | 3.7 | ||
| Target Milestone: | 3.7 M6 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
Srikanth, please investigate. I'm sorry, but I was incorrect in that it compiled in 1.6.0_22. This leads me to believe that it is user error, not an Eclipse bug. As you have discovered, this is the intended behavior. You may want to get hold of a good tutorial: http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf is a good one. "In general, if Foo is a subtype (subclass or subinterface) of Bar, and G is some generic type declaration, it is not the case that G<Foo> is a subtype of G<Bar>." Resolving as INVALID. Verified for 3.7M6 |
Build Identifier: 20100917-0705 Eclipse is marking as error the following: Collection<Comparable<?>> b = new HashSet<Comparable<Number>>(); The error is: Type mismatch: cannot convert from HashSet<Comparable<Number>> to Collection<Comparable<?>>. Interestingly, the following has no error: Comparable<?> a = new Comparable<Number>() { public int compareTo(Number o) { return 0; } }; Please also note that both the above snippets compile fine in 1.6.0_22. Reproducible: Always