Fix enhancement when mixing TYPE_USE and non-TYPE_USE annotations
This commit is contained in:
committed by
teamcityserver
parent
a5435c0efc
commit
9ac29e0714
+2
-1
@@ -36,6 +36,7 @@ abstract class AbstractSignatureParts<TAnnotation : Any> {
|
||||
abstract val KotlinTypeMarker.enhancedForWarnings: KotlinTypeMarker?
|
||||
abstract val KotlinTypeMarker.fqNameUnsafe: FqNameUnsafe?
|
||||
abstract fun KotlinTypeMarker.isEqual(other: KotlinTypeMarker): Boolean
|
||||
abstract fun KotlinTypeMarker.isArrayOrPrimitiveArray(): Boolean
|
||||
|
||||
abstract val TypeParameterMarker.isFromJava: Boolean
|
||||
|
||||
@@ -78,7 +79,7 @@ abstract class AbstractSignatureParts<TAnnotation : Any> {
|
||||
val typeParameterBounds = containerApplicabilityType == AnnotationQualifierApplicabilityType.TYPE_PARAMETER_BOUNDS
|
||||
val composedAnnotation = when {
|
||||
!isHeadTypeConstructor -> typeAnnotations
|
||||
!typeParameterBounds && enableImprovementsInStrictMode ->
|
||||
!typeParameterBounds && enableImprovementsInStrictMode && type?.isArrayOrPrimitiveArray() == true ->
|
||||
// We don't apply container type use annotations to avoid double applying them like with arrays:
|
||||
// @NotNull Integer [] f15();
|
||||
// Otherwise, in the example above we would apply `@NotNull` to `Integer` (i.e. array element; as TYPE_USE annotation)
|
||||
|
||||
+3
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.load.java.typeEnhancement
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotated
|
||||
@@ -258,6 +259,8 @@ private class SignatureParts(
|
||||
override fun KotlinTypeMarker.isEqual(other: KotlinTypeMarker): Boolean =
|
||||
containerContext.components.kotlinTypeChecker.equalTypes(this as KotlinType, other as KotlinType)
|
||||
|
||||
override fun KotlinTypeMarker.isArrayOrPrimitiveArray(): Boolean = KotlinBuiltIns.isArrayOrPrimitiveArray(this as KotlinType)
|
||||
|
||||
override val TypeParameterMarker.isFromJava: Boolean
|
||||
get() = this is LazyJavaTypeParameterDescriptor
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user