What really stricked me in Devoxx this year is the real momentum around Java 8. I cannot remember any version of Java that arrived with such enthousiasm. All the Java SE 8 talks were packed, the “Ask the expert panel” was packed, and the prospective talk by Brian Goetz was packed too. Java developers want to get to know Java 8 better, want to learn about the new patterns built on lambdas and streams, and they also want to know what lies ahead for us.
And indeed, Java 9 is already around the corner, there are already preview versions available, with already new things implemented.
Java 8
I gave two talks: a 3 hours university, and a regular 1 hour talk. The first one is about the Stream API and the Collectors, and shows how you can leverage those APIs to solve common problems in elegant ways. The second one aims to show most of what is new in Java 8, without talking about lambdas, streams and collectors, and neither about JavaFX and Nashorn. So what is new in Java 8, once we removed everything that is new. This might look like a joke, but in fact there is more than enough to nicely pack a one hour talk.
Here is the list of all Java 8 related talks, that you can check on Parleys as soon as the become available.
Lambda, from the Dark Age to the Infinity and Beyond by Rémi Forax
Java 8 Streams & Collectors : patterns, performances, parallelization and 50 new things we can do with Java 8 by José Paumard (yes, that’s me)
Java 8 – Understanding Functional Interfaces and Writing Mixins by Heinz Kabutz
Java Futures Sneak Peek by Brian Goetz
API Design With Java 8 Lambda and Streams by Stuart Marks and Brian Goetz
Java 8, 9 and beyond – Ask the Experts by Brian Goetz, Stuart Marks and Paul Sandoz
Pragmatic Functional Refactoring with Java 8 by Raoul-Gabriel Urma and Richard Warburton
Java 9
Is it really the time to talk about Java 9? We are still trying hard to move our applications to Java 8, so why not sit back and rest a little? Well, people are still hard working to develop Java, and yes, the 9th version is on its way. We already have some ideas about what is going to be available in it, what is not. And we also have previews available here: http://openjdk.java.net/projects/jdk9/.
Firstly, they wont be any changes in the language itself. No big things like lambda expressions for this time. But there will be changes in APIs. Paul Sandoz made a call during his talk: if you have ideas of existing JDK classes that could expose their data in Streams, just raise your hand, and it might make it in Java 9.
Secondly, it seems that the big thing in Java 9 will be Jigsaw. Project Jigsaw probably beat the record on the number of cancellation / revival, but yes, it will be there in Java 9. In fact, if you check the current preview version of Java 9, it has already been modularized.
Jigsaw will do three things.
- Get rid of rt.jar and tools.jar, and have a modular JDK. A quick question among the audience showed that people developing IDEs will need some attention on that point.
- The ability to build your own runtime environment from the modules your application needs. Handy for people deploying their applications on small devices.
- The ability to hide certain “internal” classes from outside modules.
Maybe for Java 9
Arrays 2.0! John Rose made a talk about Arrays 2.0 in the last JVM Summit (which program is here). The first idea is to go to long indexed arrays (instead of ints). And indeed, since we are processing larger and larger amounts of data, hitting the 32 bits limit does not seem to be science fiction anymore. Just check the classes that have an internal arrays in them (ArrayList, HashSet): they got some attention and some protection against internal overflows.
Beyond Java 9
Brian Goetz gave us hints on what he is doing for after Java 9. Of course there is absolutely no release version or date whatsoever, nothing is even guaranteed to make it one day in the JDK, and the syntax he showed in the slides are subject to change. So this is pure speculation, but also very exciting things.
But it is clear that there is a need for what is called “value types”. What are value types? In fact, to answer that, we first need to answer this first question: what is costly in the current CPUs we use when we process data? And the answer is simple: moving data from the main memory to the caches of the CPU. Reducing this cost will bring tremendous improvments in performance in data processing. Paul Sandoz has a very good talk in which he explains why very clearly. The value types are not supposed to be objects, they do not extend the Object class, and have no identity. They are just chunks of data, that will be nicely stored in memory, packed in contiguous parts, without having to follow any kind of pointers. That could solve the problem of tranferring data to the cache, and bring the performance wins we need.
Conclusion
We all know that the release of Java 7 was not a good one. Despite many cool language enhancements and new APIs, the fact that lambda expressions were not added to 7 was a big disapointment in the community. Things have completely changed with the release of Java 8. The adoption rate is much higher than expected (as stated in this aricle). Everybody loves that realease. This is a very good news for Java: everything is in order now, there are plenty of new ideas for Java 9 and beyond. Very exciting times are ahead of us.