https://kotlinlang.org logo
#ksp
Title
# ksp
t

Toshihiro Nakamura

03/09/2024, 2:11 AM
I am trying KSP2 with KSP 1.9.23-1.0.19. It seems that KSP2 cannot correctly obtain the KClass type elements of annotations. Suppose there is an annotation like this:
Copy code
annotation class MyAnnotation(val type: KClass<*> = String::class)
When retrieving the type element in SymbolProcessor, it returns a KSErrorType.
Copy code
val annotation = symbol.annotations.first { it.shortName.asString() == MyAnnotation::class.simpleName }
val type = annotation.arguments.first().value
env.logger.warn("type: $type") // type: <ERROR TYPE>
Is this a known issue?
z

Zac Sweers

03/09/2024, 1:41 PM
t

Toshihiro Nakamura

03/09/2024, 1:53 PM
Thank you for your response. I’m looking forward to seeing the revisions.