I just wanted to expand on Richard Relos’s we don’t really need closures in Java into a broader argument – syntax sugar is the least of what Java really needs now.
The beauty of Java the Language, IMHO, is its simplicity. Many people, including myself, coming from a C/C++ background immediately appreciate the fact that there is much, much less surprise in code written in Java. Every spoonful of syntax sugar added to the language adds to the conceptual complexity of the language, not linearly, but exponentially, as every new construct has to work well with everyone that’s already in there. On the other hand, it only makes things easier superficially. What does a closure gain us? A few lines of less typing? Or maybe just a few key strokes in any of the modern IDE’s these days?
Many people say that closures are easier to learn for beginners than anonymous classes. I wouldn’t be so sure. For instance, which one is easier: to explain to a student that that mysterious Foo$1.class is actually generated from a closure which, whilst not being a class conceptually, actually is handled as an anonymous class? or to explain to him that an anonymous class gets compiled into, well, a class?
Furthermore, should everything that makes Java easier to use make into the language? Dependency Injection/IoC Containers have become more and more widely adopted, but that doesn’t mean Java should necessarily incorporate Spring or Hivemind’s definition syntax, does it?
Some people say syntax sugar is supposed to make Java easier to use, so it can compete with RoR, .Net, etc. I agree to the goal, but not the means. IMHO, the changes that Java, especially enterprise Java, needs in order to go up against Microsoft and RoR/the whole LAMP camp have to be much, much more fundamental than throwing in several sugar cubes. EJB 3 is a good move in that direction, as Java admits that miserable mess happens when the principle of simplicity is forgotten. But there is yet a lot left to be desired, for example, until JVM starts supporting compartmental deployment, i.e., multiple applications running and managed in isolation, there is no hope for Java to become a strong offering in the Web hosting market. Unfortunately, AFAIK, JDK 7 has yet no plans of supporting that.