I like to see the option to add internal methods to an internal interface.
example:
internal interface MyInterface{
internal fun myFun()
}
class Test : MyInterface{
override internal fun myFun() = Unit
}
I like to see the option to add internal methods to an internal interface.
example:
internal interface MyInterface{
internal fun myFun()
}
class Test : MyInterface{
override internal fun myFun() = Unit
}
Internal interface cannot expose public methods (interface itself is not public).
I updated my suggestion.
(the next time I try to be clear from the beginning)
The question here is can you inherit from an internal interface (what about classes) and should you? At the same time I have similar wishes (I’d like to have protected members in interfaces - with default methods you almost get multiple inheritance).
The minimum requirements to fullfill my use-case:
later on this can be expanded to:
followed by:
and, maybe later explore cross-module functions.
(I don’t know anything about the compiler side, so I just did it based upon restrictions)
Just dropping this for others who stumbled upon here looking for the same functionality.
This feature is tracked here: (vote if your looking for the same functionality)
Also, this comment about sealed interfaces in KT-22268:
An important addition to this request that had been recently realized is that
sealed interface
shall supportinternal
members. This would allow library API design and evolution without ugly hacks.