I'm using Android Parcelable plugin from https://github.com/nekocode/android-parcelable-intellij-plugin-kotlin
I tried it on a class with this definition
class ChessClock : TextView {
lateinit var player:String
constructor(context: Context) : super(context)
constructor(context:Context, p:String, angle:Float) : this(context) {
player = p
rotation = angle
}
<snip>
}
and the definition was changed to
class ChessClock() : TextView, Parcelable {
lateinit var player:String
constructor(context: Context) : super(context)
constructor(context:Context, p:String, angle:Float) : this(context){
player = p
rotation = angle
}
<snip -- various stuff added here>
}
Two syntax errors were highlighted.
In the line
class ChessClock() : TextView, Parcelable
TextView
is underlined, with the comment "This type has a constructor, and must be initialized here."
In the line
constructor(context: Context) : super(context)
super
is underlined, with the comment "Primary constructor call expected."
I've only been using kotlin for a few weeks, and I don't understand what's going on here. First of all, I know (or at least I think I know) that kotlin doesn't implement multiple inheritance, so I don't understand what
class ChessClock() : TextView, Parcelable
means. Is this really legitimate kotlin? How can one make a derived class Parcelable in kotlin?