Re: String encodeUTF8 latin1 with negatives

2025-07-28 Thread Brett Okken
re-libs-dev on behalf of Brett > Okken > *Sent:* Monday, July 28, 2025 4:59 PM > *To:* Roger Riggs > *Cc:* core-libs-dev@openjdk.org > *Subject:* Re: String encodeUTF8 latin1 with negatives > > Roger, > > For a String, the byte[] val is immutable, right? > And even th

Re: String encodeUTF8 latin1 with negatives

2025-07-28 Thread Chen Liang
: Roger Riggs Cc: core-libs-dev@openjdk.org Subject: Re: String encodeUTF8 latin1 with negatives Roger, For a String, the byte[] val is immutable, right? And even the current behavior of checking for negatives and then cloning would not be safe in the face of a concurrent modification, right? Is

Re: String encodeUTF8 latin1 with negatives

2025-07-28 Thread Brett Okken
Roger, For a String, the byte[] val is immutable, right? And even the current behavior of checking for negatives and then cloning would not be safe in the face of a concurrent modification, right? Is there something else going on here which I am missing? Thanks, Brett On Mon, Jul 28, 2025 at 3:1

Re: String encodeUTF8 latin1 with negatives

2025-07-28 Thread Roger Riggs
Hi Brett, Extra care is needed if the input array might be modified concurrently with the method execution. When control flow decisions are made based on array contents, the integrity of the result depends on reading each byte of the array exactly once. Regards, Roger On 7/27/25 4:45 PM,