RFR: 8132995: Matcher$ImmutableMatchResult should be optimized to reduce space usage [v2]

Raffaello Giulietti rgiulietti at openjdk.org
Wed May 17 09:19:24 UTC 2023


On Tue, 16 May 2023 13:29:26 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Added some randomness in tests.
>
> src/java.base/share/classes/java/util/regex/Matcher.java line 359:
> 
>> 357:             if ((groups[group * 2] == -1) || (groups[group * 2 + 1] == -1))
>> 358:                 return null;
>> 359:             return text.subSequence(groups[group * 2] - offset, groups[group * 2 + 1] - offset).toString();
> 
> Could be simplified to `return text.substring(groups[group * 2] - offset, groups[group * 2 + 1] - offset);`

Right. Done

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13231#discussion_r1196198048


More information about the core-libs-dev mailing list