Pure Danger Tech


Java 7 Roundup (Feb 28th)

28 Feb 2007

This is a weekly update on new Java 7 information. All information is maintained on my Java 7 page. This week I’m going to do this more in prose than in bullets. Let me know if this is a horrible mistake by flaming me mercilessly in the comments.

Future Java direction

I ran across an interesting video from JavaPolis 2006 that is an interview with the venerable Bill Venners. The video is not explicitly about Java 7 but there are several sections where he discusses language features such as a new property keyword, closures, reified generics, etc. He also is asked about whether we should break compatibility with old code at some point. All in all, this is a great video and well worth your time.

Java Modules

Yet another interesting video from JavaPolis 2006 is a presentation by Alexander Krapf on versioning in software. The presentation covers a lot of history related to SCMs and versioning and lays out the inherent problems in it. At the very end, he eventually lays out some language proposals for ways to change Java to specify versioning directly within an interface or class which are kind of interesting. Probably unlikely this will be done soon or maybe ever, but the talk as a whole is tangentially related to JSR 277 and 294, which are the Java Modules JSRs, which are slated for Java 7.

Swing Application Framework

In the Swing Application Framework world (aka JSR 296), Juxie Techknow wrote a post about the target market for SAF vs other RCP platforms. This question (particularly in comparison to NetBeans RCP) has been raised elsewhere recently and I think the differences will start to crystallize as more people start to use SAF in earnest. From what I understand, it seems that SAF is targeted at really lightweight Swing applications that need some help in framing the app and providing some really common utilities for a typical app developer (like data binding, internationalization, layout, etc). NetBeans RCP is a heavier footprint and supports medium to large apps that can benefit from a lot more structure.

Joshua Long posted some initial experience actually using the early release version of SAF and seemed to like it a lot. It’s good to see these early drops getting a little play.

Date and Time API

Jon Bruce blogged on the new date/time library (aka JSR 310) and in particular, it’s impact on JDBC.


I added a new section this week on JSR 308 Annotations on Java Types. In Java 5, annotations can be defined on classes, interfaces, fields, methods, constructors, parameters, local variables, and packages as defined in the ElementType enumeration. The JSR 308 proposal extends annotations to allow them to also be placed on any type reference (such as in variable declaration, parameters, casts, generic types, etc). In some cases, this overlaps with declaration annotations, but they can be distinguished by the ElementType of the annotation definition.

Also of interest, although not necessarily destined for the JDK itself, is JSR 305, which defines a set of annotations specifically for software defect detection. These annotations let you more precisely state the semantics of your code so that the compiler or automated tools could check those semantics and indicate warnings or errors.

Property support

Mikael Grev posted a new variation of the property change idea which also encapsulates some event handling. Personally, I see the case for first-class property support in Java to be pretty weak from a cost/benefit point of view, but then I’m not a gui guy. To me, it seems like they should do a lot more (such as integration with event handling) to be worth the language change and potential confusion involved. I think Mikael’s post had some interesting ideas that move in that direction.


Lots of interesting stuff happening in closures this week. Probably most importantly, Stephen Colebourne announced a new closure proposal</a> called First Class Methods (FCM). He characterizes the BGGA Proposal v0.5BGGA proposal</a> as attempting to support a very complete notion of closure, which is powerful but complicated. The CICE proposal really focuses on making anonymous classes more palatable. He characterizes the FCM proposal as really focusing on the idea of defining and reusing methods, the idea being that Java developers are very familiar and comfortable with the concept of a method. I find his argument compelling and the proposal to be a pretty interesting compromise that seems to fit well with existing syntax and handle a lot of common use cases well, if at some loss of the full potential power of the BGGA’s closures. There was a quick and interesting response to the FCM proposal by Rémi Forax.

On the prior proposals, Richard Relos posted on closures mostly to say that while they are interesting in Groovy, they don’t seem essential to Groovy or Java, especially considering the complexity. He was followed up by Jing Xue who basically agreed with him that closures as syntactical sugar are not worth it.

At a meta level, I’m really glad to see these different proposals playing out in public as I think whatever comes out of it at the end will be far better than what might have been created inside Sun or an expert group. My personal opinion is that there are patterns I see on a daily basis (mostly things with executing an algorithm over a collection) where the easiest thing to do is just write some fairly crappy or unnatural code. There are ways to get around that now using anonymous classes and other techniques, but usually that just doesn’t seem worth it. So, for this class of problems, I want a solution.

And I can see how using closures for this (especially something like the BGGA version) would open up a lot of power to do a whole bunch of other potentially amazing things. Generally, I’m in favor of having more powerful constructs in the language, even if the average developer will not make use of them. But, I don’t think I’m willing to have it if it is insanely complicated. So far, I’d say generics is a wash for me – nice in some cases, really painful and annoying in others. In the end, I could do without it (although if we had reification I might change my mind).

Java Kernel

InfoQ posted an article on the Excelsior JET JVM doing something similar to Java Kernel, that may be interesting.

Miscellaneous Ideas

The inimitable Bob Lee posted on debugging serialization problems and ways to improve error handling. He mentioned that he would look into getting some of his improvements into Java 7, which would be great to see.