[
https://issues.apache.org/jira/browse/GROOVY-11259?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-11259:
---------------------------------
Fix Version/s: 3.0.21
> STC loses generic information on method references
> --------------------------------------------------
>
> Key: GROOVY-11259
> URL: https://issues.apache.org/jira/browse/GROOVY-11259
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 4.0.17
> Reporter: Christopher Smith
> Assignee: Eric Milles
> Priority: Major
> Fix For: 3.0.21
>
>
> 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.
> {code:groovy}
> @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) {}
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)