From 6a9317fc57d0e1ca21d4128a1819b060cfe472bd Mon Sep 17 00:00:00 2001 From: Alexey Sedunov Date: Tue, 28 Nov 2017 18:26:39 +0300 Subject: [PATCH] Misc: Drop utilities for checking nullability/mutability annotations Types annotated by them are already loaded as inflexible --- .../src/org/jetbrains/kotlin/idea/util/TypeUtils.kt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/idea/ide-common/src/org/jetbrains/kotlin/idea/util/TypeUtils.kt b/idea/ide-common/src/org/jetbrains/kotlin/idea/util/TypeUtils.kt index 1df1bc47208..f6a7e880bcc 100644 --- a/idea/ide-common/src/org/jetbrains/kotlin/idea/util/TypeUtils.kt +++ b/idea/ide-common/src/org/jetbrains/kotlin/idea/util/TypeUtils.kt @@ -56,7 +56,7 @@ private fun KotlinType.approximateNonDynamicFlexibleTypes( // Foo! -> Foo? var approximation = if (isCollection) - (if (isAnnotatedReadOnly()) flexible.upperBound else flexible.lowerBound).makeNullableAsSpecified(!preferNotNull) + flexible.lowerBound.makeNullableAsSpecified(!preferNotNull) else if (this is RawType && preferStarForRaw) flexible.upperBound.makeNullableAsSpecified(!preferNotNull) 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) { findAnnotation(fqName) ?: findExternalAnnotation(fqName) } != null