Generic erasure means that all type parameters are...
# android
j
Generic erasure means that all type parameters are erased to their bounds in bytecode. This means that when your bytecode is executing at runtime, your function was casting to the bound which is
Adapter<*>
. This is the type that
this.adapter
already is (so no real cast). But at compile-time the language was letting you treat it as a
T
, a subtype. That is why this cast is marked as unchecked. You tricked the language into letting you treat something as a
T
when there was no actual validation of that happening at runtime to protect you from being wrong.