Hello everyone I'm having trouble figuring out an ...
# reflect
m
Hello everyone I'm having trouble figuring out an unresolved reference I'm fairly certain i've used those imports before
Copy code
import kotlin.reflect.full.findAnnotation
 import kotlin.reflect.full.primaryConstructor
but now all I'm getting is Unresolved reference: full although
Copy code
import kotlin.reflect.KClass
seems to work perfectly fine.
not sure what im missing to be honest, but any assistance would be highly appreciated This is happening in my JVM module, and it works fine in my androidMain. I have the dependency set to both. P.S Koltin 2.0.20 Reflect 2.0.20
e
you need the kotlin-reflect library dependency, e.g.
Copy code
dependencies {
    implementation(kotlin("reflect"))
}
as noted at the top of https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect.full/ and in more detail at https://kotlinlang.org/docs/reflection.html#jvm-dependency
that being said, kotlin-reflect does take a significant amount of time to load, so while I would consider it fine in batch or server processes where the initialization time is amortized over a long runtime, I wouldn't recommend using it in an Android app (for example)