You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Christopher Smith (Jira)" <ji...@apache.org> on 2024/01/09 18:28:00 UTC

[jira] [Created] (GROOVY-11275) Support type witness in method reference

Christopher Smith created GROOVY-11275:
------------------------------------------

             Summary: Support type witness in method reference
                 Key: GROOVY-11275
                 URL: https://issues.apache.org/jira/browse/GROOVY-11275
             Project: Groovy
          Issue Type: Improvement
          Components: Compiler, parser-antlr4
    Affects Versions: 4.0.17
            Reporter: Christopher Smith


Java permits type witnesses as part of a method reference to provide the usual hinting:

{code:java}
Optional<List<Number>> foo = Optional.of(42).map(List::<Number>of);
{code}

The Groovy grammar as of 4.0.17 does not support type witnesses in this position, but there are a number of cases where the compiler (particularly the STC) has limitations with type inference and it would be helpful to have.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)