Sunday, November 19, 2023

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

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

New Features and Enhancements

- core-libs/java.nio.charsets: UTF-8 by DefaultUTF-8 is the default charset for the Java SE APIs. Prior to that was the one of the system, local and configuration. file.encoding may accept UTF-8 or COMPAT, latter instructing runtime to behave as previous releases.

- core-libs/java.net: Simple Web Server. Minimal static web server for prototyping usage, ad-hoc coding and testing.

- core-libs/java.net: Internet-Address Resolution SPI. For InetAddress to be able to use other host name and address resolution resolvers instead of the platform build-in local hosts file and DNS.

- tools/javadoc(tool): Code Snippets in Java API Documentation. @snippet tag for example source code in API documentation. The pre Java 18 version was using {@code ...} that had limitations.

- core-libs: Vector API (Third Incubator). Superior performance to equivalent scalar computations

- core-libs: Foreign Function & Memory API (Second Incubator). Interoperation with code and data outside of the Java runtime. Invoke functions outside JVM and memory not managed by the JVM, thus calling native libraries and process native data without JNI

- specification/language: Pattern Matching for switch (Second Preview)

1.  selector expression typing (an integral primitive type or any reference type)
2.  case null
3.  type pattern (case Integer i -> )
4.  guarded patterns (case String s && s.length() > 0 -> )
5.  parentesized patterns (case Triangle t && (t.calculateArea() > 100) ->)
6.  pattern labels dominance (String s included in CharSequence cs -> case)
7.  pattern label completeness (missing cases for switch, compile error)
8.  scope of the pattern variable (in case and block)
9.  new label forms (case null: case String s:) (case null, String s ->)
10. total type (case Object o ->)

More details:
JEP 406
JEP 420
JEP 427

- hotspot/gc: The Z Garbage Collector now supports string deduplication. Each string object takes at least 24 bytes at minimum, has 2 fields value and hash and duplications are removed by replacing char[] only

- hotspot/gc: The Serial Garbage Collector now supports string deduplication

- hotspot/gc: The Parallel Garbage Collector now supports string deduplication

- tools/javac: Expand checks of javac's serial lint warning. Besides the traditional check of serialVersionUID in Serializable class, it has additional checks now.

- tools/javadoc(tool): Options to Include Script Files in Generated Documentation

- tools/javadoc(tool): @SuppressWarnings for DocLint Messages

- core-libs/java.lang:reflect: Reimplement Core Reflection With Method Handles. Reimplementation of core reflection with method handles.
- tools/javac: Passing Originating Elements From Filer to JavaFileManager
- core-libs/java.nio.charsets: Charset.forName() Taking fallback Default Value
- core-libs/java.util: New System Property to Control the Default Date Comment Written Out by java.util.Properties::store Methods
- core-libs/javax.annotation.processing: printError, printWarning, and printNote methods on Messager
- core-libs/javax.lang.model: Method to Get Outermost Type Element
- core-libs/javax.lang.model: Map from an Element to its JavaFileObject
- core-libs/javax.lang.model: Mapping between SourceVersion and Runtime.Version
- hotspot/compiler: Improve Compilation Replay. Compilation Replay is a JVM feature of debug builds that is mainly used to reproduce crashes in the C1 or C2 JIT compilers.
- hotspot/gc: Configurable Card Table Card Size
- hotspot/gc: Allow G1 Heap Regions up to 512MB
- hotspot/jfr: JDK Flight Recorder Event for Finalization
- security-libs: SunPKCS11 Provider Now Supports Some PKCS#11 v3.0 APIs
- security-libs/java.security: Alternate Subject.getSubject and doAs APIs Created That Do Not Depend on Security Manager APIs
- security-libs/java.security: KeyStore Has a getAttributes Method
- security-libs/java.security: Support for RSASSA-PSS in OCSP Response
- security-libs/java.security: New Option -version Added to keytool and jarsigner Commands
- security-libs/java.security: Migrate cacerts From JKS to Password-Less PKCS12
- security-libs/java.security: Allow Store Password to Be Null When Saving a PKCS12 KeyStore
- security-libs/javax.crypto:pkcs11: SunPKCS11 Provider Supports AES Cipher With KW and KWP Modes if Supported by PKCS11 Library


Removed Features and Options


- security-libs/java.security: Removal of IdenTrust Root Certificate
- security-libs/java.security: Removal of Google's GlobalSign Root Certificate
- client-libs/2d: Removal of Empty finalize() Methods in java.desktop Module
- core-libs/java.net: Removal of Support for Pre JDK 1.4 DatagramSocketImpl Implementations
- core-libs/java.net: Removal of impl.prefix JDK System Property Usage From InetAddress
- core-libs/java.net: Removal of Legacy PlainSocketImpl and PlainDatagramSocketImpl Implementations
- security-libs/org.ietf.jgss:krb5: Removal of default_checksum and safe_checksum_type From krb5.conf

- security-libs/java.security: Removed Telia Company's Sonera Class2 CA Certificate


Deprecated Features and Options, other notes and differences between Oracle JDK and OpenJDK not included

Sunday, October 8, 2023

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

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

New Features and Enhancements

- specification: Finalized sealed classes with no changes from JDK 16

- specification: Pattern Matching for switch (Preview). Enhance the Java programming language with pattern matching for switch expressions and statements, along with extensions to the language of patterns

- core-libs/java.util: Enhanced Pseudo-Random Number Generators. Added RandomGenerator interface now implemented by legacy classes

- hotspot/compiler: Modernization of Ideal Graph Visualizer (a tool to explore visually and interactively the intermediate representation used in the HotSpot VM C2 just-in-time (JIT) compiler)

- tools/javadoc(tool): Source Details in Error Messages. When JavaDoc reports an issue in an input source file, it displays the source line for the issue, and a line containing a caret (^) pointing to the position on the line, in a manner similar to compiler (javac) diagnostic messages.

- tools/javadoc(tool): New Page for "New API" and Improved "Deprecated" Page. JavaDoc can now generate a page summarizing the recent changes in an API.

- core-libs: Foreign Function & Memory API (Incubator). Call code and data outside of Java, without JNI.

- core-libs/java.io:serialization: JDK Flight Recorder Event for Deserialization in order to monitor deserialization events.

- core-libs/java.time: Add java.time.InstantSource. Abstraction from java.time.Clock that only focuses on the current instant and does not refer to the time zone

- core-libs/java.util: Hex Formatting and Parsing Utility.

- hotspot/compiler: New Class Hierarchy Analysis Implementation in the HotSpot JVM. Enhanced handling of abstract and default methods which improves inlining decisions made by the JIT-compilers. The new implementation supersedes the original one and is turned on by default

- security-libs/javax.crypto: SunJCE Provider Supports KW and KWP Modes With AES Cipher.

- tools/javadoc(tool): "Related Packages" on a Package Summary Page.

- core-libs/java.lang: Make floating-point operations consistently strict, rather than have both strict floating-point semantics (strictfp) and subtly different default floating-point semantics. This will restore the original floating-point semantics to the language and VM, matching the semantics before the introduction of strict and default floating-point modes in Java SE 1.2.

- Added new method to Map.Entry: copyOf(java.util.Map.Entry).

- client-libs/2d: New macOS Rendering Pipeline
- client-libs/javax.swing: New API for Accessing Large Icons
- core-libs/java.net: DatagramSocket Can Be Used Directly to Join Multicast Groups
- core-libs/java.nio: Add support for UserDefinedFileAttributeView on macOS
- core-libs: Console Charset API
- core-libs/java.io:serialization: Implement Context-Specific Deserialization Filters
- core-libs/java.lang: System Property for Native Character Encoding Name
- hotspot/compiler: Experimental Compiler Blackholes Support.
- hotspot/compiler: macOS/AArch64 Port.
- hotspot/runtime: Unified Logging Supports Asynchronous Log Flushing.
- infrastructure/build: macOS on ARM Early Access Available.
- security-libs/java.security: Provide Support for Specifying a Signer in Keytool -genkeypair Command.
- security-libs/javax.crypto:pkcs11: New SunPKCS11 configuration properties
- security-libs/javax.crypto:pkcs11: SunPKCS11 Provider Supports ChaCha20-Poly1305 Cipher and ChaCha20 KeyGenerator if Supported by PKCS11 Library
- security-libs/javax.net.ssl: Configurable Extensions With System Properties
- security-libs/org.ietf.jgss:krb5: Use permitted_enctypes if default_tkt_enctypes or default_tgs_enctypes is not present.


Removed Features and Options


- core-libs: Strongly Encapsulate JDK Internals. The java launcher option --illegal-access is obsolete. Existing code that must use internal classes, methods, or fields of the JDK can still be made to work by using the --add-opens launcher option, or the Add-Opens JAR-file manifest attribute, to open specific packages.
- core-libs/java.rmi: JEP 407: Remove RMI Activation.
- hotspot/compiler: JEP 410: Remove the Experimental AOT and JIT Compiler.

- security-libs/java.security: Removed Telia Company's Sonera Class2 CA Certificate
- core-libs: Removal of sun.misc.Unsafe::defineAnonymousClass.


Deprecated Features and Options, other notes and differences between Oracle JDK and OpenJDK not included, except:

- Deprecate the Applet API for Removal (It is essentially irrelevant since all web-browser vendors have either removed support for Java browser plug-ins or announced plans to do so)
- Deprecate the Security Manager for Removal (It has not been the primary means of securing client-side Java code for many years, and it has rarely been used to secure server-side code)