Hi there,
is there a way to write a method with argument which would match null
specifically when called? This does not work:
===
1022 ocs /tmp> <q.groovy
class Test {
def foo(Collection foo) {}
def foo(Map foo) {}
def foo(org.codehaus.groovy.runtime.NullObject foo) {}
}
new Test().foo(null)
1023 ocs /tmp> /usr/local/groovy-4.0.25/bin/groovy q
Caught: groovy.lang.GroovyRuntimeException: Ambiguous method overloading for
method Test#foo.
Cannot resolve which method to invoke for [null] due to overlapping prototypes
between:
[interface java.util.Collection]
[interface java.util.Map]
===
Thanks!
OC