Skip to content

Commit e1a153a

Browse files
authored
Merge pull request #10282 from igfoo/igfoo/extendsAdditionAllowed
Kotlin: Remove a cast in extendsAdditionAllowed
2 parents 43a553d + 0ee72a5 commit e1a153a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -921,10 +921,17 @@ open class KotlinUsesExtractor(
921921
}
922922

923923
private fun extendsAdditionAllowed(t: IrType) =
924-
if (t.isBoxedArray)
925-
arrayExtendsAdditionAllowed(t as IrSimpleType)
926-
else
924+
if (t.isBoxedArray) {
925+
if (t is IrSimpleType) {
926+
arrayExtendsAdditionAllowed(t)
927+
} else {
928+
logger.warn("Boxed array of unexpected kind ${t.javaClass}")
929+
// Return false, for no particular reason
930+
false
931+
}
932+
} else {
927933
((t as? IrSimpleType)?.classOrNull?.owner?.isFinalClass) != true
934+
}
928935

929936
private fun wildcardAdditionAllowed(v: Variance, t: IrType, addByDefault: Boolean) =
930937
when {

0 commit comments

Comments
 (0)