Diamond operator compiles under OpenJDK, but not SunJDK 7

Hopefully this is not a duplicate, I searched and found some related issues, but not the differences in Java.

private List<Stuff> apps = new ArrayList<Stuff>();
// compiles under both


private List<Stuff> apps = new ArrayList<>();
// compiles under OpenJDK 7
// SunJDK 7 Error raised is : Syntax error on token "<", ? expected after this token

      

Any ideas why this is so? I like using OpenJDK on my * nix and dev servers, but sometimes I use a different Windows machine for development and testing and this is the first time I have had a problem between the two versions. Would appreciate any advice or thoughts!

Also I am using Netbeans 7.2 (which does not indicate a bug on Windows or Debain). The program uses Play Framework 1.2.5 and has a java source of 1.7.

javac -version
javac 1.7.0_01

      

and

java -version
java version "1.7.0_01"
Java<TM> SE Runtime-Environment <build 1.7.0_01-b08>

      

and checked Netbeans wherever I can point the 1.7 source where I can tell. Compiling via the command line produced the same error described above.

ANSWER?

I updated to the latest SunJDK / Java (1.7.0_13) and the problem was resolved for me.

+3


source to share


1 answer


I updated to the latest SunJDK / Java version (1.7.0_13) and the issue was fixed.



+1


source







All Articles