Java SE 8u92 Nashorn JavaScript Engine No Longer Converts Java Long Type to JavaScript Number Type
(Doc ID 2668803.1)
Last updated on MARCH 31, 2023
Applies to:
Java SE JDK and JRE - Version 8 and laterInformation in this document applies to any platform.
Symptoms
With Java SE 8 update 92 and later versions, passing a 'long' type value from a Java object to a JavaScript 'Number' type no longer works correctly. It gets passed as an 'object' type, causing an incorrect value in the JavaScript Number.
For example, the result of the following code is changed.
Disclaimer:
This sample code is provided for educational purposes only. It is not supported by Oracle Support. It has been tested internally, however we do not guarantee that it will work for you. Ensure that you run it in a safe test environment. Additionally, the code and object names used in this article represent fictitious sample names that make up an example. Any similarity to actual code is purely coincidental and not intended in any other manner.
This sample code is provided for educational purposes only. It is not supported by Oracle Support. It has been tested internally, however we do not guarantee that it will work for you. Ensure that you run it in a safe test environment. Additionally, the code and object names used in this article represent fictitious sample names that make up an example. Any similarity to actual code is purely coincidental and not intended in any other manner.
NumberTest.java
Changes
Cause
To view full details, sign in with your My Oracle Support account. |
|
Don't have a My Oracle Support account? Click to get started! |
In this Document
Symptoms |
Changes |
Cause |
Solution |