PsiType (PsiExpression expression) { if (!(expression instanceof PsiNewExpression newExpression)) { return expression.getType(); } final PsiAnonymousClass anonymousClass = newExpression.getAnonymousClass(); return anonymousClass != null ? anonymousClass.getBaseClassType() : expression.getType(); }