FIR: Load final static constant Java fields as non-nullable
This commit is contained in:
committed by
teamcityserver
parent
dba04bcf80
commit
46217318c0
+12
-1
@@ -112,7 +112,18 @@ class FirSignatureEnhancement(
|
||||
}
|
||||
is FirField -> {
|
||||
if (firElement.returnTypeRef !is FirJavaTypeRef) return original
|
||||
val newReturnTypeRef = enhanceReturnType(firElement, emptyList(), firElement.computeDefaultQualifiers(), null)
|
||||
val newReturnTypeRef = enhanceReturnType(
|
||||
firElement, emptyList(), firElement.computeDefaultQualifiers(),
|
||||
predefinedEnhancementInfo = null
|
||||
).let {
|
||||
val lowerBound = it.type.lowerBoundIfFlexible()
|
||||
|
||||
if (firElement.isStatic && firElement.initializer != null && (lowerBound.isString || lowerBound.isInt)) {
|
||||
it.withReplacedConeType(it.type.withNullability(ConeNullability.NOT_NULL, session.typeContext))
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}
|
||||
|
||||
val symbol = FirFieldSymbol(original.callableId)
|
||||
buildJavaField {
|
||||
|
||||
Reference in New Issue
Block a user