Skip to content

Commit da7b7ce

Browse files
committed
Kotlin: Remove some not-null-exprs
1 parent 51ada5c commit da7b7ce

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,9 +1474,21 @@ open class KotlinFileExtractor(
14741474
logger.warn("Cannot find functional interface type for raw method access")
14751475
null
14761476
} else {
1477-
val interfaceType = functionalInterface.classOrNull!!.owner
1478-
val substituted = getJavaEquivalentClass(interfaceType) ?: interfaceType
1479-
findFunction(substituted, OperatorNameConventions.INVOKE.asString())!!
1477+
val functionalInterfaceClass = functionalInterface.classOrNull
1478+
if (functionalInterfaceClass == null) {
1479+
logger.warn("Cannot find functional interface class for raw method access")
1480+
null
1481+
} else {
1482+
val interfaceType = functionalInterfaceClass.owner
1483+
val substituted = getJavaEquivalentClass(interfaceType) ?: interfaceType
1484+
val function = findFunction(substituted, OperatorNameConventions.INVOKE.asString())
1485+
if (function == null) {
1486+
logger.warn("Cannot find invoke function for raw method access")
1487+
null
1488+
} else {
1489+
function
1490+
}
1491+
}
14801492
}
14811493
} else {
14821494
callTarget

0 commit comments

Comments
 (0)