ClassInfo does not contain required information
Monkey Forums/Monkey Programming/ClassInfo does not contain required information
| ||
Hi! This code: [monkeycode] #REFLECTION_FILTER="reflectiontest*" Import reflection Class Test Field classInfo:ClassInfo Method New() classInfo = reflection.GetClass(Self) End Method Update() End Method Draw() End Method GetClass:ClassInfo() Return classInfo End Method End Function Attribs$( attrs ) Local t$ If attrs & ATTRIBUTE_EXTERN t+=" Extern" If attrs & ATTRIBUTE_PRIVATE t+=" Private" If attrs & ATTRIBUTE_ABSTRACT t+=" Abstract" If attrs & ATTRIBUTE_FINAL t+=" Final" If attrs & ATTRIBUTE_INTERFACE t+=" Interface" Return t End Function Ret$( t:ClassInfo ) If t Return ":"+t.Name Return ":Void" End Function Args$( t:ClassInfo[] ) Local p:="" For Local c:=Eachin t If p p+="," p+=c.Name Next Return "("+p+")" End Function Main() Local cinfo:= GetClass("Test") Local exts$ If cinfo.SuperClass exts+=" Extends "+cinfo.SuperClass.Name Print "Class "+cinfo.Name+Attribs( cinfo.Attributes() )+exts For Local info:=Eachin cinfo.GetConstructors() Print " Method New"+Args( info.ParameterTypes )+Attribs( info.Attributes() ) Next For Local info:=Eachin cinfo.GetConsts( False ) Print " Const "+info.Name+Ret( info.Type )+Attribs( info.Attributes() ) Next For Local info:=Eachin cinfo.GetGlobals( False ) Print " Global "+info.Name+Ret( info.Type )+Attribs( info.Attributes() ) Next For Local info:=Eachin cinfo.GetFields( False ) Print " Field "+info.Name+Ret( info.Type )+Attribs( info.Attributes() ) Next For Local info:=Eachin cinfo.GetMethods( False ) Print " Method "+info.Name+Ret( info.ReturnType )+Args( info.ParameterTypes )+Attribs( info.Attributes() ) Next For Local info:=Eachin cinfo.GetFunctions( False ) Print " Method "+info.Name+Ret( info.ReturnType )+Args( info.ParameterTypes )+Attribs( info.Attributes() ) Next Print "End Class" End [/monkeycode] Outputs the following: Class reflectiontest.Test Extends monkey.lang.Object Method New() Method Update:monkey.boxes.IntObject() Method Draw:monkey.boxes.IntObject() End Class There is no information about classInfo field and GetClass method. I've checked different versions and realized that ClassInfo never contains information about consts, globals, fields, methods and functions, which extend or return ClassInfo ConstInfo FieldInfo FunctionInfo GlobalInfo MethodInfo. Is this a bug or a feature of the reflection module? Thanks! |