Java Reference
In-Depth Information
This is of no consequence, as it is impossible to access a member of a paramet-
sible to use a wildcard type after the keyword
new
in a class instance creation
expression.
The sole exception to the previous paragraph is when a nested parameterized
ture conversion is not applied.
4.6. Type Erasure
Type erasure is a mapping from types (possibly including parameterized types and type
variables) to types (that are never parameterized types or type variables). We write |
T
| for
the erasure of type
T
. The erasure mapping is defined as follows:
• The erasure of a nested type
T
.
C
is |
T
|.
C
.
• The erasure of an array type
T
[]
is |
T
|
[]
.
• The erasure of a type variable (§
4.4
) is the erasure of its leftmost bound.
• The erasure of every other type is the type itself.
has no parameterized types or type variables. The erasure of a constructor or method sig-
nature
s
is a signature consisting of the same name as
s
and the erasures of all the formal
parameter types given in
s
.
method, also undergo erasure if the constructor or method's signature is erased.
The erasure of the signature of a generic method has no type parameters.
4.7. Reifiable Types
Because some type information is erased during compilation, not all types are available at
run time. Types that are completely available at run time are known as
reifiable types
.
A type is
reifiable
if and only if one of the following holds:
• It refers to a non-generic class or interface type declaration.
• It is a parameterized type in which all type arguments are unbounded wildcards