Hello again! how do you get a
KClass
out from an annotation argument?
Given the annotation:
@Retention(AnnotationRetention.SOURCE)
@Target(AnnotationTarget.PROPERTY)
annotation class Reference(val table: KClass<out Table>, val columnName: String)
// usage
@Reference(MyTable::class, "id")
I am trying to preocess it with:
val reference = kSPropertyDeclaration.getAnnotationsByType(Reference::class).first()
But when i access
reference.table
it errors with:
[ksp] com.google.devtools.ksp.KSTypeNotPresentException: java.lang.ClassNotFoundException: com.github.lamba92.ktor.restrepositories.tests.Cities
at com.google.devtools.ksp.UtilsKt.asClass(utils.kt:509)
at com.google.devtools.ksp.UtilsKt.createInvocationHandler$lambda$8(utils.kt:385)
at jdk.proxy5/jdk.proxy5.$Proxy29.table(Unknown Source)
I believe the returned class has some kind of lazy behaviour because it errors only when accessing
table
, but it is kinda weird.
Also,
com.github.lamba92.ktor.restrepositories.tests.Cities
is one of the source files.