...
There is a delegation scheme like
ScriptBytecodeAdapter.invokeMethod(...)(static method)InvokerHelper.invokeMethod(...)(static method)Invoker.invokeMethod(...)(instance method called on InvokerHelper's single instance)
MetaClass and MetaClassRegistry
...
Exceptions (when MetaClass.invokeMethod(...) is not used):
- for Closures,
Closure.invoke(...)is used - for GroovyObjects obj of type
GroovyInterceptable,obj.invokeMethod(methodName,asArray(arguments))is called - for any other
GroovyObjectobj when method invokation through its MetaClass fails,obj.invokeMethod(methodName,asArray(arguments))is called
MetaClass.invokeMethod(...) finally cares for the invokation, either by reflection or by dynamic bytecode generation. Dynamic bytecode generation is supposed to be faster. For a class MyClass it generates gjdk.groovy.lang.MyClass_GroovyReflector with an invoke method.
...