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

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • 9
    • core-libs
    • None
    • b29
    • generic
    • generic

    Backports

      Description

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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved: