#1212 overriding methods returning nullable java type

vkuzkokov Wed 15 Sep 2010

Following strange behavior has been encountered. We have pod1 with source

using [java] java.util

class A {
  virtual Random? sth() { null }
}

And pod2 with source

using [java] java.util
using pod1

class B : A {
  override Random? sth() { Random() }
}

Compiling second pod after first gives us:

/Users/vkuzkokov/tmp/pod2/fan/test.fan(5,3): Return type mismatch in override of
        'pod1::A.sth' - '[java]java.util::Random' != '[java]java.util::Random?'

If I change the second return type to non-nullable everything works.

brian Wed 15 Sep 2010

Promoted to ticket #1212 and assigned to brian

brian Wed 22 Sep 2010

Ticket resolved in 1.0.56

This was a problem in the Java runtime not reflecting nullable Java FFI types correctly when used as fields or methods.

changset

Login or Signup to reply.