Tested with 2.0.0-RC1-1.0.20
Given an annotation like so:
annotation class Example(
val someClass: KClass<*> = String::class,
val someClasses: Array<KClass<*>> = [String::class],
)
@Example
class SomeAnnotatedClass
When reading the annotation instance off of SomeAnnotatedClass in a processor, the String::class types are always error types. I discovered this while preparing KotlinPoet for K2, with a repro available in this PR in the TestProcessorTest.removeDefaultValues test. If you breakpoint the isDefaultValue() check in KSAnnotation.toAnnotationSpec(), you can verify this behavior.
I've also confirmed this happens even if you add an explicit kotlin.String import. This also is the case for the String::class inside an array, which similarly resolves to an error type.

Tested with 2.0.0-RC1-1.0.20
Given an annotation like so:
When reading the annotation instance off of
SomeAnnotatedClassin a processor, theString::classtypes are always error types. I discovered this while preparing KotlinPoet for K2, with a repro available in this PR in theTestProcessorTest.removeDefaultValuestest. If you breakpoint theisDefaultValue()check inKSAnnotation.toAnnotationSpec(), you can verify this behavior.I've also confirmed this happens even if you add an explicit
kotlin.Stringimport. This also is the case for theString::classinside an array, which similarly resolves to an error type.