Oracle has announced an experimental OpenJDK project for trialing new features for Java.
Project Valhalla for Java is in its early experimental stages, and it will be well into the future – past JDK in 2016 – before any changes to the language syntax will be incorporated into Java. The proposed initial enhancements are support for generics over primitives, and for value types.
In the announcement of the project Oracle’s Brian Goetz describes it as Oracle’s
Goetz says that it is likely that the first several rounds will not look anything like the final result, adding
“don't assume that just because the prototype operates by name mangling, or classfile mangling, or requires the operator to do the Chicken Dance, that this is the ultimate plan – it’s just an expedient way to get to the point where we can experiment with something tangible.”
One area Oracle is looking at changing is the way Java handles generic types. At the moment, generic type arguments are constrained to extend Object, meaning that they are not compatible with primitive instantiations unless boxing is used, which undermines performance. In other words you can't write a generic sort that works with integers or floats without wrapping them as objects.
The proposal is that Java will support specialization of generic classes and interfaces when instantiated with primitive type arguments. Generic specialization is a feature that many developers have requested and that has already been added to some other JVM languages.
The second major idea proposed for Valhalla is value types. Describing them on OpenJDK as “Codes like a class, works like an int,” the Valhalla team of John Rose, Brian Goetz, and Guy Steele say the idea is to add support for small, immutable, value types with no identity.
Developers would be able to use them as though they were a new user-defined primitive type added to the current list of eight hardwired primitive types: byte, short, int, long, float, double, char, and boolean. The Valhalla team expects to borrow most of the definition and encapsulation machinery from classes, allowing users to easily and safely build new value-based data structures. They say:
“in particular, we believe that it is useful, both at the JVM and language levels, to regard value type definitions as specially marked, specially restricted class definitions.”
At last year's JavaOne Anil Gaur, vice president of Oracle's Cloud Application Foundation group, announced a survey to help determine priorities for the revised road map for Java EE. The survey r [ ... ]