Last month, JDK 7u2 was released.

The release has a few correctness fixes for the Project Coin features, two diamond fixes courtesy Maurizio and one fix to strings in switch:

Diamond inference with nested classes had an improper interaction. For example, in code like class X {

class Y {

Y(T a, Z b) {...}

}

public static void main(String... args) {

X<String>.Y<String> x1 = new X<String>().new Y<String>("",""); //ok

X<String>.Y<String> x2 = new X<String>().new Y<>("",""); // Failed!

}

diamond was not allowed at the second constructor call, but such code is accepted as of 7u2. (7046778)

diamond was not allowed at the second constructor call, but such code is accepted as of 7u2. (7046778) The compiler erroneously allowed constructs like Foo<String>[] fooArr = new Foo<>[]{...};

Such code is now properly rejected.

(7057297)

Such code is now properly rejected. (7057297) If extra parenthesis were used around the case label of a string switch statement, as in switch (s) {

case ("a"):

...

}

javac would throw a NullPointerException when compiling the code.

(7071246)

Previously, the workaround was to remove the unneeded " ( " and " ) ", but javac has been corrected to accept this valid syntax.

(We received multiple reports of this bug, so parenthesis around case labels is much more common style than I would have expected!)

If you're using the Project Coin language features, I recommend upgrading to 7u2 to get these fixes and to minimize source compatibility concerns going forward.