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,
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.
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.
compile-time error occurs.