#1497 override with static field

vkuzkokov Tue 19 Apr 2011

Consider the following code:

mixin Parent
{
  abstract Str name()
  static Void main()
  {
    Parent v := Child()
    echo(v.name)
  }
}

class Child : Parent
{
  override static const Str name := "Child"
}

This compiles successfully and gives

sys::Err: java.lang.AbstractMethodError: fan.test_0.Child.name()Ljava/lang/String;
  test_0::Parent$.main (/C:/temp/test.fan:6)
  java.lang.reflect.Method.invoke (Unknown)
  fan.sys.Method.invoke (Method.java:552)
  fan.sys.Method$MethodFunc.callList (Method.java:198)
  fan.sys.Method.callList (Method.java:138)
  fanx.tools.Fan.callMain (Fan.java:135)
  fanx.tools.Fan.executeFile (Fan.java:88)
  fanx.tools.Fan.execute (Fan.java:34)
  fanx.tools.Fan.run (Fan.java:250)
  fanx.tools.Fan.main (Fan.java:288)

on attempt to run.

brian Tue 19 Apr 2011

Promoted to ticket #1497 and assigned to brian

that's definitely a bug

brian Fri 27 May 2011

Ticket resolved in 1.0.59

Login or Signup to reply.