Bug 71080

Summary: [1.5] Type parameter bound <E extends Enum<E>> should be allowed
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.1 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Philipe Mulet CLA 2004-07-29 10:33:27 EDT
JDTCore v_501

The following declaration should be legal.

public class X<E extends Enum<E>> {
}

however we reject it during its bound check:

Bound mismatch: The type E is not a valid substitute for the bounded parameter 
<E extends Enum<E>> of the type Enum<E>
Comment 1 Philipe Mulet CLA 2004-07-29 10:51:10 EDT
Added regression test: GenericTypeTest#test271.

Problem comes from the fact that while connecting hierarchy of E in X, its 
bound hasn't been set yet, and thus the bound check fails since E of Enum is 
expected to extend Enum<E>.
Comment 2 Philipe Mulet CLA 2004-07-29 11:18:57 EDT
Simpler testcase:

public class X<T extends XY<T>> {
}

class XY<U extends Cloneable> implements Cloneable {
}
Comment 3 Kent Johnson CLA 2004-08-26 15:49:40 EDT
Fixed now that we delay the bounds checks til after all type variables are 
resolved AND force types referenced in bounds to be connected.

See test271-273
Comment 4 David Audel CLA 2004-09-23 06:56:27 EDT
Verified in I200409240100.