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

ArrayData.getInt implementations do not convert to int32

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b96
    • CPU:
      generic
    • OS:
      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

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: