The article discusses various new features introduced in Java 23, including Primitive Types in Patterns, instanceof, and switch, Markdown Documentation Comments, Module Import Declarations, Implicitly Declared Classes and Instance Main Methods, Flexible Constructor Bodies, Class-File API, Stream Gatherers, Structured Concurrency, Scoped Values, Vector API, and ZGC: Generational mode by default. Each feature is explained with examples.
Features targeted for JDK 24 include warnings about the use of JNI, improvements to the G1 garbage collector, and the finalization of a class-file API. This article discusses these features and other potential additions to the Java development kit.
Class File API:
Finalized API for parsing, generating, and transforming Java class files, replacing internal copies of third-party libraries. |
Late Barrier Expansion for G1 Garbage Collector:
Simplification of the implementation of G1’s barriers by moving their expansion to a later stage in the C2 compilation pipeline. Aims to reduce C2 compilation time and improve barrier comprehensibility.
JNI Usage Warnings:
Addition of warnings about the use of JNI to prepare for future restrictions. Adjustments to the Foreign Function and Memory (FFM) API to issue warnings in a consistent manner.
Potential Future Features:
Stream gatherers, module import declarations, structured concurrency, scoped values, flexible constructor bodies, primitive types in patterns, instanceof, and switch, vector API, ahead-of-time class loading, and string templates.
Adoption:
Likely lower than LTS releases like JDK 21 and the upcoming JDK 25 due to the LTS preference among Java users.
Virtual Threads
Structured Concurrency
Immutable Data
Garbage Collection
Pattern Matching with Switch
Streamlined Syntax
Sealed Classes
Foreign Functions & Memory
Vector API
Better Null Processing
Paid License (Subscription Features)
sourceSets.main.scala.srcDir "src/main/java"
sourceSets.main.java.srcDirs = »
sourceSets.test.scala.srcDir "src/test/java"
sourceSets.test.java.srcDirs = »