Javascript object to Map
JĂșnior
fjunior87 at gmail.com
Wed Sep 25 13:35:49 PDT 2013
Hi,
Reading the point 3.10 from this link:
http://download.java.net/jdk8/docs/technotes/guides/scripting/prog_guide/javascript.html#A1147390
If I didn't misunderstand that, if I have a javascript object I can pass it
to a java method that accepts a java.util.Map.
So, this code is supposed to work:
[code]
var HashMap = Java.type("java.util.HashMap");
var map = new HashMap();
map.putAll({key:"value",key2:"value2"});
[/code]
But when executing this using the jjs I got this error:
*"Exception in thread "main" java.lang.ClassCastException: Cannot cast
jdk.nashorn.internal.scripts.JO to java.util.Map"*
Is this the expected behavior?
Thanks,
--
Francisco Ribeiro Junior
More information about the nashorn-dev
mailing list