On Mon, 19 Sep 2022 20:46:08 GMT, Joe Wang <jo...@openjdk.org> wrote:
>> Fixing JCK failures caused by the new grapheme implementation. The length of >> a CharSequence should return the `endIndex`, not `endIndex - beginIndex`. > > src/java.base/share/classes/sun/util/locale/provider/BreakIteratorProviderImpl.java > line 329: > >> 327: @Override >> 328: public int length() { >> 329: return src.getEndIndex(); > > Could the issue be somewhere else? I mean it feels correct for length = > endIndex - beginIndex. It's somewhat confusing as this class adapts `CharacterIterator` into `CharSequence` which are similar to each other (thus the bug). Those `beginIndex`/`endIndex` designate the range in the source `CharacterIterator`, and this `length()` method should return the entire text length of the `CharSequence` nevertheless, thus it should start from `0` to `endIndex`. ------------- PR: https://git.openjdk.org/jdk/pull/10349