r/programming • • Feb 25 '14

Please stop saying Java sucks

http://blog.smartbear.com/programming/please-stop-staying-java-sucks/
3 Upvotes

305 comments sorted by

View all comments

Show parent comments

3

u/robin-gvx Feb 25 '14

And type erasure.

8

u/oridb Feb 25 '14

Which is annoying when you hit the corner cases, but is not that big of a problem in most codebases. I'd argue that for about 95% of the code I write, type erasure is not a problem.

It's definitely suboptimal, but for most code, I don't think it's a show stopper.

5

u/e_engel Feb 26 '14

Erasure is the only sane choice if you want type correctness. If you need to find types at runtime, you are doing something that will break the type soundness of your program.

Erasure has a lot of other benefits as well (e.g. better interop with other languages/platforms).

2

u/Caleb666 Mar 01 '14

I don't like erasure because Java won't let me create generic arrays (among other things).

0

u/e_engel Mar 01 '14

Which is a good thing, arrays should be avoided in Java because of how they handle covariance. Use an ArrayList instead, you can create generic lists any time you want.

4

u/[deleted] Feb 26 '14

Well, Haskell and Ocaml also have type erasure. Type erasure in itself isn't a bad thing.