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

Eric Milles updated GROOVY-11807:
---------------------------------
    Language: groovy

> MapWithDefault can break type safety of key set
> -----------------------------------------------
>
>                 Key: GROOVY-11807
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11807
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Eric Milles
>            Priority: Major
>
> {code}
> Map<Number,?> map = [:].withDefault{ null }
> assert map.get('x') == null
> Number k = map.keySet()[0]
> {code}
> GroovyCastException: Cannot cast object 'x' with class 'java.lang.String' to 
> class 'java.lang.Number'



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to