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

Conversion of string to double or float should tolerate trailing d, D, f or F

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 1.0.2, 1.1, 1.2.0
    • Fix Version/s: 1.2.0
    • Component/s: specification
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      1.2
    • CPU:
      generic, sparc
    • OS:
      generic, solaris_2.4
    • Verification:
      Not verified

      Description

      JLS says explictitly in 20.10.16 that Double.valueOf(String) does not allow
      a d, D, f or F appearing after the number in the string. However, this was
      allowed in 1.0.2 and programmers may expect this to work by analogy with the
      syntax of float/double literals in Java. Since there doesn't seem to be a
      strong reason to break compatibility here, 1.1 beta-3 has been fixed to allow
      this, and the spec now needs to be changed to say that any one of these four
      letters appearing after the number is acceptable and is simply ignored.
      (Float.valueOf() has the same issue in 20.9.17.)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              gbrachasunw Gilad Bracha (Inactive)
              Reporter:
              dbowensunw David Bowen (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: