-
Bug
-
Resolution: Fixed
-
P3
-
None
-
None
-
b133
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8183880 | 8u161 | Hannes Wallnoefer | P3 | Resolved | Fixed | b01 |
JDK-8164112 | 8u152 | Hannes Wallnoefer | P3 | Resolved | Fixed | b01 |
JDK-8192723 | emb-8u161 | Hannes Wallnoefer | P3 | Resolved | Fixed | b01 |
Since JDK-8143896 not all instances of java.lang.Number are treated as primitive numbers anymore in Nashorn. This affects java longs/Long and all classes implementing java.lang.Number that do not directly represent wrappers of Java primitives.
However, these Number objects should still convert to JS numbers when passed to the ECMAScript ToPrimitive with Number hint. This would allow to compare these objects numerically in <, <=, >=, and > operators.
Currently, the code below prints "false" because Longs are converted to strings:
l1 = new java.lang.Long(2), l2 = new java.lang.Long(10);
print(l1 < l2);
However, these Number objects should still convert to JS numbers when passed to the ECMAScript ToPrimitive with Number hint. This would allow to compare these objects numerically in <, <=, >=, and > operators.
Currently, the code below prints "false" because Longs are converted to strings:
l1 = new java.lang.Long(2), l2 = new java.lang.Long(10);
print(l1 < l2);
- backported by
-
JDK-8164112 Honor Number type hint in toPrimitive on Numbers
-
- Resolved
-
-
JDK-8183880 Honor Number type hint in toPrimitive on Numbers
-
- Resolved
-
-
JDK-8192723 Honor Number type hint in toPrimitive on Numbers
-
- Resolved
-