[ 
https://issues.apache.org/jira/browse/GROOVY-8930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16725971#comment-16725971
 ] 

Eric Milles commented on GROOVY-8930:
-------------------------------------

Just to add a bit of detail, the default bytecode target for Groovy 2.4 is 1.5; 
for Groovy 2.5 it's 1.7; and for Groovy 3.0 it's 1.8.  We had been running with 
indy compilation under Groovy 2.4 with the posted example and had no issues.  
The switch to Groovy 2.5 resulted in verify errors due to the new target 
bytecode version.

If the groovy compiler is set with "source=1.8" and "target=1.8", is it 
reasonable to expect that the target bytecode version would/should follow suit? 
 I think we are setting source and target.  For sure on our Ant compiles we 
are, like this:
{code:xml}
        <!-- Create the compiler toolchain under the task name "compile" -->
        <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc"
          classpathref="classpath.compile">
        </taskdef>
        <presetdef name="compile">
            <groovyc fork="true" indy="true" includeantruntime="false">
                <javac debug="true" source="1.8" target="1.8" />
            </groovyc>
        </presetdef>
{code}

> JVM verification fails when using static interface method from inside 
> CompileStatic groovy
> ------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-8930
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8930
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.5.4
>            Reporter: Artsiom Matronkin
>            Priority: Major
>         Attachments: Caller.groovy, JavaInterface.class, JavaInterface.java
>
>
> Create and compile java interface containing static method using JDK8
> {code:java}
> public interface JavaInterface
> {
>   static int doSmth()
>   {
>     return 42;
>   }
> }
> {code}
>  javac JavaInterface.java
>  
> Open groovyConsole (2.5.4), add folder where JavaInterface.class is located 
> to classpath, check 'Enable indy compilation' and paste following script
>  
> {code}
> import groovy.transform.CompileStatic
> import static JavaInterface.doSmth
> @CompileStatic
> void doCall()
> {
>   println doSmth()
> }
> {code}
>  
>  
> Compile and Run the script in groovyConsole. The result is JVM verification 
> failure:
> {noformat}
> java.lang.VerifyError: Illegal type at constant pool entry 51 in class Caller
> Exception Details:
> Location:
> Caller.doCall()V @4: invokestatic
> Reason:
> Constant pool index 51 is invalid{noformat}
> Best Regards
> Artsiom
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to