title: Kotlin: Child Constructor Passing Default Value to Parent
body: <p>Consider the following classes:</p>
  <pre><code>open class Parent(foo: Map&lt;a, b&gt;)
  
  class Child(foo: Map&lt;a, b&gt;): Parent(foo)
  </code></pre>
  <p>This seems to work here because the definition of <code>foo</code> are identical in both classes. However when I try to do</p>
  <pre><code>class Child(foo: Map&lt;a, b&gt;? = mapOf()): Parent(foo)
  </code></pre>
  <p>It no longer works because <code>foo</code> is defined as optional in the <code>Child</code> class.
  This is giving me issues because I'm trying to initialize the <code>Child</code> class in Java and obviously it wouldn't allow me to selectively pass in arguments like Kotlin, so I was wondering what I could do here to allow the Java caller to pass in a <code>null</code> to the <code>foo</code> field so the field gets auto-initialized to an empty map.</p>
  <p>Thanks</p>
  <p>EDIT: Would also appreciate if someone could explain why Kotlin wouldn't try to pass the default <code>foo</code> value in <code>Child</code> to <code>Parent</code>? We all know <code>foo</code> in <code>Child</code> would definitely be nonnull anyway.</p>