I can't stand the lack of reference-to-reference in Java. In C++ I have lots of convenience functions that return a reference so I can assign to the return of the function. In Java, this is not possible |
What forbits you returning an object from a function? Returning a reference to a certain mutable part of an object is bad style and contradicts encapsulation.
Not to mention, Strings are immutable, and so are the primitive wrapper classes. |
Immutable strings are a *good thing* and only noobs think mutable strings are better.
And what's with erasure? Why would they make the language convoluted just to support legacy code...? |
Yep, erasure is ugly. But anyway, at least it allowed for implementation of covariant and contravariant generic types in Scala. Could be done better (as in C#), but it is not that bad as one might think at the beginning. Especially when 2.10 will have partially reified generics.
Real pains of Java are:
1. lack of value types support in JVM, especially for tuples (including stack allocation)
2. only partial megamorphic call site inlining
3. lack of object inlining
4. lack of all cool things that are in Scala
The first three are probably the only reasons that sometimes you can't get Java programs as fast as C or C++.
They are fixable at the JVM level, without changing the language, and as far as I know, point 2. is currently being worked on and others have some prototypical, experimental implementations (probably Excelsior's JET does these optimisations, because it was able to beat C++ on a few Great Language Shootout benchmarks). The 4. point is easily fixable: just use Scala, don't use Java.