Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8008197

Cross script engine function calls do not work as expected

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • None
    • core-libs
    • None
    • b82
    • generic
    • generic
    • Verified

      Nashorn supports function calls across script engines. When attempting such calls (and callbacks) from script, we get IllegalStateException from Global.instance() method. This suggests that either ScriptObject to mirror conversion or current global setup does not happen as expected.

      Example:

      r m = new javax.script.ScriptEngineManager();
      var e = m.getEngineByName("nashorn");
      var obj = {
          func: function(str) {
              return /hello/.exec(str);
          }
      };

      e.put("obj", obj);
      if (! e.eval("obj.func('hello')")) {
          print("FAILED: obj.func('hello')");
      }

      e.eval("var foo = { callMe: function(callback) { callback() } }");

            sundar Sundararajan Athijegannathan
            sundar Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: