Misc: Drop utilities for checking nullability/mutability annotations
Types annotated by them are already loaded as inflexible
This commit is contained in:
@@ -56,7 +56,7 @@ private fun KotlinType.approximateNonDynamicFlexibleTypes(
|
|||||||
// Foo<Bar!>! -> Foo<Bar>?
|
// Foo<Bar!>! -> Foo<Bar>?
|
||||||
var approximation =
|
var approximation =
|
||||||
if (isCollection)
|
if (isCollection)
|
||||||
(if (isAnnotatedReadOnly()) flexible.upperBound else flexible.lowerBound).makeNullableAsSpecified(!preferNotNull)
|
flexible.lowerBound.makeNullableAsSpecified(!preferNotNull)
|
||||||
else
|
else
|
||||||
if (this is RawType && preferStarForRaw) flexible.upperBound.makeNullableAsSpecified(!preferNotNull)
|
if (this is RawType && preferStarForRaw) flexible.upperBound.makeNullableAsSpecified(!preferNotNull)
|
||||||
else
|
else
|
||||||
@@ -84,10 +84,6 @@ private fun KotlinType.approximateNonDynamicFlexibleTypes(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun KotlinType.isAnnotatedReadOnly(): Boolean = hasAnnotationMaybeExternal(JETBRAINS_READONLY_ANNOTATION)
|
|
||||||
fun KotlinType.isAnnotatedNotNull(): Boolean = hasAnnotationMaybeExternal(JETBRAINS_NOT_NULL_ANNOTATION)
|
|
||||||
fun KotlinType.isAnnotatedNullable(): Boolean = hasAnnotationMaybeExternal(JETBRAINS_NULLABLE_ANNOTATION)
|
|
||||||
|
|
||||||
private fun KotlinType.hasAnnotationMaybeExternal(fqName: FqName) = with (annotations) {
|
private fun KotlinType.hasAnnotationMaybeExternal(fqName: FqName) = with (annotations) {
|
||||||
findAnnotation(fqName) ?: findExternalAnnotation(fqName)
|
findAnnotation(fqName) ?: findExternalAnnotation(fqName)
|
||||||
} != null
|
} != null
|
||||||
|
|||||||
Reference in New Issue
Block a user