[ 
https://issues.apache.org/jira/browse/GROOVY-10010?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King closed GROOVY-10010.
------------------------------

> STC: method call with GString elements in list/array has different error from 
> assignment
> ----------------------------------------------------------------------------------------
>
>                 Key: GROOVY-10010
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10010
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Minor
>             Fix For: 4.0.0-alpha-3
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> 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)

Reply via email to