简体   繁体   中英

Groovy : groovy.lang.MissingMethodException: No signature of method

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

I'm defining a string like below and passing it to testSender method

def line = "5 1 -81.42 Ido1"
testSender(line.toString())

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]

Should be:

class GroovySQLQuery { 
    static void main(String[] args) { 
        def line = "5 1 -81.42 Ido1" 
        testSender(line.toString()) 
    } 

    static testSender(line) { 
        println line 
    } 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM