title: GraalVm - Java complex object can't be parsed like javascript object
body: <p>I am trying to migrate from nashorn to graalvm (java 11). I have a lot of java script.<br></p>
  
  <p>Description ->  Connecting to java project as maven libs org.graalvm.js: graal-sdk, js, js-scriptengine, org.graalvm.truffle: truffle-api. Version 1.0.0-rc9.<br> ScriptEngine created like 'new ScriptEngineManager().getEngineByName("graal.js")';<br> Then you can create map in array in map like:<br><br></p>
  
  <pre><code>Map mapOuter = new HashMap();
  Map mapInner = new HashMap();
  List arrayInner = new ArrayList();
  
  mapInner.put("1", 3);
  arrayInner.add(mapInner);
  mapOuter.put("2", arrayInner);
  </code></pre>
  
  <p>Then convert mapOuter to ProxyObject like ProxyObject.fromMap(mapOuter);<br>
  Evaluate test javascript with code like:<br><br></p>
  
  <pre><code>function test(param) {
     &amp;nbsp;&amp;nbsp;print(param["2"]);
     &amp;nbsp;&amp;nbsp;param["2"].forEach(function(inArray){
     &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print(inArray);
     &amp;nbsp;&amp;nbsp;});
  }
  </code></pre>
  
  <p>Which will invoke error like: </p>
  
  <blockquote>
    <p>javax.script.ScriptException: org.graalvm.polyglot.PolyglotException: TypeError: INVOKE on foreign object failed due to: Message not supported: INVOKE</p>
  </blockquote>
  
  <p><strong>So the question is</strong>: how to make graalvm to transfer complex java object to javascript function properly?</p>
  
  <p>p.s. What i want in this example is to call object like:<br></p>
  
  <blockquote>
    <p>print(param["2"][0]["1"]);</p>
  </blockquote>
  
  <p>and it prints me 3.<br><br>
  <strong>What i tried:</strong><br>
  tried to parse each member of outerMap as ProxyObject/ProxyArray.<br><br>
  <strong>What was working</strong>
  If you change javascript like:<br></p>
  
  <blockquote>
    <p>print(param["2"][0].get("1"));</p>
  </blockquote>
  
  <p>it will prints 3;</p>