Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
1.5.6, 1.6-beta-1
-
None
-
None
Description
Not sure if this is a bug, but at least it is inconsistent.
According to the documentation, calling a closure with no arguments is equivalent to calling it with one argument of null. So this works as expected:
def f =
{a -> print(a)}; f() // prints null
However,
def f =
{a, Object[] rest -> print(a)}; f()fails with
groovy.lang.MissingMethodException: No signature of method: test$_run_closure1.call() is applicable for argument types: () values: {}
What's inconsistent is that
def f = {a, Object[] rest -> print(a)}
; f(null)
prints "null" just fine.