Monday, March 6, 2023

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

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

New Features and Enhancements

- specification/language: Sealed Classes (Preview). A sealed class or interface can be extended or implemented only by those classes and interfaces permitted to do so.
public abstract sealed class Shape permits Circle, Rectangle, Square {...}

- specification/language: Pattern Matching for instanceof (Second Preview). No changes from JDK 14

- specification/language: Records (Second Preview). Family of records can implement the same sealed interface.
Local records, declared within a method, like:
doSomething() {
record SomeRecord(String param1, String param2) {}
}
Annotations on records:
record SomeRecord(@SomeAnnot String param1, @SomeAnnot String param2) {}

- core-libs/java.lang: Added isEmpty Default Method to CharSequence, which returns the result of calling length() == 0
- core-libs/java.lang: Support for Unicode 13.0

- core-libs/java.lang.invoke: JEP 371 Hidden Classes
Introduce hidden classes, which are classes that cannot be used directly by the bytecode of other classes.
Hidden classes are intended for use by frameworks that generate classes at run time and use them indirectly, via reflection.
A hidden class may be defined as a member of an access control nest, and may be unloaded independently of other classes.
Compared to anonymouse classes which have a dynamically generated name with $, hidden classes have a /.
Hidden classes are to be used in lambda expressions.
More: JEP 371

- core-libs/java.util:collections: Specialized Implementations of TreeMap Methods
The TreeMap class now provides overriding implementations of the putIfAbsent, computeIfAbsent, computeIfPresent, compute, and merge methods.
The new implementations provide a performance improvement

- tools/javac: JEP 378 Text Blocks became final. See JEP 378 Text Blocks
- hotspot/svc-agent: New Options Added to jhsdb for debugd Modeinstall/install: Oracle JDK Installer for Windows Provides Executables (javac, etc) in a Path Reachable From Any Command Prompt
- security-libs/java.security: Tools Warn If Weak Algorithms Are Used

- security-libs/javax.crypto: Edwards-Curve Digital Signature Algorithm (EdDSA)
- core-libs/java.net: Added Support for SO_INCOMING_NAPI_ID Support
- core-svc/javax.management: Added Ability to Configure Third Port for Remote JMX
- core-svc/tools: New Option Added to jstatd for Specifying RMI Connector Port Number
- core-svc/tools: New Option Added to jcmd for Writing a gzipped Heap Dump
- security-libs/java.security: Added Revocation Checking to jarsigner
- security-libs/javax.crypto: SunJCE Provider Supports SHA-3 Based Hmac Algorithms
- security-libs/javax.net.ssl: New System Properties to Configure the TLS Signature Schemes
- security-libs/javax.net.ssl: Support for certificate_authorities Extension
- security-libs/org.ietf.jgss:krb5: Support for canonicalize in krb5.conf
- security-libs/org.ietf.jgss:krb5: Support cross-realm MSSFU


Removed Features and Options


- core-libs/jdk.nashorn: Removal of Nashorn JavaScript Engine. GraalVM can step in as a replacement for JavaScript code previously executed on the Nashorn engine

- core-libs/java.net: Removal of Terminally Deprecated Solaris-specific SO_FLOW_SLA Socket Option
- core-libs/java.rmi: Removal of RMI Static Stub Compiler (rmic)
- core-svc/javax.management: Removal of Deprecated Constant RMIConnectorServer.CREDENTIAL_TYPES
- hotspot/gc: Obsolete -XXUseAdaptiveGCBoundary
- security-libs/java.security: Removal of Comodo Root CA Certificate
- security-libs/javax.net.ssl: Retired the Deprecated SSLSession.getPeerCertificateChain() Method Implementation
- security-libs/javax.net.ssl: Removal of com.sun.net.ssl.internal.ssl.Provider Name


- ZGC and Shenandoah are production ready. G1 garbage collector is default.

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