[
https://issues.apache.org/jira/browse/GROOVY-8930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16725999#comment-16725999
]
Eric Milles commented on GROOVY-8930:
-------------------------------------
Another note: the target bytecode attribute of Ant Groovyc only supports 1.4
and 1.5 in Groovy 2.4. This has since been fixed in Groovy 2.5+.
{code:java}
/**
* Sets the bytecode compatibility mode
*
* @param version the bytecode compatibility mode
*/
public void setTargetBytecode(String version) {
if (CompilerConfiguration.PRE_JDK5.equals(version) ||
CompilerConfiguration.POST_JDK5.equals(version)) {
this.targetBytecode = version;
}
}
/**
* Retrieves the compiler bytecode compatibility mode.
*
* @return bytecode compatibility mode. Can be either <tt>1.5</tt> or
<tt>1.4</tt>.
*/
public String getTargetBytecode() {
return this.targetBytecode;
}
{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)