groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniil Ovchinnikov (JIRA)" <j...@apache.org>
Subject [jira] [Created] (GROOVY-8909) List literal type inference does not take its context into account
Date Wed, 05 Dec 2018 11:34:00 GMT
Daniil Ovchinnikov created GROOVY-8909:
------------------------------------------

             Summary: List literal type inference does not take its context into account
                 Key: GROOVY-8909
                 URL: https://issues.apache.org/jira/browse/GROOVY-8909
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
    Affects Versions: 2.5.4
            Reporter: Daniil Ovchinnikov


{code:title=bug.groovy}
def methodAcceptingListOfObjects(List<Object> lo) {}

@groovy.transform.CompileStatic
def usage() {
    methodAcceptingListOfObjects([1, 2, 3]) 
}
{code}
Compilation fails with
{noformat}
[Static type checking] - Cannot call #methodAcceptingListOfObjects(java.util.List <java.lang.Object>)
with arguments [java.util.List <java.lang.Integer>]
{noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message