Groovy 中的 MissingMethodException: 没有方法签名
MissingMethodException in Groovy: No signature of method
在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)
...我得到以下异常:
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)
据我所知,参数的数量是正确的。知道为什么此方法调用失败吗?
您使用 )
而不是 }
关闭该方法,然后它在 groovy 控制台中正常工作
应该是:
def printDocument(deviceName, document, resolution, documentName, creatorName, xOffset, yOffset, startPage, endPage, numCopies) {
// do stuff...
}
当然,除非你错误地粘贴了对问题有效的内容?
如果这不能解决您的问题,您能否 find/write 一些代码在您遇到问题的上下文中展示问题?
在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)
...我得到以下异常:
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)
据我所知,参数的数量是正确的。知道为什么此方法调用失败吗?
您使用 )
而不是 }
关闭该方法,然后它在 groovy 控制台中正常工作
应该是:
def printDocument(deviceName, document, resolution, documentName, creatorName, xOffset, yOffset, startPage, endPage, numCopies) {
// do stuff...
}
当然,除非你错误地粘贴了对问题有效的内容?
如果这不能解决您的问题,您能否 find/write 一些代码在您遇到问题的上下文中展示问题?