On Mon, 18 Aug 2025 15:31:21 GMT, Roger Riggs <rri...@openjdk.org> wrote:

> Simplify JLA by changing ZipCoder to use JLA.uncheckedNewStringNoRepl(byte[] 
> bytes, Charset cs) instead of the JLA.newStringUTF8NoRepl.
> A copy of the bytes is made so it can be exclusively used to create the 
> string. The "shared" flag is no longer needed in String.newStringUTF8NoRepl.

src/java.base/share/classes/java/util/zip/ZipCoder.java line 283:

> 281:                 // We use the JLA.newStringUTF8NoRepl variant to throw
> 282:                 // exceptions eagerly when opening ZipFiles
> 283:                 return hash(toString(a, off, len));

Earlier, `byte[]` was shared by the `String` instantiated, now it needs to be 
cloned. That is, I presume this to have a performance implication. Was this 
considered?

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

> 359:      * @throws IllegalArgumentException for malformed or unmappable 
> bytes.
> 360:      */
> 361:     String newStringUTF8NoRepl(byte[] bytes, int off, int len);

One less hole in the JLA, nice! 💯

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26822#discussion_r2284136776
PR Review Comment: https://git.openjdk.org/jdk/pull/26822#discussion_r2284141237

Reply via email to