diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt index b6a19d63bd9..2918e2bfaa4 100644 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt +++ b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt @@ -268,6 +268,11 @@ internal fun PsiElement.getMaybeLightElement(): PsiElement? { val lightElement = toLightElements().firstOrNull() if (lightElement != null) return lightElement + if (this is KtPrimaryConstructor) { + // annotations don't have constructors (but in Kotlin they do), so resolving to the class here + (this.parent as? KtClassOrObject)?.takeIf { it.isAnnotation() }?.toLightClass()?.let { return it } + } + when (val uElement = this.toUElement()) { is UDeclaration -> uElement.javaPsi is UDeclarationsExpression -> uElement.declarations.firstOrNull()?.javaPsi