[
https://issues.apache.org/jira/browse/GROOVY-11072?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King closed GROOVY-11072.
------------------------------
> Unable to compile: Expected type for closure parameter
> -------------------------------------------------------
>
> Key: GROOVY-11072
> URL: https://issues.apache.org/jira/browse/GROOVY-11072
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 3.0.12, 3.0.13, 3.0.14, 3.0.15, 3.0.16, 3.0.17
> Environment: Ubuntu 22.04
> Java 11
> Reporter: A. Lepe
> Assignee: Eric Milles
> Priority: Major
> Labels: CompileStatic, compile-error, parameters
> Fix For: 3.0.18, 4.0.13
>
>
> This code is unable to compile, throwing the exception:
> {code:java}
> Main.groovy: 15: 22: [Static type checking] - Expected type java.util.List<T>
> for closure parameter: list
> @ line 22, column 17.
> List<String> list ->
> ^
> Main.groovy: 17: [Static type checking] - Expected type java.lang.Object for
> closure parameter: tm
> @ line 17, column 21.
> TestModel tm ->
> ^
> Main.groovy: 18: [Static type checking] - No such property: id for class:
> java.lang.Object
> @ line 18, column 33.
> println(tm.id)
> ^{code}
> Code:
> {code:java}
> @CompileStatic
> class Main {
> static void main(String[] args) {
> TestTable table = new TestTable()
> table.getAll({
> List<TestModel> list ->
> list.each {
> TestModel tm ->
> println(tm.id)
> }
> })
> }
> }{code}
> This is a simplified version of my code which worked fine in 3.0.11, it
> failed first on 3.0.12 including 4.x.
> I have prepared a git project with the minimum code at:
> [https://gitlab.com/intellisrc/groovy-compile-error2]
> In _build.gradle_ you can change between 3.0.11 and 4.0.12 versions
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)