In computing, reification has come to mean an explicit representation
of a type—that is, run-time type information.
oracle tutorials says ,
A reifiable type is a type whose type information is fully available
at runtime. This includes primitives, non-generic types, raw types,
and invocations of unbound wildcards.
Non-reifiable types are types where information has been removed at
compile-time by type erasure — invocations of generic types that are
not defined as unbounded wildcards.
A type is reifiable if it is one of the following:
- A primitive type (such as
int
) //understood
- A nonparameterized class or interface type (such as
Number
, String
, or Runnable
) // why
- A parameterized type in which all type arguments are unbounded wildcards (such as
List<?>
, ArrayList<?>
, or Map<?, ?>
) // why
- A raw type (such as
List
, ArrayList
, or Map
) // why
- An array whose component type is reifiable(such as
int[]
, Number[]
, List<?>[]
, List[]
, or int[][]
) // why
A type is not reifiable if it is one of the following:
- A type variable(such as
T
) // why
- A parameterized type with actual parameters (such as
List<Number>
, ArrayList<String>
, or Map<String, Integer>
) // why
- A parameterized type with a bound (such as
List<? extends Number>
or Comparable<? super String>
) // why
Why 2,3,4,5 is reifiable and 6,7,8 as non-reifiable?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…