<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks for this report. This code is indeed very old - and probably back then, people thought sharing StringBuffer (which has since been migrated to StringBuilder) was a great idea.</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I checked the use site of the temp buffer - it appears to me that in the lifecycle of a DigitList, that buffer is usually only created and used once, and the cache would actually be more of a penalty than an optimization if that is the case. In addition, I
don't find any usage of toString of DigitList.</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I think it should be fine to create a PR to end the sharing of these temp buffer - a patch that uses a new StringBuilder for DigitList.toString should be the safest, before I18N engineers can determine if we can remove the cache mechanism altogether.</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Chen</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> core-libs-dev <core-libs-dev-retn@openjdk.org> on behalf of wenshao <shaojin.wensj@alibaba-inc.com><br>
<b>Sent:</b> Friday, May 23, 2025 8:00 PM<br>
<b>To:</b> core-libs-dev <core-libs-dev@openjdk.org><br>
<b>Subject:</b> DigitList::toString method causing incorrect results during debugging</font>
<div> </div>
</div>
<div>
<div class="x___aliyun_email_body_block">
<div style="color:0070c0; font-size:14px; font-family:Tahoma,Arial,STHeitiSC-Light,SimSun">
<div style="clear:both"><span>When debugging getLong/getDouble/getDecimal of java.text.DigitList, the debugger will call the DigitList::toString method. At this time, DigitList::toString will modify tempBuilder, which will cause incorrect results.</span></div>
<div style="clear:both"><span><br>
</span></div>
<div style="clear:both"><span>-</span></div>
<div style="clear:both"><span><span style="color:rgb(0,0,0); font-family:Tahoma,Arial,STHeitiSC-Light,SimSun; font-size:14px; font-style:normal; font-variant-ligatures:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; word-spacing:0px; white-space:normal; text-decoration-style:initial; text-decoration-color:initial; float:none; display:inline!important">Shaojin
Wen</span></span></div>
</div>
</div>
</div>
</body>
</html>