Inheritance chain like this is not allowed:
Public class
> Internal implementation
> Public interface
.
And gives compile time error: Subclass exposes its internal supertype
.
I just wonder how exactly it exposes? Internal implementation doesn’t have any new public methods, just those which are already exposed, so what exactly is exposed?
class Public : InternalImpl<Int>() {
override fun publicFun() {
super.publicFun()
}
}
internal open class InternalImpl<T> : PublicInterface<T> {
private fun privateFun() {
}
override fun publicFun() {
}
}
interface PublicInterface<T> {
fun publicFun()
}