Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.1.3
-
None
-
None
Description
Following the discussion at https://gist.github.com/alkemist/5429603, it would be interesting if Groovy allowed @DelegatesTo to map onto a generic type argument.
For example:
public <T> Object map(@DelegatesTo.Target List<T> target, @DelegatesTo(genericTypeIndex=0) Closure arg) { arg.delegate = target.join('') arg() } def test() { def result map(['f','o','o']) { result = toUpperCase() } result } assert 'FOO'==test()