java - Why we call unbounded wild-card parameterized type as reifiable? -
i reading through angelikalangerdoc. reading after gap of 3 days. in earlier lesson, learnt that, arrays of unbounded wild card
allowed created. studied unbounded wild-card parameterized types called reifiable types
. when searched definition of reifiable type, states that, type type information known @ run-time called reifiable type
. picking code snippet article.
pair<?,?>[] inipair = new pair<?,?>[10];
i have following confusion in mind.
- why unbounded wild-card parameterized type called reifiable?
- in example above, how type information known?
i know it's basic question. trying refresher on track of generics. can elaborate on issue?
since java compiler replace unbounded type parameters object
.
according type erasure
to implement generics, java compiler applies type erasure to:
1.replace type parameters in generic types bounds or object if type parameters unbounded. produced bytecode, therefore, contains ordinary classes, interfaces, , methods.
2.insert type casts if necessary preserve type safety.
3.generate bridge methods preserve polymorphism in extended generic types.
the term reifiable according javadoc
a reifiable type type type information available @ runtime. includes primitives, non-generic types, raw types, , invocations of unbound wildcards.
Comments
Post a Comment