Skip to content

Commit 2a2b939

Browse files
committed
Lint
1 parent f774467 commit 2a2b939

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,12 +1116,18 @@ open class KotlinUsesExtractor(
11161116
javaLangClass?.let { jlc ->
11171117
return jlc.symbol.typeWithArguments(t.arguments)
11181118
}
1119-
} else if (t.isArray() || t.isNullableArray()) {
1120-
val elementType = t.getArrayElementType(pluginContext.irBuiltIns)
1121-
val replacedElementType = kClassToJavaClass(elementType)
1122-
if (replacedElementType !== elementType) {
1123-
val newArg = makeTypeProjection(replacedElementType, (t.arguments[0] as IrTypeProjection).variance)
1124-
return t.classOrNull!!.typeWithArguments(listOf(newArg)).codeQlWithHasQuestionMark(t.isNullableArray())
1119+
} else {
1120+
t.classOrNull?.let { tCls ->
1121+
if (t.isArray() || t.isNullableArray()) {
1122+
(t.arguments.singleOrNull() as? IrTypeProjection)?.let { elementTypeArg ->
1123+
val elementType = elementTypeArg.type
1124+
val replacedElementType = kClassToJavaClass(elementType)
1125+
if (replacedElementType !== elementType) {
1126+
val newArg = makeTypeProjection(replacedElementType, elementTypeArg.variance)
1127+
return tCls.typeWithArguments(listOf(newArg)).codeQlWithHasQuestionMark(t.isNullableArray())
1128+
}
1129+
}
1130+
}
11251131
}
11261132
}
11271133
}
@@ -1134,7 +1140,7 @@ open class KotlinUsesExtractor(
11341140
isAnnotationClassProperty(it)
11351141
} ?: false
11361142

1137-
fun isAnnotationClassProperty(p: IrPropertySymbol) =
1143+
private fun isAnnotationClassProperty(p: IrPropertySymbol) =
11381144
p.owner.parentClassOrNull?.kind == ClassKind.ANNOTATION_CLASS
11391145

11401146
fun getAdjustedReturnType(f: IrFunction) : IrType {

0 commit comments

Comments
 (0)