You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Graeme Rocher (JIRA)" <ji...@apache.org> on 2016/11/10 12:49:59 UTC

[jira] [Created] (GROOVY-7998) Disallow automatic String conversion in static compilation context

Graeme Rocher created GROOVY-7998:
-------------------------------------

             Summary: Disallow automatic String conversion in static compilation context
                 Key: GROOVY-7998
                 URL: https://issues.apache.org/jira/browse/GROOVY-7998
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 2.4.7
            Reporter: Graeme Rocher


This code:

{code}
@groovy.transform.CompileStatic
class Bar {
    protected List bar = []
    
    boolean doStuff() {
        String bar = this.bar
        return bar.isEmpty()
    }
}

new Bar().doStuff()
{code}

Prints false. IMO it should not be possible to assign a List to a String and in a static compilation context this should be a compilation error.



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