Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 126914

Summary: [1.5][compiler] extraneous bound mismatch error
Product: [Eclipse Project] JDT Reporter: Maxime Daniel <maxime_daniel>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Maxime Daniel CLA 2006-02-08 09:55:29 EST
Build id: I20060131-1200

The following test case raises a bound mismatch error for X into Y declaration (all source in a single file):

X.java [
interface I<T extends J<T,U>, U extends I<T,U>> {
    // empty
}
interface J<T extends J<T,U>, U extends I<T,U>> {
    // empty
}
abstract class X<T, U> implements J<X<T, U>, Y<T, U>> {
    // empty
}
final class Y<T, U> extends X<T, U> implements I<X<T, U>, Y<T, U>> {
    // empty
}

Bound mismatch: The type X<T,U> is not a valid substitute for the bounded parameter <T extends J<T,U>> of the type I<T,U>

However, inverting X and Y declarations in the source file gets it to compile.

See GenericTypeTest #903 and 904.
Comment 1 Philipe Mulet CLA 2006-02-10 05:44:33 EST
Feels like one bound check occurs before some hierarchy is connected.
Comment 2 Philipe Mulet CLA 2006-02-10 05:47:51 EST
Also see javac bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6218229
Comment 3 Nicole Rauch CLA 2006-02-28 05:52:11 EST
I get the same error msg for the following code (Platform: Mac OS X, Version: 3.1.2):

interface Observer<SType extends Subject<? extends Observer<SType>>> {
}
class Subject<OType extends Observer<? extends Subject<OType>>> {
}

The exact message is:

Bound mismatch: The type ? extends Observer<SType> is not a valid substitute for the bounded parameter <OType extends Observer<? extends Subject<OType>>> of the type Subject<OType>

(and then a similar message for the second declaration). Does this have the same reason?
Comment 4 Kent Johnson CLA 2006-04-12 14:59:27 EDT
These problems were fixed with the changes for bug 115918 and bug 81949

Will enable tests in GenericTypeTest
Comment 5 Maxime Daniel CLA 2006-10-11 03:53:46 EDT
Tests are enabled.