Looks good! PS. Would be nice if we have with security manager test (perhaps .js test?) that exercises ScriptObjectMirror to adapter conversion. But, no biggie..
-Sundar On 11/16/2016 8:43 PM, Hannes Wallnöfer 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. > > Thanks, > Hannes