title: java ScriptEngine failed on array methods
body: <p>I have problems executing an array of JavaScript methods in Java ScriptEngine.</p>
  
  <p>I use JDK 8.</p>
  
  <p>Example </p>
  
  <pre><code>@Test
  public void arrayMethod() throws Exception {
      ScriptEngine engine;
      engine = new ScriptEngineManager().getEngineByName("JavaScript");
      String script = "function f1() { return [\"string2\",\"string3\"].some(item =&gt; o1==item); }";
      engine.eval(script);
      engine.put("o1", "string1");
      Boolean result =  (Boolean) (((Invocable) engine).invokeFunction("f1"));
      LOG.info(result.toString());
  }
  </code></pre>
  
  <p>Result</p>
  
  <p>java.lang.AssertionError: Failed generating bytecode for :1</p>
  
  <pre><code>at jdk.nashorn.internal.codegen.CompilationPhase$BytecodeGenerationPhase.transform(CompilationPhase.java:431)
  at jdk.nashorn.internal.codegen.CompilationPhase.apply(CompilationPhase.java:624)
  at jdk.nashorn.internal.codegen.Compiler.compile(Compiler.java:655)
  </code></pre>
  
  <p>I try to use other methods (every, etc.) with the same result. There are no syntax errors, but java script compiler could not create code. 
  My version of ScriptEngine does not have method includes for arrays. It return syntax error.
  How is it possible to work with arrays in ScriptEngine ?</p>