top | item 18935606

(no title)

vivin | 7 years ago

One point. Type erasure in Java is actually a bad thing -- this is because generics were added after the fact, and in order to provide compatibility with older code, Java only performs those checks at compile time. In some cases, even with generics, you cannot guarantee type-safety in Java due to type-erasure -- the information is essentially unavailable at runtime.

discuss

order

dragonwriter|7 years ago

> Type erasure in Java is actually a bad thing -- this is because generics were added after the fact

I'd argue it's a bad thing for Java-the-Language, but a good thing for Java-the-Platform and it's ability to support languages with more advanced typesystems but with interop with Java language code.

chrisseaton|7 years ago

> Type erasure in Java is actually a bad thing

I think it being overall a bad thing or a good thing is a matter of opinion. There's arguments for and against erasure, even if you ignore the motivation of backward compatibility, which was a key one in that case.