PsiSubstitutor (PsiSubstitutor f, PsiSubstitutor g) { if (f == PsiSubstitutor.EMPTY) { return g; } PsiSubstitutor subst = PsiSubstitutor.EMPTY; Set<PsiTypeParameter> base = g.getSubstitutionMap().keySet(); for (PsiTypeParameter p : base) { PsiType type = g.substitute(p); subst = subst.put(p, type == null ? null : f.substitute(type)); } return subst; }