File tree 1 file changed +6
-1
lines changed
lint/src/main/kotlin/kiwi/orbit/compose/lint/detectors
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import org.jetbrains.kotlin.psi.KtParameter
26
26
import org.jetbrains.kotlin.psi.KtSimpleNameExpression
27
27
import org.jetbrains.kotlin.psi.psiUtil.collectDescendantsOfType
28
28
import org.jetbrains.kotlin.psi.psiUtil.isAncestor
29
+ import org.jetbrains.kotlin.utils.addToStdlib.lastIndexOfOrNull
29
30
import org.jetbrains.uast.UCallExpression
30
31
import org.jetbrains.uast.ULambdaExpression
31
32
import org.jetbrains.uast.toUElement
@@ -36,7 +37,11 @@ internal fun PsiMethod.isInPackageName(packageName: String): Boolean {
36
37
}
37
38
38
39
internal fun PsiElement.getPackageName (): String? = when (this ) {
39
- is PsiMember -> this .containingClass?.qualifiedName?.let { it.substring(0 , it.lastIndexOf(" ." )) }
40
+ is PsiMember -> this .containingClass?.qualifiedName?.let {
41
+ it.lastIndexOfOrNull(' .' )?.let { endIndex ->
42
+ it.substring(0 , endIndex)
43
+ }
44
+ }
40
45
else -> null
41
46
}
42
47
You can’t perform that action at this time.
0 commit comments