public static void ensureValid(@NotNull PsiElement element) {
    if (!element.isValid()) {
      if (ourSleepDuringValidityCheck) {
        TimeoutUtil.sleep(1); // to see if processing in another thread suddenly makes the element valid again (which is a bug)
        if (element.isValid()) {
          LOG.error("PSI resurrected: " + element + " of " + element.getClass());
          return;
        }
      }
      throw PluginException.createByClass(new PsiInvalidElementAccessException(element), element.getClass());
    }
  }
public static void ensureValid(@NotNull PsiElement element)