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 16:45:00 UTC

[jira] [Created] (GROOVY-10354) STC: wrong closure parameter type(s) inferred for SAM-type assignment

Eric Milles created GROOVY-10354:
------------------------------------

             Summary: 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


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)