Java Reference
In-Depth Information
Two reference types are the same run-time type if:
• They are both class or both interface types, are defined by the same class loader,
and have the same binary name (§ 13.1 ) , in which case they are sometimes said to
be the same run-time class or the same run-time interface .
• They are both array types, and their component types are the same run-time type
(§10).
4.4. Type Variables
A type variable is an unqualified identifier used as a type in class, interface, method, and
constructor bodies.
A type variable is declared as a type parameter of a generic class declaration (§ 8.1.2 ) ,
generic interface declaration (§ 9.1.2 ) , generic method declaration (§ 8.4.4 ) , or generic con-
structor declaration (§ 8.8.4 ) .
TypeParameter:
TypeVariable TypeBound opt
TypeBound:
extends TypeVariable
extends ClassOrInterfaceType AdditionalBoundList opt
AdditionalBoundList:
AdditionalBound AdditionalBoundList
AdditionalBound
AdditionalBound:
& InterfaceType
The scope of a type variable declared as a type parameter is specified in § 6.3 . Every type
variable declared as a type parameter has a bound . If no bound is declared for a type vari-
able, Object is assumed. If a bound is declared, it consists of either:
• a single type variable T , or
• a class or interface type T possibly followed by interface types I 1 & ... & I n .
It is a compile-time error if any of the types I 1 ... I n is a class type or type variable.
The erasures (§ 4.6 ) of all constituent types of a bound must be pairwise different, or a
compile-time error occurs.
Search WWH ::




Custom Search