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 2022/11/19 14:51:00 UTC
[jira] [Updated] (GROOVY-10816) @NamedVariant does not work on methods on a trait or default methods on an interface
[ https://issues.apache.org/jira/browse/GROOVY-10816?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-10816:
---------------------------------
Labels: named-parameters (was: )
> @NamedVariant does not work on methods on a trait or default methods on an interface
> ------------------------------------------------------------------------------------
>
> Key: GROOVY-10816
> URL: https://issues.apache.org/jira/browse/GROOVY-10816
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 4.0.6
> Reporter: Robert Elliot
> Priority: Minor
> Labels: named-parameters
>
> The following code fails to compile:
> {code:groovy}
> import groovy.transform.NamedVariant
> trait Foo {
> @NamedVariant
> def foo(String username = "sdf", String email = "ghj") {}
> }
> {code}
> with this error:
> {{Groovyc: Error during @NamedVariant processing. Class Foo$Trait$Helper already has a named-arg method of type [org.codehaus.groovy.ast.Parameter@15247533[name: namedArgs, type: java.util.Map, hasDefaultValue: false]]}}
> It works fine as a class.
> It fails as an interface with a default method.
> Perhaps this is intended, but if so I failed to find any documentation specifying that {{@NamedVariant}} only works with classes.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)