You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 21, 2020. It is now read-only.
Currently, a JavaScript native String cannot be compared using "===" with a Java String even if both have identical content and are - for all intents and purposes - identical from a scripting perspective. The same applies to other types of native JavaScript value types and their Java (java.lang) counterparts.
It should be evaluated if Rhino allows us to provide an enhancement of the environment to allow transparent use of "===" for native JavaScript and equivalent Java objects.
The text was updated successfully, but these errors were encountered:
"===" / "!==" or better the "shallow (in)equality operator" is implemented at a static level in ScriptRuntime and can't be altered without recompiling Rhino. Only the the "==" / "!=" or regular "(in)equality operator" automatically performs a Java String-equality check if either the first left-hand-side expression resolves to a Java String or the right-hand-side expressions resolves to a Java String while the left-hand-side expression resolves to a Scriptable (NativeString is Scriptable).
Interestingly enough, the NativeString class does not seem to support "shallow (in)equality" correctly when two String literals from different source files are used as these do not evaluate to the same instance as required by the base ScriptableObject implementation for "equivalentValues()".
Currently, a JavaScript native String cannot be compared using "===" with a Java String even if both have identical content and are - for all intents and purposes - identical from a scripting perspective. The same applies to other types of native JavaScript value types and their Java (java.lang) counterparts.
It should be evaluated if Rhino allows us to provide an enhancement of the environment to allow transparent use of "===" for native JavaScript and equivalent Java objects.
The text was updated successfully, but these errors were encountered: