Oracle have announced Project Valhalla for Java. This is an experimental OpenJDK project to develop major new features for Java that require both changes to the language syntax and VM-level support. Valhalla project lead Brian Goetz stressed that this is an early-stage experimentation project, and that the community should not necessarily expect any Valhalla technology to be available as part of JDK 9 (scheduled for 2016). The project is similar in intent to some existing OpenJDK projects such as Project Lambda and the DaVinci Machine project (which led to the invokedynamic functionality released in Java 7).
One of the initial features being discussed for Valhalla is a major overhaul of Java's generics. Current versions of Java only allow generic types to contain reference types, and the Java compiler removes the detail of the contained type during compilation. This approach to generic typing (known as type erasure) has been one of the most heavily criticised features of Java's type system.
Project Valhalla will explore a new apporoach to generic typing, and hopes to produce a new form of generic typing that allows developers to use generic collections of primitive types. The aim will be for types such as List<int> to be valid Java in some future release of the JDK. This feature, known as generic specialization, is already present in some other JVM languages and Java developers have been asking for it since generics first shipped with JDK 5.
The other big feature currently proposed for Valhalla is value types. These are intended to combine some of the properties of Java's object and primitive types, but to do so in such a way that developers can treat them as though they were just a new kind of user-defined primitive type. John Rose, Brian Goetz and Guy Steele have published an initial proposal for value types here.
The prototype phase of Valhalla features will be starting soon. Interested developers should join the valhalla-dev mailing list hosted on the OpenJDK site. Brian Goetz's initial announcement is here.
Community comments
Awesome!
by C Curl,
Value types
by Luke deGruchy,
As with everything else
by Will Hartung,
Java catching up?
by Jon Okie,
Re: Java catching up?
by Luke deGruchy,
Re: Java catching up?
by Jon Okie,
Re: Java catching up?
by Victor Grazi,
Re: Java catching up?
by Luke deGruchy,
Re: Java catching up?
by Ben Evans,
Re: Java catching up?
by Jon Okie,
Re: Java catching up?
by Ben Evans,
can I get an AMEN! on primitive collections ?
by Nicholas Whitehead,
Awesome!
by C Curl,
Your message is awaiting moderation. Thank you for participating in the discussion.
been waiting for this since forever
Value types
by Luke deGruchy,
Your message is awaiting moderation. Thank you for participating in the discussion.
I really hope they find a way to get value types into JDK 9. This will benefit not only Java, but other JVM languages as well. It would be beneficial to have small, immutable struct-like object that can be allocated to the stack.
As with everything else
by Will Hartung,
Your message is awaiting moderation. Thank you for participating in the discussion.
Call me in 3 years when this finally rolls out. Call me in 5 when it's starts to hit production systems.
Java catching up?
by Jon Okie,
Your message is awaiting moderation. Thank you for participating in the discussion.
In other words, they are trying to see if Java can do what all of the .Net languages can do already.
Re: Java catching up?
by Luke deGruchy,
Your message is awaiting moderation. Thank you for participating in the discussion.
Another way of looking at it is that Oracle is investing in Java and the JVM in a way that Sun would not/could not.
As for .NET, well, many companies don't have the option of switching as their servers don't run Windows, and Mono is too much of a hack to be a viable option.
Re: Java catching up?
by Jon Okie,
Your message is awaiting moderation. Thank you for participating in the discussion.
That is a good point. I do however wonder what Oracle's plans are for getting a return on that investment.
Re: Java catching up?
by Victor Grazi,
Your message is awaiting moderation. Thank you for participating in the discussion.
Market share retention?
Re: Java catching up?
by Luke deGruchy,
Your message is awaiting moderation. Thank you for participating in the discussion.
I wonder how much of that is retaining JVM users as opposed to Java language users. Oracle put out some promotion for Java stating that Tweeter uses the JVM for development (they use Scala).
Re: Java catching up?
by Ben Evans,
Your message is awaiting moderation. Thank you for participating in the discussion.
Well, in the area of Value Types at least, there's some second mover advantage. The JVM ecosystem can definitely learn from the implementation flaws of the .NET approach, and I think that's explicitly called out in one of the design docs.
Re: Java catching up?
by Jon Okie,
Your message is awaiting moderation. Thank you for participating in the discussion.
Oh, that's good. So what specifically are they improving on?
Re: Java catching up?
by Ben Evans,
Your message is awaiting moderation. Thank you for participating in the discussion.
Hang on, I'll see if I can dig out the specific mention and post it to this thread.
can I get an AMEN! on primitive collections ?
by Nicholas Whitehead,
Your message is awaiting moderation. Thank you for participating in the discussion.
Ahh.... Trove... We love you, but are your days numbered ?