PsiSubstitutor () { PsiSubstitutor substitutor = PsiSubstitutor.EMPTY; for (PsiTypeParameter parameter : PsiUtil.typeParametersIterable(mySourceClass)) { substitutor = substitutor.put(parameter, null); } final Map<PsiTypeParameter, PsiType> substitutionMap = TypeConversionUtil.getSuperClassSubstitutor(myTargetSuperClass, mySourceClass, PsiSubstitutor.EMPTY).getSubstitutionMap(); for (PsiTypeParameter parameter : substitutionMap.keySet()) { final PsiType type = substitutionMap.get(parameter); final PsiClass resolvedClass = PsiUtil.resolveClassInType(type); if (resolvedClass instanceof PsiTypeParameter) { substitutor = substitutor.put((PsiTypeParameter)resolvedClass, JavaPsiFacade.getElementFactory(myProject).createType(parameter)); } } return substitutor; }