Java SE 15 release

After six months of development, Oracle released platform JavaSE 15 (Java Platform, Standard Edition 15), which uses the open source OpenJDK project as a reference implementation. Java SE 15 maintains backward compatibility with previous releases of the Java platform, and all previously written Java projects will work without changes when launched under the new version. Ready to install Java SE 15 builds (JDK, JRE and Server JRE) prepared by for Linux (x86_64), Windows and macOS. Reference implementation developed by the OpenJDK project Java 15 fully open source under the GPLv2 license with GNU ClassPath exceptions allowing dynamic linking to commercial products.

Java SE 15 is classified as a general support release and will continue to receive updates until the next release. The Long Term Support (LTS) branch should be Java SE 11, which will continue to receive updates until 2026. The previous LTS branch of Java 8 will be supported until December 2020. The next LTS release is scheduled for September 2021. Let us remind you that starting with the release of Java 10, the project switched to a new development process, implying a shorter cycle for the formation of new releases. New functionality is now 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 innovations Java 15 can Mark:

  • Built in support for the EdDSA (Edwards-Curve Digital Signature Algorithm) digital signature creation algorithm RFC 8032). The proposed EdDSA implementation does not depend on hardware platforms, is protected from side-channel attacks (constant time of all calculations is ensured) and is faster in performance than the existing ECDSA implementation written in C language, with the same level of protection. For example, EdDSA using an elliptic curve with a 126-bit key exhibits similar performance to ECDSA with a secp256r1 elliptic curve and a 128-bit key.
  • Added by experimental support for sealed classes and interfaces, which cannot be used by other classes and interfaces to inherit, extend, or override the implementation. Sealed classes also provide a more declarative way to restrict the use of a superclass than access modifiers, based on explicitly listing 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 {…}

  • Added by support for hidden classes that cannot be used directly by the bytecode of other classes. The key purpose of hidden classes is to be used in frameworks that dynamically generate classes at runtime and use them indirectly, through reflection. Such classes usually have a limited life cycle, so maintaining them for access from statically generated classes is not justified and will only lead to increased memory consumption. Hidden classes also eliminate the need for the non-standard API sun.misc.Unsafe::defineAnonymousClass, which is slated for removal in the future.
  • The ZGC (Z Garbage Collector) garbage collector has been stabilized and is recognized as ready for widespread use. ZGC operates in passive mode, minimizes latency due to garbage collection as much as possible (stall time when using ZGC does not exceed 10 ms.) and can work with both small and huge heaps, ranging in size from several hundred megabytes to many terabytes.
  • Stabilized and found ready for general use
    garbage collector Shenandoah, working with minimal pauses (Low-Pause-Time Garbage Collector). Shenandoah was developed by Red Hat and is notable for its use of an algorithm that reduces the stall time during garbage collection by running cleanup in parallel with the execution of Java applications. The size of the delays introduced by the garbage collector is predictable and does not depend on the size of the heap, i.e. for heaps of 200 MB and 200 GB the delays will be identical (don't go out beyond 50 ms and usually within 10 ms);

  • Support has been stabilized and introduced into the language text blocks - a new form of string literals that allows you to include multi-line text data in the source code without using character escaping and preserving the original text formatting in the block. The block is framed by three double quotes.

    For example, instead of the code

    String html = " Β» +
    "\n\t" + " Β» +
    "\n\t\t" + " \"Java 1 is here!\" Β» +
    "\n\t" + " Β» +
    "\n" + " ";

    you can specify:

    String html = """


    Β»Java 1\
    is here!

    """;

  • Redesigned Legacy DatagramSocket API. The old implementations of java.net.DatagramSocket and java.net.MulticastSocket have been replaced with a modern implementation that is easier to debug and maintain, and is also compatible with virtual streams developed within the project Loom. In case of possible incompatibility with existing code, the old implementation has not been removed and can be enabled using the jdk.net.usePlainDatagramSocketImpl option.
  • Second experimental implementation proposed pattern matching in the β€œinstanceof” operator, which allows you to immediately define a local variable to access the checked value. For example, you can immediately write β€œif (obj instanceof String s && s.length() > 5) {.. s.contains(..) ..}” without explicitly defining β€œString s = (String) obj”.

    It was:

    if (obj instanceof Group) {
    Group group = (Group)obj;
    var entries = group.getEntries();
    }

    Now you can do without the definition β€œGroup group = (Group) obj”:

    if (obj instanceof Group group) {
    var entries = group.getEntries();
    }

  • Suggested second experimental implementation of the keyword "record", which provides a compact form for defining classes, allowing you to avoid explicitly defining various low-level methods such as equals(), hashCode() and toString() in cases where data is stored only in fields whose behavior does not change. When a class uses standard implementations of the equals(), hashCode() and toString() methods, it can do without their explicit definition:

    public record BankTransaction(LocalDate date,
    double amount
    String description) {}

    This declaration will automatically add implementations of the equals(), hashCode() and toString() methods in addition to the constructor and getter methods.

  • Suggested a second preview of the Foreign-Memory Access API, allowing Java applications to securely and efficiently access memory regions outside the Java heap by manipulating the new MemorySegment, MemoryAddress, and MemoryLayout abstractions.
  • Disabled and deprecated the Biased Locking optimization technique used in the HotSpot JVM to reduce locking overhead. This technique has lost its relevance on systems with atomic instructions provided by modern CPUs, and is too labor-intensive to maintain due to its complexity.
  • Announced outdated mechanism RMI Activation, which will be removed in a future release. It is noted that RMI Activation is outdated, relegated to the category of an option in Java 8 and is almost never used in modern practice.
  • Removed JavaScript engine rhino, which was deprecated in Java SE 11.
  • Removed ports for Solaris OS and SPARC processors (Solaris/SPARC, Solaris/x64 and Linux/SPARC). Removing these ports will allow the community to accelerate the development of new OpenJDK features without wasting time maintaining Solaris- and SPARC-specific features.

Source: opennet.ru

Add a comment