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

Unary ADD and array literal always produces NaN

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • None
    • core-libs
    • None
    • b93
    • Verified

      the following expressions all evaluate to NaN:

      +[]
      +[1]
      +[1,2,3]

      They should evaluate to 0, 1, NaN respectively.

      It looks like somewhere the array literal node is replaced with a NaN constant as the generated bytecode always looks like this:

          LDC NaN
          INVOKESTATIC java/lang/Double.valueOf (D)Ljava/lang/Double;

            lagergren Marcus Lagergren
            hannesw Hannes Wallnoefer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: