On Mon, 19 Sep 2022 23:04:12 GMT, Stuart Marks <sma...@openjdk.org> wrote:
>> Thanks, Joe. Added comment to the method. > > OK yeah this is really confusing. One might ask a similar question in > `charAt` about why it doesn't call > > src.setIndex(index + src.getBeginIndex()); > > The answer is that this is a special-purpose `CharSequence` that represents > characters in the index range [0..endIndex) of the underlying > `CharacterIterator`, **even if** that `CharacterIterator` represents the > subrange of some string. As Joe noted, the calling code in > `GraphemeBreakIterator` takes care to ensure that only valid indexes into the > `src` are used. > > I think the comment on `length` helps a little bit but maybe a class-level > comment would be better, since it applies to the whole model of this special > `CharSequence` and not just the `length` method. Just a sentence or two is > sufficient. Feel free to crib from the above. Thanks, Stuart. I used the paragraph almost intact for the class description 😀 ------------- PR: https://git.openjdk.org/jdk/pull/10349