If I define a file named Foo.kt which contains:
fun bar() {}
kotlinc will produce a file FooKt.class
if I execute the following code:
Class.forName("FooKt").kotlin.functions
I get the following exception:
Exception in thread "main" kotlin.reflect.KotlinReflectionInternalError: Class not resolved: class FooKt
the call to functions
is causing the exception.
Looking at the KClassImpl code it looks like the descriptor is not getting initialized, but I don’t know enough about the internal workings for a fix. Is there a way to introspect these classes using Kotlin’s reflections?