JSObject and browser JSObject linkers should provide fallback to call underlying Java methods directly

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 9
    • Affects Version/s: 9
    • Component/s: core-libs
    • None
    • b29
    • generic
    • generic

        JSObject and browser JSObject linkers provide easier access to instances of jdk.nashorn.api.scripting.JSObject and netscape.javascript.JSObject. But sometimes we may need to call/access underlying Java APIs of these classes directly. For example calling "eval" on these objects. So, JSObjectLinker and BrowserJSObjectLinker classes should allow explicit method signature access to public methods of the objects.

        Example:

        var m = new javax.script.ScriptEngineManager();
        var e = m.getEngineByName("nashorn");

        function func(obj) {
           // explicit signature method access
           print(obj['getMember(java.lang.String)']("foo"));
           print(obj['eval(String)']("this + 44"));
           return obj;
        }

        func(e.eval("({ foo: 33, valueOf: function() 42 })"));

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

                Created:
                Updated:
                Resolved: