Hi there,

is it possible to reliably recognise an empty closure, i.e., „{}“, 
programmatically? 

def foo(Closure bar) {
  if (?bar-is-empty?) throw new Exception('The closure cannot be empty!')
  else bar()
}
foo { println "ok" } // OK
foo { 1 } // OK
foo { } // throws

Thanks!
OC

Reply via email to