Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
Consider the following:
void setFoo(java.util.function.Consumer<Number> c) {}
@groovy.transform.TypeChecked
void test(Date d) {
foo = { n = d -> }
}
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 -> }"
Attachments
Issue Links
- is related to
-
GROOVY-10072 SC: closure with default argument(s)
- Closed
- relates to
-
GROOVY-11085 STC: assignment of closure with untyped parameter to SAM-type (setter target)
- Closed