2.14-rc-3 throws 'Could not find method', used to work until 2.14-rc-2

I’m attaching a sample project to replicate the issue
gradle214rc3-closure-bug.zip (1.2 KB)

Thanks for the example!

Could you try changing your Closure implementation from:

        project.getExtensions().add("myFunction", new Closure<Object>(this) {
            @Override public Class[] getParameterTypes() { return [ Object.class ]; }
            @Override public int getMaximumNumberOfParameters() { return 1; }
            @Override public Object call(Object... args) { return myFunction(args[0]); }


        project.getExtensions().add("myFunction", new Closure<Object>(this) {
            public Object doCall(Object... args) { return myFunction(args[0]); }

Thank you, this fixes it, but I’d be concerned about a breaking change this late in the release cycle.
The code has been working at least since 2.10, and it’s never been a problem up until rc-2.
It really caught me by surprise.

Yes, I agree. The breakage is caused by some changes to how we look-up dynamic properties and methods. We started checking for Closure’s that implement doCall with particular argument types. We’re going to roll back these changes.

I would consider changing to doCall anyways. If you use doCall, you don’t have to implement getParameterTypes or getMaximumNumberOfParameters yourself.

Added https://issues.gradle.org/browse/GRADLE-3466 for this. Will be fixed in the next RC.