Talk


New features are added to the JDK with each release and some of these features are worked on in a way that is not so obvious to all Java developers. In this talk, we will demystify the work that is going on in two different efforts to make Java even better: StableValues and SegmentMapper.
Some internal JDK classes are relying heavily on the annotation `jdk.internal.vm.annotation.@Stable`
to mark scalar and array fields whose values or elements will change *at most once*, thereby providing
crucial performance, energy efficiency, and flexibility benefits.
But the powerful @Stable annotation cannot be used directly in Java applications thereby severely restricting its applicability. The StableValue rectifies this imbalance between internal and client code by providing safe wrappers around the `@Stable` annotation. Hence, all the important benefits of `@Stable` are now made available to regular Java developers and third-party library developers.
The Foreign Function & Memory API (the FFM API), introduced in Java 22, provides access to structured memory. Sadly, only access to primitive values like `int` and `long` were available. SegmentMapper fixes this shortcoming and allows structured memory to be mapped to standard Java composites like `record` classes, thereby significantly improving the versatility of the FFM API.
Per Minborg
Oracle, Inc
Per Minborg works in the Java Core Library team at Oracle and is also a member of the Panama project team. He is an inventor and developer with more than 20 years of Java coding experience. He has been a frequent contributor to various open-source projects, is a regular speaker at events, Oracle JavaOne alumnus, and co-author of the publication Modern Java.