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/04/05 16:44:00 UTC

[jira] [Created] (GROOVY-10010) STC: ...

Eric Milles created GROOVY-10010:
------------------------------------

             Summary: STC: ...
                 Key: GROOVY-10010
                 URL: https://issues.apache.org/jira/browse/GROOVY-10010
             Project: Groovy
          Issue Type: Bug
            Reporter: Eric Milles
            Assignee: Eric Milles


Follow up from GROOVY-5559 and GROOVY-9971.  Consider the following:
{code:groovy}
void m(List<String> list) { }
@groovy.transform.TypeChecked
void test() {
  def bar = 123
  m(["foo","$bar"])
  List<String> strings = ["foo","$bar"]
}
{code}

The assignment yields a nice error message as per 5559: "You are trying to use a GString in place of a String in a type which explicitly declares accepting String. Make sure to call toString() on all GString values."

The direct use of a list expression as a call argument still retains the less-informative generics compatibility error: "Cannot call Script#m(java.util.List <java.lang.String>) with arguments [java.util.ArrayList <java.io.Serializable>]".



--
This message was sent by Atlassian Jira
(v8.3.4#803005)