[ 
https://issues.apache.org/jira/browse/GROOVY-8001?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles reassigned GROOVY-8001:
-----------------------------------

    Assignee: Eric Milles

> Static compiling fails type checking with generics
> --------------------------------------------------
>
>                 Key: GROOVY-8001
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8001
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 2.4.7
>            Reporter: Juan Martín Sotuyo Dodero
>            Assignee: Eric Milles
>            Priority: Major
>
> Given a property of type {{Map<String, Object>}} and the assignment:
> {code}
> myObject.property = ['myKey':"${buildDir}/file-cache"]
> {code}
> I get the following error:
> {quote}
> [Static type checking] - Cannot assign value of type java.util.LinkedHashMap 
> <java.lang.String, groovy.lang.GString> to variable of type java.util.Map 
> <java.lang.String, java.lang.Object>
> {quote}
> I have to manually cast the value to {{Object}} for it to work without 
> warnings:
> {code}
> myObject.property = ['myKey': "${buildDir}/file-cache" as Object]
> {code}
> This should not be needed, since any object is a valid instance of {{Object}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to