Home > JDK 7 With Danny Coward > JDK 7 With Danny Coward

JDK 7 With Danny Coward



Just recently we had a post about Java versions, and timely SDN has given us a precious insight into JDK 1.7. As Ed Ort candidly speaks to Danny Coward about the venture, Danny reveals few of the new functionalities that will be incorporated in JDK 1.7.


Vodpod videos no longer available.


Guest Host/Blogger: Ed Ort, Senior Staff Information Engineer, Sun Microsystems
Guest: Danny Coward, Chief Architect for Client Software at Sun Microsystems
August 20, 2009


SDN Quotes:

Learn about some of the new and cool features in the next release of the Java Development Kit, JDK 7. In this Deep Dive, Danny Coward, Chief Architect for Client Software at Sun Microsystems, highlighted some of the significant new features in JDK 7. Some of these features focus on modularizing the JDK, supporting non-Java languages at the VM level, and making developers more productive through various small changes to the Java languages. Danny backed up this discussion with some code examples and demonstrations.


Few prominent features of JDK 1.7:

  • Modularization
  • Multi-language on JVM
  • New garbage collector
  • NIO.2 File System API’s
  • Swing application framework


Danny Coward articulates that there hasn’t been much change to the java language since 2004, and ever since then, there have been lot of proposals for certain modifications. The concept modularization is introduced in JDK 1.7 straight from Sun’s Project Jigsaw. The intention of which was to package JDK into modules for better management and performance.


Jigsaw Quotes:

The JDK is big—and hence it ought to be modularized. Doing so would enable signi?cant improvements to the key performance metrics of download size, startup time, and memory footprint.

Java libraries and applications can also bene?t from modularization. Truly modular Java components could leverage the performance-improvement techniques applicable to the JDK and also be easy to publish in the form of familiar native packages for many operating systems.


Modularity is being introduced into JDK 1.7 with an intention to clean up the problems with versioning and classpath to a considerable extent. The following example is self-explanatory of how useful this can be.


Example excerpt:-

Declaring that a class belongs to a module:

module M;

package P;

public Class Foo {..}

Defining a module in a module-info.java file:

Module M @1.0{

requires N @2.1; // N module of 2.1 version

requires L @0.5; // L module of 0.5 version


Class Foo is declared to belong to package P and module M. module M has to be defined with a version in another .java file. In the above example, module M is defined as version 1.0 and it uses the packages that are defined in module N with version 2.1 and module L with version 0.5. This allows us to be certain of the version that has to be used.

JDK 1.7 is including features from another Sun’s Project Coin such as enhanced for loop, exception handling, null-safe operations and switch statements.


Project Coin Quotes:

The goal of Project Coin is to determine what set of small language changes should be added to JDK 7.


Typical present day if/else condition:

String animal = “dog”;



} else if(animal.equals(“cat”)){



Using JDK 1.7 switch statements:

The switch construct now is being used with bytes & primitive types, but with JDK 1.7 switch can be used with String / Objects as shown below:-

String animal = “dog”;


case “dog” : takeForWalk(animal);

case “cat” : feedMilk(animal);



Typical present day exception handling:

If a code throws multiple exception types that do not belong to the same hierarchy, then it had to be caught separately as shown below:-



}catch(IOException e){


}catch(SQLException e){



Exception handling in JDK 1.7:

But in JDK 1.7, feature is such that with a logical “|”, we can catch different exception types of different hierarchies in a single statement, making the code lot cleaner and efficient.



}catch(final IOException | SQLException e){




Typical present day null-safe check:

Typically, we first check if an object is null, if not then invoke methods on it, as shown below.

Object anObject;






Null-safe check in JDK 1.7:

In JDK 1.7, null-safe check happens in a single line of code. If anObject is null, then “nothing” is assigned to anObject, else .toString() method is invoked on it.

String s = anObject? .toString() ?: “nothing”;

On a lighter note, “?:” is also called “Elvis operator”. Find out why so from Danny in the discussion.

Coming to NIO.2 API, this introduces new FileSystem API, File Notifications, Directory Operations and asynchronous I/O to name a few. NIO was first introduced in JDK 1.4. The API is enhanced to deal with the present day demand and expectation from File API’s which certainly seems very promising and handy.

The anticipating feature of bulk directory search and listeners to FileSystem changes in JDK 1.7 is well explained in the discussion. So, no longer does any developer has to deal with code-intensive, complex, multi-threaded File operations but instead use NIO.2 API which internally performs all the complicated functionalities like deep directory searches and listeners to FileSystem changes such as creation / deletion etc.

Swing application framework, is another interesting feature that will be eagerly awaited by many swing developers as it provides enhanced API to enable utmost ease of front-end development. For example:- A Date Picker (Calendar), which most of the times is developed using JavaScript, will be available in the API for ready use.

An insight into other important features such as the new garbage collector and VM enhancements is also discussed. Danny suggests to try out the available API from downloadable preview release to get hands on JDK 1.7 even before it is released. Refer to links below for useful information and downloads.

According to Danny Coward, JDK 1.7 is foresighted to be released in coming March 2010. Well, we have to wait after all!






Note: Refer to other posts in Java category for further knowledge.


  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: