Provide default implementation for Annotations.findExternalAnnotation

This commit is contained in:
Alexander Udalov
2017-07-04 13:28:42 +03:00
parent 5636318eb4
commit 9ee4b39e1b
7 changed files with 2 additions and 18 deletions
@@ -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 {
@@ -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()
@@ -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