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

Clarify semantics of DecimalFormat.getGroupingSize(0)

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 14
    • core-libs
    • None
    • minimal
    • Risk is minimal, as this is just to clarify the spec.
    • Java API
    • SE

      Summary

      Clarify the semantics of grouping size of zero in java.text.DecimalFormat class

      Problem

      It is unclear how grouping size zero affects the formatting from the current spec.

      Solution

      Clarify the validity of size zero in get/setGroupingSize() method descriptions.

      Specification

      Add the following sentence in the first paragraph in get/setGroupingSize() methods.

      -     * in the number "123,456.78", the grouping size is 3.
      -     * <br>
      +     * in the number "123,456.78", the grouping size is 3. Grouping size of
      +     * zero designates that grouping is not used, which provides the same
      +     * formatting as if calling {@link #setGroupingUsed(boolean)
      +     * setGroupingUsed(false)}.
      +     * <p>

      Modify the description of the serial field groupingSize as follows:

            * The number of digits between grouping separators in the integer
      -     * portion of a number.  Must be equal to, or greater than 0 if
      +     * portion of a number.  Must not be negative or greater than
      +     * {@link java.lang.Byte#MAX_VALUE Byte.MAX_VALUE} if
            * {@code NumberFormat.groupingUsed} is true.

            naoto Naoto Sato
            darcy Joe Darcy
            Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: