RFR: 8365719: Refactor uses of JLA.uncheckedNewStringNoRepl

Volkan Yazici vyazici at openjdk.org
Tue Aug 19 06:02:39 UTC 2025


On Mon, 18 Aug 2025 21:34:39 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> Refactor uses of JLAuncheckedNewStringNoRepl(byte[], ISO_8859_1) adding JLA.uncheckedNewStringWithLatin1Bytes(byte[]).
> There is no decoding needed, and no exceptions expected or thrown when creating the string from the supplied latin1 bytes. 
> If COMPACT_STRINGS is false, the bytes are inflated to UTF16.

src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java line 330:

> 328:      * @return the newly created string
> 329:      */
> 330:     String uncheckedNewStringWithLatin1Bytes(byte[] bytes);

@RogerRiggs, we introduce a new `JLA::uncheckedNewStringNoRepl` specialization that
 doesn't throw `CCE` and fix the charset to Latin-1. _"The only reason"_ we do this is to save the call-site from catching `CCE`, am I right?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26831#discussion_r2284154346


More information about the core-libs-dev mailing list