On Tue, 28 Mar 2023 17:35:22 GMT, Roger Riggs <rri...@openjdk.org> wrote:

>> 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.

@RogerRiggs Yes, it would be nice to be able to write

private void appendExpandedReplacement(StringBuilder | StringBuffer app, String 
replacement) 

and get rid of the `try` statement altogether.

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

PR Comment: https://git.openjdk.org/jdk/pull/13048#issuecomment-1487363161

Reply via email to