RFR: JDK-6285888: ChoiceFormat can support unescaped relational symbols in the Format segment [v2]
Justin Lu
jlu at openjdk.org
Tue Jan 30 23:09:17 UTC 2024
> Please review this PR and [CSR](https://bugs.openjdk.org/browse/JDK-8314822) which allows for the _Format_ segment of a ChoiceFormat pattern to use the ChoiceFormat Relational symbols without the need to escape them using quotes. Previously, using a non escaped Relational symbol within a _Format_ segment would throw an IAE.
>
> Implementation wise, this can be achieved by adding an additional check of `part == 0` to the relational symbol conditional. This is safe to do, as any subsequent relational symbols should only come after a '|' is parsed, which sets part back to 0. This ensures that for the duration of `part = 1` (Format segment), the relational symbols can be used without syntactic meaning.
>
> For example, this change allows behavior such as: `new ChoiceFormat("1#The code is #7281")`. Previously, the workaround would have been new `ChoiceFormat("1#The code is '#'7281")` to achieve the same formatted behavior. Please see the CSR for more detail.
>
> Additionally, this change also includes an unrelated grouping of the ChoiceFormat examples under a single header: **Usage Information**.
Justin Lu has updated the pull request incrementally with one additional commit since the last revision:
update wording on quoting behavior
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/17640/files
- new: https://git.openjdk.org/jdk/pull/17640/files/a088f91f..740686b2
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=17640&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=17640&range=00-01
Stats: 4 lines in 1 file changed: 3 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/17640.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/17640/head:pull/17640
PR: https://git.openjdk.org/jdk/pull/17640
More information about the core-libs-dev
mailing list