We just recently caught wind of some proposed “extensions” to Java under JSR-666. One of them in particular had us all laughing and that was the yoda keyword. Here’s example code showing how this new keyword would be used:

yoda (UnsupportedEncodingException) {
    String s = new String(byteArray, "UTF-8");
}

I didn’t quite get it until I read this post. The purpose of the yoda keyword is to tell Java to “do or do not” when there is no corresponding try.

Another gem from JSR-666 is a new exception of type undetermined until it is first accessed, appropriately named a SchrödingerException (the umlaut is required, by the way). Even more silly extensions seem to be converging under JSR-666 just in time for April.

Still, at least one of these, the yoda keyword, is actually semi-inspired by a Ruby idiom and there is a serious standing proposal to add closures to Java in an upcoming version (7, perhaps?). Java 5 saw the introduction of generics as well. All of this makes me think that maybe the proposed JSR-666 extensions are some kind of profound statement about the danger of trying to constantly add hot new features from other up-and-coming languages (like Ruby) to Java. I found generics to be a very welcome addition to the Java language but there were some hiccups in the implementation, especially where backwards compatibility with “raw” (un-templated) types was involved.

What do you think? Are these funny extensions just an elaborate joke or are they a profound statement about the current state of Java as a programming language?

Tags: , , ,