Huabei
Huabei

Reputation: 23

how to fix groovy.lang.MissingMethodException: No signature of method

why following groovy code throw an exception: groovy.lang.MissingMethodException: No signature of method.

I am the new guy for groovy, can any body help me?

def b = {->
    c()
  }

  def c={ ->
  true
  } 

  b()

Stracktrace is

groovy.lang.MissingMethodException: No signature of method: Script1.c() is applicable for argument types: () values: []
Possible solutions: a(), is(java.lang.Object), run(), run(), any(), any(groovy.lang.Closure)<i>
    at Script1$_run_closure1.doCall(Script1.groovy:7)
    at Script1.run(Script1.groovy:14)

Upvotes: 2

Views: 8389

Answers (1)

rvargas
rvargas

Reputation: 635

It's about order

def c = { ->
    true
} 

def b = { ->    
    c()
}

b()​​

Upvotes: 3

Related Questions