Chapter 3. Red Hat build of OpenJDK features
The latest Red Hat build of OpenJDK 21 release might include new features. Additionally, the latest release might enhance, deprecate, or remove features that originated from previous Red Hat build of OpenJDK 21 releases.
For all the other changes and security fixes, see OpenJDK 21.0.3 Released.
Red Hat build of OpenJDK enhancements
Red Hat build of OpenJDK 21 provides enhancements to features originally created in previous releases of Red Hat build of OpenJDK.
Java compiler aligns with the Java Language Specification by rejecting final keyword in record patterns
The Java 21 release enhanced the Java language with pattern matching for switch statements. However, Red Hat build of OpenJDK 21 provides a javac compiler that allows use of the final keyword before a record pattern (for example, case final R(…) ->). This use of the final keyword violates the Java Language Specification.
In Red Hat build of OpenJDK 21.0.3, the javac compiler is aligned with the Java Language Specification. This enhancement means that any program that includes the final keyword in a switch statement now fails to compile. In this situation, to ensure that the program compiles successfully, you must remove the final keyword.
See JDK-8317300 (JDK Bug System).
XML Security for Java updated to Apache Santuario 3.0.3
In Red Hat build of OpenJDK 21.0.3, the XML signature implementation is based on Apache Santuario 3.0.3.
This enhancement introduces the following four SHA-3-based RSA-MGF1 SignatureMethod algorithms:
-
SHA3_224_RSA_MGF1 -
SHA3_256_RSA_MGF1 -
SHA3_384_RSA_MGF1 -
SHA3_512_RSA_MGF1
Because the javax.xml.crypto.dsig.SignatureMethod API cannot be modified in update releases to provide constant values for the new algorithms, use the following equivalent string literal values for these algorithms:
-
http://www.w3.org/2007/05/xmldsig-more#sha3-224-rsa-MGF1 -
http://www.w3.org/2007/05/xmldsig-more#sha3-256-rsa-MGF1 -
http://www.w3.org/2007/05/xmldsig-more#sha3-384-rsa-MGF1 -
http://www.w3.org/2007/05/xmldsig-more#sha3-512-rsa-MGF1
See JDK-8319124 (JDK Bug System).
TrimNativeHeapInterval option available as a product switch
Red Hat build of OpenJDK 21.0.3 provides the -XX:TrimNativeHeapInterval=ms option as an official product switch. This enhancement enables the JVM to trim the native heap at specified intervals (in milliseconds) on supported platforms. Currently, the only supported platform for this enhancement is Linux with glibc.
You can disable trimming by setting TrimNativeHeapInterval=0. The trimming feature is disabled by default.
See JDK-8325496 (JDK Bug System).
SystemTray.isSupported() method returns false on most Linux desktops
In Red Hat build of OpenJDK 21.0.3, the java.awt.SystemTray.isSupported() method returns false on systems that do not support the SystemTray API correctly. This enhancement is in accordance with the SystemTray API specification.
The SystemTray API is used to interact with the taskbar in the system desktop to provide notifications. SystemTray might also include an icon representing an application. Due to an underlying platform issue, GNOME desktop support for taskbar icons has not worked correctly for several years. This platform issue affects the JDK’s ability to provide SystemTray support on GNOME desktops. This issue typically affects systems that use GNOME Shell 44 or earlier.
Because the lack of correct SystemTray support is a long-standing issue on some systems, this API enhancement to return false on affected systems is likely to have a minimal impact on users.
See JDK-8322750 (JDK Bug System).
Certainly R1 and E1 root certificates added
In Red Hat build of OpenJDK 21.0.3, the cacerts truststore includes two Certainly root certificates:
- Certificate 1
- Name: Certainly
- Alias name: certainlyrootr1
- Distinguished name: CN=Certainly Root R1, O=Certainly, C=US
- Certificate 2
- Name: Certainly
- Alias name: certainlyroote1
- Distinguished name: CN=Certainly Root E1, O=Certainly, C=US
See JDK-8321408 (JDK Bug System).
Precise parallel scanning of large object arrays for young collection roots
During the collection of young generation objects, the Parallel Garbage Collector (GC) partitions old generation objects into 64 kB stripes to scan for references to the young generation. These stripes are assigned to worker threads to perform scanning in parallel.
Previous releases of Red Hat build of OpenJDK 21 did not constrain the worker threads to their own stripe. This lack of constraint imposed limits on parallelism. For example, if a large object started in a stripe that was allocated to a specific worker thread, this thread could end up scanning an object with thousands of references across multiple stripes.
Red Hat build of OpenJDK 21.0.3 constrains each worker thread to its allocated stripe. Each thread now processes only the interesting parts of large object arrays. When large object arrays are present, pauses for the Parallel GC are now similar to pauses for the Garbage-First (G1) collector. In some cases, this enhancement helps to reduce the length of pauses by 75–80%. For example, a 100-millisecond pause in earlier releases could be reduced to a 20-millisecond pause in this release.
See JDK-8310031 (JDK Bug System).
Fixed potential JVM failures when using ZGC and a non-default ObjectAlignmentInBytes value
In earlier releases of Red Hat build of OpenJDK 21, if you ran the JVM with the -XX:+UseZGC option and a non-default value for -XX:ObjectAlignmentInBytes, the JVM could fail or malfunction. This issue occurred because ZBarrierSet::clone_obj_array ignored padding at the end of an object array.
Red Hat build of OpenJDK 21.0.3 resolves this issue to ensure that you can successfully run the JVM when using the Z Garbage Collector (ZGC) and non-default values for Java object alignment when running the JVM.