Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
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.