What's the correct way to instantiate a class usin...
# announcements
What's the correct way to instantiate a class using the reflections (KClass) with primary constructor? Assuming we know the type and number of parameters.
Using the constructors:
Copy code
Copy code
Exception in thread "main" kotlin.jvm.KotlinReflectionNotSupportedError: Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath
Following error occurs, do we need to add dependency to the kotlin-reflect for this? Is there any other way, in the standard libarary itself.
If you want to use reflection, you need the code for it. I don't think there is another way.
Though I found,
actually gives primary constructor reference, so it works ­čśŤ