Groovy:groovy.lang.MissingMethodException:没有方法的签名 [英] Groovy : groovy.lang.MissingMethodException: No signature of method
本文介绍了Groovy:groovy.lang.MissingMethodException:没有方法的签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是从常规开始.此错误看起来很基本.但我似乎没有解决这个问题.感谢任何指导我正确方向的帮助
I'm just starting with groovy. This error looks basic. but i don't seem to get through this. Appreciate any help in guiding me through the right direction
我正在定义一个类似于下面的字符串,并将其传递给testSender方法
I'm defining a string like below and passing it to testSender method
def line = "5 1 -81.42 Ido1"
testSender(line.toString())
testSender方法的定义
Definition of testSender method
def testSender(line){
try {
println line
} catch(e) {
println e.printStackTrace()
}
}
运行此命令时,出现此错误
When I run this, getting this error
groovy.lang.MissingMethodException:
No signature of method: GroovySQLQuery$_main_closure1.testSender()
is applicable for argument types: (java.lang.String) values: [5 1 -81.42 Ido1]
推荐答案
应为:
class GroovySQLQuery {
static void main(String[] args) {
def line = "5 1 -81.42 Ido1"
testSender(line.toString())
}
static testSender(line) {
println line
}
}
这篇关于Groovy:groovy.lang.MissingMethodException:没有方法的签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文