ThreeState (final @NotNull PsiElement psiElement) { if (psiElement.getLanguage() == JavaLanguage.INSTANCE && !PsiUtil.isLanguageLevel5OrHigher(psiElement)) { return ThreeState.NO; } UElement uElement = UastContextKt.toUElement(psiElement); while (uElement != null) { if (uElement instanceof UAnnotation) { return ThreeState.YES; } if (uElement instanceof UImportStatement) { return ThreeState.UNSURE; } if (uElement instanceof UDeclaration || uElement instanceof UFile) { break; } uElement = uElement.getUastParent(); } return ThreeState.NO; }