JDK-6193815 : Restrictions on declaration of type variables
Type:Bug
Component:specification
Sub-Component:language
Affected Version:5.0
Priority:P5
Status:Closed
Resolution:Fixed
OS:os_x
CPU:generic
Submitted:2004-11-11
Updated:2014-02-26
Resolved:2011-07-21
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
The JLS doesn't specify any restrictions on the order of declaration of type variables.
###@###.### 2004-11-11 04:04:34 GMT
Comments
EVALUATION
JLS 8.1.2, 9.1.2, 8.4.4 and 8.8.4 impose no restrictions on the order. But it is worth specifying that cycles are not allowed in the subtype relation for type variables:
(Either in 4.4, or exploded out into 8.1.2 et al for each sort of generic entity.)
"Within the type parameter list of a generic class or interface, or the formal type parameter list of a generic method or constructor, the bound of a type variable T under the transitive subtyping relation for type variables in the list may not include T except in the type argument list of a parameterized type."
This permits T extends Foo<? extends T> as well as T extends Foo<T>.