PsiClass (GrExpression expr) { final PsiType type = expr.getType(); if (type instanceof PsiClassType classType) { return classType.resolve(); } else { final String text = type.getPresentableText(); final Project project = expr.getProject(); final JavaPsiFacade facade = JavaPsiFacade.getInstance(project); return facade.findClass(text, GlobalSearchScope.allScope(project)); } }