private static SQLRefReference getValidAnnoReference(
     final PsiAnnotation annotation, final Project project) {
   if (AnnoRefConfigSettings.getInstance(project)
       .getAnnoRefState()
       .ANNOREF_ANNOTATION_FQN
       .equals(annotation.getQualifiedName())) {
     String cleanedAnnoRef =
         SQLRefNamingUtil.cleanAnnoRefForName(annotation.getContainingFile(), annotation);
     if (cleanedAnnoRef != null) {
       SQLRefReference sqlRefReferenceForID =
           ServiceManager.getService(project, SQLRefRepository.class)
               .getSQLRefReferenceForID(cleanedAnnoRef);
       if (!sqlRefReferenceForID.getXmlQueryElements().isEmpty()) {
         return sqlRefReferenceForID;
       }
     }
   }
   return null;
 }