LingPipe and JDK 7


[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:

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:

This includes Project Coin, which involved changes to the language itslef. These are summarized nicely with examples at:

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.

LingPipe Compatibility

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:

And also a very nice discussion with great examples here:

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.

3 Responses to “LingPipe and JDK 7”

  1. JDK7 Project Coin Primer - Dhruba Bandopadhyay Says:

    […] to LingPipe for linking to this […]

  2. Dean Jones Says:

    The Lucene project has issued an advisory to people not to use Java 7 until some bugs around loop optimisation have been fixed.

    It’s surprising that Oracle went ahead with the release, or at least didn’t switch these optimisations off by default.

    • Bob Carpenter Says:

      Gadzooks. Thanks for the heads up. I’m adding a warning at the top of the post.

      Is this going to be a problem for some of the JDK 6 versions? I thought they were backporting optimizations from version 7.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: