Java SE 18 Release

After six months of development, Oracle has released Java SE 18 (Java Platform, Standard Edition 18), which uses the open project OpenJDK as its reference implementation. Except for the removal of some deprecated features, Java SE 18 maintains backward compatibility with previous Java platform releases—most previously written Java projects will work without changes when run on the new version. Installable builds of Java SE 18 (JDK, JRE, and Server JRE) are provided for Linux (x86_64, AArch64), Windows (x86_64), and macOS (x86_64, AArch64). The reference implementation of Java 18 developed within the OpenJDK project is fully open under the GPLv2 license with GNU ClassPath exceptions allowing dynamic linking with commercial products.

Java SE 18 is categorized as a release with a standard support period, with updates being released until the next version. For a long-term support (LTS) version, Java SE 17 should be used, with updates being provided until 2029. It is worth recalling that starting with Java 10, the project transitioned to a new development process, which involves a shorter cycle for forming new releases. New functionality is now developed in a continuously updated master branch, from which branches for stabilizing new releases are created every six months.

Notable features of Java 18 include:

  • UTF-8 encoding is enabled by default. Java APIs that process text data with consideration for character encoding will now default to using UTF-8 across all platforms, regardless of system settings and locale. To revert to the old behavior, where the encoding is selected based on the system locale, you can use the parameter "-Dfile.encoding=COMPAT".
  • The package com.sun.net.httpserver is included, which contains the jwebserver utility and a library API that implements 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 mainly aimed at use during development for prototyping, debugging, and testing projects.
  • JavaDoc now supports the @snippet tag for embedding working examples and code fragments in API documentation, which can be used with tools for correctness checking, syntax highlighting, and integration with IDEs.
  • The implementation of the API java.lang.reflect (Core Reflection), which is intended to obtain information about methods, fields, and constructors of classes, as well as to access the internal structure of classes, has been revamped. The java.lang.reflect API itself remains unchanged but is now implemented using method handles provided by the java.lang.invoke module, instead of relying on bytecode generators. This change allows for unifying the implementations of java.lang.reflect and java.lang.invoke, and simplifies their maintenance.
  • A third preliminary implementation of the Vector API has been proposed, which provides functions for vector computations that are performed using the vector instructions of x86_64 and AArch64 processors and allow for operations to be applied simultaneously to multiple values (SIMD). Unlike the auto-vectorization capabilities for scalar operations provided in the HotSpot JIT compiler, the new API gives explicit control over vectorization for parallel data processing.
  • A service-provider interface (SPI) has been added for resolving host names and (the key to connect to is specified, and iroh finds the associated host and establishes an encrypted connection using the QUIC protocol). Direct P2P connections are established whenever possible, but if not, it falls back to using relays, which are also employed for host discovery by keys. You can run your own relay or connect to public relays supported by the community., allowing alternative resolvers, independent of the handlers provided by the operating system, to be used in java.net.InetAddress.
  • The second preliminary implementation of the Foreign Function & Memory API is proposed, allowing applications to interact with code and data outside the Java runtime. The new API enables efficient calls to functions not executed in the JVM, and access to memory unmanaged by the JVM. For example, functions can be called from external shared libraries and data can be accessed from processes without using JNI.
  • The second experimental implementation of pattern matching in switch expressions has been added, allowing flexible patterns that cover a range of values to be used in case labels instead of requiring cumbersome 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(); };
  • The finalization mechanism has been deprecated and will be disabled in one of the upcoming releases, along with related methods such as Object.finalize(), Enum.finalize(), Runtime.runFinalization(), and System.runFinalization().
  • String deduplication support has been implemented in the ZGC (Z Garbage Collector), SerialGC, and ParallelGC garbage collectors.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster