#2055 Unclear err msg in Type#method

Akcelisto Sat 10 Nov 2012

class MethodSlotTest{
  static Void main(){
    echo(A#.method("name"))
  }
}

class A{
  static const Str name := "A"
}

Output:

sys::CastErr: java.lang.ClassCastException: fan.sys.Field cannot be cast to fan.sys.Method
  fan.sys.Type.method (Type.java:230)
  fan.sys.Type.method (Type.java:229)
  rateResearch::MethodSlotTest.main (UnclearMsgInField.fan:3)
  java.lang.reflect.Method.invoke (Unknown)
  fan.sys.Method.invoke (Method.java:559)
  fan.sys.Method$MethodFunc.callList (Method.java:198)
  fan.sys.Method.callList (Method.java:138)
  fanx.tools.Fan.callMain (Fan.java:173)
  fanx.tools.Fan.executeType (Fan.java:140)
  fanx.tools.Fan.execute (Fan.java:41)
  fanx.tools.Fan.run (Fan.java:298)
  fanx.tools.Fan.main (Fan.java:336)

andy Sat 10 Nov 2012

fan.sys.Field cannot be cast to fan.sys.Method

A.name is a field - you need to use Type.field (or Type.slot)

Akcelisto Sat 10 Nov 2012

I know. I expect more clear err msg.

Login or Signup to reply.