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

Indy ignores custom invoker in meta class

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.4.4
    • groovy-runtime
    • None

    Description

      import groovy.xml.Entity
      
      class InterceptionThroughMetaClassTest extends GroovyTestCase {
          void testPOJOMetaClassInterception() {
              String invoking = 'ha'
              invoking.metaClass.invokeMethod = {String name, Object args ->
                  'invoked'
              }
              assert invoking.length() == 'invoked'
              assert invoking.someMethod() == 'invoked'
          }
          void testPOGOMetaClassInterception() {
              Entity entity = new Entity('Hello')
              entity.metaClass.invokeMethod = {String name, Object args ->
                  'invoked'
              }
              assert entity.build(new X()) == 'invoked'
              assert entity.someMethod() == 'invoked'
          }
      }
      
      class X {}

      This program is based on https://github.com/groovy/groovy-core/pull/651.

      The test works fine for normal Groovy but fails with indy, because indy ignores the custom invoker given through invokeMethod.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            blackdrag Jochen Theodorou
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: