[jira] [Commented] (GROOVY-8573) Add @ClosureParams to each/eachWithIndex methods in DefaultGroovyMethods

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Commented] (GROOVY-8573) Add @ClosureParams to each/eachWithIndex methods in DefaultGroovyMethods

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/GROOVY-8573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16502550#comment-16502550 ]

Jochen Theodorou commented on GROOVY-8573:

To have a realistic version you need to say something about iterator. The best way to do this is by implementing Iterable. And for this case we have an each-method and an eachWithIndex variant as well. In my opinion we should close this issue and GROOVY-8574

> Add @ClosureParams to each/eachWithIndex methods in DefaultGroovyMethods
> ------------------------------------------------------------------------
>                 Key: GROOVY-8573
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8573
>             Project: Groovy
>          Issue Type: Improvement
>    Affects Versions: 2.6.0-alpha-3, 3.0.0-alpha-2, 2.4.15, 2.5.0-rc-2
>            Reporter: Eric Milles
>            Priority: Minor
> Category methods {{each(T,Closure)}} and {{eachWithIndex(T,Closure)}} are missing {{@ClosureParams}} annotations.
> From some cursory testing, it looks like these are the necessary additions:
> {code:java}
> public static <T> T each(T self, @ClosureParams(value=FromString.class, options={"T"}) Closure closure)
> public static <T> T eachWithIndex(T self, @ClosureParams(value=FromString.class, options="T,Integer") Closure closure)
> {code}

This message was sent by Atlassian JIRA