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)

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

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

New Features and Enhancements

- core-libs: Foreign Linker API (Incubator)API that offers statically-typed, pure-Java access to native code for simplification of native library binding

- core-libs: Strongly Encapsulate JDK Internals by Default . Strongly encapsulate all internal elements of the JDK by default, except for critical internal APIs such as sun.misc.Unsafe. Existing code that uses most internal classes, methods, or fields of the JDK will fail to run

- core-libs: Foreign-Memory Access API (Third Incubator). Introduce an API to allow Java programs to safely and efficiently access foreign memory outside of the Java heap

- core-libs/java.lang:reflec: Add InvocationHandler::invokeDefault Method for Proxy's Default Method Support

- core-libs/java.time: Day Period Support Added to java.time Formats. A new formatter pattern, letter 'B', so applications can now express periods in a day, such as "in the morning" or "at night", not just am/pm.

- core-libs/java.util.stream: Add Stream.toList() Method

- hotspot/gc: ZGC Concurrent Stack Processing. Concurrent threads stacks processing in concurrent phase instead of the stop-the-world pauses. Amount of work in ZGC pauses now constant not exceeding few hundred microseconds.

- hotspot/gc: Concurrently Uncommit Memory in G1. Changes the time when G1 returns Java heap memory to OS. Sizing decisions still made during GC pause, but expensive work offloaded to a concurrent thread.

- tools/javac: Sealed Classes (Second Preview)Inheriting classes of a sealed class have to be marked with one of the following keywords: sealed, final, non-sealed
In future release, type test patterns will improve the code:

Shape rotate(Shape shape, double angle) {
    if (shape instanceof Circle) return shape;
    else if (shape instanceof Rectangle) return shape.rotate(angle);
    else if (shape instanceof Square) return shape.rotate(angle);
    // no else needed!
}
transforms into:
Shape rotate(Shape shape, double angle) {
    return switch (shape) { // pattern matching switch
        case Circle c    -> c;
        case Rectangle r -> r.rotate(angle);
        case Square s    -> s.rotate(angle);
        // no default needed!
    }
}

The Java Virtual Machine recognizes sealed classes and interfaces at runtime, and prevents extension by unauthorized subclasses and subinterfaces.

- tools/javac: Records added as fully functional component of Java language. They act as transparent carriers for immutable data with less ceremony than normal classes. Records now can be used as class members of inner classes

- tools/javac: Pattern Matching for instanceof made final

- tools/jpackage: Packaging Tool jpackage tool, for packaging self-contained Java applications, incubating from java 14


- core-libs: Warnings for Value-based Classes, for discouraging calling the wrapper class constructors and synchronization on value-based class instances
- core-libs/java.nio: Unix domain sockets
- hotspot/compiler: Vector API (Incubator). Vector computations at runtime to optimal vector hardware instructions on supported CPU architectures for superior performance
- hotspot/compiler: Improved CompileCommand Flag
- hotspot/jfr: New jdk.ObjectAllocationSample Event Enabled by Default
- hotspot/runtime: "Elastic Metaspace"."Elastic Metaspace" overhauls the VM-internal metaspace- and class-space-implementation. Less memory is used for class metadata. The savings effect is mostly noticeable in scenarios involving lots of small grained class loaders. Upon class unloading, memory is timely returned to the operating system
- security-libs/java.security: Signed JAR Support for RSASSA-PSS and EdDSA. The JarSigner API and the jarsigner tool now support signing a JAR file with an RSASSA-PSS or EdDSA key
- security-libs/java.security: SUN, SunRsaSign, and SunEC Providers Supports SHA-3 Based Signature Algorithms
- security-libs/java.security: jarsigner Preserves POSIX File Permission and symlink Attributes
- security-libs/java.security: Added -trustcacerts and -keystore Options to keytool -printcert and -printcrl Commands
- security-libs/javax.crypto: SunPKCS11 Provider Supports SHA-3 Related Algorithms
- security-libs/javax.net.ssl: Improve Certificate Chain Handling
- security-libs/javax.net.ssl: Improve Encoding of TLS Application-Layer Protocol Negotiation (ALPN) Values
- security-libs/javax.net.ssl: TLS Support for the EdDSA Signature Algorithm


Removed Features and Options


- security-libs/java.security: Removed Root Certificates with 1024-bit Keys
- security-libs/javax.crypto: Removal of Legacy Elliptic Curves

- client-libs/java.awt: Removal of java.awt.PeerFixer
- hotspot/compiler: Removal of Experimental Features AOT and Graal JIT
- hotspot/runtime: Deprecated Tracing Flags Are Obsolete and Must Be Replaced With Unified Logging Equivalents


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

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

Sunday, February 26, 2023

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

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

New Features and Enhancements

- Pattern matching instanceof
Examples(from JEP 305):
if (obj instanceof String s) {
    // can use s here
} else {
    // can't use s here
}

@Override public boolean equals(Object o) {
    return (o instanceof CaseInsensitiveString cis) &&
        cis.s.equalsIgnoreCase(s);
}

- Switch Expressions from JDK12 and JDK13 made Standard.

- Text Blocks, second preview, adding 2 new escape sequences:
    \ - line-terminator
    \s - single space

- core-libs: Accounting Currency Format Support, NumberFormat.getCurrencyInstance(Locale)

- core-libs/java.lang: JEP 359 Records (Preview) - data carrier classes.
Example:
record Point(int x, int y) { }
record (name)(state description -> i.e. components of the record) {}
More info:
    * A private final field for each component of the state description;
    * A public read accessor method for each component of the state description, with the same name and type as the component;
    * A public constructor, whose signature is the same as the state description, which initializes each field from the corresponding argument;
    * Implementations of equals and hashCode that say two records are equal if they are of the same type and contain the same state; and
    * An implementation of toString that includes the string representation of all the record components, with their names.
    * Records are final, non-abstract and cannot extend other class and cannot declare instance fields other than the private final fields of state description.
    * Components are final
    * isRecord method added to Class

- RecordComponent class added, that provides information about, and dynamic access to, a component of a record class
- RecordComponentElement interface added, representing a record component.
- TypeElement getRecordComponents method added.
- hotspot/gc: JEP 365 ZGC on Windows. The Z Garbage Collector (ZGC) is now available as an experimental feature on Windows
- hotspot/gc: JEP 364 ZGC on macOS. The Z Garbage Collector (ZGC) is now available as an experimental feature on macOS.
- hotspot/gc: Parallel GC Improvements. Parallel GC has adopted the same task management mechanism for scheduling parallel tasks as other collectors. This might result in significant performance improvements.
- hotspot/jfr: JEP 349 JFR Event Streaming. JDK Flight Recorder (JFR) now supports continuous monitoring of a Java application by allowing events to be consumed dynamically using a new API located in the jdk.jfr.consumer package.
- StrictMath added decrementExact, incrementExact and negateExact for int and long.
- PrintStream added write(byte[]) and writeBytes(byte[]) methods, equivalent to write(buf, 0, buf.length). One has throws, the other does not.

- Added optional @Serial annotation, for annotating methods or fields, to help compiler.
This annotation will check the following:
Your methods are one of the following:
    * private void writeObject(java.io.ObjectOutputStream stream) throws IOException
    * private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException
    * private void readObjectNoData() throws ObjectStreamException
    * ANY-ACCESS-MODIFIERObject writeReplace() throws ObjectStreamException
    * ANY-ACCESS-MODIFIERObject readResolve() throws ObjectStreamException
Your fields are one of the following:
    * private static final ObjectStreamField[] serialPersistentFields
    * private static final long serialVersionUID

- HashSet added new method: toArray()
- LockSupport added setCurrentBlocker(Object) method.

- xml/jaxp: New Method to SAX ContentHandler for Handling XML Declaration
- tools/javac: Allow Discoverable javac Plugins to be Invoked by Default
- security-libs/javax.xml.crypto: Apache Santuario Library Updated to Version 2.1.4
- security-libs/java.security: Weak Named Curves in TLS, CertPath, and Signed JAR Disabled by Default.
- hotspot/gc: JEP 345 NUMA-Aware Memory Allocation for G1.
- core-libs/java.nio: Clarify the Specification of ReadableByteChannel.read() and Related Methods


Removed Features and Options

- hotspot/gc: JEP 363 Remove the Concurrent Mark and Sweep (CMS) Garbage Collector (JEP 363)
- core-libs/java.nio.charsets: Removal of sun.nio.cs.map System Property
- deploy: Removal of netscape.javascript.JSObjectgetWindow Method
- security-libs/java.security: Removed Deprecated java.security.acl APIs
- security-libs/java.security: Removal of the Default keytool -keyalg Value
- tools/jar: JEP 367 Remove the Pack200 Tools and API

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

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

Sunday, February 12, 2023

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

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

New Features and Enhancements

- added support for Unicode 11
- core-libs/java.text: Support for Compact Number Formatting(example: 1000 as 1K). CompactNumberFormat class. NumberFormat class has 2 additional methods related to compact (getCompactNumberInstance)
- TypeDescriptor interface added, though for me wasn't clear the use case. Might be related to some class file internals.
- hotspot/gc: ZGC Concurrent Class Unloading, for lowering the overall footprint of the application
- tools/javac: JEP 325 Switch Expressions (Preview, must be enabled) As statement or expression. Precursor to pattern matching.
Example(taken from JEP) from:

switch(day){
    case MONDAY:
    case FRIDAY:
    case SUNDAY:
        System.out.println(6);
        break;
    case WEDNESDAY:
        System.out.println(9);
        break;
}

to:

switch (day) {
    case MONDAY, FRIDAY, SUNDAY -> System.out.println(6);
    case WEDNESDAY              -> System.out.println(9);
}

Switch expression:

int numLetters = switch (day) {
    case MONDAY, FRIDAY, SUNDAY -> 6;
    case WEDNESDAY              -> 9;
};
- core-libs/java.lang.invoke: JEP 334 JVM Constants API: Constable, ClassDesc, ConstantDesc etc. within java.base
Most JDK classes have changes related to constable.
- 2 new methods in String class: indent and transform
- File.mismatch(java.nio.file.Path,java.nio.file.Path). Finds and returns the position of the first mismatched byte in the content of two files, or -1L if there is no mismatch
- CompletableFuture, added new methods: exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync
- Collectors.teeing​ -> Returns a Collector that is a composite of two downstream collectors


- core-libs/java.lang: POSIX_SPAWN Option on Linux
- core-libs/java.util:i18n: Square Character Support for Japanese New Era
- hotspot/gc: Allocation of Old Generation of Java Heap on Alternate Memory Devices
- hotspot/runtime: HotSpot Windows OS Detection Correctly Identifies Windows Server 2019 (Prior to that it was detected as 2016)
- hotspot/runtime: Command-Line Flag -XX+ExtensiveErrorReports (more extensive reporting + sensitive)
- security-libs/java.security: disallow and allow Options for java.security.manager System Property
- security-libs/java.security: -groupname Option Added to keytool Key Pair Generation
- security-libs/java.security: New Java Flight Recorder (JFR) Security Events
- security-libs/java.security: Customizing PKCS12 keystore Generation
- security-libs/javax.net.ssl: ChaCha20 and Poly1305 TLS Cipher Suites
- security-libs/org.ietf.jgss:krb5: Support for dns_canonicalize_hostname in krb5.conf
- tools: jdeps --print-module-deps Reports Transitive Dependences


Removed Features and Options

- client-libs/java.awt: Removal of com.sun.awt.SecurityWarning Class
- core-libs/java.io: Removal of finalize Methods from FileInputStream and FileOutputStream.
The java.lang.ref.Cleaner has been implemented since JDK 9 as the primary mechanism to close file descriptors that are no longer reachable from FileInputStream and FileOutputStream. The recommended approach to close files is to explicitly call close or to use try-with-resources.
- core-libs/java.util.jar: Removal of finalize Method in java.util.ZipFile/Inflator/Deflator
- infrastructure/build: Dropped the YY.M Vendor Version String from Oracle-Produced Builds

java 11 2018-09-25
Java(TM) SE Runtime Environment 18.9 (build 11+28)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11+28, mixed mode)

compared to the new one:

java 12 2019-03-19
Java(TM) SE Runtime Environment (build 12+17)
Java HotSpot(TM) 64-Bit Server VM (build 12+17, mixed mode)

- security-libs/java.security: Removal of GTE CyberTrust Global Root
- tools/javac: Removal of javac Support for 6/1.6 source, target, and release Values

Deprecated Features and Options, Other Notes and Differences between Oracle JDK and OpenJDK not included, except:
- hotspot/gc: G1 May Uncommit Memory During Marking Cycle - returning heap to OS
- security-libs/javax.net.ssl: Distrust TLS Server Certificates Anchored by Symantec Root CAs

Wednesday, January 25, 2023

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

Link to the Oracle release notes: Oracle Release Notes
Java SE 11 Final Release Specification

Java API Diff page useful for identification of additions, removals or modifications to the Java API, like adding new methods to String class (isBlank, lines, strip, stripLeading, stripTrailing, repeat)

New Features and Enhancements


- added support for Unicode 9 and 10
- java.net.http: standardized the HttpClient that implements HTTP/2 and WebSocket and which replaces HttpURLConnection API.
- java.util.collections: A new default method toArray(IntFunction) has been added to the java.util.Collection interface.
- java.util:i18n: Updated Locale Data to Unicode CLDR v33
- compiler: Lazy Allocation of Compiler Threads, to prevent initial large amount of compiler threads on multi-cpu machines. -XX:+UseDynamicNumberOfCompilerThreads
- hotspot/gc: The experimental Z concurrent garbage collector:
    1. Pause times do not exceed 10 ms.
    2. Pause times do not increase with the heap or live-set size.
    3. Handle heaps ranging from a few hundred megabytes to multi terabytes in size
For the limitations of this GC, refer to the Release Notes.
- hotspot/gc: Epsilon No-Op Garbage Collector: only allocation, no reclamation. Useful for performance testing.
- security-libs/javax.net.ssl: JEP 332 Transport Layer Security (TLS) 1.3 RFC 8446
- tools/javac: JEP 323: Local-Variable Syntax for Lambda Parameters -> usage of var in declaring the formal parameters of lambda expression.
Imposes restriction on using var for all other formal parameters of a lambda expression.
- tools/launcher: JEP 330 Launch Single-File Source-Code Programs -> Java launcher to run a program supplied as a single file of Java source code.

- hotspot/jvmti: Provide a low-overhead way of sampling Java heap allocations, accessible via JVMTI:
    1. low overhead
    2. sampling all allocations
    3. can be GC algorithm or VM implementation agnostic.
    4. info about live and dead Java objects.
- hotspot/runtime: Nest-Based Access Control -> arrangement of classes and interfaces in nests. Low level change.
Allows classes and interfaces which are logically related to same code, but compiled to distinct class files to access private members without bridge methods.
- security-libs: JEP 324 Key Agreement with Curve25519 and Curve448
- security-libs/javax.crypto: Added Brainpool EC Support (RFC 5639)
- security-libs/javax.crypto: JEP 329 ChaCha20 and Poly1305 Cryptographic Algorithms
- security-libs/javax.crypto: Enhanced KeyStore Mechanisms
- security-libs/javax.crypto: RSASSA-PSS Signature Support Added to SunMSCAPI
- security-libs/org.ietf.jgss:krb5: Support for AES Encryption with HMAC-SHA2 for Kerberos 5 Defined in RFC 8009


Removed Features and Options


- client-libs: Removal of com.sun.awt.AWTUtilities Class, deprecated in JDK 10
- client-libs/2d: Removal of Lucida Fonts from Oracle JDK. JDK does not provide anymore any fonts and relies only on OS fonts. Apps will fail.
- client-libs/java.awt: Removal of appletviewer Launcher deprecated in JDK 9
- client-libs/javax.imageio: Oracle JDK's javax.imageio JPEG Plugin No Longer Supports Images with alpha. Apps will fail.
- core-libs/java.lang: Removal of Thread.destroy() and Thread.stop(Throwable) methods. Thread.destroy was never implemented, and stop has been non-functional since Java SE 8.
- core-svc/javax.management: Removal of JVM-MANAGEMENT-MIB.mib -> Now instead of the specification for JVM monitoring and management through SNMP. Customers can use JMX to monitor and manage a running JVM and to access the standard set of metrics and operations.
- deploy: Removal of Java Deployment Technologies -> The Java Plugin and Java WebStart technologies that were deprecated in JDK 9 and marked as candidates for removal in JDK 10, have now been removed
- infrastructure: Removal of Java Mission Control from the Oracle JDK, available separately.
- javafx/other: Removal of JavaFX from the Oracle JDK, available separately, as OpenJFX

- core-libs: Removal of sun.misc.Unsafe.defineClass. Now must use: java.lang.invoke.MethodHandles.Lookup.defineClass
- core-libs/java.nio: Removal of sun.nio.ch.disableSystemWideOverlappingFileLockCheck Property, introduced in JDK for supressing JVM-wide file locking.
- core-libs/java.util:i18n: Removal of sun.locale.formatasdefault Property introduced in JDK7.
- core-svc/tools: Removal of SNMP Agent jdk.snmp.
- other-libs: JEP 320 Remove the Java EE and CORBA Modules:
    1. java.xml.ws
    2. java.xml.bind
    3. java.activation
    4. java.xml.ws.annotation
    5. java.corba
    6. java.transaction
    7. java.se.ee
    8. jdk.xml.ws
    9. jdk.xml.bind
    + other changes.


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