JavaOne 2016 is over! For two weeks already, so maybe I’m a little late with this write-up. Well, it simply took some time to watch enough talks to get an impression of what was going on. But even two weeks are not enough – Oracle uploaded about a hundred videos from JavaOne 2016! So I had to pick a theme and I decided to stay close to the nucleus: the language and core libraries, standard and enterprise edition, themselves.
As tempting as they are, I abstained talks that strayed away from the motor of Java’s drive. So no, I didn’t even watch the talk about JUnit 5 – yet.
Java SE
Let’s start with the Java SE keynote. Honestly, I found neither the introduction nor the Mazda report particularly thrilling. But that’s just the first third of the 30 minute presentation.
It got more interesting when Mark Reinhold started to get technical. He talked about Java 9 in general (which I will do further below as well) and covered jShell and Project Jigsaw in particular. It got even more interesting when Brian Goetz joined him in an awkwardly choreographed entrance.
Imagine, we might be able to write this at some point in the future:
public class Point(int x, int y) { }
And the compiler generates fields, constructors, accessors, proper equals
, hashCode
, and toString
. Wow!
And it gets better! (Or worse, depending on how much you’re prefer clarity over succinctness.)
var url = new URL("https://sitepoint.com/java");
var connection = url.openConnection();
As Brian makes very clear, this does not weaken Java’s type system. It just means that the compiler infers more types than it already does today.
Last but not least Brian quickly summarizes the projects Valhalla and Panama.
Before diving into the more focused talks, I want to recommend Ask the JDK Architects, where Mark Reinhold, John Rose, and Brian Goetz answered random questions regarding Java and the JVM. It’s a nice potpourri of why Java is the way it is and how that might change in the future.
Java 8
I found it interesting that there where a number of talks dedicated to Java 8 and that many of them where still presenting some of the basics. Others, and this made more sense to me, were more advanced and help developers, who mostly have been using it daily for a while now, to get the details right.
The first half of Stuart Marks’ Collections Refueled (slides) talk presented some extensions to the collections framework that happened in Java 8 and might’ve been overlooked due to the hype around streams. For example, I didn’t know about Collection::removeIf
, List::replaceAll
, or how List::sort
improved sort performance. He finished off with the Comparator
factories before turning to Java 9.
Another talk making sure you get everything out of Java 8 was Venkat Subramaniam’s A Few Hidden Treasures in Java 8, in which he covered varied topics like string joining, default methods, and parallel streams.
Talking about parallel streams, if you want to know more about how to create solutions that parallelize well, watch Stuart Marks’ and Brian Goetz’ Thinking in parallel. Here they gave succinct mental models for how to design good solutions and estimate parallel stream performance.
But let’s not get distracted from Venkat’s live coding marathon. In Let’s Get Lazy: Explore the Real Power of Streams he dived into laziness and why lazy evaluations are beneficial. He did it again in Refactoring to Functional Style with Java 8 – a journey from Java 8’s functional programming features to functional programming with Java 8. Why are higher-order functions, immutability, lambdas, streams, and laziness relevant and how do they come together?
I really enjoyed Journey’s End: Collection and Reduction in the Stream API, which took a deep dive into reduction and collectors. As I’ve written elsewhere, I’m not a fan of complex stream collection but that doesn’t mean it’s not good to know how to do it if you need to. Besides, Maurice Naftalin gave a lot of interesting background info as well.
Java 9
Java 9 was of course a big topic and there were a lot of talks about it. Before heading into some of the details of the new version, though, I want to recommend two particular talks for those that have not yet spent a lot of time with Java 9.
The first, JDK 9 Language, Tooling, and Library Features by Joseph Darcy, gave a high-level overview over Java 9. Give or take, it was pretty much the spoken version of my ultimate guide to Java 9 (but it also covered some of the still unpublished second part).
Then there was Prepare for JDK 9 (slides), in which Alan Bateman explored what our projects should do to prepare for the new version. Some of the things he mentioned were which internal APIs Jigsaw is going make inaccessible and how to deal with that, the new run time’s file system layout, and the upcoming version string format. Finally he explained how the pretty cool multi-release JARs can help projects stay compatible to several versions.
Project Jigsaw
As all posts about Java 9 we have to talk about Project Jigsaw and the upcoming Java Platform Modularity System (JPMS). The Jigsaw team presented a series of talks where each built on the previous ones.
In Introduction to Modular Development (slides) Alan Bateman gave an introduction to the module system. He explained how modules are created and how the JVM handles them. Keywords were module declarations, readability, and accessibility; jlink is introduced as well.
Most of the next talk, Advanced Modular Development by Alex Buckley and Alan Bateman (slides), discussed how to migrate existing libraries and applications to the module system (largely via the unnamed module and automatic modules). The talk finished off with a continuation of jlink before ending in an extensive round of questions – some interesting, some less so.
A key ingredient in decoupling clients from implementations of an interface they depend on is a third party that detects implementations and makes them available to the client. This is often done by DI containers, which also inject the implementations. Another approach is the service locator pattern, where clients have to access a central registry to request implementations. Java already supports the latter with the ServiceLocator
class which, as Alex Buckley presented in Modules and Services (slides), has been extended to allow modules to easily publish and consume services.
Finally, in Project Jigsaw: Under the Hood (slides) Alex Buckley took viewers to the next level. He explained:
- the interaction of the module system and class loaders as well as the concept of layers
- how dependencies can be made transitive (
requires transitive
) - the current state of the face-off between encapsulation and reflection (
exports private
) - different kinds of modules (named, unnamed, automatic)
Unless you’ve been following Jigsaw very closely, you will learn a lot of new things here. Highly recommended!
If you still can’t get enough, watch the Project Jigsaw Hack Session with Alan Bateman, Mandy Chung, and Mark Reinhold.
APIs
I was a little surprised to find only two talks about the new APIs that Java 9 brings to the game, both given by Stuart Marks – maybe I just overlooked others?
The first one was in fact held by Stuart’s alter ego, Dr. Deprecator himself. In Enhanced Deprecation (slides) the doctor went into the details behind Java’s deprecation history and lifecycle, the additions to @Deprecated
coming in Java 9, new tooling (jdeprscan), and future deprecation work.
I already mentioned the other, Collections Refueled (slides), because it started off talking about Java 8. The second part began about half way through by explaining why there won’t be collection literals (short version: collections are part of the library, not the language, so language-level support would be awkward). Instead we get collection factory methods, which Stuart presented in-depth, including details like immutability, random iteration order, and more. In the last couple of minutes he laid out plans for the near and distant future.
Tooling
Build tools are probably the most interesting topic when it comes to Java 9 and Project Jigsaw. So how are they doing? In Java 9 and the Impact on Maven Projects Robert Scholte discussed all the things he had to do to make Maven work with Java 9. You should definitely watch this one if you’re using Maven! Interesting tidbits are the support for multi-release JARs, that the extra enforcer rule ban duplicate classes is a good way to detect split packages and, if you want to stay up to date, the Maven Wiki page for Java 9. An unfortunate detail is that there is currently no support for generating module-info.java
from pom.xml
, which leaves developers with the ugly chore to maintain dependencies in two places.
If you’ve ever seen Venkat Subramaniam code live, you’ll believe like I do that jShell, Java’s own and brand-new read-evaluate-print-loop (REPL for short), was made just for him. So in Interactive Development and Fast Feedback with Java 9 REPL he took it for a test drive. You’ll learn what a REPL is, what it’s good for, and how to use Java’s.
In Introduction to Troubleshooting in JDK 9 (slides) Yuji Kubota, Yasumasa Suenaga, and Shinji Takao explained the servicability tools jhsdb, jcmd, and the HeapStats agent, which were introduced or considerably improved in JDK 9. They present how to do things like configuring the JVM after it goes live, obtaining thread/heap dumps or class histograms, and detecting native memory leaks.
Java EE
First things first: Java EE 8 is scheduled for September 2017, version 9 just for one year later.
The vision for the Enterprise Edition is presented in the Java EE Keynote. In one word: cloud. In more words: cloud, microservices, cloud, hypewords, cloud. It is noteworthy that Anil Gaur went out of his way to stress that Oracle is listening (his emphasis, not mine) to its partners and customers. A couple of them were invited up on stage to support the Java EE roadmap. In the end, after an entry that was arguably even more awkward than Brian Goetz’s, there was even some code.
Java EE 8
If you’re interested in the state of the Java EE union and particularly the upcoming version 8, Linda DeMichiel’s Java EE 8 Update has you covered. She not only talks about 8, though, but also gives insight into focus areas and interesting proposals, for example for reactive programming, circuit breakers, and security. At last Linda lists other talks related to Java EE. Here are the non-cloud ones for which I could find a video:
- JAX RS 2.1 for Java EE 8 by Ed Burns and Pavel Bucek
- Servlet 4.0: Status Update, HTTP/2 Comes to Java by Ed Burns
- Java EE Next – HTTP/2 & REST Opportunities by Pavel Bucek and David Delabassee
- JSF 2.3 The Community Takes Over by Ed Burns and Kito Mann
- Configuration for Java EE 8 and the Cloud by Dmitry Kornilov
- Security for Java EE 8 and the Cloud by Kk Sriramadhesikan (slides only)
Moar Cloud
As we learned in the keynote, the cloud is important:
- Enterprise Java for the Cloud by Rajiv Mordani, Josh Dorr, and Dhiraj Mutreja
- Portable Cloud Applications With Java EE by Rajiv Mordani, Josh Dorr, and Joe Di Pol
- Java EE Applications on Oracle Java Cloud Service by Harshad Oak
- Migrate Java EE Applications to Microservices and Oracle Java Cloud by Tilen Faganel and Matjaz B. Juric
- Cloud Native Java EE by Mike Croft and Ondrej Mihalyi
Wonder how much these talks can possibly differ? So do I! (I didn’t watch them – not exactly a JEE guy.)
What Else?
This was the full front of Java SE and EE talks. But there were many more. Two particular topics that stood out were microservices and tooling. If you’re interested in those, take a look at the JavaOne 2016 playlist.
If you want to hear other peoples’ opinions of JavaOne, check out these posts:
- Groovy Podcast #33, Live from JavaOne 2016
- JavaOne 2016 Follow-Up by Josh Juneau
- Daily reports by Solita: day 1, day 2, day 3, executive summary (if you only read one, make it this one)
- More daily reports, this time by Canoo: day 1, day 2, day 3
- JavaOne 2016 Recap by FreeWave
- Oracle JavaOne 2016 by WhiteHorses
And unlike me, they were even there. :)
Nicolai is a thirty year old boy, as the narrator would put it, who has found his passion in software development. He constantly reads, thinks, and writes about it, and codes for a living as well as for fun. Nicolai is the former editor of SitePoint's Java channel, writes The Java 9 Module System with Manning, blogs about software development on codefx.org, and is a long-tail contributor to several open source projects. You can hire him for all kinds of things.