From a506dd5a366d0adebcb91409a7fcf882c063deb3 Mon Sep 17 00:00:00 2001 From: GeorgCantor Date: Sat, 9 Nov 2024 16:32:15 +0300 Subject: [PATCH] Update KSNameImpl.kt Using lastIndexOf --- .../com/google/devtools/ksp/common/impl/KSNameImpl.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common-util/src/main/kotlin/com/google/devtools/ksp/common/impl/KSNameImpl.kt b/common-util/src/main/kotlin/com/google/devtools/ksp/common/impl/KSNameImpl.kt index 0cbccba79d..c3475aa2a9 100644 --- a/common-util/src/main/kotlin/com/google/devtools/ksp/common/impl/KSNameImpl.kt +++ b/common-util/src/main/kotlin/com/google/devtools/ksp/common/impl/KSNameImpl.kt @@ -13,10 +13,12 @@ class KSNameImpl private constructor(val name: String) : KSName { } override fun getQualifier(): String { - return name.split(".").dropLast(1).joinToString(".") + val lastIndex = name.lastIndexOf('.') + return if (lastIndex != -1) name.substring(0, lastIndex) else "" } override fun getShortName(): String { - return name.split(".").last() + val lastIndex = name.lastIndexOf('.') + return if (lastIndex != -1) name.substring(lastIndex + 1) else name } }