RFR: 8162839: JavaAdapters do not work with ScriptObjectMirror objects
szegedia at gmail.com
Thu Nov 17 14:44:22 UTC 2016
> On 16 Nov 2016, at 16:13, Hannes Wallnöfer <hannes.wallnoefer at oracle.com> wrote:
> Please review:
> Bug: https://bugs.openjdk.java.net/browse/JDK-8162839
> Webrev: http://cr.openjdk.java.net/~hannesw/8162839/webrev.00/
> This makes JavaAdapters work with ScriptObjectMirrors in addition to ScriptObjects and ScriptFunctions.
> A few notes:
> - NashornLinker.getSamTypeConverter now gets the constructor with Object.class extra parameter if sourceType is more generic than ScriptFunction.class. However, this really is an OverloadedMethod constructor, so the ScriptFunction constructor will be called if the argument happens to be a ScriptFunction.
> - Unfortunately the only way to get at the ScriptObject and Global of a ScriptObjectMirror is to use reflection, making the fields accessible. Since ScriptObjectMirror is in a package that’s exported to the world we can’t add public getters. Field accessors are created lazily and cached in JavaAdapterServices.MirrorFieldHolder.
> - When writing the test for this I noticed that some of our java tests are not run in „ant run“. I added the missing test packages to build.xml.
> - This contains cleanup for indentation in JavaAdapterByteCodeGenerator.java. That class had wrong indentation in various places.
More information about the nashorn-dev