Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
4.0.6
-
None
-
None
Description
The following code fails to compile:
import groovy.transform.NamedVariant trait Foo { @NamedVariant def foo(String username = "sdf", String email = "ghj") {} }
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.