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

Roger Riggs rriggs at openjdk.org
Tue Mar 28 17:38:29 UTC 2023


On Wed, 15 Mar 2023 20:01:05 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
>   
>   Removed other allocations of StringBuilder when processing named groups in replacement string.

Sorry for the delay.
The workaround for appending to StringBuffer/StringBuilder is awkward, adding a try/catch that can't happen.  But I don't have a better suggestion. 
It is scoped to the appendExpandedReplacement method and has no runtime impact.

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

Marked as reviewed by rriggs (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13048#pullrequestreview-1361610772


More information about the core-libs-dev mailing list