<i18n dev> RFR: 6228794: java.text.ChoiceFormat pattern behavior is not well documented. [v2]
Naoto Sato
naoto at openjdk.org
Wed Sep 6 23:14:45 UTC 2023
On Fri, 1 Sep 2023 22:17:00 GMT, Justin Lu <jlu at openjdk.org> wrote:
>> Please review this PR and associated [CSR](https://bugs.openjdk.org/browse/JDK-8314546) which expands on the `java.text.ChoiceFormat` specification regarding its pattern.
>>
>> `j.text.ChoiceFormat` provides an example pattern in the class description, but beyond that it does not specify any well-defined syntax for creating a pattern. In addition, methods related to the pattern String are under-specified.
>>
>> The wording for `getLimits()` and `getFormats()` was also adjusted, as there are other ways to set the limits and formats beyond the constructor.
>>
>> The pattern syntax may be easier to view -> https://cr.openjdk.org/~jlu/api/java.base/java/text/ChoiceFormat.html
>
> Justin Lu has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains ten commits:
>
> - merge master and resolve conflicts
> - Include Unicode sequence in pattern
> - Drop throws tag, that change can go to JDK8314925
> - Clarify ≤
> - Adjust pattern definition
> - Remove leftover comments
> - Revert the example changes to focus on the more important changes
> - Adjust wording of getter methods
> - Init
src/java.base/share/classes/java/text/ChoiceFormat.java line 136:
> 134: * Limit Relation Format
> 135: * <i>Limit:</i>
> 136: * {@code String} that can be parsed as a {@code double} / "∞" ({@code U+221E}) / "-∞" (-{@code U+221E}).
Could the first choice be more specific? Also, do `SubPattern`s need to be sorted with `Limit`s?
src/java.base/share/classes/java/text/ChoiceFormat.java line 152:
> 150: *
> 151: * System.out.println("Format with -INF : " + fmt.format(Double.NEGATIVE_INFINITY));
> 152: * // ...
Commenting out (with ellipsis) would not print the result below
src/java.base/share/classes/java/text/ChoiceFormat.java line 343:
> 341:
> 342: /**
> 343: * Constructs this ChoiceFormat with limits and corresponding formats
`this` -> `a`
src/java.base/share/classes/java/text/ChoiceFormat.java line 398:
> 396:
> 397: /**
> 398: * Get the limits of this ChoiceFormat.
@return can be applied
src/java.base/share/classes/java/text/ChoiceFormat.java line 407:
> 405:
> 406: /**
> 407: * Get the formats of this ChoiceFormat.
Same here
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15392#discussion_r1317914110
PR Review Comment: https://git.openjdk.org/jdk/pull/15392#discussion_r1317902030
PR Review Comment: https://git.openjdk.org/jdk/pull/15392#discussion_r1317916239
PR Review Comment: https://git.openjdk.org/jdk/pull/15392#discussion_r1317917169
PR Review Comment: https://git.openjdk.org/jdk/pull/15392#discussion_r1317917388
More information about the i18n-dev
mailing list