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

Unary ADD and array literal always produces NaN

    XMLWordPrintable

Details

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

    Description

      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;

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: