Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
Follow up from GROOVY-5559 and GROOVY-9971. Consider the following:
void m(List<String> list) { } @groovy.transform.TypeChecked void test() { def bar = 123 m(["foo","$bar"]) List<String> strings = ["foo","$bar"] }
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>]".