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

    • Bug
    • Resolution: Fixed
    • P3
    • 1.2.0
    • 1.0.2, 1.1, 1.2.0
    • specification
    • 1.2
    • generic, sparc
    • generic, solaris_2.4
    • 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

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

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: