Significant Changes in JDK 14 Release
The following are some of the changes in Java SE 14 and JDK 14:
- Switch is extended so it can be used as either a statement or an
expression, so that both forms can use either traditional
case ... :labels (with fall through) or newcase ... ->labels (with no fall through), with a further new statement for yielding a value from a switch expression. See JEP 361: Switch Expressions (Standard) and Java Language Changes. - G1 is enhanced to improve allocation performance on non-uniform memory access (NUMA) memory systems. See JEP 345: NUMA-Aware Memory Allocation for G1.
- JDK Flight Recorder data is now available as a data stream allowing for continuous monitoring. See JEP 349: JFR Event Streaming.
- New JDK-specific file mapping modes have been added so that the
FileChannelAPI can be used to createMappedByteBufferinstances that refer to non-volatile (NVM) memory. See JEP 352: Non-Volatile Mapped Byte Buffers. - Allows currencies to be formatted with locale-specific accounting formats, for example, ($3.27) instead of -$3.27. See Accounting Currency Format Support.
- Enhanced
com.sun.management.OperatingSystemMXBeanto ensure that it reports values based on the current operating environment, such as a container environment. The MXBean for tools to get information on the operating system has been improved for container environments. See OperatingSystemMXBean made container aware.
Experimental, Preview, and Incubator Features
Recordsis a Java language preview feature, which provides a compact syntax for declaring classes that are transparent holders for shallowly immutable data. See JEP 359: Records (Preview).- Pattern Matching for
instanceofis a Java language preview feature that simplifies theinstanceof-and-castidiom. See JEP 305: Pattern Matching for instanceof (Preview). - Text blocks are multi-line string literals that avoids the need for most escape sequences, automatically formats the string in a predictable way, and gives the developer control over the format when desired. Text Blocks were introduced in JDK 13 as a Preview Feature. Text Blocks is being previewed again in JDK 14 with the addition of two new escape sequences. See JEP 368: Text Blocks (Second Preview).
jpackage, a simple tool for packaging self-contained Java applications. See JEP 343: Packaging Tool (Incubator).- An API that allows Java programs to efficiently access foreign memory outside of the Java heap is introduced. See JEP 370: Foreign-Memory Access API (Incubator).
- The Z Garbage Collector (ZGC), previously available only for Linux, is introduced as an experimental feature on Windows and macOS. See JEP 364: ZGC on macOS and JEP 365: ZGC on Windows.
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 14.