When I type
open interface I
the Kotlin compiler warns me that modifier 'open' is redundant for 'interface'
. This makes complete sense.
However, the reflection library seems to contradict this:
interface I
println(I::class.isOpen) // prints 'false'
How does this make sense? The KDoc of isOpen
is very brief:
true
if this class is open.
What exactly is the definition of "open" in Kotlin? I thought it meant "open to the possibility of being sub-typed by classes outside this file".
Aucun commentaire:
Enregistrer un commentaire