boolean (@Nullable PsiExpression arg) { if (arg != null && !isPolyExpression(arg)) { final PsiType type = arg.getType(); return type instanceof PsiPrimitiveType && type != PsiTypes.nullType(); } else if (arg instanceof PsiNewExpression || arg instanceof PsiFunctionalExpression) { return false; } else if (arg instanceof PsiParenthesizedExpression) { return isExpressionOfPrimitiveType(((PsiParenthesizedExpression)arg).getExpression()); } else if (arg instanceof PsiConditionalExpression) { return isBooleanOrNumeric(arg) != null; } else if (arg instanceof PsiMethodCallExpression) { final PsiMethod method = ((PsiMethodCallExpression)arg).resolveMethod(); return method != null && method.getReturnType() instanceof PsiPrimitiveType; } else if (arg instanceof PsiSwitchExpression) { return isBooleanOrNumeric(arg) != null; } else { assert false : arg; return false; } }