private void doInvoke(final PsiClass aClass, final String superClassName) throws IncorrectOperationException {
    PsiJavaCodeReferenceElement ref;
    if (!aClass.isPhysical()) {
      ref = PsiTreeUtil.findSameElementInCopy(getRefElement(), aClass.getContainingFile());
    } else {
      ref = getRefElement();
    }
    assert ref != null;
    String refName = ref.getReferenceName();
    LOG.assertTrue(refName != null);
    PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(aClass.getProject());
    PsiClass created = myKind.create(elementFactory, refName);
    final PsiModifierList modifierList = created.getModifierList();
    LOG.assertTrue(modifierList != null);
    if (aClass.isInterface() || PsiUtil.isLocalOrAnonymousClass(aClass)) {
      modifierList.setModifierProperty(PsiModifier.PACKAGE_LOCAL, true);
    } else {
      modifierList.setModifierProperty(PsiModifier.PRIVATE, true);
    }
    if (CommonJavaRefactoringUtil.isInStaticContext(ref, aClass) && !aClass.isInterface()) {
      modifierList.setModifierProperty(PsiModifier.STATIC, true);
    }
    if (superClassName != null) {
      CreateFromUsageUtils.setupSuperClassReference(created, superClassName);
    }
    CreateFromUsageBaseFix.setupGenericParameters(created, ref);

    if (!aClass.isPhysical()) {
      PsiClass add = (PsiClass)aClass.add(created);
      PsiDeconstructionPattern pattern = getDeconstructionPattern(ref);
      if (pattern != null) {
        setupRecordFromDeconstructionPattern(add, pattern, getText());
      }
    }
    else {
      if (!FileModificationService.getInstance().preparePsiElementForWrite(aClass)) return;
      WriteCommandAction.runWriteCommandAction(aClass.getProject(), getText(), null,
                                               () -> {
                                                 PsiClass add = (PsiClass)aClass.add(created);
                                                 ref.bindToElement(add);
                                                 PsiDeconstructionPattern pattern = getDeconstructionPattern(ref);
                                                 if (pattern != null) {
                                                   setupRecordFromDeconstructionPattern(add, pattern, getText());
                                                 }
                                               },
                                               aClass.getContainingFile());
    }
  }
private void doInvoke(final PsiClass aClass, final String superClassName)