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/06 13:39:00 UTC
[jira] [Comment Edited] (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=17729739#comment-17729739 ]
Eric Milles edited comment on GROOVY-11080 at 6/6/23 1:38 PM:
--------------------------------------------------------------
https://github.com/apache/groovy/commit/357a3020bac60dbc8015c251cc26b666459afbb0
https://github.com/apache/groovy/commit/77024ea1c171ebb6d5b2eb7d3878cf35d6e87120
was (Author: emilles):
https://github.com/apache/groovy/commit/357a3020bac60dbc8015c251cc26b666459afbb0
> 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
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.13
>
>
> 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)