Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.4.12
-
None
-
None
Description
See the small attached example class.
Problem arises if you define a local variable and name it "metaClass", then call a closure that accepts some parameters like map.each
{ key, value -> ... }.
When the code gets to Closure.call(Object... args) it executes:
return (V) getMetaClass().invokeMethod(this,"doCall",args);
only now getMetaClass() returns the shadowed metaClass variable, not the Closure's metaClass and an exception is thrown if the class that the external metaClass belongs to does not define a doCall(args) method.
This seems to be happening only with @CompileStatic
Renaming the local variable from metaClass to anything else works around the problem.