Support external annotations in IDE when approximating flexible types

This commit is contained in:
Alexander Udalov
2015-04-13 17:25:52 +03:00
parent 2271ca1e81
commit 890d18e7be
7 changed files with 78 additions and 102 deletions
@@ -32,9 +32,14 @@ class LazyJavaAnnotations(
c.resolveAnnotation(annotation)
}
override fun findAnnotation(fqName: FqName) = annotationOwner.findAnnotation(fqName)?.let(annotationDescriptors)
override fun findAnnotation(fqName: FqName) =
annotationOwner.findAnnotation(fqName)?.let(annotationDescriptors)
override fun iterator() = annotationOwner.getAnnotations().sequence().map(annotationDescriptors).filterNotNull().iterator()
override fun findExternalAnnotation(fqName: FqName) =
c.externalAnnotationResolver.findExternalAnnotation(annotationOwner, fqName)?.let(annotationDescriptors)
override fun iterator() =
annotationOwner.getAnnotations().sequence().map(annotationDescriptors).filterNotNull().iterator()
override fun isEmpty() = !iterator().hasNext()
}
@@ -47,6 +52,10 @@ class FilteredAnnotations(
if (fqNameFilter(fqName)) delegate.findAnnotation(fqName)
else null
override fun findExternalAnnotation(fqName: FqName) =
if (fqNameFilter(fqName)) delegate.findExternalAnnotation(fqName)
else null
override fun iterator() = delegate.sequence()
.filter { annotation ->
val descriptor = annotation.getType().getConstructor().getDeclarationDescriptor()