RFR: 8365719: Refactor uses of JLA.uncheckedNewStringNoRepl

Johannes Döbler duke at openjdk.org
Tue Aug 19 19:09:43 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/java/lang/String.java line 766:

> 764:      * @param src a byte array with the bytes for a latin1 string
> 765:      */
> 766:     static String newStringWithLatin1Bytes(byte[] src) {

You could call this new method from `newStringNoRepl1(byte[] src, Charset cs)` for the ISO_8859_1 case.

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

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


More information about the core-libs-dev mailing list