Diamond syntax with anonymous class constructors now available in JDK 9 build 59
joe darcy
joe.darcy at oracle.com
Fri Apr 10 18:34:01 UTC 2015
Hello,
Thanks to efforts by Srikanth and Dan, on the javac and JLS fronts,
respectively, anonymous classes constructors can now use diamond syntax
(in many cases) as of JDK 9 build 59:
https://jdk9.java.net/download/
The summary of the change is that when the inferred type for the diamond
is denotable (no intersection types, no capture variables, etc.), then
diamond can be used for anonymous classes. For more technical details, see:
JDK-8062373: Project Coin: diamond and anonymous classes,
https://bugs.openjdk.java.net/browse/JDK-8062373
JDK-8073593: 15.9: Allow diamond to be used with anonymous classes,
https://bugs.openjdk.java.net/browse/JDK-8073593
Please give the feature a try and report any issues to any issues to
compiler-dev.
Thanks,
-Joe
More information about the jdk9-dev
mailing list