What is happening with Java 7?

I have had conversations with fellow technologists over the past few weeks about the features we are hoping will be in Java 7. With Milestone 5 its worth installing and trying some of them out. We were mainly interested in some of the new Concurrency additions, Phasers, TransferQueue etc. Apparently there is still no JSR for Java 7 as yet.  I figured someone would have attempted a summary somewhere and dug up this excellent page: http://tech.puredanger.com/java7

There are some nice smaller language features, checkout the improved catch clause and the safe null handling. Pity that chained invocation might not make it in, that would save modifying IDE generated setters when writing builders or method chaining factories.

Chained invocation (don’t think this one is going to make it, shame!)

The proposal is for void methods to return an implicit this.

class CandleFactory{

// Void returns implicit this so the new style method is clean of a return
void setName(String name) { this.name = name; }

// The current way means I have to add "return this" to every set method.
CandleFactory setHeight(int height) { this.height = height; return this;}
Candle build() {...}

Typical use of the chained methods.
Candle candle = new CandleFactory().setName("Fred").setHeight(30).build();

There is no OSX version of Java 7 yet so I will have to install on my Linux box.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Comments are closed.