[SLC] AnnotationsProvider: replace isTheSameAs with regular equals
^KT-56046
This commit is contained in:
committed by
Space Team
parent
cce933907f
commit
cf713d31ef
-1
@@ -13,6 +13,5 @@ internal sealed interface AnnotationsProvider {
|
||||
fun annotationInfos(): List<KtAnnotationApplicationInfo>
|
||||
operator fun get(classId: ClassId): Collection<KtAnnotationApplicationWithArgumentsInfo>
|
||||
operator fun contains(classId: ClassId): Boolean
|
||||
fun isTheSameAs(other: Any?): Boolean
|
||||
fun ownerClassId(): ClassId?
|
||||
}
|
||||
|
||||
+4
-5
@@ -26,12 +26,11 @@ internal class CompositeAnnotationsProvider(val providers: Collection<Annotation
|
||||
|
||||
override fun contains(classId: ClassId): Boolean = providers.any { classId in it }
|
||||
|
||||
override fun isTheSameAs(other: Any?): Boolean = other === this ||
|
||||
override fun equals(other: Any?): Boolean = other === this ||
|
||||
other is CompositeAnnotationsProvider &&
|
||||
other.providers.size == providers.size &&
|
||||
other.providers.zip(providers).all { (another, myProvider) ->
|
||||
myProvider.isTheSameAs(another)
|
||||
}
|
||||
other.providers == providers
|
||||
|
||||
override fun hashCode(): Int = providers.hashCode()
|
||||
|
||||
override fun ownerClassId(): ClassId? = null
|
||||
}
|
||||
|
||||
-1
@@ -13,6 +13,5 @@ internal object EmptyAnnotationsProvider : AnnotationsProvider {
|
||||
override fun annotationInfos(): List<KtAnnotationApplicationInfo> = emptyList()
|
||||
override fun get(classId: ClassId): Collection<KtAnnotationApplicationWithArgumentsInfo> = emptyList()
|
||||
override fun contains(classId: ClassId): Boolean = false
|
||||
override fun isTheSameAs(other: Any?): Boolean = this === other
|
||||
override fun ownerClassId(): ClassId? = null
|
||||
}
|
||||
|
||||
+3
-1
@@ -36,12 +36,14 @@ internal class SymbolAnnotationsProvider<T : KtAnnotatedSymbol>(
|
||||
annotatedSymbol.hasAnnotation(classId, annotationUseSiteTargetFilter)
|
||||
}
|
||||
|
||||
override fun isTheSameAs(other: Any?): Boolean = other === this ||
|
||||
override fun equals(other: Any?): Boolean = other === this ||
|
||||
other is SymbolAnnotationsProvider<*> &&
|
||||
other.ktModule == ktModule &&
|
||||
other.annotationUseSiteTargetFilter == annotationUseSiteTargetFilter &&
|
||||
annotatedSymbolPointer.pointsToTheSameSymbolAs(other.annotatedSymbolPointer)
|
||||
|
||||
override fun hashCode(): Int = annotatedSymbolPointer.hashCode()
|
||||
|
||||
override fun ownerClassId(): ClassId? = withAnnotatedSymbol { annotatedSymbol ->
|
||||
(annotatedSymbol as? KtClassLikeSymbol)?.classIdIfNonLocal
|
||||
}
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ internal class SymbolLightLazyAnnotation(
|
||||
other.annotationApplication.index == annotationApplication.index &&
|
||||
other.annotationApplication.useSiteTarget == annotationApplication.useSiteTarget &&
|
||||
other.annotationApplication.isCallWithArguments == annotationApplication.isCallWithArguments &&
|
||||
annotationsProvider.isTheSameAs(other.annotationsProvider) &&
|
||||
other.annotationsProvider == annotationsProvider &&
|
||||
other.parent == parent
|
||||
|
||||
override fun hashCode(): Int = fqName.hashCode()
|
||||
|
||||
Reference in New Issue
Block a user