On Sun, 18 May 2025 11:11:32 GMT, Shaojin Wen <s...@openjdk.org> wrote:

> When debugging getLong/getDouble/getDecimal of DigitList, the debugger will 
> call the DigitList::toString method. At this time, DigitList::toString will 
> modify tempBuilder, which will cause incorrect results.

src/java.base/share/classes/java/text/DigitList.java line 787:

> 785:         }
> 786: 
> 787:         return "0." + new String(digits, 0, count) + "x10^" + decimalAt;

what about

        return new StringBuilder()
                .append("0.")
                .append(digits, 0, count)
                .append("x10^")
                .append(decimalAt)
                .toString();

to avoid the temporary string created by `new String(digits, 0, count)`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25288#discussion_r2109740606

Reply via email to