Is open modifier needed for accessing properties in super class?


I'm having an abstract class Input extending abstract class EmptyElement which extends abstract class Element. They all reside in the same package.

public abstract class Input(val type: String?, var value: String? = null, id: String? = null) :
        EmptyElement(name = "input", id = id) {

  val htmlInputElement: HTMLInputElement = super.htmlElement as HTMLInputElement;

  init {
  this.htmlElement.setAttribute(“type”, type);
  if ( value != null ) {
           this.htmlInputElement.value = value!!

However the call above fails:


Unless I’ve declared property htmlElement of class Element “open”:

public abstract class Element (name: String?,
                               cssClass: String? = null,
                               id: String? = null,
                               htmlElement: HTMLElement? = null) {

  open val htmlElement: HTMLElement = htmlElement ?: document.createElement(name) as HTMLElement;

<pre><span >...</code></pre>

Empty/uploads/kotlinlang/original/1X/ (299 Bytes) (504 Bytes)


i'm using version "0.1-SNAPSHOT"


I can't reproduce it.

Could you please provide full project or simplified project?



I reproduced the problem, and I'll create issue about it soon.

Let us know if you need help to workaround it.



Thanks. I guess the workaround is to keep it open.


I created issue KT-7653. Feel free to vote or star it to get updates.