RFR: 8132995: Matcher$ImmutableMatchResult should be optimized to reduce space usage [v3]
Raffaello Giulietti
rgiulietti at openjdk.org
Wed May 17 15:03:08 UTC 2023
On Wed, 17 May 2023 14:42:52 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> Raffaello Giulietti has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>>
>> - Adjusted incorrect logic in results().
>> Added tests for results().
>> Refined capturing logic when there's no match.
>> - Merge branch 'master' into JDK-8132995
>> - Adjusted erroneous logic in results().
>> Added tests for results().
>> - Added some randomness in tests.
>> - 8132995: Matcher should be optimized to reduce space usage
>
> src/java.base/share/classes/java/util/regex/Matcher.java line 278:
>
>> 276: public MatchResult toMatchResult() {
>> 277: String capturedText = hasMatch()
>> 278: ? text instanceof String s
>
> This `instanceof` became a little gratuitous now since `text.subSequence(..)` on `String` delegates to `substring` and the `toString()` will be a no-op.
Addressed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13231#discussion_r1196653497
More information about the core-libs-dev
mailing list