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.

Marked as reviewed by vyazici (Committer).

src/java.base/share/classes/java/lang/String.java line 763:

> 761:      * The byte array can be exclusively used to construct
> 762:      * the string and is not modified or used for any other purpose.
> 763:      */

I see you opted for adhering to the method commenting style that is already 
present in the file. While I can see the rationale and advantages for such an 
approach, we might also consider incorporating a complete Javadoc block, e.g.,

Suggestion:

    /**
     * {@return a new {@code String} created using the given byte array that is
     * encoded in specified charset}
     * <p>
     * <b>WARNING: The caller of this method is assumed to have relinquished
     * and transferred the ownership of the byte array</b>. It can thus be
     * exclusively used to construct the {@code String}.
     *
     * @param src byte array containing encoded characters
     * @param cs charset the byte array encoded in
     *
     * @throws CharacterCodingException for malformed input or unmappable 
characters
     */


I trust your judgement on the matter. Feel free the discard the above remark.

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

PR Review: https://git.openjdk.org/jdk/pull/26822#pullrequestreview-3133259512
PR Review Comment: https://git.openjdk.org/jdk/pull/26822#discussion_r2285931273

Reply via email to