Provide default implementation for Annotations.findExternalAnnotation
This commit is contained in:
+1
-3
@@ -36,8 +36,6 @@ class AnnotatedWithOnlyTargetedAnnotations(original: Annotated) : Annotated {
|
||||
|
||||
override fun findAnnotation(fqName: FqName) = null
|
||||
|
||||
override fun findExternalAnnotation(fqName: FqName) = null
|
||||
|
||||
override fun getUseSiteTargetedAnnotations() = getAdditionalTargetedAnnotations()
|
||||
|
||||
override fun getAllAnnotations() = getAdditionalTargetedAnnotations()
|
||||
@@ -48,4 +46,4 @@ class AnnotatedWithOnlyTargetedAnnotations(original: Annotated) : Annotated {
|
||||
}
|
||||
}
|
||||
|
||||
class AnnotatedSimple(annotations: Annotations) : AnnotatedImpl(annotations)
|
||||
class AnnotatedSimple(annotations: Annotations) : AnnotatedImpl(annotations)
|
||||
|
||||
@@ -78,8 +78,6 @@ class LazyAnnotations(
|
||||
return null
|
||||
}
|
||||
|
||||
override fun findExternalAnnotation(fqName: FqName) = null
|
||||
|
||||
override fun getUseSiteTargetedAnnotations(): List<AnnotationWithTarget> {
|
||||
return annotationEntries
|
||||
.mapNotNull {
|
||||
|
||||
-2
@@ -194,8 +194,6 @@ private class EnhancedTypeAnnotations(private val fqNameToMatch: FqName) : Annot
|
||||
else -> null
|
||||
}
|
||||
|
||||
override fun findExternalAnnotation(fqName: FqName) = null
|
||||
|
||||
override fun getAllAnnotations() = this.map { AnnotationWithTarget(it, null) }
|
||||
|
||||
override fun getUseSiteTargetedAnnotations() = emptyList<AnnotationWithTarget>()
|
||||
|
||||
@@ -32,7 +32,7 @@ interface Annotations : Iterable<AnnotationDescriptor> {
|
||||
|
||||
fun hasAnnotation(fqName: FqName) = findAnnotation(fqName) != null
|
||||
|
||||
fun findExternalAnnotation(fqName: FqName): AnnotationDescriptor?
|
||||
fun findExternalAnnotation(fqName: FqName): AnnotationDescriptor? = null
|
||||
|
||||
fun getUseSiteTargetedAnnotations(): List<AnnotationWithTarget>
|
||||
|
||||
@@ -45,8 +45,6 @@ interface Annotations : Iterable<AnnotationDescriptor> {
|
||||
|
||||
override fun findAnnotation(fqName: FqName) = null
|
||||
|
||||
override fun findExternalAnnotation(fqName: FqName) = null
|
||||
|
||||
override fun getUseSiteTargetedAnnotations() = emptyList<AnnotationWithTarget>()
|
||||
|
||||
override fun getAllAnnotations() = emptyList<AnnotationWithTarget>()
|
||||
|
||||
@@ -53,8 +53,6 @@ class AnnotationsImpl : Annotations {
|
||||
|
||||
override fun getAllAnnotations() = targetedAnnotations
|
||||
|
||||
override fun findExternalAnnotation(fqName: FqName) = null
|
||||
|
||||
override fun iterator() = annotations.iterator()
|
||||
|
||||
override fun toString() = annotations.toString()
|
||||
|
||||
@@ -66,8 +66,6 @@ private class AnnotationsWithOnly(val presentAnnotation: FqName): Annotations {
|
||||
|
||||
override fun findAnnotation(fqName: FqName): AnnotationDescriptor? = null
|
||||
|
||||
override fun findExternalAnnotation(fqName: FqName): AnnotationDescriptor? = null
|
||||
|
||||
override fun getUseSiteTargetedAnnotations(): List<AnnotationWithTarget> = emptyList()
|
||||
|
||||
override fun getAllAnnotations(): List<AnnotationWithTarget> = emptyList()
|
||||
|
||||
-4
@@ -36,8 +36,6 @@ class DeserializedAnnotations(
|
||||
override fun findAnnotation(fqName: FqName) =
|
||||
annotations.firstOrNull { annotation -> annotation.annotationClass?.fqNameUnsafe == fqName.toUnsafe() }
|
||||
|
||||
override fun findExternalAnnotation(fqName: FqName) = null
|
||||
|
||||
override fun getUseSiteTargetedAnnotations(): List<AnnotationWithTarget> = emptyList()
|
||||
|
||||
override fun getAllAnnotations(): List<AnnotationWithTarget> = annotations.map { AnnotationWithTarget(it, null) }
|
||||
@@ -58,8 +56,6 @@ class DeserializedAnnotationsWithPossibleTargets(
|
||||
target == null && annotation.annotationClass?.fqNameUnsafe == fqName.toUnsafe()
|
||||
}?.annotation
|
||||
|
||||
override fun findExternalAnnotation(fqName: FqName) = null
|
||||
|
||||
override fun getUseSiteTargetedAnnotations(): List<AnnotationWithTarget> = annotations.filter { it.target != null }
|
||||
|
||||
override fun getAllAnnotations(): List<AnnotationWithTarget> = annotations
|
||||
|
||||
Reference in New Issue
Block a user