On Thu, 28 Jul 2022 13:12:57 GMT, Сергей Цыпанов <[email protected]> wrote:
>> `Appendable` does not currently have an `append(int)` method on the
>> interface, though `StringBuilder` does. We could add it to `Appendable` via
>> default method if so desired:
>>
>>
>> default Appendable append(int value) {
>> return append(Integer.toString(value));
>> }
>
> I think in this case it's better to specify `StringBuilder` instead of
> `Appendable`, because the method is private and you'd hardly ever pass there
> anything different from SB.
If we go with the proposal above to make `appendTo(Appendable)` package visible
so that `Throwable.printStackTrace()` can benefit from this as well, we would
need to keep this as Appendable, otherwise I agree we should just inline this
all into toString
-------------
PR: https://git.openjdk.org/jdk/pull/9665