groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Wagenleitner <>
Subject Re: Invokedynamic
Date Sun, 30 Apr 2017 15:10:46 GMT
On Fri, Apr 28, 2017 at 8:59 AM, Janice Treshova <> wrote:

> Hi Groovy Users!
> I am new to Groovy and trying 2.4.11 on Windows (8.1).
> The "Invoke dynamic support" page on the site says:
> The usual way to run a script from the command line is by "groovy
>> foo.groovy",
>> where foo.groovy is the groovy program in source form. To use indy for
>> this you
>> have to use the indy distribution and "groovy --indy foo.groovy". Doing
>> this
>> without the indy distribution will result in an error message.
> But if I remove all indy-related jars from the distribution, my scripts
> still run with the --indy switch without any error message.
> When I set DEBUG, "groovy --indy test.groovy" results the following:
> "C:\Program Files\Java\jdk1.8.0_121\bin\java.exe" "-Xmx128m"
>"" -Dgroovy.home="c:\Groovy" -Dtools.jar="C:\Program
> Files\Java\jdk1.8.0_121\lib\tools.jar" -Dgroovy.starter.conf="c:\Groovy\conf\groovy-starter.conf"
>"C:\Temp\--indy"  -classpath "c:\Groovy\lib\groovy-2.4.11.jar"
> --main groovy.ui.GroovyMain
> --conf "c:\Groovy\conf\groovy-starter.conf" --classpath "."  --indy
> test.groovy
> Note the
> part - is it OK?
> Is there a way to check whether my script runs with invokedynamic support?
Hi Janice,

I think that the last 2 sections (Running groovy script from command line &
The compilation flag) of that page [1] are not correct about needing the
groovy-*-indy.jar files in order to use indy with your scripts.  The Groovy
compiler is able to compile scripts using invokedynamic instructions
regardless of whether the indy or non-indy Groovy jar files are used.   You
can see this if you use groovyc to compile the script and then use javap to
see the bytecodes generated.

The only difference I'm aware of between the indy and non-indy jar files in
the Groovy distribution has to do with how the Groovy source files that
make up Groovy itself are compiled.  But user supplied Groovy sources will
be generated with invokedynamic instructions regardless of which set of
jars are used if the indy flag is used.



View raw message