private static PsiElement rebuildPsiElement(@NotNull Project project, PsiElement psiElement) {
    if (psiElement instanceof PsiMethod) {
      return rebuildMethod(project, (PsiMethod)psiElement);
    }
    else if (psiElement instanceof PsiField) {
      return rebuildField(project, (PsiField)psiElement);
    }
    else if (psiElement instanceof PsiClass) {
      if (((PsiClass)psiElement).isEnum()) {
        return rebuildEnum(project, (PsiClass)psiElement);
      }
      else {
        return rebuildClass(project, (PsiClass)psiElement);
      }
    }
    return null;
  }
private static PsiElement rebuildPsiElement(@NotNull Project project, PsiElement psiElement)