<i18n dev> RFR: JDK-6801704: ChoiceFormat::applyPattern inconsistency for invalid patterns [v2]

Justin Lu jlu at openjdk.org
Fri Feb 16 23:35:11 UTC 2024


On Fri, 16 Feb 2024 22:38:11 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> Justin Lu has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   replace spec tag with note
>
> src/java.base/share/classes/java/text/ChoiceFormat.java line 235:
> 
>> 233:      *
>> 234:      * @implNote Given an incorrect pattern, this implementation may either
>> 235:      * throw an exception or succeed and discard the incorrect
> 
> An explanation for the exception may be helpful, either enumerating possible exceptions or simply a `RuntimeException`.

I think initially since it was an `implSpec` tag, I didn't want to over-detail the inconsistent behavior as specification. As an `implNote` tag it seems much better to give further explanation. I added details for the two possible exceptions. Let me know if you think I should go into further detail on when a pattern may be discarded if you think that is necessary.

> src/java.base/share/classes/java/text/ChoiceFormat.java line 237:
> 
>> 235:      * throw an exception or succeed and discard the incorrect
>> 236:      * portion. Discarding the incorrect portion may result in a ChoiceFormat
>> 237:      * with empty {@code limits} and {@code choices}.
> 
> `formats` instead of `choices`? A `choice` means a `limit`+`format` to me.

Yes, should definitely be `formats` here, thanks.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17856#discussion_r1493074870
PR Review Comment: https://git.openjdk.org/jdk/pull/17856#discussion_r1493073571


More information about the i18n-dev mailing list