Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.4.10
-
None
-
Windows 7, JDK 1.8.0_66
Description
The following code
import groovy.transform.CompileStatic import static java.util.stream.Collectors.toList @CompileStatic class Test { static void main(String[] args) { List<String> tables = ['a', 'b'] println tables.stream().filter { tableName -> tableName.contains('a') }.collect(toList()) } }
fails with the error:
Error:(9, 55) Groovyc: [Static type checking] - Cannot find matching method java.lang.Object#contains(java.lang.String). Please check if the declared type is right and if the method exists.
But works fine with compile dynamic.
It would be great if CompileStatic get all required types from the steam (type info should be there, Java can handle similar code)