RFR: 8357681: Fixed the DigitList::toString method causing incorrect results during debugging
Johannes Döbler
duke at openjdk.org
Tue May 27 17:13:52 UTC 2025
On Sun, 18 May 2025 11:11:32 GMT, Shaojin Wen <swen at 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
More information about the core-libs-dev
mailing list