PsiType (PsiMember member, PsiSubstitutor substitutor) { if (member instanceof PsiField field) { return substitutor.substitute(field.getType()); } if (member instanceof PsiMethod method) { if (method.isConstructor()) { PsiClass aClass = Objects.requireNonNull(method.getContainingClass()); return JavaPsiFacade.getElementFactory(method.getProject()).createType(aClass, substitutor); } return patchGetClass(method, substitutor.substitute(method.getReturnType())); } return null; }