[FE 1.0] Support java sealed classes
^KT-46778 Fixed
This commit is contained in:
committed by
teamcityserver
parent
972211f8e6
commit
fa1d09c778
+17
@@ -0,0 +1,17 @@
|
||||
// WITH_REFLECT
|
||||
// FILE: Base.java
|
||||
public sealed class Base permits O, K {}
|
||||
|
||||
// FILE: O.java
|
||||
public final class O extends Base {}
|
||||
|
||||
// FILE: K.java
|
||||
public non-sealed class K extends Base {}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun box(): String {
|
||||
val clazz = Base::class.java
|
||||
if (!clazz.isSealed) return "Error: Base is not sealed"
|
||||
return clazz.permittedSubclasses.joinToString("") { it.simpleName ?: "_No name provided_" }
|
||||
}
|
||||
Reference in New Issue
Block a user