From e55c82d3f38439b0507e1622818151ee5eff81b1 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 7 Oct 2016 18:07:22 +0200 Subject: [PATCH] don't try to resolve declaration to descriptor if we don't have any annotations --- .../elements/KtLightModifierListWithExplicitModifiers.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightModifierListWithExplicitModifiers.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightModifierListWithExplicitModifiers.kt index e4b74162880..756ab777396 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightModifierListWithExplicitModifiers.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightModifierListWithExplicitModifiers.kt @@ -93,6 +93,9 @@ class KtLightModifierList( internal fun computeAnnotations(lightElement: PsiModifierList, delegate: PsiAnnotationOwner): CachedValue> { fun doCompute(): Array { + val delegateAnnotations = delegate.annotations + if (delegateAnnotations.isEmpty()) return emptyArray() + val lightOwner = lightElement.parent as? KtLightElement<*, *> val declaration = lightOwner?.kotlinOrigin as? KtDeclaration if (declaration != null && !declaration.isValid) return PsiAnnotation.EMPTY_ARRAY @@ -105,8 +108,7 @@ internal fun computeAnnotations(lightElement: PsiModifierList, } val ktAnnotations = annotatedDescriptor?.annotations?.getAllAnnotations() ?: emptyList() var nextIndex = 0 - val result = delegate - .annotations + val result = delegateAnnotations .map { clsAnnotation -> val currentIndex = ktAnnotations.indexOfFirst(nextIndex) { it.annotation.type.constructor.declarationDescriptor?.fqNameUnsafe?.asString() == clsAnnotation.qualifiedName