Skip to content

Commit

Permalink
Fixed symbol processor
Browse files Browse the repository at this point in the history
  • Loading branch information
IVIanuu committed Feb 26, 2024
1 parent 7f3df31 commit 68d5b95
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,23 @@ class InjektSymbolProcessor(private val environment: SymbolProcessorEnvironment)
}

private fun KSTypeReference.typeHash(): String = buildString {
val visited = mutableSetOf<KSType>()
fun KSType.append() {
if (!visited.add(this)) return
annotations.forEach { it.annotationType.resolve().append() }
append(declaration.qualifiedName!!.asString())
arguments.forEach {
append(it.type?.typeHash())
append(it.variance)
append(declaration.qualifiedName?.asString())
arguments.forEach { argument ->
append(argument.type?.let { append(it) })
append(argument.variance)
}
append(isMarkedNullable)
}

resolve().append()
try {
resolve().append()
} catch (e: Throwable) {
throw IllegalStateException("Wtf ${resolve()}", e)
}
}

@AutoService(SymbolProcessorProvider::class)
Expand Down

0 comments on commit 68d5b95

Please sign in to comment.