Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.5.14, 3.0.8
-
None
Description
When using @NamedVariant on a method that uses primitives, it cannot invoke the underlying method.
import groovy.transform.NamedVariant @NamedVariant def foo(String a = 'a', int b = 1, long c = 2L) { "$a-$b-$c" } assert foo(b: 2) == "a-2-2"
You can also try it directly in the new Groovy Console.
groovy.lang.MissingMethodException: No signature of method: Script1.foo() is applicable for argument types: (null, Integer, null) values: [null, 2, null] Possible solutions: foo(), foo(java.lang.String, int), foo(java.lang.String, int, long), foo(java.lang.String), foo(java.util.Map), run() at Script1.foo(Script1.groovy) at Script1$foo.callCurrent(Unknown Source) at Script1.run(Script1.groovy:8)
Attachments
Issue Links
- relates to
-
GROOVY-9158 @NamedParam arguments don't get their default value when only named parameters are used in the method call
- Closed
-
GROOVY-10261 @NamedVariant: Default parameters on ctor/method are ignored when passing some named parameters
- Closed