This article is more than 1 year old
'Java 9, it did break some things,' Oracle bod admits to devs still clinging to version 8
'I want to explain why it was necessary'
Java has a problem – the language and platform is evolving faster than ever, but many developers are stuck on the five-year-old Java 8.
When Trisha Gee, a developer advocate for Java tool company JetBrains, surveyed Twitter ahead of a talk at QCon conference in London this week, 78 per cent stated they were using Java 8 – and considering that her following is likely to tilt towards the bleeding edge, the reality is likely even higher.
Which version of #Java are you using?— Trisha Gee (@trisha_gee) February 18, 2019
It's a shame, since there are a bunch of strong new features in later versions: JLink to create small Java executables for Docker images; Var for implicit typing; JShell interactive Java; improved collections; optional class; improved garbage collection; modularity and much more.
So why have developers not upgraded? Simply, Java 9 introduced major changes, including internal restructuring, new modularity (known as "Project Jigsaw"), and the removal of little-used APIs. These changes broke code, and even developers who are happy to make the necessary revisions have dependency issues. "We have problems with libraries that do not yet support the latest versions," said one QCon attendee.
"I want to explain why it was necessary," said Oracle's Ron Pressler, part of the Java platform group developing the language and lead for Project Loom.
"There are billions of lines of code in Java, and Java 9, it did break some things. The reason is that Java is 20-something years old. It will probably be big and popular in another 20 years. We have to think 20 years ahead. The way the JDK was structured prior to Java 9 was just unmaintainable. We could not keep Java competitive if we had not done that change. That was an absolute necessity."
Martijn Verburg, CEO of Java performance troubleshooter JClarity, said there had been some progress. "Of the top 1,000 most popular Maven libraries, about 65 per cent of them are now Java 9+ compatible. Six months ago it was about 42 per cent. There is probably another year to go before it is all cleaned up."
However, obscure open-source and internal enterprise libraries have a long tail. Java 8 is still well supported, and there is no strong incentive to move. "There are going to be two worlds," said one attendee. "A Java 8 world, and a Java 11 and later world."
At a QCon Java panel, Pressler expressed some frustration. "There is no fundamental reason why your Java code won't run on Java 9+. You may need to change access to old APIs etc. But it's not a different language."
At the same time, he acknowledged that the current practice of giving Java a new version number every six months gives the wrong impression.
"One of the biggest confusing things that we've done is to give the new six-month releases integer version numbers. So going from Java 9 to Java 10 you think that is a new Java major version. It is not. Java 10 is not a major Java release. It is a small release. The last ever major Java release was Java 9. There will be no more for the foreseeable future."
Is Oracle's licensing change in Java 11 – it has to be commercially licensed unless you are willing to move with the pace of the open-source implementation, OpenJDK – also a problem?
"Java is actually more free," said Verburg. The reason is that Oracle officially supports the OpenJDK and works with OpenJDK providers to share security fixes. "But if you just go to the Oracle download site, you have to make a decision. Do you want commercial Java, or Oracle's OpenJDK build, or OpenJDK from somewhere else? You have to make a choice. That's the confusion in the marketplace."
Oracle Java SE product manager Donald Smith concurred, but added: "Unfortunately, The Register can't run an article that says 'Java now more free than ever'. People won't click on it." Ahem. ®