https://kotlinlang.org logo
#feed
Title
# feed
a

Alex Vanyo

11/03/2020, 12:22 AM
Just published https://medium.com/livefront/sealed-enum-replacing-enums-in-kotlin-4c513e7e8db, the introduction article for https://github.com/livefront/sealed-enum! It’s a runtime library and annotation processor that allows sealed classes of objects to completely replace normal enum classes, allowing for enumerations with base classes, generics, and hierarchies.
👏🏾 5
t

Tomasz Krakowiak

11/03/2020, 6:06 PM
Too bad it's annotation processor and not compiler plugin. So only jvm is supported.
👍 1
a

Alex Vanyo

11/03/2020, 6:15 PM
It started out internally as an annotation processor for Android projects, so the JVM limitation wasn’t an issue, but I’m definitely interested in the possibility of making it multiplatform. A #ksp version is currently in the works and available experimentally (https://github.com/livefront/sealed-enum/pull/32), which could lead to multiplatform support. A compiler plugin would also open up the possibility for a more integrated API by rewriting code (making the sealed class directly implement
Comparable
, making the
companion object
implement
SealedEnum
, etc.)
5 Views