JDK-8067420 : BrowserJSObjectLinker should give priority to beans linker for property get/set
  • Type: Bug
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2014-12-15
  • Updated: 2015-09-29
  • Resolved: 2014-12-15
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
8u60Fixed 9 b44Fixed
Description
For object property get and set BrowserJSObjectLinker should give priority to beans linker. If there is a matching bean style property, that should be linked. Only when no matching property is found or if the access is indexed access, then BrowserJSObjectLinker should use JSObject.getMember/getSlot and JSObject.setMember/setSlot methods.

This is because bean style properties are strongly typed and so script value to required Java side value conversion can happen. For example, JavaFX WebView HTML button class implements JSObject - but has strongly typed getter/setter for many properties. "onclick" property accepts EventHandler object (which is a SAM type). With bean property getting priority, Nashorn  can allow script writer to set "onclick" with script function value. script function to EventHandler SAM conversion occurs - because of existing target type conversion scheme. Without priority to beans linker, script writer has to explicitly convert script function  to EventHandler (because JSObject methods accept Object and hence no target type conversion).