RFR: 8291598: Matcher.appendReplacement should not create new StringBuilder instances [v2]

Roger Riggs rriggs at openjdk.org
Wed Mar 15 19:03:23 UTC 2023


On Wed, 15 Mar 2023 18:47:09 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> Remove instantiation of `StringBuilder`
>
> Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8291598: Matcher.appendReplacement should not create new StringBuilder instances
>   
>   Fix copyright year



src/java.base/share/classes/java/util/regex/Matcher.java line 1066:

> 1064:                             } else {
> 1065:                                 break;
> 1066:                             }

Possibly remove another SB allocation; remember start and end and use `replacement.substring(start, end)`.

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

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


More information about the core-libs-dev mailing list