Please check this out:
http://mail.openjdk.java.net/pipermail/nashorn-dev/2014-October/003676.html
Summary: in jdk8u40 and jdk9, ScriptObjects (like NativeArray, JO4) are
always wrapped as ScriptObjectMirror when crossing to Java layer.
-Sundar
On Thursday 16 October 2014 08:49 AM, Jeramie Hicks wrote:
I'm not sure if this is the right place to ask, as I'm fairly new to this whole
scripting thing. But I've been banging my head against the wall for about 4
days and can't seem to make any progress.
Here's the really short version. I have a custom (extended) HashMap in Java. I put() it
into the engine, eval the script, everything works great. When the script is done and
I'm back in Java, my poor HashMap is now full of NativeArrays and JO4s. I gotta JSON-up
all this data and I can't seem to find any way into those objects (and even if so, I
don't want to depend on talking straight to internals). I really, really don't want to
burden the script with any boilerplate to make this work; the script currently runs
beautifully with nice clean statements like "dataStore.xyz = [5,6,7];" so I'd
hate to junk it up with a bunch of manual function calls to just make this to work. I can
see the data I need is RIGHT THERE in my HashMap... what step am I missing? Thanks.
More specific info at
http://stackoverflow.com/questions/26392602/reading-nashorn-jo4-and-nativearray
Much obliged for your time. - Jeramie Hicks