3 ms·
> If you're not careful (or if you're trying to be clever), you can insert a String into an object that had been declared to be a List<Integer> It's less about
by mscuwa 5y ago
> If you're not careful (or if you're trying to be clever), you can insert a String into an object that had been declared to be a List<Integer>
It's less about type erasure and more about missing covariance/contravariance in Java generics. Scala also has type erasure in generics (same JVM), but won't allow that (unless you explicitly upcast). HM doesn't recognize inheritance, so it's in a completely different category.