JDK-8170565 : JSObject call() is passed undefined for the argument 'thiz'
  • Type: Bug
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 8u112,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2016-12-01
  • Updated: 2018-06-07
  • Resolved: 2016-12-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
8u152Fixed 9 b148Fixed
Related Reports
Relates :  
This issue was reported by Art Fiedler via nashorn-dev openjdk alias:


email content cut-pasted here for convenience:

--- email from Art Fiedler ----

When calling the following code, I expected the call to myJSObject inside
testJSOCall to pass the current
scope as a ScriptObjectMirror to JSObjectImpl's call method as the thiz
argument. In this case without
modifying the call to myJSObject() should 'this' automatically be passed to
the call() method?

Arthur Fiedler

public class NashornBugTest
    public static void main(String[] args) throws Exception {
        NashornScriptEngineFactory factory = new
        ScriptEngine scriptEngine = factory.getScriptEngine();
        scriptEngine.put("myJSObject", new JSObjectImpl());
            "var a = 42;\n" +
            "function testJSOCall(b) {\n" +
            "    myJSObject('text purposely did not pass b');\n" +
            "}\n" +
    public static class JSObjectImpl extends AbstractJSObject
        public Object call(Object thiz, Object... args)
            if (ScriptObjectMirror.isUndefined(thiz) || thiz == null)
                throw new IllegalArgumentException("'thiz' is
            // TODO: need the value of 'b' in the calling function
            return super.call(thiz, args);
        public boolean isFunction()
            return true;