[ https://issues.apache.org/jira/browse/GROOVY-11731?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18015833#comment-18015833 ]
Eric Milles commented on GROOVY-11731: -------------------------------------- "Each element of the array corresponds to a single signature, and each comma in an element separate parameters of the signature." > Closure Params FromString > -------------------------- > > Key: GROOVY-11731 > URL: https://issues.apache.org/jira/browse/GROOVY-11731 > Project: Groovy > Issue Type: Bug > Reporter: Sven > Priority: Minor > > {code:java} > @CompileStatic > static void main(String[] args) { > test({ int rowNumber, Map<String, Object> currentRow -> > // This is a placeholder for the actual logic that would process each > row.) > println "Row number: $rowNumber" > println "Current row: $currentRow" > }) > } > static void test(@ClosureParams(value = FromString, options = ["Integer", > "Map<String, Object>"]) Closure closure) { > int rowNumber = 0 > Map <String, Object> currentRow = [:] > closure(rowNumber, currentRow) > } {code} > The above code works with groovy 3.0.18 and below after that it stops working > I got it to work like that: > {code:java} > @CompileStatic > static void main(String[] args) { > test({ int rowNumber, Map<String, Object> currentRow -> > // This is a placeholder for the actual logic that would process each > row.) > println "Row number: $rowNumber" > println "Current row: $currentRow" > }) > } > static void test(@ClosureParams(value = FromString, options = ["Integer, > Map<String, Object>"]) Closure closure) { > int rowNumber = 0 > Map <String, Object> currentRow = [:] > closure(rowNumber, currentRow) > } > {code} > But either the doc is wrong or the implementation has a bug. > > The error I get is the following: > Incorrect number of parameters. Expected 1 but found 2 > @ line 9, column 10. > test({ int rowNumber, Map<String, Object> currentRow -> > ^ > > -- This message was sent by Atlassian Jira (v8.20.10#820010)