Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6582

Script.invokeMethod bypasses getProperty when looking for closure-valued properties.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.9, 2.2.1
    • 2.3.0-beta-1, 2.2.3
    • 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.

      Attachments

        Activity

          People

            jimwhite James P. White
            jimwhite James P. White
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: