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

Dynamic dispatch fails to recognize updates in the meta-class

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.1, 2.1.2
    • 2.2.2
    • groovy-runtime
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: