[ https://issues.apache.org/jira/browse/GROOVY-7467?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14585130#comment-14585130 ]
Jochen Theodorou commented on GROOVY-7467: ------------------------------------------ It was working in Groovy 2.2.2, because the static type checker did not check this properly. In other words, this was a bug and got fixed in a later version. Imagine a program like this: {code:Java]} List foo() { return ["a","b"] } foo.each { Map m -> assert m instance of Map } {code} In Groovy 2.2.2 this should fail at runtime because it cannot call the right doCall method of the open block. The type checker is supposed to prevent this, thus the program should, if possible fail at compile time already. List is equal to List<Object>, so he only information we have is that this is a list of Objects. There might or might not a map inside, thus compilation must fail. Groovy 2.3.10 does this better now > Expected parameter of type java.lang.Object but got java.util.Map in groovy > 2.3.10 > ---------------------------------------------------------------------------------- > > Key: GROOVY-7467 > URL: https://issues.apache.org/jira/browse/GROOVY-7467 > Project: Groovy > Issue Type: Bug > Components: Static compilation > Affects Versions: 2.3.10 > Reporter: Vijaykumar > Assignee: Jochen Theodorou > > Expected parameter of type java.lang.Object but got java.util.Map > I'm getting the above exception in the groovy 2.3.10.. > I have declared the closure parameter as Map in my code. The same code is > working in groovy 2.2.2. > I am upgrading groovy from 2.2.2 to 2.3.10. -- This message was sent by Atlassian JIRA (v6.3.4#6332)