Bug 76720

Summary: [1.5] Implementing generic bounded subinterface causes Bound mismatch error
Product: [Eclipse Project] JDT Reporter: Dave Latham <eclipse.org>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Dave Latham CLA 2004-10-20 20:15:03 EDT
Got this error on 3.1M2, using jdk1.5.0rc
The code below causes this error, "Bound mismatch: The type M is not a valid
substitute for the bounded parameter <M extends MyClass> of the type A<M>"

public class MyClass {}
public interface A<M extends MyClass> {}
public interface B<M extends MyClass> extends A<M> {}
public class C implements B<MyClass>

Note - it works fine if you change class C to:
public class C implements A<MyClass>
Comment 1 Philipe Mulet CLA 2004-10-21 08:07:58 EDT
Cannot reproduce in latest. It compiles ok.
Comment 2 Dave Latham CLA 2004-10-28 14:29:37 EDT
I verified that this does now compile correctly in N20041028.  However, it works
only on a clean build.  Taking the same example as above, start with:

public class C

Let it compile with automatic compilation.  Then change it back to:

public class C implements B<MyClass>

And it will give the same error as before.  Telling it to do a clean build makes
the error go away, though, which is much nicer than before.
Comment 3 Philipe Mulet CLA 2004-10-28 16:00:44 EDT
Thanks for reopening, will investigate the incremental scenario.
Comment 4 Philipe Mulet CLA 2004-10-29 07:59:41 EDT
Added GenericTypeTest#test358
Comment 5 Philipe Mulet CLA 2004-10-29 09:34:08 EDT
There was a problem in our lazy resolution of type variable super types.
When forcing resolution, they were bypassed.

Implemented required support in BinaryTypeBinding#resolveType.
Fixed
Comment 6 Dave Latham CLA 2004-11-01 17:01:20 EST
Works nicely in N20041101 on full or incremental build.  Thanks!
Comment 7 David Audel CLA 2004-11-02 10:55:30 EST
Verified for 3.1M3 with build I20041101