Significant Changes in JDK 27 Release
Java SE 27 and JDK 27 introduce a range of updates across the language, security libraries, and performance improvements.
See JDK 27 Release Notes for descriptions of the new features and enhancements, and API specification in JDK 27.
Language Preview Features
-
Primitive Types in Patterns, instanceof, and switch (Fifth Preview)
Enhance pattern matching by allowing primitive types in all pattern contexts, and extend
instanceofandswitchto work with all primitive types. This is a preview language feature.See JEP 532 and Primitive Types in Patterns, instanceof, and switch.
Library Improvements, Previews, and Incubating Features
-
Lazy Constants (Third Preview)
Introduce an API for lazy constants, which are objects that hold unmodifiable data. Lazy constants are treated as true constants by the JVM, enabling the same performance optimizations that are enabled by declaring a field
final. Compared tofinalfields, however, lazy constants offer greater flexibility as to the timing of their initialization. This is a preview API.See JEP 531 and Lazy Constants.
-
Structured Concurrency (Seventh Preview)
Simplify concurrent programming by introducing an API for structured concurrency. Structured concurrency treats groups of related tasks running in different threads as single units of work, thereby streamlining error handling and cancellation, improving reliability, and enhancing observability. This is a preview API.
See JEP 533 and Structured Concurrency.
-
Vector API (Twelfth Incubator)
Introduce an API to express vector computations that reliably compile at run time to optimal vector instructions on supported CPUs, thus achieving performance superior to equivalent scalar computations. This is an incubating API.
See JEP 537 and the module.
Security Libraries
-
Post-Quantum Hybrid Key Exchange for TLS 1.3
Enhance the security of Java applications that require secure network communication by implementing hybrid key exchange algorithms for TLS 1.3. Such algorithms defend against future quantum computing attacks by combining a quantum-resistant algorithm with a traditional algorithm. Applications that use the
javax.net.sslAPIs will benefit from these improved algorithms by default, without change to existing code. -
PEM Encodings of Cryptographic Objects (Third Preview)
Introduce an API for encoding objects that represent cryptographic keys, certificates, and certificate revocation lists into the widely-used Privacy-Enhanced Mail (PEM) transport format, and for decoding from that format back into objects. This is a preview API.
See JEP 538 and The BinaryEncodable Interface.
Performance and Runtime Improvements
-
Make G1 the Default Garbage Collector in All Environments
Make the Garbage-First (G1) garbage collector the default collector in all environments, rather than just server environments.
See JEP 523 and Garbage-First (G1) Garbage Collector .
-
Compact Object Headers by Default
Make compact object headers the default object header layout in the HotSpot JVM. Compact object headers reduce object headers from 96 bits down to 64 bits on 64-bit architectures, thereby reducing heap size, improving deployment density, and increasing data locality.
See JEP 534.
Monitoring
-
JFR In-Process Data Redaction
Enhance JDK Flight Recorder (JFR) to redact command-line arguments and the initial values of environment variables and system properties in recordings. Redact this data before it leaves the process, so that sensitive information does not leak.
See JEP 536.
Removals and Warnings for Future Changes
- JDK 27 issues warnings about uses of deep reflection to mutate
finalfields. These warnings aim to prepare developers for a future release that ensures integrity by default by restrictingfinalfield mutation through deep reflection, which makes Java programs safer and potentially faster. You can use the command-line options--enable-final-field-mutationand--illegal-final-field-mutationto selectively enable the ability to mutatefinalfields through deep reflection where essential, thereby avoiding warnings and future restrictions. See JEP 500: Prepare to Make Final Mean Final and Preparing for final Field Mutation Restrictions.