private static @NotNull ThreeState isReferenceToAnnotation(final @NotNull PsiElement psiElement) {
    if (psiElement.getLanguage() == JavaLanguage.INSTANCE && !PsiUtil.isAvailable(JavaFeature.ANNOTATIONS, 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;
  }
private static @NotNull ThreeState isReferenceToAnnotation(final @NotNull PsiElement psiElement)