Java Full-Stack Report October 2022: New & Noteworthy
What’s This?
Here are the most important news for Java developers from last month — in my opinion, at least.
Archive
2022 | Sep | Aug | Jul | Jun | May | Apr | Mar | Feb | Jan |
Table Of Contents
New & Noteworthy
What’s New In Java 19
Java 19 landed on September 20 with 7 Java Enhancement Proposals (JEP). The two most exciting JEPs are about Project Loom — see the following news item.
Of the remaining five JEPs, the two about records have the broadest appeal. Here’s a sample from JEP 405, which allows access to the record fields in an instanceof
:
record Point(int x, int y) {}
static void printSum(Object o) {
if (o instanceof Point(int x, int y)) {
System.out.println(x+y);
}
}
And here’s a shortened example from JEP 427 about using records in a switch
statement:
record Point(int i, int j) {}
static void typeTester(Object o) {
switch (o) {
case Point p -> System.out.println("Record class: " + p.toString());
default -> System.out.println("Something else");
}
}
The other three JEPs are low-level features: a port to RISC-V and updates to the Foreign Function & Memory API and the Vector API.
Virtual Threads from Project Loom Explained
Project Loom reinvents Java concurrency with a lightweight implementation of Java threads. They dramatically reduce the effort of writing, maintaining, and observing high-throughput concurrent applications so that a “thread-per-request” programming style becomes viable again. Virtual threads are supposed to be easy to troubleshoot, debug, and profile.
So at least partially, Project Loom is on a collision course with reactive programming that has become popular recently (e.g., Spring, Quarkus, and Helidon). Or, in the words of Oracle’s Java Language Architect Brian Goetz, “Project Loom will kill reactive programming”.
We can use virtual threads easily in Java 19:
var executor = Executors.newVirtualThreadPerTaskExecutor();
executor.submit(() -> { // do something here };
Spring Boot 3 Ships November 2022 And Delays Java Module Support
We guessed that Spring Boot 3 (and Spring Framework 6) would ship by the time the Spring One conference starts (Dec 6–8, 2022). Now we know the planned release date for good: It’s the end of November, as revealed by Spring Developer Advocate Oliver Drotbohm in his talk at JAX London. You know, that JAX London where I gave two talks (about Flutter and JHipster).
And we also now know that Spring Boot 3 (and Spring Framework 6, on which it is based) won’t support Java Modules. Maybe later it will. Why? Because VMware focuses on native Java with GraalVM. And because “there have been very few requests for it”. Ouch…
Jakarta EE 10 Adds New Features for the First Time in Five Years
After five years, Jakarta EE (formerly known as “Java Enterprise Edition” or “Java EE”) has finally added new features. Yes, Java EE 8 from August 2017 was the last time they did: Jakarta EE 8 was a re-release in the Eclipse infrastructure, Jakarta EE 9 just moved to the jakarta
namespace, and Jakarta EE 9.1 added compatibility for Java 11. So, what’s new? Here are the highlights:
- Java 11 is the new baseline, but Java 17 is also supported.
- There’s a new
@Asynchronous
annotation — - think@Async
from Spring. - Jakarta Persistence got “new functions to the Query Language and Criteria API”.
- Jakarta Security can now use OpenID Connect, which most social platforms use.
- REST services can now run outside of a Jakarta EE environment (e.g., in a unit test). Jakarta EE 10 also includes multipart from data.
My Short Interview with the Helidon Lead
Helidon 3.0 launched at the end of July. My news item about the launch was later. But I got to ask the Helidon project lead, Dmitry Kornilov, some questions. He thinks about 30% of all users choose the reactive programming model. You know, the one that Project Loom wants to kill (see item “Virtual Threads from Project Loom Explained” above). And Dmitry says Helidon has better dependency injection when running in native Java with GraalVM.