title: Access Java object from JavaScript in GraalVM Polyglot context
body: <p>Running on GraalVM CE.</p>
  
  <pre><code>openjdk version "11.0.5" 2019-10-15
  OpenJDK Runtime Environment (build 11.0.5+10-jvmci-19.3-b05-LTS)
  OpenJDK 64-Bit GraalVM CE 19.3.0 (build 11.0.5+10-jvmci-19.3-b05-LTS, mixed mode, sharing)
  </code></pre>
  
  <p><strong>Case 1:</strong></p>
  
  <pre><code>import org.graalvm.polyglot.Context;
  
  public class Test {
  
      static class Data {
          public String name = "HelloWorld";
          public String getName() {
              return this.name;
          }
      }
  
      public static void main(String[] args) {
          Context context = Context.newBuilder("js").allowHostAccess(true).build();
          context.getBindings("js").putMember("d", new Data());
  
          context.eval("js", "var x = d.name");
  
          System.out.println(
                  context.getBindings("js").getMember("x").asString()
          );
      }
  }
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>null
  </code></pre>
  
  <p>Why?</p>
  
  <p>As I can understand, <code>d</code> passed correctly:</p>
  
  <pre><code>((Data) context.getBindings("js").getMember("d").as(Data.class)).name
  </code></pre>
  
  <p>returns <code>"HelloWorld"</code>.</p>
  
  <p><strong>Case 2:</strong></p>
  
  <pre><code>context.eval("js", "d.getName()");
  </code></pre>
  
  <p><strong>Exception</strong></p>
  
  <pre><code>Exception in thread "main" TypeError: invokeMember (getName) 
  on JavaObject[task.Test$Data@35a3d49f (task.Test$Data)] failed due to: 
  Unknown identifier: getName
  </code></pre>
  
  <p>But <code>getName</code> is public...
  What's wrong?</p>