3 ms·
if T and U don't have the same erasure the compiler will forbid the cast if they do the compiler will warn you that an List<T> to List<U> cast is naughty but
by blibble 3y ago
if T and U don't have the same erasure the compiler will forbid the cast
if they do the compiler will warn you that an List<T> to List<U> cast is naughty
but in that case the only methods you can call on it are that of the erased type anyway
in practice I don't think I've ever seen a bug as a result of this type of erasure (and I've probably worked with at least several million lines of Java)