mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-03 23:29:46 +00:00
fix of kspCommonMainKotlinMetadata call
This commit is contained in:
@@ -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 ->
|
||||
|
@@ -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(
|
||||
|
Reference in New Issue
Block a user