Java SE 18 release

After six months of development, Oracle has released Java SE 18 (Java Platform, Standard Edition 18), which uses the OpenJDK open source project as a reference implementation. With the exception of the removal of some deprecated features, Java SE 18 maintains backward compatibility with previous releases of the Java platform—most previously written Java projects will still work without modification when running under the new version. Installable builds of Java SE 18 (JDK, JRE, and Server JRE) are prepared for Linux (x86_64, AArch64), Windows (x86_64), and macOS (x86_64, AArch64). Developed by the OpenJDK project, the Java 18 reference implementation is fully open under the GPLv2 license with GNU ClassPath exceptions to allow dynamic linking to commercial products.

Java SE 18 is categorized as a regular support release, with updates to be released before the next release. The long term support (LTS) branch should be Java SE 17, which will receive updates until 2029. Recall that starting with the release of Java 10, the project switched to a new development process, which implies a shorter cycle for the formation of new releases. New functionality is now being developed in one constantly updated master branch, which incorporates already completed changes and from which branches are branched every six months to stabilize new releases.

New features in Java 18 include:

  • The default encoding is UTF-8. Java APIs that process text data based on character encoding will now use UTF-8 by default on all platforms, regardless of system settings and locale settings. To revert to the old behavior, where the encoding is chosen based on the system locale, you can use the "-Dfile.encoding=COMPAT" option.
  • The package includes the com.sun.net.httpserver package, which includes the jwebserver utility and library API with the implementation of a simple http server for serving static content (CGI and servlet-like handlers are not supported). The built-in HTTP server is not optimized for workloads and does not support access control and authentication, as it is aimed primarily at use in the development process for prototyping, debugging and testing projects.
  • JavaDoc provides support for the "@snippet" tag to embed working examples and code snippets into API documentation, where you can use validation tools, syntax highlighting, and IDE integration.
  • The implementation of the java.lang.reflect API (Core Reflection), designed to obtain information about methods, fields and class constructors, as well as access to the internal structure of classes, has been redesigned. The java.lang.reflect API itself remains unchanged, but is now implemented using method handles provided by the java.lang.invoke module, instead of using bytecode generators. The change allowed us to unify the implementations of java.lang.reflect and java.lang.invoke, and simplify their maintenance.
  • A third preview of the Vector API has been proposed, providing functions for vector calculations that are executed using vector instructions on x86_64 and AArch64 processors and allow operations to be applied simultaneously to multiple values ​​(SIMD). Unlike the capabilities provided in the HotSpot JIT compiler for auto-vectorization of scalar operations, the new API makes it possible to explicitly control vectorization for parallel data processing.
  • Added SPI interface (service-provider interface) for resolving host names and IP addresses, allowing you to use alternative resolvers in java.net.InetAddress that are not tied to handlers offered by the operating system.
  • A second preview of the Foreign Function & Memory API is provided, allowing 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.
  • A second experimental implementation of pattern matching in “switch” expressions has been added, allowing the use of flexible patterns in “case” labels rather than exact values, covering a series of values ​​at once, for which previously it was necessary to use cumbersome chains of “if...else” expressions. 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(); };
  • The finalization mechanism and its associated methods such as Object.finalize(), Enum.finalize(), Runtime.runFinalization() and System.runFinalization() have been deprecated and will be disabled in a future release.
  • The ZGC (Z Garbage Collector), SerialGC, and ParallelGC garbage collectors support row deduplication.

Source: opennet.ru

Add a comment