Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.0.17
-
None
Description
In the following code, the correct return type of Map.Entry::getKey is K = String, but the STC loses track of it and returns Object, leading to downstream type mismatches.
@CompileStatic class Repro { void repro(Map<String, String> input) { var keys = input.entrySet().stream() .map(Map.Entry::getKey) .toSet() consume(keys) } static void consume(Set<String> keys) {} }
Attachments
Issue Links
- is related to
-
GROOVY-9803 Static type checker forgets nested generic types
-
- Closed
-
-
GROOVY-11241 Regression in STC generics solution
-
- Closed
-
-
GROOVY-10749 STC: closure/lambda/reference parameter as type witness for SAM type generics
-
- Closed
-
-
GROOVY-10974 Fail to perform SAM conversion using method references
-
- Closed
-
-
GROOVY-10975 STC rejects program when passing method reference in parameterized function
-
- Closed
-