Sunday, February 19, 2023

What's new in JDK 13(my short version)

Oracle Release Notes
Java SE 13 Final Release Specification
Java API Diff page: +,-,change

New Features and Enhancements

- core-libs/java.nio: added FileSystems.newFileSystem method for file system files.
- core-libs/java.nio: java.nio.ByteBuffer and the other buffer types in java.nio now define absolute bulk get and put methods to transfer contiguous sequences of bytes without regard to or effect on the buffer position.
- core-libs/java.time: New Japanese Era Name Reiwa
- core-libs/java.util:i18n: Support for Unicode 12.1
- hotspot/gc: ZGC was enhanced to return unused heap memory to the operating system. Memory will not be uncommitted so that the heap size shrinks below the minimum heap size (-Xms). This means this feature will be implicitly disabled if the minimum heap size (-Xms) is configured to be equal to the maximum heap size (-Xmx)
- hotspot/gc: Added -XXSoftMaxHeapSize Flag, working only on Z garbage collector. This flag is useful when resource usage is a concern to keep heap low but allow to deal with temporary heap increase. An additional case would be when using ZGC to more aggressively collect garbage, for more resilience to a sudden increase in allocation.
- hotspot/gc: The maximum supported heap size for ZGC was increased from 4TB to 16TB.
- hotspot/runtime: Dynamic CDS Archiving - Application class data sharing, used to improve startup and footprint by allowing classes to be placed in the shared archive (Application Class-Data Sharing) is extended to be dynamic on application exit.
- tools/javac: JEP 354 Switch Expressions (Second Preview) - To yield a value from a `switch` expression, the `break` with value statement is dropped in favor of a `yield` statement. See JEP 325: Switch Expressions (Preview) for previous.

Examples:
int j = switch (day) {
    case MONDAY  -> 0;
    case TUESDAY -> 1;
    default      -> {
        int k = day.toString().length();
        int result = f(k);
        yield result;
    }
};

int result = switch (s) {
    case "Foo":
        yield 1;
    case "Bar":
        yield 2;
    default:
        System.out.println("Neither Foo nor Bar, hmmm...");
        yield 0;
};

- tools/javac: JEP 355 Text Blocks (Preview) - A text block is a multi-line string literal that avoids the need for most escape sequences, automatically formats the string in a predictable way, and gives the developer control over format when desired

Example:
String textBlock = """
"somestringWithinDoubleQuotes"
""";

- security-libs/java.security: Configurable Read Timeout for CRLs
- security-libs/java.security: New keytool -showinfo -tls Command for Displaying TLS Configuration Information
- security-libs/javax.crypto: Support for MS Cryptography Next Generation (CNG), thus allowing RSA and EC keys in CNG format to be loaded from Windows keystores.
- security-libs/javax.crypto:pkcs11: SunPKCS11 Provider Upgraded with Support for PKCS#11 v2.40
- security-libs/javax.net.ssl: Support for X25519 and X448 in TLS
- security-libs/javax.net.ssl: Session Resumption without Server-Side State in JSSE
- security-libs/javax.security: Allow SASL Mechanisms to Be Restricted
- security-libs/javax.xml.crypto: New String Constants for Canonical XML 1.1 URIs
- security-libs/javax.xml.crypto: [xmldsig] Added KeyValueEC_TYPE
- security-libs/org.ietf.jgss: Added a Default Native GSS-API Library on Windows
- security-libs/org.ietf.jgss:krb5: Support for Kerberos Cross-Realm Referrals (RFC 6806)
- xml/jaxp: New Methods for Creating DOM and SAX Factories with Namespace Support


Removed Features and Options

- client-libs: Removal of awt.toolkit System Property
- core-libs/java.lang: Removal of Runtime Trace Methods
- core-libs/java.net: Pre-JDK 1.4 SocketImpl Implementations No Longer Supported
- hotspot/runtime: Removal of VM option -XX+AggressiveOpts
- security-libs: Duplicated RSA Services No Longer Supported by SunJSSE Provider
- security-libs/java.security: Removal of T-Systems Deutsche Telekom Root CA 2 Certificate
- security-libs/java.security: Removal of Two DocuSign Root CA Certificates
- security-libs/java.security: Removal of Two Comodo Root CA Certificates
- security-libs/javax.net.ssl: Removal of the Internal com.sun.net.ssl Package Only Used for Compatibility with Legacy JSSE 1.0 Applications
- security-libs/javax.net.ssl: Removal of Experimental FIPS 140 Compliant Mode from SunJSSE Provider
- tools/javadoc(tool): Removal of Old Features from javadoc Tool

Deprecated Features and Options, Other Notes and Differences between Oracle JDK and OpenJDK not included