After six months of development, Oracle has released the Java SE 19 platform (Java Platform, Standard Edition 19), using the OpenJDK open project as its reference implementation. Except for the removal of some deprecated features, Java SE 19 maintains backward compatibility with previous versions of the Java platform — most previously written Java projects will run without changes on the new version. Installable builds of Java SE 19 (JDK, JRE, and Server JRE) are prepared for Linux (x86_64, AArch64), Windows (x86_64), and macOS (x86_64, AArch64). The reference implementation of Java 19 developed as part of the OpenJDK project is fully open under the GPLv2 license, with exceptions for GNU ClassPath that allow dynamic linking with commercial products.
Java SE 19 is categorized as a release with regular support, with updates to be released until the next version. For long-term support (LTS), Java SE 17 should be used, with updates scheduled until 2029. It should be noted that starting from the Java 10 release, the project switched to a new development process, involving a shorter cycle for new release formation. New functionality is now developed in a continuously updated master branch, into which ready changes are included, and from which stabilization branches for new releases are created every six months.
Notable new features in Java 19 include:
- Preliminary support for record patterns has been introduced, extending the pattern matching capability that appeared in Java 16 for parsing values of record type classes. For example: record Point(int x, int y) {} void printSum(Object o) { if (o instanceof Point(int x, int y)) { System.out.println(x+y); } }
- Support for the RISC-V architecture has been added in the Linux builds.
- Preliminary support for the FFM (Foreign Function & Memory) API has been added, which allows Java programs to interact with external code and data by calling functions from external libraries and accessing memory outside the JVM.
- Support for virtual threads has been added, representing lightweight threads that greatly simplify the writing and maintenance of high-performance multithreaded applications.
- The fourth preliminary implementation of the Vector API has been proposed, providing features for vector computations using x86_64 and AArch64 processor vector instructions, allowing operations to be applied simultaneously to multiple values (SIMD). Unlike the vectorization capabilities for scalar operations provided by the HotSpot JIT compiler, the new API offers explicit control over vectorization for parallel data processing.
- A third experimental implementation of pattern matching in switch expressions has been added, allowing flexible patterns in case labels that cover a range of values, eliminating the need for bulky if...else chains. 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(); };
- An experimental API for structured concurrency has been added to simplify the development of multithreaded applications by handling multiple tasks running in different threads as a single block.
Source: opennet.ru
