Can I create a totally new Kotlin (data) class type at run-time, dynamically ?
By this I mean that I want to create a totally new type dynamically, I am not asking about creating a new instance of a known type.
Basically I want to do at run-time what Kotlin compiler does at compile-time for serializable data classes.
Example of a serializable data class I want to create:
@Serializable data class MyData( val f1: String, val f2: Boolean)
The reason I wanted to do this is so that I can create these data classes which will be used to serialize and de-serialize to/from Json (using Kotlinx Json library).
Right now there is IDEA plug-in which does it statically inside editor IDE, i.e. generating boiler-plate code. This approach/plug-in works well but it is static in nature.
Having an option of creating new data class types at run-time may be even better (?).