【问题标题】:MissingMethodException in Groovy: No signature of methodGroovy 中的 MissingMethodException:没有方法签名
【发布时间】:2015-10-19 22:07:01
【问题描述】:

在 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)

...我得到以下异常:

捕获:groovy.lang.MissingMethodException:没有方法签名 printDocument() 适用于参数类型(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 missingmethodexception


    【解决方案1】:

    您使用 ) 而不是 } 关闭该方法,然后它在 groovy 控制台中工作正常

    应该是:

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

    当然,除非您错误地将某些内容粘贴到问题中?

    如果这不能解决您的问题,您能否找到/编写一些代码在您遇到问题的上下文中显示问题?

    【讨论】:

      猜你喜欢
      • 2018-12-26
      • 1970-01-01
      • 1970-01-01
      • 2022-08-06
      • 2017-03-02
      • 2021-04-28
      • 2014-10-16
      • 1970-01-01
      • 2012-10-03
      相关资源
      最近更新 更多