java.util.regex.Matcher and StringBuilder/StringBuffer APIs
Rob Spoor
openjdk at icemanx.nl
Fri Jun 21 17:02:40 UTC 2019
Maybe because Appendable comes with IOExceptions?
On 21/06/2019 17:06, Robert Marcano wrote:
> Greetings. Is there a reason the newest APIs added to Matcher
> (performance maybe?) with StringBuilder arguments weren't added as
> Appendable instead?
>
> For example:
>
> public StringBuilder appendTail(StringBuilder sb)
> public Matcher appendReplacement(StringBuilder sb, String replacement)
>
> Could have been:
>
> public <T extends Appendable> T appendTail(T ap)
> public Matcher appendReplacement(Appendable ap, String replacement)
>
> Both appendReplacement(...) implementations are copies, that could be
> reduced to a simple one if Appendable was the argument, and the present
> ones calling to that.
>
> If this sounds reasonable, I could write a patch for testing.
>
> Note: I was hit with this when trying to use another kind of Appendable
> optimized for my use case.
>
More information about the core-libs-dev
mailing list