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 21:12:00 UTC

[jira] [Resolved] (GROOVY-11083) STC: closure param's default not type-checked (method target)

     [ https://issues.apache.org/jira/browse/GROOVY-11083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles resolved GROOVY-11083.
----------------------------------
    Resolution: Fixed

https://github.com/apache/groovy/commit/1e0e8b98bd7418e7ba7d455394d9fd9f3a4a849a

> STC: closure param's default not type-checked (method target)
> -------------------------------------------------------------
>
>                 Key: GROOVY-11083
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11083
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Minor
>
> Consider the following:
> {code:groovy}
> void setFoo(java.util.function.Consumer<Number> c) {}
> @groovy.transform.TypeChecked
> void test(Date d) {
>   foo = { n = d -> }
> }
> {code}
> The default value expression "d" is not compatible with the Number parameter "n".  There is no type-checking error for the call case.  Direct assignment is checked: "java.util.function.Consumer<Number> c = \{ n = new Date() -> \}" and "def bar = \{ Number n = d -> \}"



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