Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.0
-
None
Description
this works fine:
@groovy.transform.TypeChecked def test() { List<GString> dates = ["${new Date()-1}", "${new Date()}", "${new Date()+1}"] List<String> upper = dates*.toUpperCase() } test()
but this fails:
@groovy.transform.TypeChecked def test() { List<GString> dates = ["${new Date()-1}", "${new Date()}", "${new Date()+1}"] List<GString> copied = [] copied.addAll(dates) List<String> upper = copied*.toUpperCase() } test()
with this error message:
2 compilation errors: [Static type checking] - Cannot find matching method groovy.lang.GString#toUpperCase(). Please check if the declared type is right and if the method exists. at line: 6, column: 26 [Static type checking] - Incompatible generic argument types. Cannot assign java.util.List <java.lang.Object> to: java.util.List <String> at line: 6, column: 5