On Wed, 9 Oct 2024 05:30:58 GMT, Alan Bateman <al...@openjdk.org> wrote:
>> I have updated the source code so that it looks up `cs.length()` live each >> time. Nevertheless, this does not necessarily imply any predictable outcome >> due to the natur of an interface: Custom implementations could concurrently >> replace already read characters, but we need to step on with `next` for each >> `read()`/`skip()`, and `CharSequence` itself does not provide any read >> cursor means (like files have with `position()`). Because of that, I have >> added a warning in the JavaDocs, paraphrased from `CharSequence::chars` and >> `CharSequence::codePoints`: `If the sequence is concurrently modified then >> the result is undefined.` > > The sentence "If the sequence is modified .." in the these methods is in the > context of the methods. For ofReader(CharSequence) then it is any > modification, doesn't have to be concurrent. Maybe something like "If the > sequence changes while the reader is open, e.g. the length changes, the > behavior is undefined". Thank you, Alan. I have copied your wording. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/21371#discussion_r1792880212