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

Dynamic dispatch fails to recognize updates in the meta-class

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.1, 2.1.2
    • Fix Version/s: 2.2.2
    • Component/s: groovy-runtime
    • Labels:
      None

      Description

      def a = new Dummy()
      //def a = new Object()
      Closure cl = {a.foo()}
      
      a.metaClass.foo {println "Original version"}
      cl(1.5G)
      
      a.metaClass.foo {println "Updated version"}
      cl(1.5G)
      
      class Dummy {}
      This issue imposes some problems on GPars DynamicDispatchActors:
      
      

      This script outputs:
      Original version
      Original version

      while I would expect
      Original version
      Updated version

      Additionally, the behavior differs depending on whether "a" is an instance of a Java or a Groovy class. After making "a" an instance of a Java class, I get the expected output.

        Attachments

          Activity

            People

            • Assignee:
              blackdrag Jochen Theodorou
              Reporter:
              roller_vaclav Vaclav Pech
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: