Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8214039

Correction to the spec of implicit negative subpattern in DecimalFormat

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 16
    • core-libs
    • None
    • minimal
    • The compatibility risk is minimum as the implementation correctly uses ASCII minus sign ('-' U+002D) to form implicit negative subpattern, irrespective of the mention of "localized minus sign" in the specification.
    • Java API
    • SE

      Summary

      Correction to the spec of implicit negative subpattern in DecimalFormat

      Problem

      The DecimalFormat pattern contains positive and optional negative subpattern separated by ';' (For example, "#,##0.00;(#,##0.00)"), if negative subpattern is missing, then the positive pattern prefixed by the ASCII minus sign ('-' U+002D HYPHEN-MINUS) is used, which is incorrectly mentioned as "localized minus sign" in the specification.

      Solution

      Update the DecimalFormat specification to correctly mention the use of ASCII minus sign ('-' U+002D HYPHEN-MINUS) instead of "localized minus sign" for the implicit negative subpattern.

      Specification

      Update the DecimalFormat specification

      from:

       * <p>A {@code DecimalFormat} pattern contains a positive and negative
       * subpattern, for example, {@code "#,##0.00;(#,##0.00)"}.  Each
       * subpattern has a prefix, numeric part, and suffix. The negative subpattern
       * is optional; if absent, then the positive subpattern prefixed with the
       * localized minus sign ({@code '-'} in most locales) is used as the
       * negative subpattern. That is, {@code "0.00"} alone is equivalent to
       * {@code "0.00;-0.00"}.

      to:

       * <p>A {@code DecimalFormat} pattern contains a positive and negative
       * subpattern, for example, {@code "#,##0.00;(#,##0.00)"}.  Each
       * subpattern has a prefix, numeric part, and suffix. The negative subpattern
       * is optional; if absent, then the positive subpattern prefixed with the
       * minus sign ('-' U+002D HYPHEN-MINUS) is used as the
       * negative subpattern. That is, {@code "0.00"} alone is equivalent to
       * {@code "0.00;-0.00"}.

            naoto Naoto Sato
            nishjain Nishit Jain
            Lance Andersen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: