Generate values()/valueOf() even for empty enums

This commit is contained in:
Alexander Udalov
2013-10-16 20:13:12 +04:00
parent b4ecb36445
commit 5a1daaa4b6
3 changed files with 98 additions and 74 deletions
@@ -0,0 +1,13 @@
enum class Empty
fun box(): String {
if (Empty.values().size != 0) return "Fail: ${Empty.values()}"
try {
val found = Empty.valueOf("nonExistentEntry")
return "Fail: $found"
}
catch (e: Exception) {
return "OK"
}
}