You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Shil Sinha (JIRA)" <ji...@apache.org> on 2015/09/29 06:32:04 UTC

[jira] [Created] (GROOVY-7610) Null safe is call throws VerifyError when used as condition with CompileStatic

Shil Sinha created GROOVY-7610:
----------------------------------

             Summary: Null safe is call throws VerifyError when used as condition with CompileStatic
                 Key: GROOVY-7610
                 URL: https://issues.apache.org/jira/browse/GROOVY-7610
             Project: Groovy
          Issue Type: Bug
          Components: Static compilation
    Affects Versions: 2.4.5, 2.4.4
         Environment: OS X 10.10, JDK 1.8.0_60

            Reporter: Shil Sinha
            Assignee: Cédric Champeau


Here's an example:

{code}
import groovy.transform.CompileStatic

@CompileStatic
class A {
    void ifCondition(Object x, Object y) {
        if (x?.is(y))
            return
    }

    void ternaryCondition(Object x, Object y) {
          x?.is(y) ? 'foo' : 'bar'
    }
}
new A()
{code}

The above code throws the following error:

{code}
java.lang.VerifyError: (class: A, method: ternaryCondition signature (Ljava/lang/Object;Ljava/lang/Object;)V) Expecting to find object/array on stack
{code}

This appears to be caused by the ?.is call expression being transformed to a CompareIdentityExpression, which is semantically different.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)