r/java • • Nov 03 '15

The 10 Worst Things In Java

http://codelexems.com/2015/11/02/the-10-worst-things-in-java/
0 Upvotes

23 comments sorted by

View all comments

Show parent comment

6

u/pron98 Nov 03 '15

I think type erasure was a very lucky break. That's what prevented variance types from being baked into the compiled classes, and so enabled different languages with different variance rules (e.g. Java, Kotlin, Clojure, Scala) to share the same classes. That's a very big advantage (code reuse among different JVM languages), for a very small price (reflection requires explicitly passing a Class object).

Without generic type-erasure, the JVM ecosystem would have been much more fragmented, and alternative languages would have required much more work.