简体   繁体   中英

MissingMethodException in Groovy: No signature of method

When using the following piece of code in Groovy...

def printDocument(deviceName, document, resolution, documentName, creatorName, xOffset, yOffset, startPage, endPage, numCopies) {
    // do stuff...
)

printDocument(
    'Printer name',
    'C:/temp/test.pdf',
    600,
    'My document',
    'John Doe',
    0,
    0,
    0,
    0,
    1)

... I get the following exception:

Caught: groovy.lang.MissingMethodException: No signature of method printDocument() is applicable for argument types (java.lang.String, java.lang.String, java.lang.Integer, java.lang.String, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer)

As far as I can see the number of arguments are correct. Any ideas why this method call fails?

You close the method with a ) not a } then it works fine in the groovy console

Should be:

def printDocument(deviceName, document, resolution, documentName, creatorName, xOffset, yOffset, startPage, endPage, numCopies) {
    // do stuff...
}

Unless of course you have pasted something which works in to the question by mistake?

If that doesn't fix your issue, can you find/write some code that exhibits the problem in the context you are having the issue with?

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