private void doRefactoring(UsageInfo[] usages) throws IncorrectOperationException {
    final PsiTypeParameter[] typeParameters = myClass.getTypeParameters();
    final boolean[] toRemoveParms = detectRemovedParameters(typeParameters);

    for (final UsageInfo usage : usages) {
      LOG.assertTrue(usage.getElement() instanceof PsiJavaCodeReferenceElement);
      processUsage(usage, typeParameters, toRemoveParms);
    }
    final Map<PsiTypeElement, PsiClass> supersMap = new HashMap<>();
    myClass.accept(new JavaRecursiveElementWalkingVisitor() {
      @Override
      public void visitTypeElement(@NotNull PsiTypeElement typeElement) {
        super.visitTypeElement(typeElement);
        final PsiType type = typeElement.getType();
        final PsiClass psiClass = PsiUtil.resolveClassInType(type);
        if (psiClass instanceof PsiTypeParameter) {
          final int i = ArrayUtil.find(typeParameters, psiClass);
          if ( i >= 0 && i < toRemoveParms.length && toRemoveParms[i]) {
           supersMap.put(typeElement, psiClass.getSuperClass());
          }
        }
      }
    });
    final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(myProject);
    for (Map.Entry<PsiTypeElement, PsiClass> classEntry : supersMap.entrySet()) {
      classEntry.getKey().replace(elementFactory.createTypeElement(elementFactory.createType(classEntry.getValue())));
    }
    changeClassSignature(typeParameters, toRemoveParms);
  }
private void doRefactoring(UsageInfo[] usages)