Prefer flexible nullability by Java annotations to nullable one if the corresponding type parameter has nullable bound

^KT-47422 Fixed
This commit is contained in:
Victor Petukhov
2021-07-19 14:24:17 +03:00
committed by teamcityserver
parent 2c9857b880
commit 99491014e4
14 changed files with 306 additions and 18 deletions
@@ -398,6 +398,14 @@ class SignatureEnhancement(
}
val boundsFromTypeParameterForArgument = typeParameterForArgument?.boundsNullability() ?: return result
if (defaultTypeQualifier == null && result == null && boundsFromTypeParameterForArgument.qualifier == NullabilityQualifier.NULLABLE) {
return NullabilityQualifierWithMigrationStatus(
NullabilityQualifier.FORCE_FLEXIBILITY,
boundsFromTypeParameterForArgument.isForWarningOnly
)
}
if (result == null) return boundsFromTypeParameterForArgument
return mostSpecific(boundsFromTypeParameterForArgument, result)