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

Cross script engine function calls do not work as expected

    XMLWordPrintable

Details

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

    Description

      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() } }");

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: