private @NotNull PsiSubstitutor processClass(@NotNull PsiClass resolve, @NotNull PsiSubstitutor originalSubstitutor) {
      UnmodifiableHashMap<PsiTypeParameter, PsiType> substMap = EMPTY_MAP;
      while (true) {
        final PsiTypeParameter[] params = resolve.getTypeParameters();
        for (final PsiTypeParameter param : params) {
          final PsiType original = originalSubstitutor.substitute(param);
          PsiType mapping = original == null ? null : original.accept(this);
          substMap = substMap.with(param, mapping);
        }
        final PsiClass containingClass = resolve.hasModifierProperty(PsiModifier.STATIC) ? null : resolve.getContainingClass();
        if (containingClass == null) break;
        resolve = containingClass;
      }
      return PsiSubstitutor.createSubstitutor(substMap);
    }
private @NotNull PsiSubstitutor processClass(@NotNull PsiClass resolve, @NotNull PsiSubstitutor originalSubstitutor)