private static boolean isValidOriginal(@NotNull PsiFile file) {
    PsiFile original = file.getOriginalFile();
    return original == file || original.isValid();
  }
private static boolean isValidOriginal(@NotNull PsiFile file)