Type Erasure

Noun · Development

Definitions

  1. The compile-time removal of generic type information so that the runtime operates on raw types. Java's approach to generics — List<String> and List<Integer> become the same List at runtime. Simplifies backwards compatibility but prevents runtime type inspection and causes subtle gotchas.

    In plain English: When the compiler removes type details from generic code so the program can't tell the difference at runtime.

    Example: "You can't do instanceof List<String> in Java because of type erasure — the generic parameter doesn't exist at runtime."

Related Terms