Martin @ Blog

software development and life.


JDK 7: new developments

Java 7: new developments and rumours

As promised in my last post, I will write some more on the Java 7 developments. Since my last post, there are not that many new developments, but since I’m reading a bit more on the subject there are some things I want to mention here.

Project Coin

First of all, there are developments in Project Coin. Since this week is the last change to submit new proposals (and I think they don’t expect very interesting ones), the have created a short list of proposals which are considered for implementing for JDK 7. It is discouraged to discuss on the other proposals on the mailing list, which means effectively that these other proposals are rejected. The improvements which are considered for inclusion in Java 7 are the following:

  • Strings in switch statments. This makes it possible to switch on a String object and uses cases which match on a String object as well (obviously).
  • Improved Exception Handling for Java. This proposal includes catch blocks which handles multiple Exception types and safe rethrow of exceptions
  • Autmoatic Resource Management. I didn’t discuss this in my previous post on JDK 7. In short, this proposal suggest a method which eases closing of resources after use. This feature, submitted by Joshua Bloch of Effective Java and the Collection framework fame, solve the difficulty of closing resources properly. Bloch gives an example of the required code for closing multiple resources, which can become quite complicated because it requires several nested try-catch statements.
  • Improved Type Inference for Generic Instance Creation. This is the proposal which makes it possible to omit the generic type declaration when creating an instance of (for example) a collection. Example:
    List<string <List<String>>:> myList = new ArrayList<>();.
    Currently, one whould repeat the generic types in the right hand instanciation of the ArrayList.
  • Elvis and other null-safe operators. This proposal describes the safe dereference operators, such as .?. It makes it possible to omit checks on objects for null values.
  • Simplified Varargs Method Invocation. This proposal was also not discussed in my previous post. It presents a solution for warnings which are issued when a method combines varargs with non-reifiable array types (in fact using generics in combination with varargs). The proposal does not really include a language change, but moves the point where a warning is given in the mentioned case, namely at the definition of the method instead of at the moment the method is used.
  • The Project Coin mainlinglist now focusses on discussing the above six proposals in order to come to a final proposal. Chances are that these proposals will be included in JDK 7, however Darcy notes that probably only five proposals will be implemented and part of JDK 7. As every week, Darcy posted a list of new proposals that were submitted this week. This list will evaluated as the previous list, and possible acceptable proposals will be added to the shortlist.

    No Java 7?

    Another interesting point is made by Stephen Colebourne (of JSR 310, Date and Time API). He express his concerns regarding the fact that there will be probably no official specification for Java 7, which in fact means that there will be no ‘official’ Java 7, but only a JDK 7 implemented by Sun. There is no other way to create an official Java SE 7 JDK. In fact, this removes one of the strong points of Java, namely that it is an official specification and not ‘just an implementation of a language’.

    This point is backed by Neil Bartlett of OSGi, who states that Project Jigsaw is also not backed by a JSR, apart from JSR-294 (superpackages). He is especially worried about this considering the rumours regarding a possible take over of Sun by IBM, since IBM will kill off Project Jigsaw according to Bartlett, since it is not in its interest to development such a project because it already has OSGi. It should be noted that former conclusions are only based on assumptions. Colebourne thinks he has a point, by pointing at the fact that most bloggers at Sun only mention JDK 7 and almost never use the ‘Java 7’ term.

    Release plan and current status

    Danny Coward posted an update on the release plan of JDK 7. There is a list of milestones which consists of a total of 8 milestones, where M8 is the final one which should be the final JDK 7. Currently we are at M2, which already includes the new Garbage Collector (G1), compressed 64-bit pointers, NIO2 and a method to close URLClassLoader. M3 should be released before JavaOne (at the earliest on the 21st of May). This release should contain some interesting improvements, inlcuding Invoke Dynamic, SCTP and SDP support (mainly intersting for mainframe stuff, I think), upgraded class-loader and improved unicode handling. This latter consist a fix which removes support for unicode characters which are not represented using the shortest possible way. It is possible to represent the same character using several byte patterns in UTF-8. This can lead to security problems when this is not handled correctly.

Tags: , ,

Comments are closed.