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

Shaojin Wen swen at openjdk.org
Fri Sep 26 04:04:40 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:

  add DateTimePrinterParser#withOptional, from @RogerRiggs

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/26913/files
  - new: https://git.openjdk.org/jdk/pull/26913/files/cac20038..558fa46f

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

  Stats: 322 lines in 2 files changed: 242 ins; 2 del; 78 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