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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • 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 })"));

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

                Created:
                Updated:
                Resolved: