RFR: JDK-8321545: Override toString() for Format subclasses [v6]

Justin Lu jlu at openjdk.org
Tue Jan 23 19:22:44 UTC 2024


> Please review this PR which implements toString() for the `Format` subclasses. Corresponding CSR: [JDK-8323088](https://bugs.openjdk.org/browse/JDK-8323088)
> 
> The general specification follows a template that provides the locale (if the class is localized) and any relevant patterns. The specification was intentionally kept minimal and deliberately worded as "for debugging".
> 
> An example of all the classes has output such as 
> 
> 
> CompactNumberFormat [locale: "English (United States)", decimal pattern: "foo#0.00#baz", compact patterns: "[, , , {one:0K other:0K}, {one:00K other:00K}, {one:000K other:000K}, {one:0M other:0M}, {one:00M other:00M}, {one:000M other:000M}, {one:0B other:0B}, {one:00B other:00B}, {one:000B other:000B}, {one:0T other:0T}, {one:00T other:00T}, {one:000T other:000T}]"]
> 
> DecimalFormat [locale: "English (United States)", pattern: "foo#0.00#baz"]
> 
> SimpleDateFormat [locale: "Chinese (China)", pattern: "EEE, MMM d, ''yy"]
> 
> ListFormat [locale: "English (United States)", start: "{0}, {1}", middle: "{0}, {1}", end: "{0}, and {1}", two: "{0} and {1}", three: "{0}, {1}, and {2}"]
> 
> MessageFormat [locale: "Chinese (China)", pattern: "foo {0}"]
> 
> ChoiceFormat [pattern: "0#foo"]

Justin Lu has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision:

 - reflect Rogers comments: style changes
 - Merge branch 'master' into JDK-8321545-toString-j.text.Format
 - remove quotes around locale when equal to null
 - replace 'None' with 'null' for applicable classes
 - Merge branch 'master' into JDK-8321545-toString-j.text.Format
 - swap placement of decimal pattern and compact patterns. Expand on tests
 - add unit tests
 - Merge branch 'master' into JDK-8321545-toString-j.text.Format
 - account for null locale for SDF through deserialization
 - Merge branch 'master' into JDK-8321545-toString-j.text.Format
 - ... and 1 more: https://git.openjdk.org/jdk/compare/9baaa352...d65cbcd1

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/17355/files
  - new: https://git.openjdk.org/jdk/pull/17355/files/70e0a175..d65cbcd1

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=17355&range=05
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17355&range=04-05

  Stats: 14587 lines in 430 files changed: 7332 ins; 5481 del; 1774 mod
  Patch: https://git.openjdk.org/jdk/pull/17355.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17355/head:pull/17355

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


More information about the core-libs-dev mailing list