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

Misconceptions about j.text.DecimalFormat digits during parsing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • 25
    • 25
    • core-libs

      DecimalFormat digits are used during formatting. However, some users also assume that these digits would change parsing behavior.

      For example, in JDK-6609652, since the pattern contains fractional digits, the user thinks that all parsed results should be of type Float/Double, and is surprised when they got Long.

      Another example is JDK-6213123, the pattern only contains integer digits, so the user thinks that the parsed result should be integral only, and is surprised that it also parsed fractional digits.

      It needs to be clarified that these digits do not affect parsing. (Which may be counter-intuitive, since other parts of the pattern do, such as prefix, grouping symbols, etc.)

            jlu Justin Lu
            jlu Justin Lu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: