void (PsiExpression expression) { BooleanExpressionKind kind = getExpressionKind(expression); if (kind == BooleanExpressionKind.UNKNOWN) { return; } final PsiElement parent = ParenthesesUtils.getParentSkipParentheses(expression); if (parent instanceof PsiExpression && getExpressionKind((PsiExpression)parent) != BooleanExpressionKind.UNKNOWN) { return; } final String replacement = buildSimplifiedExpression(expression, new StringBuilder(), new CommentTracker()).toString(); final Supplier<PsiElement> newBodySupplier = () -> JavaPsiFacade.getElementFactory(expression.getProject()).createExpressionFromText(replacement, expression); if (parent instanceof PsiLambdaExpression && !LambdaUtil.isSafeLambdaBodyReplacement((PsiLambdaExpression)parent, newBodySupplier)) { return; } registerError(expression, expression, replacement, kind == BooleanExpressionKind.USELESS_WITH_SIDE_EFFECTS); }