From cbe62f076df87ea4aadc780a74a50d06cb91e205 Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Fri, 9 Jun 2017 13:54:10 +0300 Subject: [PATCH] Drop JavaTypeAttributes::isMarkedNotNull property The only cases this code runs are annotation parameters and supertypes that are already not-nullable by default --- .../kotlin/load/java/lazy/types/JavaTypeResolver.kt | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/types/JavaTypeResolver.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/types/JavaTypeResolver.kt index a6a973f81a6..ff82b526e56 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/types/JavaTypeResolver.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/types/JavaTypeResolver.kt @@ -22,8 +22,6 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations import org.jetbrains.kotlin.descriptors.annotations.CompositeAnnotations import org.jetbrains.kotlin.descriptors.annotations.FilteredAnnotations import org.jetbrains.kotlin.load.java.ANNOTATIONS_COPIED_TO_TYPES -import org.jetbrains.kotlin.load.java.JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION -import org.jetbrains.kotlin.load.java.JvmAnnotationNames.JETBRAINS_NULLABLE_ANNOTATION import org.jetbrains.kotlin.load.java.components.TypeUsage import org.jetbrains.kotlin.load.java.components.TypeUsage.COMMON import org.jetbrains.kotlin.load.java.components.TypeUsage.SUPERTYPE @@ -267,7 +265,7 @@ class JavaTypeResolver( if (flexibility == FLEXIBLE_LOWER_BOUND) return false if (flexibility == FLEXIBLE_UPPER_BOUND) return true - return !isMarkedNotNull && !isForAnnotationParameter && howThisTypeIsUsed != SUPERTYPE + return !isForAnnotationParameter && howThisTypeIsUsed != SUPERTYPE } } @@ -283,7 +281,6 @@ internal fun makeStarProjection( interface JavaTypeAttributes { val howThisTypeIsUsed: TypeUsage - val isMarkedNotNull: Boolean val flexibility: JavaTypeFlexibility get() = INFLEXIBLE val typeAnnotations: Annotations @@ -314,18 +311,13 @@ class LazyJavaTypeAttributes( override val isForAnnotationParameter: Boolean = false ): JavaTypeAttributes { override val typeAnnotations = FilteredAnnotations(annotations) { it in ANNOTATIONS_COPIED_TO_TYPES } - override val isMarkedNotNull: Boolean get() = typeAnnotations.isMarkedNotNull() } -fun Annotations.isMarkedNotNull() = findAnnotation(JETBRAINS_NOT_NULL_ANNOTATION) != null -fun Annotations.isMarkedNullable() = findAnnotation(JETBRAINS_NULLABLE_ANNOTATION) != null - fun TypeUsage.toAttributes( isForAnnotationParameter: Boolean = false, upperBoundForTypeParameter: TypeParameterDescriptor? = null ) = object : JavaTypeAttributes { override val howThisTypeIsUsed: TypeUsage = this@toAttributes - override val isMarkedNotNull: Boolean = false override val typeAnnotations: Annotations = Annotations.EMPTY