Bug 71080 - [1.5] Type parameter bound <E extends Enum<E>> should be allowed
Summary: [1.5] Type parameter bound <E extends Enum<E>> should be allowed
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M2   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-29 10:33 EDT by Philipe Mulet CLA
Modified: 2004-09-23 06:56 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 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.