Hello everyone,
I recently updated to Rhino 1.8.0 from 1.7.14. First - it's great to see that new versions are coming out, and big thanks to everyone involved.
All in all the update was pretty easy, but the following code breaks at runtime:
String code = "ns.forEach(e=>javaSet.add(e))";
try ( Context cx = Context.enter() ) {
ScriptableObject tlScope = cx.initStandardObjects();
Set<Object> javaSet = new HashSet<>();
tlScope.put("ns", tlScope, ns);
tlScope.put("javaSet", tlScope, javaSet);
cx.evaluateString(tlScope, code, "", 1, null);
return new NativeSetStub(javaSet);
}
Reporting the error: org.mozilla.javascript.EcmaError: TypeError: Method "forEach" called on incompatible object. (#1)
From what I gather, this means that the Set instance ns is not a Set object when the "forEach" method is called, but I may be wrong.
Any ideas?
Thanks,
Michael