You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/12/01 22:52:00 UTC
[jira] [Commented] (GROOVY-10858) STC method reference return type checking
[ https://issues.apache.org/jira/browse/GROOVY-10858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17642198#comment-17642198 ]
Eric Milles commented on GROOVY-10858:
--------------------------------------
https://github.com/apache/groovy/commit/798903b2ef9089ebf8b39ce96eda8b654ae8cdb8
> STC method reference return type checking
> -----------------------------------------
>
> Key: GROOVY-10858
> URL: https://issues.apache.org/jira/browse/GROOVY-10858
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 3.0.13, 4.0.6
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Minor
>
> Consider the following:
> {code:groovy}
> @groovy.transform.CompileStatic
> void test() {
> java.util.function.Function<Object,Number> f = Object::toString
> print(f.apply('xxx'))
> }
> {code}
> This code compiles and prints the string instead of a compile-time error indicating that String is not compatible with Number.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)