Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
I have the following program
import java.util.*; @FunctionalInterface interface Foo<T> { int m(List<T> x); } class Main { static final void test() { Foo<String> p = (List<String> x) -> 1; } }
Actual behavior
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Main.groovy: 11: [Static type checking] - Expected type java.util.List<T> for lambda parameter: x @ line 11, column 22. Foo<String> p = (List<String> x) -> 1; ^ 1 error
Expected behavior
Compile successfully
Notes
Tested against master (commit: cdc57551a7cce33ec7031b40753f25c869dcf0cc)
Test case adapted from the following program that uses the apache-commons-collection4 lib
class Main { static final void test() { org.apache.commons.collections4.sequence.ReplacementsHandler<Number> f = (int x, List<java.io.IOException> y, List<Number> z) -> { } ; } }
Attachments
Issue Links
- relates to
-
GROOVY-11072 Unable to compile: Expected type for closure parameter
- Closed