Details
-
Improvement
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
None
-
None
Description
For methods like each, collect, times, ... that take a closure as an argument, the type checker doesn't have enough type information to infer what is the expected argument types of the closure. For example, in the following case:
List<String> strings = ['abc','def'] strings.collect { it.toUpperCase() }
there's not enough type information in the signature of collect for the type checker to know that the type of it is a String.
With the upcoming lambda support in JDK8, it becomes critical for us to provide such information.
Attachments
Issue Links
- is depended upon by
-
GROOVY-5923 CompileStatic: closure dispatch is sometimes not type checked
- Closed
-
GROOVY-5842 Runtimer error when types down match with Map and Map.Entry when using @CompileStatic
- Closed
-
GROOVY-5899 withObject[Output|Input]Stream - auto detect 'it' type
- Closed
-
GROOVY-6486 Type inference fails in @CompileStatic for collection iteration closure argument
- Closed
-
GROOVY-6479 Closure to SAM interface coercion doesn't handle contravariant types correctly
- Closed
- relates to
-
GROOVY-7934 Type inference breaks for Collection.inject
- Open