Oracle for two years , New versions of the Java,Oracle JDK 14 Bring developers a preview of innovative features and features .Oracle JDK 14 New features have been added to improve developer productivity , These new features include ： Yes switch Of expression Java Language support , For continuous monitoring JDK Flight Recorder New data API, And low latency Z The garbage collector extends to macOS and Windows in , In addition, the new version includes three preview features ：instanceof Pattern matching （JEP 305）、 Record class （JEP 359） And text blocks （JEP 368）
Now Oracle is officially released Java 14（Oracle JDK 14）.
Adhering to Oracle's consistent commitment to accelerating innovation ,Java Keep releasing new versions every six months , New enhancements for the enterprise and developer community . new edition Java Development kit （JDK） There are many new features , There are two much anticipated new preview features ：instanceof Pattern matching （JEP 305） And record class （JEP 359） And a second block of text as a preview feature （JEP 368）.
Besides , The latest version Java It's also added yes switch Of expression Java Language support , Disclosed for continuous monitoring DK Flight Recorder New data API, Will delay low Z The availability of the garbage collector extends to macOS and Windows, And in the incubator module package independent Java Applications and new external memory access API, To support security 、 Access... Efficiently Java Memory outside the heap .
“Java Keep the pace of new releases every six months , So that developers can try many features as soon as possible that would have to wait a few years , This advantage lies in Java 14 It is further reflected in .” Oracle Java Vice president of platform development Georges Saab Express ,“JDK 14 It not only brings a lot of enhancements to help developers improve their work efficiency , And the first offer comes from Project Panama And so on , Including external memory access API enhance （JEP 370） as well as Project Amber Continuous improvement of , For example, pattern matching （JEP 305） And record class （JEP 359）.”
Java 14 The distribution is the result of the whole industry working together , This includes open review 、 Weekly build and have been Oracle engineers through OpenJDK Communities and Java Community Process And global Java Extensive collaboration among members of the developer community .
Java 14 New features include the following ：
JEP 305：instanceof Pattern matching （Pattern Matching for instanceof, preview ） — This preview feature is available through instanceof Operator pattern matching to enhance Java. Use this feature , Developers can remove common boilerplate code , Write more concise type safety code , So as to improve work efficiency .
JEP343： Packaging tools （Packaging Tool, Incubation stage ）— Support developers to package Java Apply and distribute in platform specific format . This helps developers develop modern applications that require the runtime and application to be bundled in a single deliverable .Java 14 This tool is introduced into the incubator module , It will not be the final version API And non final tools for developers to get feedback , these API Or tools may be retained or removed in future releases .
JEP 345： Apply to G1 Of NUMA Aware memory allocation （NUMA-Aware Memory Allocation for G1）— Improve inconsistent memory access （NUMA） On the system G1 The overall performance of the garbage collector .
JEP 349：JFR Flow of events （JFR Event Streaming） — Open JDK Flight Recorder （JFR） Data for continuous monitoring . This helps simplify the tools and applications for JFR Access to data , And encourage further innovation .
JEP 352： Nonvolatile mapped byte buffer （Non-Volatile Mapped Byte Buffers） — When using non-volatile memory , by JDK Add a file mapping pattern , Extend access to non-volatile memory .
JEP 358： Helpful NullPointerExceptions（Helpful NullPointerExceptions） — Describe exactly which variable is null And provide other useful information , So as to improve NullPointerExceptions The usability of . This will improve developer productivity , Improve the quality of many development and debugging tools .
JEP 359： Record class （Records, preview ）— The preview feature uses a compact syntax to declare classes that hold shallow immutable data . This feature helps to significantly reduce boilerplate code in this class , But its biggest advantage is that it can model data as data . Users can easily 、 clear 、 Simply declare these shallow immutable data aggregations .
JEP 361：Switch expression （Switch Expressions, The standard version ）— stay JDK 12 and JDK 13 in ,Switch The expression is the preview feature , Now it's a standard feature . It allows the use of switch As a statement or expression . This feature simplifies everyday coding , And match the patterns in this version (JEP 305) The preview feature is ready .
JEP 364：macOS Upper ZGC as well as JEP 365：Windows Upper ZGC — Although most of them need ZGC Users of the need to Linux Scalability of the environment , But it usually needs to be deployed and tested in order to macOS and Windows Upper support ZGC. There are also a few aimed at Windows and macOS Desktop applications will also benefit from ZGC.
JEP 368： Text block （Text Blocks, Second preview ）— Text blocks are introduced for the first time as preview features Java 13 After that, I received a lot of feedback from end users . Now? , Text blocks are enhanced , Again as a preview feature in Java 14 in , The goal becomes the future JDK Version of the standard features . Text blocks make it easy to express strings across multiple lines of source code . It has improved Java In the procedure, it is not Java The readability of the string of code written in language ; It is agreed that , Any newly constructed block of text can be represented by the same character set as the string , Interpret the same escape sequence and operate in the same way as a string .
JEP370： External memory access API（Foreign-Memory Access API, Incubation stage ）— this API It is permissible to Java Program security 、 Access... Efficiently Java External memory outside the heap .
For users and businesses looking for business support , Oracle also offers a low cost 、 Predictable support solutions — Oracle Java SE A subscription service . At present, the service has been widely used by thousands of organizations of different sizes and types around the world . Through this service , Users can get Java SE Full support of licenses and required systems and on demand , And we can get the tested and certified performance from Oracle on a regular basis 、 Stability and security update .
Java As one of the preferred programming languages favored by software developers , With Java 14 On time delivery of innovative functions , Detailed planning for the future and continuous investment in the ecosystem ,Java The platform will continue to inject power into modern application development .
本文为[Science and technology stars]所创，转载请带上原文链接，感谢