I'm unable to use createInstance()
. For example, Foo::class.createInstance()
I have a gradle project using Kotlin 1.3.70 kotlin("jvm") version "1.3.70"
plugin. and have implementation(kotlin("stdlib-jdk8"))
and implementation(kotlin("reflect"))
in my dependencies.
Does anyone know why this function appears to be missing?
I have a function that receives a classType: KClass<Foo>
and I want to create a instance of Foo
using the noarg constructor.