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:

  1. a primitive type (such int) //understood
  2. a nonparameterized class or interface type (such number, string, or runnable) // why
  3. a parameterized type in type arguments unbounded wildcards (such list<?>, arraylist<?>, or map<?, ?>) // why
  4. a raw type (such list, arraylist, or map) // why
  5. an array component type reifiable(such int[], number[], list<?>[], list[], or int[][]) // why

a type not reifiable if 1 of following:

  1. a type variable(such t) // why
  2. a parameterized type actual parameters (such list<number>, arraylist<string>, or map<string, integer>) // why
  3. a parameterized type bound (such list<? extends number> or comparable<? 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

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -