@Override
    protected void applyFix(@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) {
      PsiImplicitClass implicitClass;
      if (element instanceof PsiImplicitClass elementAsClass) {
        implicitClass = elementAsClass;
      }
      else {
        implicitClass = PsiTreeUtil.getParentOfType(element, PsiImplicitClass.class);
      }
      if (implicitClass == null) {
        return;
      }
      String text = implicitClass.getText();
      String qualifiedName = implicitClass.getQualifiedName();
      if (qualifiedName == null) {
        return;
      }
      PsiClass newClass = PsiElementFactory.getInstance(element.getProject()).createClassFromText(text, implicitClass);
      newClass.setName(qualifiedName);
      //user probably mostly wants to use it somewhere
      PsiModifierList modifierList = newClass.getModifierList();
      if (modifierList != null) {
        modifierList.setModifierProperty(PsiModifier.PUBLIC, true);
      }
      PsiFile containingFile = implicitClass.getContainingFile();
      if (!(containingFile instanceof PsiJavaFile psiJavaFile)) {
        return;
      }
      @NotNull ImplicitlyImportedStaticMember[] imports = PsiImplUtil.getImplicitStaticImports(psiJavaFile);
      PsiElement replaced = implicitClass.replace(newClass);
      PsiJavaFile newPsiJavaFile = PsiTreeUtil.getParentOfType(replaced, PsiJavaFile.class);
      if (newPsiJavaFile == null) {
        return;
      }
      PsiImportList importList = newPsiJavaFile.getImportList();
      if (importList == null) {
        return;
      }
      JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project);
      for (@NotNull ImplicitlyImportedStaticMember importMember : imports) {
        PsiClass psiClass = psiFacade.findClass(importMember.getContainingClass(), implicitClass.getResolveScope());
        if (psiClass == null) {
          continue;
        }
        PsiReferenceExpressionImpl.bindToElementViaStaticImport(psiClass, importMember.getMemberName(), importList);
      }
      JavaCodeStyleManager.getInstance(project).optimizeImports(newPsiJavaFile);
    }
@Override
    protected void applyFix(@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater)