On Tue, 20 Sep 2022 01:09:29 GMT, Naoto Sato <na...@openjdk.org> wrote:

>> 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 😀

OK looks good.

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

PR: https://git.openjdk.org/jdk/pull/10349

Reply via email to