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 2021/11/09 19:01:00 UTC
[jira] [Commented] (GROOVY-10354) STC: wrong closure parameter
type(s) inferred for SAM-type assignment
[ https://issues.apache.org/jira/browse/GROOVY-10354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17441326#comment-17441326 ]
Eric Milles commented on GROOVY-10354:
--------------------------------------
I must be missing something because Java infers String in this case.
> STC: wrong closure parameter type(s) inferred for SAM-type assignment
> ---------------------------------------------------------------------
>
> Key: GROOVY-10354
> URL: https://issues.apache.org/jira/browse/GROOVY-10354
> Project: Groovy
> Issue Type: Bug
> Reporter: Eric Milles
> Priority: Major
>
> Follow up from GROOVY-9998. Consider the following:
> {code:groovy}
> @groovy.transform.TypeChecked
> void test() {
> Comparator<? super String> comparator = { o1, o2 ->
> o1.toLowerCase() <=> o2.toLowerCase()
> }
> }
> {code}
> No STC error is produced for "o1.toLowerCase()", which cannot be safely assumed is of type String.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)