mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-17 08:31:29 +00:00
* if enum class has abstract members, then it is ABSTRACT * otherwise, if enum class has entries with members, then it is OPEN * otherwise, it is FINAL.
47 lines
563 B
Kotlin
Vendored
47 lines
563 B
Kotlin
Vendored
enum class TestFinalEnum1 {
|
|
X1
|
|
}
|
|
|
|
enum class TestFinalEnum2(val x: Int) {
|
|
X1(1)
|
|
}
|
|
|
|
enum class TestFinalEnum3 {
|
|
X1
|
|
;
|
|
|
|
fun doStuff() {}
|
|
}
|
|
|
|
enum class TestOpenEnum1 {
|
|
X1 {
|
|
override fun toString() = "X1"
|
|
}
|
|
}
|
|
|
|
enum class TestOpenEnum2 {
|
|
X1 {
|
|
override fun foo() {}
|
|
};
|
|
|
|
open fun foo() {}
|
|
}
|
|
|
|
enum class TestAbstractEnum1 {
|
|
X1 {
|
|
override fun foo() {}
|
|
};
|
|
|
|
abstract fun foo()
|
|
}
|
|
|
|
interface IFoo {
|
|
fun foo()
|
|
}
|
|
|
|
enum class TestAbstractEnum2 : IFoo {
|
|
X1 {
|
|
override fun foo() {}
|
|
}
|
|
}
|