JDK-8055796 : JSObject and browser JSObject linkers should provide fallback to call underlying Java methods directly
  • Type: Bug
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2014-08-22
  • Updated: 2019-05-07
  • Resolved: 2014-08-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u40Fixed 9 b29Fixed
Related Reports
Relates :  
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 })"));