From 21fc31e645a2ff6ef0c1d018a894f5c279e0668f Mon Sep 17 00:00:00 2001 From: Michael Rittmeister Date: Fri, 21 Jun 2024 17:18:55 +0200 Subject: [PATCH] Fix bug related causing ksp processor to fail when enums are used --- .../kotlin/generator/DataClassRepresentation.kt | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/ksp/processor/src/main/kotlin/generator/DataClassRepresentation.kt b/ksp/processor/src/main/kotlin/generator/DataClassRepresentation.kt index f8a95a1..3d87b5e 100644 --- a/ksp/processor/src/main/kotlin/generator/DataClassRepresentation.kt +++ b/ksp/processor/src/main/kotlin/generator/DataClassRepresentation.kt @@ -38,16 +38,12 @@ private fun KSTypeReference.dataClassType(rootType: KSClassDeclaration): TypeNam else -> { val declaration = resolvedType.declaration - if (declaration is KSClassDeclaration && declaration.classKind == ClassKind.ANNOTATION_CLASS) { - if (resolvedType.isMappedAnnotation(rootType) - || (resolvedType.declaration as? KSClassDeclaration)?.classKind == ClassKind.ENUM_CLASS - ) { - ClassName("", declaration.simpleName.asString()) - } else { - KSAnnotation::class.asClassName() - } + if (resolvedType.isMappedAnnotation(rootType) + || (resolvedType.declaration as? KSClassDeclaration)?.classKind == ClassKind.ENUM_CLASS + ) { + ClassName("", declaration.simpleName.asString()) } else { - error("Unexpected type: $this") + KSAnnotation::class.asClassName() } } }