Today Oracle released JDK (Java Development Kit) 22, not a long-term release version but nevertheless including important features such as the Foreign Function and Memory API, a replacement for the Java Native Interface. The company is also keen to capture mindshare from new developers, in part by improving support for Visual Studio Code (VS Code).
“Visual Studio Code is getting tremendous adoption in schools and universities,” VP software development Bernard Traverstat told the press in a briefing. “We looked at the support of Java in VS Code and found that the current support is not very good. We’re investing heavily now into providing the best possible Java support within Visual Studio Code, and we released six months ago the first instance of this extension.”
The obstacle faced by Oracle is that Microsoft, which provides VS Code, has its own Extension Pack for Java, comprised mainly of a Red Hat language server extension and a lightweight debugger from Microsoft itself. The Red Hat extension has existed for a long time and boasts upwards of 33 million installs; whereas Oracle’s recent Java Platform Support extension has fewer than 25,000. The company was slow to support VS Code.
Oracle nevertheless believes that its own extension is a big improvement. “The Red Hat extension is based on the Eclipse compiler, which is always in a catch-up mode versus what we are doing. Our extension is based directly on the Javac compiler that everyone is using within the entire Java ecosystem,” said Traverstat, adding that the compiler is now extremely complex, thanks to new abstractions and simplifications that push the type system.
“The Javac compiler that is being used today in the Red Hat extension doesn’t have the same capability that we have. It can barely support Java 22. It can’t support Java 23, where we already support Java 23,” said Traverstat. Java 23 is in preview, with release expected in September this year.
The relationship of Red Hat’s extension with Eclipse is seen in bugs such as “Failed to initialize language server due to Internal error. Caused by: org.eclipse.core.runtime.AssertionFailedException: null argument.”
Also worth mention in this latest release is the Apache NetBeans Java extension for VS Code, praised by its users as “Far better and faster than Red Hat’s java language server – especially for very large projects.”
Another aspect of Oracle’s push for Java take-up from new developers is language simplification when getting started. JEP 463, in second preview in JDK 22, allows for implicitly declared classes and main methods, reducing Java’s Hello World to two lines of code.
Other features in JDK 22 include the second preview of string templates for simplifying work with strings, advances in Project Loom for concurrency (second preview), the seventh incubator of the Vector API, and performance improvements in JNI via region pinning of objects to their locations. We have a summary of the changes on our sister site The Register.
Is JDK 22 worth using, given its short six-month duration of support? “Though JDK 22 is not a long-term support update, there is no reason not to use it in production,” said Azul’s deputy CTO Simon Ritter. One of the factors today is that modern DevOps practices potentially make it easy to update applications and runtimes, reducing the friction of making short-term improvements.