Why following types are reifiable& non-reifiable in java?

Sun/Oracle says the reason is combo of:

  • Need: compile time type checking is sufficient
  • Code size: avoid STL-like code bloat
  • Performance: avoid type checking at runtime that was already done at compile

Type erasure ensures that no new classes are created for parameterized
types; consequently, generics incur no runtime overhead.

In short, 1-5 are reifiable because they simply remain the same types as specified in the code so there is no type information lost/erased, but 6-8 will lose type information during compilation (the stuff between the <>) so can’t be accessed at runtime.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)