<i18n dev> RFR: 8363972: Loose matching of dash/minusSign in number parsing [v6]

Roger Riggs rriggs at openjdk.org
Mon Aug 4 18:06:04 UTC 2025


On Fri, 1 Aug 2025 19:05:27 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> Enabling lenient minus sign matching when parsing numbers. In some locales, e.g. Finnish, the default minus sign is the Unicode "Minus Sign" (U+2212), which is not the "Hyphen Minus" (U+002D) that users type in from keyboard. Thus the parsing of user input numbers may fail. This change utilizes CLDR's `parseLenient` element for minus signs and loosely matches them with the hyphen-minus so that user input numbers can parse. As this is a behavioral change, a corresponding CSR has been drafted.
>
> Naoto Sato has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 16 commits:
> 
>  - Merge branch 'master' into JDK-8363972-Loose-matching-dash
>  - Spec update
>  - Supplementary/CanonEq tests
>  - flipped again, which was correct
>  - flipped the size check
>  - Address review comments
>  - Merge branch 'master' into JDK-8363972-Loose-matching-dash
>  - tidying up
>  - test location
>  - spec update
>  - ... and 6 more: https://git.openjdk.org/jdk/compare/8e921aee...3682484d

src/java.base/share/classes/java/text/DecimalFormat.java line 421:

> 419:  * returns a numerically greater value.
> 420:  *
> 421:  * @implNote The default implementation follows the LDML specification

You can remove "default".  `The implementation follows...`.
The default changes the sense to refer to the code implementing this class.

src/java.base/share/classes/java/text/DecimalFormat.java line 3522:

> 3520:         if (alen == 0) {
> 3521:             return true;
> 3522:         }

This seems suspect, a zero length affix seems like an error. And if there is an empty affix, subsequent code should not be doing replacement.

src/java.base/share/classes/java/text/DecimalFormatSymbols.java line 721:

> 719:      * {@return the lenient minus signs}
> 720:      */
> 721:     String getLenientMinusSign() {

Singular vs plural might be confusing. Is it a single char or a set of chars returned in a string.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26580#discussion_r2252223596
PR Review Comment: https://git.openjdk.org/jdk/pull/26580#discussion_r2252228223
PR Review Comment: https://git.openjdk.org/jdk/pull/26580#discussion_r2252195256


More information about the i18n-dev mailing list