Skip to content

Commit d4517f1

Browse files
committed
Kotlin: Refactor away a NotNullExpr in the extractor
1 parent 40334a2 commit d4517f1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,15 +440,20 @@ open class KotlinUsesExtractor(
440440
return null
441441
}
442442

443+
val fqName = c.fqNameWhenAvailable
444+
if (fqName == null) {
445+
return null
446+
}
447+
443448
fun tryGetPair(arity: Int): Pair<IrClass, List<IrTypeArgument>?>? {
444-
val replaced = pluginContext.referenceClass(c.fqNameWhenAvailable!!)?.owner ?: return null
449+
val replaced = pluginContext.referenceClass(fqName)?.owner ?: return null
445450
return Pair(replaced, List(arity) { makeTypeProjection(pluginContext.irBuiltIns.anyNType, Variance.INVARIANT) })
446451
}
447452

448453
// The list of types handled here match https://github.com/JetBrains/kotlin/blob/d7c7d1efd2c0983c13b175e9e4b1cda979521159/plugins/parcelize/parcelize-compiler/src/org/jetbrains/kotlin/parcelize/ir/AndroidSymbols.kt
449454
// Specifically, types are added for generic types created in AndroidSymbols.kt.
450455
// This replacement is from a raw type to its matching parameterized type with `Object` type arguments.
451-
return when (c.fqNameWhenAvailable?.asString()) {
456+
return when (fqName.asString()) {
452457
"java.util.ArrayList" -> tryGetPair(1)
453458
"java.util.LinkedHashMap" -> tryGetPair(2)
454459
"java.util.LinkedHashSet" -> tryGetPair(1)

0 commit comments

Comments
 (0)