JDK-8144131 : ArrayData.getInt implementations do not convert to int32
  • Type: Bug
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2015-11-26
  • Updated: 2016-04-27
  • Resolved: 2015-12-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
8u101Fixed 9 b96Fixed
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:


Actual output: