View ToC

Java 17 - Overview



Java 17 is a major feature release and it has brought many JVM specific changes and language specific changes to JAVA. JAVA 17 was released on September, 2021, just six months after Java 16 release.

Java 17 is a LTS release.

New Features

Following are the major new features which are introduced in Java 17.

  • JEP 415: Context-Specific Deserialization Filters − Allow apps to use a JVM-wide filter factory to choose a filter for each deserialization operation, allowing them to build context-specific and dynamically selected deserialization filters.

  • JEP 414: Vector API (Second Incubator) − Introduce a platform-agnostic vector API, which was first introduced in JDK 16 and will be reintroduced in JDK 17, for expressing vector computations that reliably compile to optimal vector instructions on supported CPU architectures at runtime, outperforming equivalent scalar computations.
    - The vector API in JDK 17 has been improved for performance and implementation, including enhancements to translate byte vectors to and from boolean arrays.

  • JEP 412: Foreign Function & Memory API (Incubator) − Introduce an API that allows Java programmes to call native libraries and process native data without risking JNI by efficiently executing foreign functions (i.e., code that runs outside of the JVM) and securely accessing foreign memory (i.e. memory not handled by the JVM).
    - The Foreign-Memory Access API and the Foreign Linker API, both incubating APIs, are combined in this JEP proposal. It had previously been the focus of Java 14, 15, and 16

  • JEP 411: Deprecate the Security Manager for Removal − There has been a Security Manager in Java since version 1.0. For many years, however, it has been infrequently used. Security Manager has been deprecated in Java 17 and will be removed in a future version, along with the obsolete Applet API, in order to bring Java forward (JEP 398).

  • JEP 410: Remove the Experimental AOT and JIT Compiler − Because of its limited utility and the enormous work necessary to maintain it, the experimental Java-based ahead-of-time (AOT) and just-in-time (JIT) compiler should be removed.
    - Graal compiler will keep the experimental Java-level JVM compiler interface (JVMCI) so that developers can continue to use externally-built versions of the compiler for JIT compilation.

  • JEP 409: Sealed Classes − Enhance Java programming language with sealed classes and interfaces. Sealed classes and interfaces restrict which other classes or interfaces can extend or implement.

  • JEP 407: Remove RMI Activation − The Activation mechanism for Remote Method Invocation (RMI) will be eliminated, but the remainder of RMI should be kept. The RMI Activation mechanism is no longer in use because it is obsolete. JEP 385 in Java SE 15 recommended that it be deleted because it was deprecated.

  • JEP 406: Pattern Matching for switch (Preview) − Switch pattern matching extends Java's pattern language to allow switch expressions and statements to be checked against a variety of patterns, each with its own action. This allows sophisticated data-oriented queries to be expressed in a simple and secure manner.
    - In JDK 16, the instanceof operator now accepts a type pattern and performs pattern matching. The proposed expansion to the well-known instanceof-and-cast idiom simplifies it.

  • JEP 403: Strongly Encapsulate JDK Internals − Except for crucial internal APIs like sun.misc.Unsafe, strongly encapsulate all internal aspects of the JDK. From JDK 9 through JDK 16, it will no longer be able to relax the rigorous encapsulation of internal sections with a single command-line parameter.

  • JEP 398: Deprecate the Applet API for Removal − Because all online browser makers have either withdrawn or announced plans to eliminate support for Java browser plug-ins, the Applet API is practically obsolete. The Applet API was deprecated in Java 9, but it had not been removed previously.

  • JEP 391: macOS/AArch64 Port − Port the JDK to the new architecture macOS/AArch64 expecting future demand

  • JEP 382: New macOS Rendering Pipeline − The new Apple Metal framework necessitates the development of a new Java 2D rendering pipeline for macOS. Java 2D is still entirely dependant on OpenGL. Although Apple deprecated the OpenGL rendering library in macOS 10.14, the Metal framework now takes its place.

  • JEP 356: Enhanced Pseudo-Random Number Generators − Pseudorandom number generators (PRNGs) get a new interface and implementation, including jumpable PRNGs and a new class of splittable PRNG algorithms (LXM).
    - A focus on numerous areas for development in the field of pseudorandom number generation in Java motivates the strategy. RandomGenerator will have a common API for all current and new PRNGs, as well as four specialised RandomGenerator interfaces.

  • JEP 306: Restore Always-Strict Floating-Point Semantics − Make floating-point operations consistently stringent, rather than having both severe floating-point semantics (strictfp) and drastically varied default floating-point semantics. This will restore the language's and virtual machine's original floating-point semantics, as they were before Java SE 1.2 introduced strict and default floating-point modes.

Java 17 enhanced numerous APIs with new methods and options. We'll see these changes in next chapters.