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

Indy ignores custom invoker in meta class

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4.4
    • Component/s: groovy-runtime
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: