You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2021/02/06 12:14:00 UTC
[jira] [Commented] (GROOVY-9930) Groovy 3.0.7 miscompiles methods
with default arguments for targetBytecode 1.5 or 1.6
[ https://issues.apache.org/jira/browse/GROOVY-9930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17280171#comment-17280171 ]
Paul King commented on GROOVY-9930:
-----------------------------------
Interesting. We indicate JDK8 as the minimum version for Groovy 3. Setting the bytecode to prior to that is outside what we recommend. We can look into it but it will probably be low priority.
> Groovy 3.0.7 miscompiles methods with default arguments for targetBytecode 1.5 or 1.6
> -------------------------------------------------------------------------------------
>
> Key: GROOVY-9930
> URL: https://issues.apache.org/jira/browse/GROOVY-9930
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 3.0.7
> Reporter: Ryan Tandy
> Priority: Minor
>
> Regression in 3.0.7: When targetBytecode is set to 1.5 or 1.6, Groovy generates invalid bytecode for methods with default arguments.
> {noformat}
> $ cat test.groovy
> String method(String arg1, String arg2 = '') {
> return null
> }
> $ ./groovy-3.0.7/bin/groovy test.groovy
> $ echo $?
> 0
> $ echo 'configuration.targetBytecode = "1.5"' > configscript.groovy
> $ ./groovy-3.0.7/bin/groovy --configscript configscript.groovy test.groovy
> Caught: java.lang.VerifyError: (class: test, method: method signature: (Ljava/lang/String;)Ljava/lang/String;) Illegal target of jump or branch
> java.lang.VerifyError: (class: test, method: method signature: (Ljava/lang/String;)Ljava/lang/String;) Illegal target of jump or branch
> $ echo 'configuration.targetBytecode = "1.6"' > configscript.groovy
> $ ./groovy-3.0.7/bin/groovy --configscript configscript.groovy test.groovy
> Exception Details:
> Location:
> test.run()Ljava/lang/Object; @6: aconst_null
> Reason:
> Error exists in the bytecode
> Bytecode:
> 0x0000000: b800 0f4c 01b0 01b0
> java.lang.VerifyError: Expecting a stack map frame
> Exception Details:
> Location:
> test.run()Ljava/lang/Object; @6: aconst_null
> Reason:
> Error exists in the bytecode
> Bytecode:
> 0x0000000: b800 0f4c 01b0 01b0
> {noformat}
> I have not bisected, but I suspect [6292f785|https://github.com/apache/groovy/commit/6292f7852a] for at least the 1.5 case. It looks like the static metaclass check generates a goto with an offset that previously pointed at the "unused" insns but now points past the end of the method.
> (My project targets Java 8, but our build system -- running a very old version of gmavenplus -- was unintentionally compiling for 1.5. Upgrading gmavenplus fixed that, so I'm not actually affected by this, but it seemed worth reporting.)
--
This message was sent by Atlassian Jira
(v8.3.4#803005)