JDK-8144020 : Remove long as an internal numeric type
  • Type: Task
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2015-11-25
  • Updated: 2023-05-12
  • Resolved: 2015-12-14
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 b99Fixed
Related Reports
Relates :  
Relates :  
Relates :  
ECMA defines double as the only number type in JavaScript. In Nashorn, we internally represent numbers as int, long and double. Use of long is problematic because it adds extra precision to the 53 bits provided by double. Two examples for such problems are JDK-8143896 and JDK-8065910. 

If we wanted to continue use long as an internal number representation, we'd have to artificially limit precision to 53 bits. It seems unlikely that the benefit of using longs justifies that overhead.

There are a few things to consider when removing long support from Nashorn. Two areas where we use long are results of unsigned right shift (>>> and =>>>) and array indices and lengths.  Both are defined as unsigned 32 bit integers which are ideally represented as longs in java. 
URL: http://hg.openjdk.java.net/jdk9/jdk9/nashorn/rev/fd97b9047199 User: lana Date: 2015-12-23 23:04:13 +0000

URL: http://hg.openjdk.java.net/jdk9/dev/nashorn/rev/fd97b9047199 User: hannesw Date: 2015-12-14 13:51:29 +0000