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/10/25 14:37:00 UTC
[jira] [Resolved] (GROOVY-10791) STC doesn't find method reference on superclass
[ https://issues.apache.org/jira/browse/GROOVY-10791?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-10791.
----------------------------------
Fix Version/s: 4.0.7
Resolution: Fixed
https://github.com/apache/groovy/commit/f579fa304a23461b7d1c86602eb60c600ace36c6
> STC doesn't find method reference on superclass
> -----------------------------------------------
>
> Key: GROOVY-10791
> URL: https://issues.apache.org/jira/browse/GROOVY-10791
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 4.0.6
> Reporter: Christopher Smith
> Assignee: Eric Milles
> Priority: Major
> Labels: default-methods
> Fix For: 4.0.7
>
>
> Java permits method references to specify a subclass in {{ContainingType}}, but the STC produces an error unless the exact declaring type is supplied.
> {code:groovy}
> @Grab('io.vavr:vavr:0.10.4')
> import io.vavr.control.Option
> Option<String> supply() { Option.of('hello') }
> @groovy.transform.CompileStatic
> void test() {
> println supply().map(Option::toTry)
> // ^ declared on Value
> }
> test()
> {code}
> produces
> {code}
> Failed to find the expected method[toTry(java.lang.String)] in the type[io.vavr.control.Option] @ line 8, column 24.
> println supply().map(Option::toTry)
> {code}
> (which also suggests that the STC, not traversing supertypes to find a {{::toTry}}, has misinferred the signature).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)