[
https://issues.apache.org/jira/browse/GROOVY-6956?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King updated GROOVY-6956:
------------------------------
Summary: Align the parameters of @DelegatesTo and @ClosureParams (was:
Align the parameters of @DeleatesTo and @ClosureParams)
> Align the parameters of @DelegatesTo and @ClosureParams
> -------------------------------------------------------
>
> Key: GROOVY-6956
> URL: https://issues.apache.org/jira/browse/GROOVY-6956
> Project: Groovy
> Issue Type: Wish
> Affects Versions: 2.3.4
> Reporter: Dimitar Dimitrov
> Assignee: Cédric Champeau
> Fix For: 2.4.0-beta-4
>
>
> Currently @DelegateTo allows to use the generic type of another argument of
> the call, but I actually need to delegate to one of the generic parameters of
> the enclosing class.
> I.e. my signature is:
> {code}
> PipelineBuilder<T> map(
> boolean passThroughNulls = true,
> @ClosureParams(value=FromString.class, options=["T"]) Closure<T> mapper
> )
> {code}
> And I want the mapper closure to be able to refer to the payload through the
> delegate as well as the 'it' parameter.
> Unfortunately @DelegatesTo won't let me do this as it was written prior
> to @ClosureParams and it does not support things like {{FirstParam}} or
> {{FromString}}...
> Aligning the config params of @DeleatesTo and @ClosureParams, will make them
> more powerful and easier to learn.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)