You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (JIRA)" <ji...@apache.org> on 2018/05/08 15:30:00 UTC
[jira] [Comment Edited] (GROOVY-8574) Add type parameterization and
@ClosureParams to each/every/etc. Object variants
[ https://issues.apache.org/jira/browse/GROOVY-8574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16467556#comment-16467556 ]
Eric Milles edited comment on GROOVY-8574 at 5/8/18 3:29 PM:
-------------------------------------------------------------
Also, should these predicate methods have {{Closure<Boolean>}} instead of plain {{Closure}}? Or does the current impl support Groovy truth of the returned value?
was (Author: emilles):
Also, should these predicate methods have {{Closure<Boolean>}} instead of plain {{Closure}}?
> Add type parameterization and @ClosureParams to each/every/etc. Object variants
> -------------------------------------------------------------------------------
>
> Key: GROOVY-8574
> URL: https://issues.apache.org/jira/browse/GROOVY-8574
> Project: Groovy
> Issue Type: Bug
> 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
>
> Similar to GROOVY-8573, there are a few DGMs that operate on "anything that can be converted to an iterator", ex: {{every(Object,Closure)}}. Would it be safe to convert these to type-parameterized methods to allow proper {{@ClosureParams}} tagging?
> Ex:
> {code:java}
> public static boolean every(Object self, Closure closure)
> // becomes:
> public static <T> boolean every(T self, @ClosureParams(value=FromString.class, options={"T"}) Closure closure)
> {code}
> I think this is binary-compatible with the old signature since the T is erased at compile time.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)