RFR: 8313205: Modernize java.text.Format with StringBuilder [v3]
Justin Lu
jlu at openjdk.org
Fri Aug 23 19:29:43 UTC 2024
> Please review this PR which adds public StringBuilder overloads to the formatting methods of java.text.Format and implementing subclasses.
>
> While Format, NumberFormat, and DateFormat are abstract, these new methods are not added as abstract to prevent compatibility concerns. Instead they are added as non-abstract methods, with a default implementation that throws UOE and a recommendation that subclasses override and provide their own implementations. These new methods use the same specification as the StringBuffer ones, with exception of `MessageFormat.format(format(Object[] arguments, StringBuilder result, FieldPosition pos)` which omits the table, and instead links to it.
>
> The JDK implementing Format classes, (such as DecimalFormat) leverage the StringBuf proxy methods.
>
> A corresponding CSR has been drafted: https://bugs.openjdk.org/browse/JDK-8337141, which goes into detail on motivation/history. (Holding off on uploading the specification to CSR until wording finalized).
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 four additional commits since the last revision:
- Merge remote-tracking branch 'upstream/master' into JDK-8313205-Format-publicStrBldr-overloads
- throw UOE where possible in abstract class level
- add since tags
- init
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/20337/files
- new: https://git.openjdk.org/jdk/pull/20337/files/314b8d7b..0e4a70c8
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=20337&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=20337&range=01-02
Stats: 40405 lines in 1259 files changed: 21540 ins; 13082 del; 5783 mod
Patch: https://git.openjdk.org/jdk/pull/20337.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/20337/head:pull/20337
PR: https://git.openjdk.org/jdk/pull/20337
More information about the core-libs-dev
mailing list