Hi Jochen
> $getStaticMetaClass can I think not be put in an interface. It needs
> static information about the exact class this method is in and there is
> supposed to be one for each Groovy class we create...
While I investigated the implementation of the instance method
`$getStaticMetaClass`, I found It seems that `$getStaticMetaClass` can also
be put in an interface too, because we can get static information via
reflection( e.g. `this.getClass().getField("$staticClassInfo")` ) ;-)
```
protected synthetic $getStaticMetaClass()Lgroovy/lang/MetaClass;
ALOAD 0
INVOKEVIRTUAL java/lang/Object.getClass ()Ljava/lang/Class;
LDC LTest1;.class
IF_ACMPEQ L0
ALOAD 0
INVOKESTATIC
org/codehaus/groovy/runtime/ScriptBytecodeAdapter.initMetaClass
(Ljava/lang/Object;)Lgroovy/lang/MetaClass;
ARETURN
L0
FRAME SAME
GETSTATIC Test1.$staticClassInfo :
Lorg/codehaus/groovy/reflection/ClassInfo;
ASTORE 1
ALOAD 1
IFNONNULL L1
ALOAD 0
INVOKEVIRTUAL java/lang/Object.getClass ()Ljava/lang/Class;
INVOKESTATIC org/codehaus/groovy/reflection/ClassInfo.getClassInfo
(Ljava/lang/Class;)Lorg/codehaus/groovy/reflection/ClassInfo;
DUP
ASTORE 1
PUTSTATIC Test1.$staticClassInfo :
Lorg/codehaus/groovy/reflection/ClassInfo;
L1
FRAME APPEND [org/codehaus/groovy/reflection/ClassInfo]
ALOAD 1
INVOKEVIRTUAL org/codehaus/groovy/reflection/ClassInfo.getMetaClass
()Lgroovy/lang/MetaClass;
ARETURN
MAXSTACK = 2
MAXLOCALS = 2
```
> I also intend to remove the meta
> class in the class itself and have it 100% managed outside. But that
> depends.
It will break many existing code. In addition, that will make Groovy less
object oriented IMHO, e.g. `groovyObj.foo()` VS
`InvokerHelper.invokeMethod(groovyObj, "foo", EMPTY_OBJECT_ARRAY)`, I prefer
the former...
Cheers,
Daniel.Sun
--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html