I was surprised that static methods can be inherited,except primitive type.
fansh> Int.echo("Ad")
java.lang.VerifyError: (class: fan/sh1/FanshEval, method: _eval signature: ()Lja
va/lang/Object;) Unable to pop operand off an empty stack
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.lang.Class.getDeclaredFields(Unknown Source)
at fan.sys.ClassType.finishSlots(ClassType.java:562)
at fan.sys.ClassType.finish(ClassType.java:525)
at fan.sys.Method$MethodFunc.isStatic(Method.java:459)
at fan.sys.Method$MethodFunc.callList(Method.java:175)
at fan.sys.Type.make(Type.java:245)
at fan.sys.ClassType.make(ClassType.java:110)
at fan.fansh.Evaluator.eval(Evaluator.fan:111)
at fan.fansh.Shell.run(Shell.fan:46)
at fan.fansh.Main.main(Shell.fan:202)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at fan.sys.Method.invoke(Method.java:536)
at fan.sys.Method$MethodFunc.callList(Method.java:182)
at fan.sys.Method.callList(Method.java:147)
at fanx.tools.Fan.callMain(Fan.java:135)
at fanx.tools.Fan.executeType(Fan.java:102)
at fanx.tools.Fan.execute(Fan.java:38)
at fanx.tools.Fan.run(Fan.java:236)
at fanx.tools.Fan.main(Fan.java:274)
sys::Err: Method not mapped to java.lang.reflect correctly sh1::FanshEval.make
fan.sys.Method$MethodFunc.isStatic (Method.java:466)
fan.sys.Method$MethodFunc.callList (Method.java:175)
fan.sys.Type.make (Type.java:245)
fan.sys.ClassType.make (ClassType.java:110)
fansh::Evaluator.eval (Evaluator.fan:111)
fansh::Shell.run (Shell.fan:46)
fansh::Main.main (Shell.fan:202)
java.lang.reflect.Method.invoke (Unknown)
fan.sys.Method.invoke (Method.java:536)
fan.sys.Method$MethodFunc.callList (Method.java:182)
fan.sys.Method.callList (Method.java:147)
fanx.tools.Fan.callMain (Fan.java:135)
fanx.tools.Fan.executeType (Fan.java:102)
fanx.tools.Fan.execute (Fan.java:38)
fanx.tools.Fan.run (Fan.java:236)
fanx.tools.Fan.main (Fan.java:274)
I think,if static method can't be override,inherited is no help.
brianWed 29 Sep 2010
That was sort of a weird boundary condition with the compiler's logic to do boxing of value-types.
go4 Wed 29 Sep 2010
I was surprised that static methods can be inherited,except primitive type.
I think,if static method can't be override,inherited is no help.
brian Wed 29 Sep 2010
That was sort of a weird boundary condition with the compiler's logic to do boxing of value-types.
I pushed a fix: changeset
go4 Tue 5 Oct 2010
Have you considered that to do static method as virtual and to override it in subclass