| Summary: | [1.5][compiler] incorrect Bound mismatch compilation error | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Jay Sachs <jaybsachs> |
| Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 3.1 | ||
| Target Milestone: | 3.1 RC2 | ||
| Hardware: | Macintosh | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
It indeed feels like we are a bit too strict. New capture oriented bound check is not properly handling cases where upperbound is a type variable. Added GenericTypeTest#test707. Fixed Verified for 3.1 RC2 using build N20050607-0010 + JDT/Core HEAD Verified for 3.1 RC2 using build I20050610-0010 |
The following class compiles in javac, and in Eclipse 3.1M7, but now fails to compile in RC1 with the error message "Bound mismatch: The generic method a() of type Foo<T> is not applicable for the arguments () since the type ? extends T is not a valid substitute for the bounded parameter <U extends T>" It certainly appears to be type-safe, though I haven't read the spec to be positive. public class Foo<T> { B<? extends T> b() { return a(); } <U extends T> B<U> a() { return null; } static class B<X> { } }