Type Erasure: In some languages (Java), generic type info is removed at compile time and only checked statically — it doesn't exist at runtime. Type erasure means generic type information is removed when code is compiled. Java checks that a List<String> only holds strings at compile time, but at runtime it is just a List of objects.
This kept Java's generics compatible with older code, and avoids generating separate versions of each generic class. The cost is that you cannot ask at runtime what type a generic list was declared with, or create an array of a generic type directly.
What should you keep in mind with Type Erasure?
Other languages make other choices. C# keeps generic types at runtime, and Rust and C++ generate specialised code per type. PHP has no runtime generics at all; PHPStan and Psalm check generic annotations statically, which is effectively type erasure by design. The practical effect is that runtime checks still need to validate data coming from outside the program.
Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.