Enable indy (invokedynamic) compile flag for Groovy scripts by default

With Java 7 and the `groovy-all-x.y.z-indy` jar, Groovy scripts can be compiled with `invokedynamic` instruction support. Even with the "indy" jar, Groovy does not enable this by default so that Groovy code compiled with these features are compatible with JVMs prior to Java 7.

With this commit, it is turned on by default because Elasticsearch requires Java 7. However, Java 7's invokedynamic support was buggy until Java 7u60 (and later), which means that users of this should update their JVMs to at least that version.

This does provide an unadvertised property (`"script.groovy.indy"`) to disable the feature in the unlikely event that user's do not want it enabled (e.g., future, non-existent JVM bug). Set it to `false` to disable this feature.

Closes #8184
If someone needs to use the conditional, I would expect them to swap the
jar as well.

I didn't update the docs noting the setting for that reason. It's a feature
that I don't expect to use, but I prefer having the chance to do it if the
generated bytecode hits the fan.

On Wednesday, October 22, 2014, Uwe Schindler <notifications@github.com>
wrote:

> In
> src/main/java/org/elasticsearch/script/groovy/GroovyScriptEngineService.java:
>
> >          CompilerConfiguration config = new CompilerConfiguration();
> > +
> > +        // optimizations
> > +        this.invokeDynamic = settings.getAsBoolean(GROOVY_INDY_ENABLED, true);
> > +        if (invokeDynamic) {
>
> A fallback option only enables/disables indy in OUR code. As soon as you
> use the "-indy" JAR file, you are already fucked up.
> This only compares the difference in our code. But as Groovy itsself
> executes code with invokedynamic *before* our code, the user is already
> fucked up while compiling the script (the Groovy compiler is itsself
> written partially in Groovy, so it would crush before the code is executed).
>
> Code that just does simple math should not call invokedynamic...
>
> I just say: Its bullshit to have the fallback option.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/elasticsearch/elasticsearch/pull/8201/files#r19250860>
> .
>