Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Section 3.2.2 of the Groovy Object Orientation documentation describes named method parameters (http://groovy-lang.org/objectorientation.html#_named_parameters_2).
All name parameters are collected in a map, and passed in as first parameter to the called method. One corner case is not mentioned, though: when you call the method without any named parameter, the map is not created and not passed in. Thus, one should make the map optional:
def foo(Map args=[:], Integer number)
If not optional, one gets a groovy.lang.MissingMethodException: No signature of method.
This is a tricky, unintuitive case which should be explicitly mentioned in the documentation.