It wasn’t until I started at Netflix that I had ever tried out any of the java 1.5 specific features. From a language syntax perspective, the main ones (at least the main ones that I can think of off the top of my head) are foreach, annotations, and generics. I’m not going write a long blog post about each of these features. The links on each are pretty good, and if you’d like more information, Java 5.0 Tiger: A Developer’s Notebook is a pretty concise look at the changes if you’re already experienced with java. The interesting thing will all of the changes is that all the new syntactic modifications are designed to run within a pre 1.5 JVM. This isn’t incredibly exciting, but it is interesting when considering tradeoffs you have to make in order to keep that consistency. In the end, it means that almost all of the features are just to make life easier for the programmer by adding in some compile time checks and code generation.
When I was going through the listing of java 1.5 warnings that you can enable in Eclipse, I came across the feature @override. This construct’s entire purpose is to keep track of the fact that the method it is annotating is meant to override a superclass. If you change the signature of the method in the superclass so that this method is no longer overriding it, the compiler will generate an error. This is one of those features that I kind of scratch my head about. I want to believe that it is useful and will someday prevent me from refactoring issues when I change APIs or when somebody else changes some API that I am extending, but I can’t remember a time when having this feature would have saved me any time.