You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/06/05 22:34:00 UTC

[jira] [Commented] (GROOVY-11080) Static type checking regression with implicit generics of inline maps

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

Eric Milles commented on GROOVY-11080:
--------------------------------------

Can you try 4.0.13 snapshot?  Some map literal changes have been fixed already. 

> Static type checking regression with implicit generics of inline maps
> ---------------------------------------------------------------------
>
>                 Key: GROOVY-11080
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11080
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 4.0.12
>            Reporter: Luke Bemish
>            Priority: Major
>
> In 4.0.12, generic types of inline map definitions are no longer correctly inferred in situations where they would be under 4.0.11. For instance, the following:
> {code:java}
> @CompileStatic
> class TypeCheckingTest {
>     static final Map<String, Map<String, String>> testMap = [:]
>     static test() {
>         testMap.put("test", [:])
>     }
> }{code}
> Fails to compile in 4.0.12, but compiles in 4.0.11. The error produced is:
> {code:java}
> 10: [Static type checking] - Cannot find matching method java.util.Map#put(java.lang.String, java.util.LinkedHashMap<#K, #V>). Please check if the declared type is correct and if the method exists.
>  @ line 10, column 9.
>            testMap.put("test", [:])
>            ^1 error {code}



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