Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Duplicate
-
4.0.13
-
None
-
None
Description
With static compilation, the types of the parameters to withIndex().collect{} are lost.
This example fails to compile:
import groovy.transform.CompileStatic @CompileStatic // compiles without this class WithIndexCollectParameters { List<String> myList = [] void myMethod() { myList.withIndex().collect { String str, int idx -> // [Static type checking] - Expected type java.lang.Object for closure parameters true } } }
Attachments
Issue Links
- is related to
-
GROOVY-11089 STC: closure param type inference for array and list
- Closed
-
GROOVY-11124 iterating Tuple2s loses type parameters
- Closed
-
GROOVY-11090 STC: closure param type inference for tuple
- Closed
- relates to
-
GROOVY-11135 Unable to compile: Expected type java.lang.Object for closure parameter
- Closed