[ 
https://issues.apache.org/jira/browse/GROOVY-11807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18092273#comment-18092273
 ] 

ASF GitHub Bot commented on GROOVY-11807:
-----------------------------------------

testlens-app[bot] commented on PR #2641:
URL: https://github.com/apache/groovy/pull/2641#issuecomment-4830395641

   ## ✅ All tests passed ✅
   
   🏷️ Commit: a4b448b7f43240632cd49e7681236742cb540dbe
   ▶️ Tests:  102126 executed
   ⚪️ Checks: 31/31 completed
   
   ---
   _Learn more about TestLens at [testlens.app](https://testlens.app)._
   




> 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
>          Components: groovy-jdk
>            Reporter: Eric Milles
>            Assignee: Paul King
>            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