private static void createLocalClass(PsiClass aClass) {
    WriteCommandAction.writeCommandAction(aClass.getProject()).withName(getTitle(aClass)).withGroupId(getTitle(aClass)).run(() -> {
      final PsiDeclarationStatement statement = (PsiDeclarationStatement)aClass.getParent();
      final PsiTypeParameterList oldTypeParameterList = aClass.getTypeParameterList();
      PsiModifierList modifierList = aClass.getModifierList();
      assert modifierList != null;
      PsiElementFactory factory = JavaPsiFacade.getElementFactory(aClass.getProject());
      @NotNull PsiStatement newClassStatement = factory.createStatementFromText("class " + suggestTargetClassName(aClass) + " {}", aClass);
      PsiClass newClass = (PsiClass)statement.getParent().addAfter(newClassStatement, statement).getFirstChild();
      startTemplate(oldTypeParameterList, aClass.getProject(), aClass, newClass, true);
    });
  }
private static void createLocalClass(PsiClass aClass)