[Update: 29 July 2011: Thanks to Dean Jones for pointing out that our friends at Lucid Imagination have found a deal-breaking bug in the initial JDK 7's optimization of loops. Here's the scoop from the source:
- Lucid Imagination: JDK 7 Bug Report
In any case, we won't be using any of the JDK 7 features in LingPipe until JDK 6 is retired.]
Oracle (seems odd to say that) just released version 7 of the Java developers kit, aka JDK 7.
What’s in JDK 7?
I haven’t been following what was going into JDK 7. I found this comprehensive list of changes:
- Java.net: JDK 7 Features
This includes Project Coin, which involved changes to the language itslef. These are summarized nicely with examples at:
- Dhruba Bandopadhyay: JDK 7 Project Coin Primer
There were also changes to add module structure, some concurrency changes, some new I/O (nio) changes, support for Unicode 6 in internationalization, support for the latest XML, a new version of JDBC, a bunch of changes to Swing, and some changes to things like cryptography that I didn’t even know were in Java in the first place.
The good news is that LingPipe seems to work just fine with Java 7. At least all of our unit tests pass.
There are a couple new compiler warnings. Variable list arguments (i.e., varargs) and generics don’t play nicely together. This should be obvious from the fact that varargs use an array and you can’t have generic arrays. So now I get very menacing error messages like
warning: [unchecked] Possible heap pollution from parameterized vararg type E
I’m a bit surprised they didn’t add this warning earlier, as it seems like a well understood and commonly made mistake. There’s a nice discussion of the underlying problem due to type erasure and arrays here:
- Oracle: Non-Reifiable VarArgs Type
And also a very nice discussion with great examples here:
- Angelika Kalanger: (Java) Generics FAQ
From Kalanger’s discussion, I realized everywhere I got these errors was actually safe as the arrays in question didn’t persist beyond the scope of the function body where the user couldn’t get at them.