PsiType (PsiType bound, PsiSubstitutor substitutor) { final HashSet<InferenceVariable> dependencies = new LinkedHashSet<>(); if (!collectDependencies(bound, dependencies)) { return bound; } for (InferenceVariable dependency : dependencies) { PsiType instantiation = dependency.getInstantiation(); if (instantiation != PsiTypes.nullType()) { substitutor = substitutor.put(dependency, instantiation); } } return substitutor.substitute(bound); }