<< March 31, 2009 | Home | April 2, 2009 >>

Java VIII

Following Apple's lead in switching from positional to roman notation in version numbers, Sun announced today that the successor to the upcoming Java 7 will be called "Java SE VIII" instead of "Java SE 8". The announcement also revealed some of the new features that are planned for this version. I will summarize the most important ones:

Syntax extensions

The new "intrude" statement provides convenient access to an object's private members. Here is a usage example:
    Object x;
intrude (foo) {
x = foo.privateMethod();
}
Outside the block, the variable x can be used just as if it had been assigned from a regular public method. This results in much shorter code than the old technique of using "java.lang.reflect" to accomplish the same thing. To circumvent possible abuses of this new feature, it is recommended that any sensitive private data is stored as RFC4648-encoded text strings wrapped in XML documents that encrypt the data according to the W3C XMLENC-CORE standard.

New annotations

In response to the increasing demands for higher programmer productivity, a new annotation is provided that makes it easier to get away with quick-and-dirty code:
    @Shameless
public void foobar() {
...
}
When this annotation is used, the -Xlint option to javac will be completely disabled during compilation of the annotated code block. Also, some "slack" will be allowed for indexing outside array bounds. Exactly how much slack there will be has not yet been finalized, but the intent is that the programmer should never have to worry about trivial fence-post errors.

Memory management

New state-of-the-art memory management. For environmental reasons, garbage data will in the future be viewed as a valuable local resource rather than "waste" that has to be managed and removed by a centralized service. Traditional garbage collection has been deprecated in Java VIII and in its place there is an assertion-based API contract that forces all consumers of heap objects to recycle used objects back to their producers. This is technically done via a new signature for the "java.lang.Object.notifyAll" method.

All this is very exciting, and I am looking forward to the planned alpha release of Java VIII which is preliminary scheduled for April 1, MMXI.