Bug 98079

Summary: [1.5][compiler] incorrect Bound mismatch compilation error
Product: [Eclipse Project] JDT Reporter: Jay Sachs <jaybsachs>
Component: CoreAssignee: 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:

Description Jay Sachs CLA 2005-06-02 07:24:53 EDT
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> { }
    
}
Comment 1 Philipe Mulet CLA 2005-06-02 07:51:48 EDT
It indeed feels like we are a bit too strict.
Comment 2 Philipe Mulet CLA 2005-06-02 10:48:37 EDT
New capture oriented bound check is not properly handling cases where upperbound
is a type variable.
Added GenericTypeTest#test707.
Fixed
Comment 3 Frederic Fusier CLA 2005-06-07 11:17:15 EDT
Verified for 3.1 RC2 using build N20050607-0010 + JDT/Core HEAD
Comment 4 David Audel CLA 2005-06-10 11:55:34 EDT
Verified for 3.1 RC2 using build I20050610-0010