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

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b29
    • CPU:
      generic
    • OS:
      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

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

                  Dates

                  Created:
                  Updated:
                  Resolved: