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

ArrayData.getInt implementations do not convert to int32

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • 8
    • core-libs
    • None
    • b96
    • generic
    • generic

    Backports

      Description

        The getInt(int) implementations in NumberArrayData and LongArrayData just casts the element value to int, which is not correct JS semantics. What we should do is call JSType.toInt32. This can be seen by running the following script:

        x = [0xffffffff, 0.5] // second element makes this a double array
        print(x[0] & -10)
        y = 0xffffffff
        print(y & -10)

        Expected output:

        -10
        -10

        Actual output:

        2147483638
        -10

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved: