Understanding error from method added from Plugin

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Understanding error from method added from Plugin

Hi All,

I am trying to port the jGit plugin to Grails 3.

This plugin adds a method 'withJGit' to some classes (default 'Controller','Service' and 'Domain', but configurable from Config.groovy in Grails 2.x).

I have made all the changes I thought necessary for Grails 3, but when our application tries to call 'withJGit' the following error occurs:

No signature of method: app.GitService.withJGit() is applicable for argument types: (app.GitService$_updateData_closure1) values: [app.GitService$_updateData_closure1@2e4d8f4a] Possible solutions: withJGit(groovy.lang.Closure)

The definition of 'withJGit' in the plugin is:

private void addDynamicMethods(klass, jgit) {
    klass.metaClass.withJGit = withJGit.curry(jgit)

private withJGit = { jgit, Closure closure ->
    if (!closure) return

    closure.delegate = jgit
    closure.resolveStrategy = Closure.DELEGATE_FIRST

Why does this give the 'No signature' error?
What is wrong with this dynamic method definition?

The 'jgit' in the above code is a springbean implementing the interface to the underlying jgit library

I thought I had a pretty good understanding of Groovy, but this baffles me

Hans Bogaards

P.S. The work-in-progress code can be found here: https://github.com/anwbhv/grails-jgit/tree/grails3

You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/c45f217f-e594-49b0-9f51-8afb5925cb5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.