Bug 98079 - [1.5][compiler] incorrect Bound mismatch compilation error
Summary: [1.5][compiler] incorrect Bound mismatch compilation error
Status: CLOSED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.1 RC2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-02 07:24 EDT by Jay Sachs CLA
Modified: 2005-06-10 11:55 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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