Java SE 17 Released

Java SE 17 Released

After six months of development, Oracle has released a platform Java SE 17 (Java Platform, Standard Edition 17), as a reference implementation that uses an open source project OpenJDK. Except for the removal of some deprecated features, Java SE 17 retains backward compatibility with previous releases of the Java platform — most previously written Java projects will work unchanged when run under the new version. Ready-to-install Java SE 17 assemblies (JDK, JRE, and Server JRE) are prepared for Linux (x86_64, AArch64), Windows (x86_64), and macOS (x86_64, AArch64). The reference implementation developed by the OpenJDK project is Java 17 fully open source under the GPLv2 license with GNU ClassPath exceptions to allow dynamic linking to commercial products.

Java SE 17 has been categorized as a Long Term Support (LTS) release with updates to be released until 2029. Updates for the previous Java 16 interim release have been discontinued. The previous LTS branch of Java 11 will be supported until 2026. The next LTS release is slated for September 2024. Recall that starting with the release of Java 10, the project moved to a new development process, implying a shorter cycle of forming new releases. The new functionality is now being developed in one constantly updated master branch , which includes ready-made changes and from which branches are branched every six months to stabilize new releases.

Of the innovations in Java 17, we can note :

  • An proposed experimental implementation of pattern matching in “switch” expressions is , which allows using not exact values ​​in “case” labels, but flexible templates covering a series of values ​​at once, for which earlier it was necessary to use cumbersome chains of “if … else” expressions. In addition, inside the “switch” there is the possibility of handling NULL values. Object o = 123L; String formatted = switch (o) { case Integer i -> String.format(“int %d”, i); case Long l -> String.format(“long %d”, l); case Double d -> String.format(“double %f”, d); case String s -> String.format(“String %s”, s); default -> o.toString(); };
  • Stabilized support for “sealed” classes and interfaces that cannot be used by other classes and interfaces to inherit, extend, or override implementation. Sealed classes also provide a more declarative way to restrict the use of a superclass than access modifiers, based on an explicit enumeration of the subclasses allowed for extension. package com.example.geometry; public sealed class Shape permits com.example.polar.Circle, com.example.quad.Rectangle, com.example.quad.simple.Square {…}
  • A proposed second preliminary implementation of the Vector API is , which provides functions for vector calculations that are performed using vector instructions of the x86_64 and AArch64 processors and allow simultaneous application of operations to multiple values ​​(SIMD). Unlike the capabilities of autovectorization of scalar operations provided in the HotSpot JIT compiler, the new API makes it possible to explicitly control vectorization for parallel data processing.
  • Added a preliminary implementation of the Foreign Function & Memory API that allows applications to interact with code and data outside the Java runtime. The new API allows you to efficiently call non-JVM functions and access non-JVM-managed memory. For example, you can call functions from external shared libraries and access process data without using JNI.
  • The rendering engine for macOS, which powers the Java 2D API, which in turn is used by the Swing API, is adapted to use the Metal graphics API. OpenGL is still used by default on macOS, and Metal support requires “-Dsun.java2d.metal = true” and at least macOS 10.14.x release.
  • Added port for macOS / AArch64 platform (Apple computers based on new Apple M1 chips). A feature of the port is support for the W ^ X (Write XOR Execute) memory protection mechanism, in which memory pages cannot be simultaneously available for writing and execution. (the code can be executed only after the prohibition of writing, and writing to the memory page is possible only after the prohibition of execution).
  • Returned to use only strict (strictfp) semantics for floating point expressions. Dropped support for the “default” semantics available since the Java 1.2 release, which includes simplifications for working on systems with very old math coprocessors x87 (after the SSE2 instructions, the need for additional semantics was gone).
  • Implemented new types of interfaces to the pseudo-random number generators, and implemented additional algorithms for higher quality random number generation. Applications are given the opportunity to choose an algorithm for generating pseudo-random numbers. Improved support for generating streams of random objects.
  • Implemented mandatory strong encapsulation of all JDK internals, with the exception of critical APIs such as sun.misc.Unsafe. Strong encapsulation blocks attempts to access internal classes, methods, and fields from code. Previously, strict encapsulation could be disabled with the “–illegal-access = permit” option, but it is now deprecated. For applications that need access to internal classes, methods and fields, they must be explicitly defined using the “–add-opens” option or the Add-Opens attribute in the manifest file.
  • Applications are provided with the ability to define filters for deserializing data, which can be context sensitive and selected dynamically in relation to specific deserialization operations. The filters you set are applicable to the entire virtual machine (JVM-wide), i.e. cover not only the application itself, but also the third-party libraries used in the application.
  • Swing adds the javax.swing.filechooser.FileSystemView.getSystemIcon method to load large thumbnails to improve UI rendering on HighDPI screens.
  • The API provides support for connecting to Multicast groups without the need for a separate API.
  • The improved IGV (Ideal Graph Visualizer) utility has been , which provides interactive visualization of the intermediate code representation in the HotSpot VM C2 JIT compiler.
  • In JavaDoc, by analogy with the javac compiler, when displaying an error, the number of the problem line in the source file and the location of the error are now indicated.
  • Added the native.encoding property, which reflects the name of the system character encoding (UTF-8, koi8-r, cp1251, etc.).
  • Added java.time.InstantSource interface to manipulate time without being bound to time zone.
  • Added java.util.HexFormat API to convert to hexadecimal and vice versa.
  • A added to blackhole mode has been the compiler, which disables dead-code elimination, which can be used in performance tests.
  • The Runtime added option “-Xlog: async” for the log entries in the asynchronous mode.
  • When establishing secure connections, TLS 1.3 is enabled by default (previously TLS 1.2 was used).
  • The previously deprecated API Applet (java.applet.Applet *, javax.swing.JApplet), which was used to run Java applications in a browser, has been moved to the category of intended for removal (it has lost its relevance after the termination of support for the Java plug-in for browsers).
  • Moved into the category of Security Manager scheduled for removal, which has long lost its relevance and turned out to be unclaimed after the end of support for the browser plug-in.
  • Removed the mechanism RMI Activation , which is deprecated, transferred to the category of options back in Java 8 and is almost never used in modern practice.
  • An from the SDK removed experimental compiler has been that supports JIT (just-in-time) for dynamically compiling Java code for the HotSpot JVM, as well as the ahead-of-time compilation mode (AOT, ahead-of-time) of classes into machine code before starting the virtual machine. The compiler was written in Java and based on the work of the project Graal . It is noted that compiler maintenance requires a lot of labor costs, which do not justify themselves in conditions of lack of demand from developers.

Be the first to comment

Leave a Reply

Your email address will not be published.