On Thu, 28 Jul 2022 13:07:01 GMT, David Schlosnagle <d...@openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/StackTraceElement.java line 400:
>> 
>>> 398:                 dest.append(fileName)
>>> 399:                         .append(':')
>>> 400:                         .append(Integer.toString(lineNumber))
>> 
>> I think `Integer.toString(lineNumber)` is redundant here, you can pass `int` 
>> directly
>
> `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.

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

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

Reply via email to