Significant Changes in JDK 15 Release
See JDK 15 Release Notes for the complete list of new features and enhancements in JDK 15.
The following are some of the updates in Java SE 15 and JDK 15:
- Text Blocks, first previewed in Java SE 13, is a permanent feature
in this release and can be used without enabling preview features.
Text blocks are multiline string literals that avoid the need for most escape sequences, automatically format the string in a predictable way, and give the developer control over the format when desired. See JEP 378: Text Blocks and Programmer's Guide to Text Blocks.
- The Z Garbage Collector (ZGC) is ready to use in production and no
longer an experimental feature. Enable ZGC by using the command-line option
-XX:+UseZGC
. See JEP 377: ZGC: A Scalable Low-Latency Garbage Collector (Production). - Hidden classes are classes that cannot be used directly by the bytecode of other classes. Hidden classes are intended for use by frameworks that generate classes at run time and use them indirectly through reflection. See JEP 371: Hidden Classes.
Preview and Incubator Features
See Java Language Preview Feature for more information about preview features.
- Sealed Classes is a Java language preview feature. Sealed classes and interfaces restrict which other classes or interfaces may extend or implement them. See JEP 360: Sealed Classes (Preview) and Sealed Classes in Java Platform, Standard Edition Java Language Updates guide.
- Pattern Matching for
instanceof
, a preview feature from Java SE 14, is re-previewed for this release. This feature allows common logic in a program, namely the conditional extraction of components from objects, to be expressed more concisely and safely. See JEP 375: Pattern Matching for instanceof (Second Preview) and Pattern Matching for the instanceof in Java Platform, Standard Edition Java Language Updates guide. - Records, a preview feature from Java SE 14, is re-previewed for this release. Records are classes that act as transparent carriers for immutable data. See JEP 384: Records (Second Preview) and Record Classes in Java Platform, Standard Edition Java Language Updates guide.
- The Foreign Memory Access API allows Java programs to efficiently and safely access foreign memory outside of the Java heap. See JEP 383: Foreign-Memory Access API (Second Incubator).
Removed APIs, Tools, and Components
See:
In addition, there are security related updates that you need to be aware of. See: Security Updates in JDK 15.