Java 14 is expected to be released laster this month. The latest update to the programming language features a number of changes.
Here is a breakdown of upcoming changes:
- JEP 305: Pattern Matching for instanceof (Preview): Pattern matching allows common logic to be expressed “concisely and safely.” According to OpenJDK documentation, the motivation for introducing this feature is that there are currently only ad-hoc solutions for pattern matching and they felt it was “time for Java to embrace pattern matching.”
- JEP 343: Packaging Tool (Incubator): This tool can be used to package self-contained Java applications.
- JEP 345: NUMA-Aware Memory Allocation for G1: This will improve G1 performance on large machines.
- JEP 349: JFR Event Streaming: This allows for continuous monitoring of JDK Flight Recorder data.
- JEP 352: Non-Volatile Mapped Byte Buffers: This release adds new file mapping modes that allow the FileChannel API to be used to create MappedByteBuffer instances that refer to non-volatile memory.
- JEP 358: Helpful NullPointerExceptions: Now NullPointerExceptions generated by the JVM will describe which variable was null.
- JEP 359: Records (Preview): Records provide a syntax for declaring classes that act as transparent holders for immutable data. One of the main complaints about Java is that it is too verbose, especially when it comes to classes. According to OpenJDK documentation, developers sometimes try to cut corners, which results in issues down the line.
- JEP 361: Switch Expressions: Now switch can be used either as a statement or an expression. This will simplify everyday use of Java, and lay the groundwork for pattern matching in switch. This feature was previously available as a preview in JDK 12 and JDK 13.
- JEP 362: Deprecate the Solaris and SPARC Ports: These will be deprecated in this release, and in a future release will be removed completely.
- JEP 363: Remove the Concurrent Mark Sweep (CMS) Garbage Collector (GC): The CMS Garbage Collector was deprecated over two years ago so that attention could be focused on improving other collectors. Since then, two new collectors have been introduced: ZGC and Shenandoah. The team believes that it is now safe to remove, and expects that future improvements to other garbage collectors will further reduce the need for CMS.
- JEP 364 and 365: ZGC on macOs and Windows: The ZCG garbage collector has been ported to both macOS and Windows.
- JEP 366: Deprecate the ParallelScavenge + SerialOld GC Combination: According to the team, this combination is rarely used, but requires significant maintenance. They believe it is only useful in deployments that combine a very large young generation GC and very small old generation GC.
- JEP 367: Remove the Pack200 Tools and API: These tools were deprecated in Java SE 11.
- JEP 368: Text Blocks (Second Preview): This will add text blocks, which are multi-line string literals that don’t need escape sequences, automatically format strings in a predictable way, and give developers control over the format.
- JEP 370: Foreign-Memory Access API (Incubator): This API will allow Java programs to safely and efficiently access foreign memory outside of the Java heap.