Java News from Friday, April 28, 2006

Sun has submitted JSR-294, Improved Modularity Support in the Javatrade; Programming Language. In brief this proposes a change in Dolphin (Java 7) to enable modules that sit between package and public access. The idea is that some classes would be essentially public to other classes in the same module, but private to everyone else. I'm not sure I'm explaining it well, but think of it as friend functions for Java. However this is very much something that Java has needed for years. The lack of it has meant that public access is vastly overused and consequently much java software is far less stable and more fragile than it should be. I am skeptical of the claim that this will require VM level changes rather than simply language level additions. Surely if inner classes and generics did not require VM level changes, this proportionately smaller change shouldn't either?

Kent Beck and David Saff have released JUnit 4.1. Version 4.1 is a big fix release. Most notably, "The @RunWith annotation is now inherited by subclasses: all subclasses of an abstract test class will be run by the same runner."

JUnit 4 takes advantage of Java 5 features like annotations, varargs, and generics to simplify unit testing still further. If you're committed to Java 5, then JUnit 4 is big leap forward. Unfortunately while JUnit 4 is backward and forwards compatible with JUnit 3 test suites and test runners, it's completely incompatible with Java 1.4 and earlier so I'm afraid most of us will be sticking with JUnit 3 for some years to come.