Chapter 3. Red Hat build of OpenJDK features
Chapter 3. Red Hat build of OpenJDK features The latest Red Hat build of OpenJDK 17 release might include new features. Additionally, the latest release might enhance, deprecate, or remove features that originated from earlier Red Hat build of OpenJDK 17 releases. Note For all the other changes and security fixes, see OpenJDK 17.0.14 Released . Red Hat build of OpenJDK enhancements Red Hat build of OpenJDK 17 provides enhancements to features originally created in earlier releases of Red Hat build of OpenJDK. Fix for invokedynamic string concatenation changing order of operations The Indify String Concatenation feature that was added in OpenJDK 9 through JEP-280 introduced a regression in the order in which string concatenation expressions are evaluated. The Java Language Specification requires that operands are fully evaluated in left-to-right order. However, with the introduction of invokedynamic (indy) call generation by the javac compiler for evaluating string concatenation expressions, all operands were evaluated in order but not converted to strings. In this situation, each operand was converted to a string only later. For example, consider the following code, where the third argument of the concatenation has the side effect of altering the value of builder to "goodbye" : Based on the preceding example, in earlier releases, the Indify String Contenation feature did not convert the second argument to a string until after the builder.append method altered the StringBuilder object. In this situation, the concatenation incorrectly became "" + "goodbye" + "goodbye" , which produced "goodbyegoodbye" as the output. In Red Hat build of OpenJDK 17.0.14, string concatenation evaluates and eagerly converts each argument to a string in left-to-right order. In this situation, the concatenation correctly becomes "" + "good" + "goodbye" , which produces "goodgoodbye" as the output. Note The resolution of this issue has the same effect as using a version of the javac compiler that was available before OpenJDK 9 or running javac with the -XDstringConcat=inline command-line option. See JDK-8273914 (JDK Bug System) . Option for jar command to avoid overwriting files when extracting an archive In earlier Red Hat build of OpenJDK releases, when the jar tool extracted files from an archive, the jar tool overwrote any existing files with the same name in the target directory. Red Hat build of OpenJDK 17.0.14 adds a new ‐k (or ‐‐keep-old-files ) option that you can use to ensure that the jar tool does not overwrite existing files. You can specify this new option in either short or long format. For example: jar xkf myfile.jar jar --extract ‐‐keep-old-files ‐‐file myfile.jar Note In Red Hat build of OpenJDK 17.0.14, the jar tool retains the old behavior by default. If you do not explicitly specify the ‐k (or ‐‐keep-old-files ) option, the jar tool automatically overwrites any existing files with the same name. See JDK-8335912 (JDK Bug System) and JDK bug system reference ID: JDK-8337499. IANA time zone database updated to version 2024b In Red Hat build of OpenJDK 17.0.14, the in-tree copy of the Internet Assigned Numbers Authority (IANA) time zone database is updated to version 2024b. This update is primarily concerned with improving historical data for Mexico, Mongolia, and Portugal. This update to the IANA database also includes the following changes: Asia/Choibalsan is an alias for Asia/Ulaanbaatar . The Middle European Time (MET) time zone is equal to Central European Time (CET). Some legacy time-zone IDs are mapped to geographical names rather than fixed offsets: Eastern Standard Time (EST) is mapped to America/Panama rather than -5:00 . Mountain Standard Time (MST) is mapped to America/Phoenix rather than -7:00 . Hawaii Standard Time (HST) is mapped to Pacific/Honolulu rather than -10:00 . Red Hat build of OpenJDK overrides the change in the legacy time-zone ID mappings by retaining the existing fixed-offset mapping. See JDK-8339637 (JDK Bug System) .
StringBuilder builder = new StringBuilder("good"); return "" + builder + builder.append("bye");