private void markTypeParameterUsages(final PsiClass psiClass, PsiClassType migrationType, PsiReferenceParameterList referenceParameterList,
                                       final Map<PsiElement, Pair<PsiReference[], PsiType>> roots) {

    final PsiSubstitutor[] fullHierarchySubstitutor = {migrationType.resolveGenerics().getSubstitutor()};
    CommonJavaRefactoringUtil.processSuperTypes(migrationType, new CommonJavaRefactoringUtil.SuperTypeVisitor() {
      @Override
      public void visitType(PsiType aType) {
        fullHierarchySubstitutor[0] = fullHierarchySubstitutor[0].putAll(((PsiClassType)aType).resolveGenerics().getSubstitutor());
      }
      @Override
      public void visitClass(PsiClass aClass) {
        //do nothing
      }
    });

    final PsiClass resolvedClass = (PsiClass)((PsiJavaCodeReferenceElement)referenceParameterList.getParent()).resolve();
    LOG.assertTrue(resolvedClass != null);
    final Set<PsiClass> superClasses = new HashSet<>();
    superClasses.add(resolvedClass);
    InheritanceUtil.getSuperClasses(resolvedClass, superClasses, true);
    for (PsiClass superSuperClass : superClasses) {
      final Set<PsiTypeParameter> typeParameters = ContainerUtil.newHashSet(PsiUtil.typeParametersIterable(superSuperClass));
      superSuperClass.accept(new JavaRecursiveElementVisitor(){
        @Override
        public void visitMethod(final @NotNull PsiMethod method) {
          super.visitMethod(method);
          processMemberType(method, typeParameters, psiClass, fullHierarchySubstitutor[0], roots);
          for (PsiParameter parameter : method.getParameterList().getParameters()) {
            processMemberType(parameter, typeParameters, psiClass, fullHierarchySubstitutor[0], roots);
          }
        }

        @Override
        public void visitField(final @NotNull PsiField field) {
          super.visitField(field);
          processMemberType(field, typeParameters, psiClass, fullHierarchySubstitutor[0], roots);
        }
      });
    }

  }
private void markTypeParameterUsages(final PsiClass psiClass, PsiClassType migrationType, PsiReferenceParameterList referenceParameterList,
                                       final Map<PsiElement, Pair<PsiReference[], PsiType>> roots)