On Tue, 6 Oct 2026 17:46:16 GMT, Justin Lu <[email protected]> wrote:

>> Fixes the grapheme break logic for consecutive `ZWJ`s under GB11 in Unicode 
>> Text Segmentation (UAX29). Also corrects an existing test case that 
>> incorrectly joined a `ZWJ` and a pictograph.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> src/java.base/share/classes/jdk/internal/util/regex/Grapheme.java line 72:
> 
>> 70:                 rules[t0][t1]) {
>> 71:                 // found the break
>> 72:                 break;
> 
> So we always `break` and don't need to check `ret > off` like the old code 
> did because the assignment is `int ret = off + Character.charCount(ch0);` so 
> `ret`  should always be greater than `off`.

Yes. It used to scan from the beginning, so checking `off` was needed, but not 
any more.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33186#discussion_r4199249038

Reply via email to