id=”js_article-tag-card__right” class=”article-tag-card__right”> 1

>

Java Development Kit (JDK) 18 will be released on March 22, 2022. The new version of standard Java will have nine new features, which were frozen on December 9 and entered the first phase of Rampdown.

It’s worth noting that JDK 17 is a long-term support (LTS) release that will be supported by Oracle for at least eight years, but JDK 18 will be a short-term feature release that will only be supported for six months. Early adopters of JDK 18 for Linux, Windows, and MacOS can be found on java.net (https://jdk.java.net/18/).

JDK 18 New Features at a Glance

:

  • JEP 400: Specifies UTF-8 as the default character set for standard Java APIs. With this change, APIs that rely on the default character set will be consistent across all implementations, operating systems, locales, and configurations.
  • JEP 408: Introducing a simple web server. Provides a command-line tool to start a minimal web server that only serves static files, and no CGI or servlet-like functionality is available. The tool is used for prototyping, temporary coding, and testing purposes, especially in teaching environments.
  • JEP 413: Support for including code snippets in Java API documentation. Introduce a @snippet markup for JavaDoc’s Standard Doclet to simplify embedding sample source code in API documentation.
  • JEP 416: Re-implement core reflection with method handles. Refactoring the methods, constructors, and fields of java.lang.reflect on top of the method handle of java.lang.invoke, and the underlying mechanism of using method handles to handle reflection will reduce the API for both java.lang.reflect and java.lang.invoke Maintenance and development costs.
  • JEP 417: Vector API (Third Incubator). Introduce an API to express vector computations that, at runtime, can be compiled into the best vector instructions on supported CPU architectures, achieving better performance than equivalent scalar computations.
  • JEP 418: Internet Address Resolution SPI. Define a service provider interface (SPI) for host name and address resolution so that java.net.InetAddress can use a resolver other than the platform’s built-in resolver.
  • JEP 419: External Functions and Memory APIs (Second Incubator). A new API has been introduced through which Java programs can interoperate with code and data outside of the Java runtime. By efficiently calling external functions (that is, code outside the JVM) and securely accessing external memory (that is, memory not managed by the JVM), external functions and memory APIs enable Java programs to call native libraries and process native data without the fragility and danger of JNI.
  • JEP 420: switch pattern matching expression. Enhance the Java programming language with pattern matching of switch expressions and statements and extensions to the pattern language. Extending pattern matching to switch allows expressions to be tested against multiple patterns, each with a specific action, to express complex data-oriented queries concisely and safely.
  • JEP 421: Deprecated Finalization features. Finalization, introduced in Java 1.0 to help avoid resource leaks, was deprecated with unpredictable latency, unconstrained behavior, and unspecified threads, which led to problems with security, performance, reliability, and maintainability, so it was deprecated and users had the option to migrate to other resource management technologies such as try– with-resources statement and cleaner.

January

20, 2022 will enter the second phase of Rampdown, with initial and final candidate (RC) releases on February 10 and February 24 next year, respectively, and the stable JDK 18 will be released on March 22, 2022, which can be found on the JDK announcement page.

JDK announcement page: https://openjdk.java.net/projects/jdk/18/

source | OSC Open Source Community (ID: oschina2013)