-
Type:
Bug
-
Resolution: Not an Issue
-
Priority:
P3
-
None
-
Affects Version/s: 17
-
Component/s: core-libs
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
Tested on Windows and MacOS with Java Version 21.0.7 + Nashorn 15.7 (Maven). Worked with Java Version 11.0.27 (Nashorn included).
A DESCRIPTION OF THE PROBLEM :
When I create two java.lang.Long values with the same value, the comparison with "==" returns "false" instead of "true";
This happens since we upgraded to Java 21 + Nashorn 15.7 (Maven Dependency).
With Java 11 the comparison returned "true".
I provide simple Javascript Code to demonstrate the behavior.
var test1 = new java.lang.Long(1234);
var test2 = new java.lang.Long(1234);
if (test1 == test2) {
java.lang.System.out.println('Same');
} else {
java.lang.System.out.println('Not same');
}
REGRESSION : Last worked in version 11.0.29
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute given Code with Nashorn Engine.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Comparison with "==" should result in "true".
ACTUAL -
Comparison with "==" results in "false".
---------- BEGIN SOURCE ----------
var test1 = new java.lang.Long(1234);
var test2 = new java.lang.Long(1234);
if (test1 == test2) {
java.lang.System.out.println('Same');
} else {
java.lang.System.out.println('Not same');
}
---------- END SOURCE ----------
Tested on Windows and MacOS with Java Version 21.0.7 + Nashorn 15.7 (Maven). Worked with Java Version 11.0.27 (Nashorn included).
A DESCRIPTION OF THE PROBLEM :
When I create two java.lang.Long values with the same value, the comparison with "==" returns "false" instead of "true";
This happens since we upgraded to Java 21 + Nashorn 15.7 (Maven Dependency).
With Java 11 the comparison returned "true".
I provide simple Javascript Code to demonstrate the behavior.
var test1 = new java.lang.Long(1234);
var test2 = new java.lang.Long(1234);
if (test1 == test2) {
java.lang.System.out.println('Same');
} else {
java.lang.System.out.println('Not same');
}
REGRESSION : Last worked in version 11.0.29
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute given Code with Nashorn Engine.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Comparison with "==" should result in "true".
ACTUAL -
Comparison with "==" results in "false".
---------- BEGIN SOURCE ----------
var test1 = new java.lang.Long(1234);
var test2 = new java.lang.Long(1234);
if (test1 == test2) {
java.lang.System.out.println('Same');
} else {
java.lang.System.out.println('Not same');
}
---------- END SOURCE ----------