FIR Java: make annotation parameters not-null
This commit is contained in:
@@ -143,20 +143,30 @@ private fun JavaArrayType.toConeKotlinTypeWithoutEnhancement(
|
|||||||
javaTypeParameterStack: JavaTypeParameterStack,
|
javaTypeParameterStack: JavaTypeParameterStack,
|
||||||
forAnnotationValueParameter: Boolean = false,
|
forAnnotationValueParameter: Boolean = false,
|
||||||
isForSupertypes: Boolean
|
isForSupertypes: Boolean
|
||||||
): ConeFlexibleType {
|
): ConeKotlinType {
|
||||||
val componentType = componentType
|
val componentType = componentType
|
||||||
return if (componentType !is JavaPrimitiveType) {
|
return if (componentType !is JavaPrimitiveType) {
|
||||||
val classId = StandardClassIds.Array
|
val classId = StandardClassIds.Array
|
||||||
val argumentType = componentType.toConeKotlinTypeWithoutEnhancement(session, javaTypeParameterStack, forAnnotationValueParameter, isForSupertypes)
|
val argumentType = componentType.toConeKotlinTypeWithoutEnhancement(
|
||||||
classId.toConeFlexibleType(
|
session, javaTypeParameterStack, forAnnotationValueParameter, isForSupertypes
|
||||||
arrayOf(argumentType),
|
|
||||||
typeArgumentsForUpper = arrayOf(ConeKotlinTypeProjectionOut(argumentType))
|
|
||||||
)
|
)
|
||||||
|
if (forAnnotationValueParameter) {
|
||||||
|
classId.constructClassLikeType(arrayOf(argumentType), isNullable = false)
|
||||||
|
} else {
|
||||||
|
classId.toConeFlexibleType(
|
||||||
|
arrayOf(argumentType),
|
||||||
|
typeArgumentsForUpper = arrayOf(ConeKotlinTypeProjectionOut(argumentType))
|
||||||
|
)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
val javaComponentName = componentType.type?.typeName?.asString()?.capitalize() ?: error("Array of voids")
|
val javaComponentName = componentType.type?.typeName?.asString()?.capitalize() ?: error("Array of voids")
|
||||||
val classId = StandardClassIds.byName(javaComponentName + "Array")
|
val classId = StandardClassIds.byName(javaComponentName + "Array")
|
||||||
|
|
||||||
classId.toConeFlexibleType(emptyArray())
|
if (forAnnotationValueParameter) {
|
||||||
|
classId.constructClassLikeType(emptyArray(), isNullable = false)
|
||||||
|
} else {
|
||||||
|
classId.toConeFlexibleType(emptyArray())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,6 +193,9 @@ private fun JavaClassifierType.toConeKotlinTypeWithoutEnhancement(
|
|||||||
isForSupertypes,
|
isForSupertypes,
|
||||||
forAnnotationValueParameter = forAnnotationValueParameter
|
forAnnotationValueParameter = forAnnotationValueParameter
|
||||||
)
|
)
|
||||||
|
if (forAnnotationValueParameter) {
|
||||||
|
return lowerBound
|
||||||
|
}
|
||||||
val upperBound =
|
val upperBound =
|
||||||
toConeKotlinTypeForFlexibleBound(
|
toConeKotlinTypeForFlexibleBound(
|
||||||
session,
|
session,
|
||||||
|
|||||||
Reference in New Issue
Block a user