Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
import groovy.transform.* @TupleConstructor class Person { String name } public <T> List<T> names( @DelegatesTo.Target List<T> list, @DelegatesTo(genericTypeIndex = 0) Closure modify) { list.collect { modify.delegate = it modify() } } @CompileStatic def test(List<Person> persons) { def names = names(persons) { getname().toUpperCase() } assert names == ['GUILLAUME', 'CÃDRIC'] } test([new Person('Guillaume'), new Person('Cédric')])
If I make a typo in getName() method like above, I get a runtime error instead of getting a type checker compile-time error.