RFR: 8368172: Make java.time.format.DateTimePrintContext immutable [v2]

Shaojin Wen swen at openjdk.org
Sat Sep 20 14:32:03 UTC 2025


> 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.

Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:

  Update src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java
  
  Co-authored-by: Stephen Colebourne <scolebourne at joda.org>

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/26913/files
  - new: https://git.openjdk.org/jdk/pull/26913/files/d3c43c57..6f07a475

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=26913&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26913&range=00-01

  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/26913.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26913/head:pull/26913

PR: https://git.openjdk.org/jdk/pull/26913


More information about the core-libs-dev mailing list