<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 style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Hi wenshao,</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
I think this is a very good proposal that makes code much cleaner. This allows us to migrate this context to value classes in the future for better optimization, improves the thread safety of the optional status tracking (compared to throwing exceptions), and
makes the context thread safe.</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Regards,</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
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> Thursday, September 18, 2025 8:16 PM<br>
<b>To:</b> core-libs-dev <core-libs-dev@openjdk.org><br>
<b>Subject:</b> Propose to make j.t.f.DateTimePrintContext immutable</font>
<div> </div>
</div>
<div>
<div class="x___aliyun_email_body_block">
<div style="font-family:Tahoma,Arial,STHeitiSC-Light,SimSun">
<div style="clear:both"><span><span>I propose to make j.t.f.DateTimePrintContext immutable.</span></span></div>
<div style="clear:both"><br>
<div style="clear:both">Currently, DateTimePrintContext has only one mutable field, optional. This can be replaced by adding an optional parameter to the DateTimeFormatter.formatTo method.</div>
<span>
<div style="clear:both"><br>
</div>
Immutable DateTimePrintContext can be optimized by escape analysis, such as immutable object optimization.</span></div>
<div style="clear:both"><span><br>
</span></div>
<div style="clear:both"><span><span><span>In order to make it easier for reviewers to see my ideas, I submitted a draft Pull Request (
<span><a href="https://github.com/openjdk/jdk/pull/26913" target="_blank">https://github.com/openjdk/jdk/pull/26913</a> )</span>. Please give me feedback.</span></span></span></div>
</div>
</div>
</div>
</body>
</html>