generics - Why following types are reifiable& non-reifiable in java? -
in computing, reification has come mean explicit representation of type—that is, run-time type information.
oracle tutorials says ,
a reifiable type type type information available @ runtime. includes primitives, non-generic types, raw types, , invocations of unbound wildcards.
non-reifiable types types information has been removed @ compile-time type erasure — invocations of generic types not defined unbounded wildcards.
a type reifiable if 1 of following:
- a primitive type (such
int) //understood- a nonparameterized class or interface type (such
number,string, orrunnable) // why- a parameterized type in type arguments unbounded wildcards (such
list<?>,arraylist<?>, ormap<?, ?>) // why- a raw type (such
list,arraylist, ormap) // why- an array component type reifiable(such
int[],number[],list<?>[],list[], orint[][]) // why
a type not reifiable if 1 of following:
- a type variable(such
t) // why- a parameterized type actual parameters (such
list<number>,arraylist<string>, ormap<string, integer>) // why- a parameterized type bound (such
list<? extends number>orcomparable<? super string>) // why
why 2,3,4,5 reifiable , 6,7,8 non-reifiable?
you ask google same question:
reifiable type
when use generics, of time, compile-time type information lost. @ run time, program knows reference is reference sort of object. if type information known @ run time, type called reifiable. perhaps day generics redesigned types reifiable.
Comments
Post a Comment