[Analysis API] rename KtAnnotationsList.containsAnnotation -> hasAnnotation

This commit is contained in:
Ilya Kirillov
2022-09-13 18:18:03 +02:00
parent 1bdde25dc7
commit 7d47651353
6 changed files with 12 additions and 12 deletions
@@ -37,7 +37,7 @@ internal class KtFe10AnnotationsList private constructor(
}
}
override fun containsAnnotation(classId: ClassId): Boolean = withValidityAssertion {
override fun hasAnnotation(classId: ClassId): Boolean = withValidityAssertion {
return fe10Annotations.hasAnnotation(classId.asSingleFqName())
}
@@ -29,7 +29,7 @@ internal class KtFirAnnotationListForDeclaration private constructor(
}
override fun containsAnnotation(classId: ClassId): Boolean = withValidityAssertion {
override fun hasAnnotation(classId: ClassId): Boolean = withValidityAssertion {
firSymbol.resolvedAnnotationClassIds.contains(classId)
}
@@ -25,7 +25,7 @@ internal class KtFirAnnotationListForType private constructor(
get() = withValidityAssertion { coneType.customAnnotations.map { it.toKtAnnotationApplication(useSiteSession) } }
override fun containsAnnotation(classId: ClassId): Boolean = withValidityAssertion {
override fun hasAnnotation(classId: ClassId): Boolean = withValidityAssertion {
coneType.customAnnotations.any { it.fullyExpandedClassId(useSiteSession) == classId }
}
@@ -15,7 +15,7 @@ class KtEmptyAnnotationsList(override val token: KtLifetimeToken) : KtAnnotation
override val annotations: List<KtAnnotationApplication>
get() = withValidityAssertion { emptyList() }
override fun containsAnnotation(classId: ClassId): Boolean = withValidityAssertion { false }
override fun hasAnnotation(classId: ClassId): Boolean = withValidityAssertion { false }
override fun annotationsByClassId(classId: ClassId): List<KtAnnotationApplication> =
withValidityAssertion { emptyList() }
@@ -23,12 +23,12 @@ public val KtAnnotated.annotations: List<KtAnnotationApplication>
get() = annotationsList.annotations
/**
* Checks if entity contains annotation with specified [classId].
* Checks if entity has annotation with specified [classId].
*
* @see [KtAnnotationsList.containsAnnotation]
* @see [KtAnnotationsList.hasAnnotation]
*/
public fun KtAnnotated.containsAnnotation(classId: ClassId): Boolean =
annotationsList.containsAnnotation(classId)
public fun KtAnnotated.hasAnnotation(classId: ClassId): Boolean =
annotationsList.hasAnnotation(classId)
/**
* A list of annotations applied with specified [classId].
@@ -17,7 +17,7 @@ public abstract class KtAnnotationsList : KtLifetimeOwner {
/**
* A list of annotations applied.
*
* To check if annotation is present, please use [containsAnnotation].
* To check if annotation is present, please use [hasAnnotation].
*
* @see KtAnnotationApplication
*/
@@ -31,12 +31,12 @@ public abstract class KtAnnotationsList : KtLifetimeOwner {
* annotationsList.containsAnnotation(classId) == annotationsList.annotations.any { it.classId == classId }
* ```
*/
public abstract fun containsAnnotation(classId: ClassId): Boolean
public abstract fun hasAnnotation(classId: ClassId): Boolean
/**
* A list of annotations applied with specified [classId].
*
* To check if annotation is present, please use [containsAnnotation].
* To check if annotation is present, please use [hasAnnotation].
*
* The semantic is equivalent to
* ```
@@ -50,7 +50,7 @@ public abstract class KtAnnotationsList : KtLifetimeOwner {
/**
* A list of annotations [ClassId].
*
* To check if annotation is present, please use [containsAnnotation].
* To check if annotation is present, please use [hasAnnotation].
*
* The semantic is equivalent to
* ```