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 2021/07/19 09:45:00 UTC
[jira] [Created] (GROOVY-10176) @NamedVariant with primitives can't
find method
Leonard Brünings created GROOVY-10176:
-----------------------------------------
Summary: @NamedVariant with primitives can't find method
Key: GROOVY-10176
URL: https://issues.apache.org/jira/browse/GROOVY-10176
Project: Groovy
Issue Type: Bug
Affects Versions: 3.0.8, 2.5.14
Reporter: Leonard Brünings
When using {{@NamedVariant}} on a method that uses primitives, it cannot invoke the underlying method.
{code:java}
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"
{code}
You can also try it directly in the new [Groovy Console|https://gwc-experiment.appspot.com/?codez=eJxVjc0KwjAQhO_7FEMI1EJTMEeh4AOIF8H79peAzZZNEER8d6Pgwe80wwwzYd1EMxYVuT_arBzTLLq2Z16n8coaOGai458dpxmzyO6SNcQFjA4VVw1CzOiL2Te4SQmGov2pxpNQMJad7Z0dDL2IOKWp_H5m-gN8ja6DYeedN_St_3gDo98tiw].
{noformat}
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) {noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)