Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8e5bbea

Browse files
committed
Use map...firstOrNull not firstNotNullOfOrNull
The latter was introduced in Kotlin 1.5, so we can't use it in all supported versions.
1 parent 2d98eb5 commit 8e5bbea

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ open class KotlinFileExtractor(
318318
// Extract the outer <-> inner class relationship, passing on any type arguments in excess to this class' parameters if this is an inner class.
319319
// For example, in `class Outer<T> { inner class Inner<S> { } }`, `Inner<Int, String>` nests within `Outer<Int>` and raw `Inner<>` within `Outer<>`,
320320
// but for a similar non-`inner` (in Java terms, static nested) class both `Inner<Int>` and `Inner<>` nest within the unbound type `Outer`.
321-
val useBoundOuterType = (c.isInner || c.isLocal) && (c.parents.firstNotNullOfOrNull {
321+
val useBoundOuterType = (c.isInner || c.isLocal) && (c.parents.map { // Would use `firstNotNullOfOrNull`, but this doesn't exist in Kotlin 1.4
322322
when(it) {
323323
is IrClass -> when {
324324
it.typeParameters.isNotEmpty() -> true // Type parameters visible to this class -- extract an enclosing bound or raw type.
@@ -327,7 +327,7 @@ open class KotlinFileExtractor(
327327
}
328328
else -> null // Look through enclosing non-class entities (this may need to change)
329329
}
330-
} ?: false)
330+
}.firstOrNull { it != null } ?: false)
331331

332332
extractEnclosingClass(c, id, locId, if (useBoundOuterType) argsIncludingOuterClasses?.drop(c.typeParameters.size) else listOf())
333333

0 commit comments

Comments
 (0)