RFR: 8368172: Make java.time.format.DateTimePrintContext immutable

Roger Riggs rriggs at openjdk.org
Sat Sep 20 14:07:23 UTC 2025


On Sat, 23 Aug 2025 11:27:55 GMT, Shaojin Wen <swen at openjdk.org> wrote:

> I propose to make j.t.f.DateTimePrintContext immutable.
> 
> Currently, DateTimePrintContext has only one mutable field, optional. This can be replaced by adding an optional parameter to the DateTimeFormatter.formatTo method.
> 
> Immutable DateTimePrintContext can be optimized by escape analysis, such as immutable object optimization.

What is the performance data that makes justifies this change? Its not enough to just want to make things constant.

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

PR Comment: https://git.openjdk.org/jdk/pull/26913#issuecomment-3314990889


More information about the core-libs-dev mailing list