fix of kspCommonMainKotlinMetadata call

This commit is contained in:
2025-07-11 16:39:08 +06:00
parent 57f009e8aa
commit fa45e7b696
2 changed files with 4 additions and 3 deletions

View File

@@ -238,7 +238,7 @@ class Processor(
""".trimIndent()
)
ksFile.getAnnotationsByType(GenerateKoinDefinition::class).forEach {
val type = it.type.safeClassName()
val type = safeClassName { it.type }
val targetType = runCatching {
type.parameterizedBy(*(it.typeArgs.takeIf { it.isNotEmpty() } ?.map { it.asTypeName() } ?.toTypedArray() ?: return@runCatching type))
}.getOrElse { e ->

View File

@@ -6,9 +6,10 @@ import com.squareup.kotlinpoet.ClassName
import com.squareup.kotlinpoet.asTypeName
import kotlin.reflect.KClass
@Suppress("NOTHING_TO_INLINE")
@OptIn(KspExperimental::class)
fun KClass<*>.safeClassName() = runCatching {
asTypeName()
inline fun safeClassName(classnameGetter: () -> KClass<*>) = runCatching {
classnameGetter().asTypeName()
}.getOrElse { e ->
if (e is KSTypeNotPresentException) {
ClassName(