title: How to inject value into field in groovy script from java via reflection api?
body: <p>Very simple groovy script:</p>
  <pre><code>@Field
  List list
  
  def execute(Object args) {
      return list[0]
  }
  </code></pre>
  <p>I try to write simple code in java:</p>
  <pre><code>final GroovyClassLoader groovyClassLoader = new GroovyClassLoader();
  final File file = new File(&quot;&lt;path to groovy file&gt;&quot;);
  GroovyCodeSource groovyCodeSource = new GroovyCodeSource(file);
  final Class groovyClass = groovyClassLoader.parseClass(groovyCodeSource);
  final List&lt;String&gt; testList = Collections.singletonList(&quot;test&quot;);
  final Binding context = new Binding();
  context.setVariable(&quot;list&quot;, testList );
  final Script script = InvokerHelper.createScript(groovyClass, context);
  final Field list = groovyClass.getField(&quot;list&quot;);
  list.setAccessible(true);
  list.set(null, testList );
  final Object returnValue = script.invokeMethod(&quot;execute&quot;, null);
  </code></pre>
  <p>But in field groovyClass.getField(&quot;list&quot;); I get exception NoSuchFieldException
  Could you please help me? Why is it happened?</p>