You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Leonard Brünings (Jira)" <ji...@apache.org> on 2022/04/04 15:44:00 UTC
[jira] [Created] (GROOVY-10567) @NamedVariant support ignoring arguments
Leonard Brünings created GROOVY-10567:
-----------------------------------------
Summary: @NamedVariant support ignoring arguments
Key: GROOVY-10567
URL: https://issues.apache.org/jira/browse/GROOVY-10567
Project: Groovy
Issue Type: Improvement
Reporter: Leonard Brünings
Currently, the {{@NamedVariant}} will create a map version for all parameters. This makes it impossible to use as [extension method|https://groovy-lang.org/metaprogramming.html#_extension_modules] as the receiver couldn't be defined.
I would propose something along the lines of
{code:groovy}
@NamedVariant
void coolExtension(@NamedVariant.Ignore File file, String p1 = '', String p2 = '') {
//
}
{code}
This would then generate
{code:groovy}
@Generated
void coolExtension(File file, Map namedArgs) {
//
}
{code}
You could apply {{@NamedVariant.Ignore}} only from the left, without interruptions, and those arguments would then be added as standard positional arguments.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)