Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.8.9, 2.2.1
-
None
-
None
Description
The implementation of Script.invokeMethod calls binding.getVariable(name) rather than getProperty(name) when checking to see if there is a property with that name that has a value that implements Closure. This is significantly bugged because if Script is subclassed (such as when using the @BaseScript annotation) and getProperty is overridden to supply Closure values then they are seen as property values as variables but not as functions.
Fixing this by having Script.invokeMethod call getProperty rather than binding.getVariable will make the behavior consistent with Expando.invokeMethod. See also GROOVY-6586 where I'm assembling information on the big picture so that we can eventually have a logically consistent (and documented) system for these class-like dynamic properties in Groovy.