PsiType (final Object o) { if (o instanceof ResolveResult) { return getPsiType(((ResolveResult)o).getElement()); } if (o instanceof PsiVariable) { return ((PsiVariable)o).getType(); } else if (o instanceof PsiMethod) { return ((PsiMethod)o).getReturnType(); } else if (o instanceof PsiClass psiClass) { return JavaPsiFacade.getElementFactory(psiClass.getProject()).createType(psiClass); } return null; }