Don't apply Java defaulting nullability annotations rules to unbounded wildcards

^KT-47396 Fixed
This commit is contained in:
Victor Petukhov
2021-07-19 16:26:25 +03:00
committed by teamcityserver
parent 99491014e4
commit f9cb0d61a8
14 changed files with 69 additions and 13 deletions
@@ -358,7 +358,8 @@ class SignatureEnhancement(
?: computeNullabilityInfoInTheAbsenceOfExplicitAnnotation(
nullabilityFromBoundsForTypeBasedOnTypeParameter,
defaultTypeQualifier,
typeParameterForArgument
typeParameterForArgument,
isFromStarProjection
)
val isNotNullTypeParameter =
@@ -385,7 +386,8 @@ class SignatureEnhancement(
private fun computeNullabilityInfoInTheAbsenceOfExplicitAnnotation(
nullabilityFromBoundsForTypeBasedOnTypeParameter: NullabilityQualifierWithMigrationStatus?,
defaultTypeQualifier: JavaDefaultQualifiers?,
typeParameterForArgument: TypeParameterDescriptor?
typeParameterForArgument: TypeParameterDescriptor?,
isFromStarProjection: Boolean
): NullabilityQualifierWithMigrationStatus? {
val result =
@@ -406,7 +408,7 @@ class SignatureEnhancement(
)
}
if (result == null) return boundsFromTypeParameterForArgument
if (result == null || isFromStarProjection) return boundsFromTypeParameterForArgument
return mostSpecific(boundsFromTypeParameterForArgument, result)
}