PsiReference[] markRootUsages(PsiElement element, PsiType migrationType, PsiReference[] refs) {
    final List<PsiReference> validReferences = new ArrayList<>();
    for (PsiReference ref1 : refs) {
      final PsiElement ref = ref1.getElement();

      if (element instanceof PsiMethod) {
        final PsiElement parent = Util.getEssentialParent(ref);

        if (!(parent instanceof PsiMethodCallExpression)) {
          continue;
        }

        getTypeEvaluator().setType(new TypeMigrationUsageInfo(parent), migrationType);
      }
      else if (element instanceof PsiVariable) {
        if (ref instanceof PsiReferenceExpression) {
          getTypeEvaluator().setType(new TypeMigrationUsageInfo(ref), PsiUtil.captureToplevelWildcards(migrationType, ref));
        }
      }
      else {
        LOG.error("Method call expression or reference expression expected but found " + element.getClass().getName());
        continue;
      }
      validReferences.add(ref1);
    }

    validReferences.sort(Comparator.comparingInt(o -> o.getElement().getTextOffset()));

    return validReferences.toArray(PsiReference.EMPTY_ARRAY);
  }
PsiReference[] markRootUsages(PsiElement element, PsiType migrationType, PsiReference[] refs)