Project Coin Fixes in 7u2

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)

  • The compiler erroneously allowed constructs like

    Foo<String>[] fooArr = new Foo<>[]{...};
    
    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.

Comments:

Sir,
i saw your jdk8 unsigned integer improvements from a tweet.
Is there any plan for new unsigned types. UByte, UShort, etc.?

Posted by Fırat on January 16, 2012 at 01:31 AM PST #

@Firat,

Please see my subsequent blog entry on unsigned support:
http://blogs.oracle.com/darcy/entry/unsigned_api

Posted by Joe Darcy on January 20, 2012 at 12:11 PM PST #

Post a Comment:
Comments are closed for this entry.
About

darcy

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
News

No bookmarks in folder

Blogroll