[ https://issues.apache.org/jira/browse/GROOVY-7870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15345965#comment-15345965 ]
Paul King commented on GROOVY-7870: ----------------------------------- Shil Sinha, were you planning on looking into this? > Implicit returns of transformed binary expressions do not have line numbers > when statically compiled > ---------------------------------------------------------------------------------------------------- > > Key: GROOVY-7870 > URL: https://issues.apache.org/jira/browse/GROOVY-7870 > Project: Groovy > Issue Type: Bug > Components: Static compilation > Affects Versions: 2.4.7 > Reporter: Shil Sinha > > If certain transformed binary expressions (<=>, ==, <<, >>, >>>) are > implicitly returned, their line numbers are not reported. Example: > {code} > @groovy.transform.CompileStatic > def test() { > def l = [] > l << 3 > } > {code} > The code above is compiled to the following bytecode (as seen using > GroovyConsole): > {code} > public test()Ljava/lang/Object; > L0 > LINENUMBER 3 L0 > ICONST_0 > ANEWARRAY java/lang/Object > INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.createList > ([Ljava/lang/Object;)Ljava/util/List; > ASTORE 1 > L1 > ALOAD 1 > POP > ALOAD 1 > ICONST_3 > INVOKESTATIC java/lang/Integer.valueOf (I)Ljava/lang/Integer; > INVOKESTATIC org/codehaus/groovy/runtime/DefaultGroovyMethods.leftShift > (Ljava/util/List;Ljava/lang/Object;)Ljava/util/List; > ARETURN > L2 > ACONST_NULL > ARETURN > LOCALVARIABLE this Lscript1466525199339; L0 L2 0 > LOCALVARIABLE l Ljava/util/List; L1 L2 1 > MAXSTACK = 2 > MAXLOCALS = 2 > {code} > There is no line number corresponding to L1, which includes the leftShift > call (should be line number 4.) > This is occurs because 1) BinaryExpressionTransformer does not copy the > source position of the original expression to the transformed expression in > some cases, and 2) ReturnAdder set the source position of the generated > return for an expression statement with that of the expression. -- This message was sent by Atlassian JIRA (v6.3.4#6332)