private static void setOriginalFile(PsiFileImpl copy, PsiFile origin) {
    checkInjectionConsistency(copy);
    PsiFile currentOrigin = copy.getOriginalFile();
    if (currentOrigin == copy) {
      copy.setOriginalFile(origin);
    } else if (currentOrigin != origin) {

      PsiUtilCore.ensureValid(currentOrigin);
      checkInjectionConsistency(origin);
      checkInjectionConsistency(currentOrigin);

      PsiElement host = Objects.requireNonNull(currentOrigin.getContext());
      recoverFromBrokenInjection(host.getContainingFile());
      throw new AssertionError(
        currentOrigin + " != " + origin + "\n" +
        currentOrigin.getViewProvider() + " != " + origin.getViewProvider() + "\n" +
        "host of " + host.getClass());
    }
  }
private static void setOriginalFile(PsiFileImpl copy, PsiFile origin)