void (@NotNull PsiBinaryExpression expression) { super.visitBinaryExpression(expression); final IElementType tokenType = expression.getOperationTokenType(); if (!outerTokens.contains(tokenType)) { return; } final PsiExpression lhs = PsiUtil.skipParenthesizedExprDown(expression.getLOperand()); final PsiExpression rhs = PsiUtil.skipParenthesizedExprDown(expression.getROperand()); if (!(lhs instanceof PsiBinaryExpression lBinaryExpression) || !(rhs instanceof PsiBinaryExpression rBinaryExpression)) { return; } final IElementType lTokenType = lBinaryExpression.getOperationTokenType(); final IElementType rTokenType = rBinaryExpression.getOperationTokenType(); if (!innerTokens.contains(lTokenType) || !lTokenType.equals(rTokenType) || tokenType.equals(lTokenType) || lBinaryExpression.getOperands().length != 2 || rBinaryExpression.getOperands().length != 2 ) { return; } final PsiExpression llExpression = PsiUtil.skipParenthesizedExprDown(lBinaryExpression.getLOperand()); final PsiExpression lrExpression = PsiUtil.skipParenthesizedExprDown(lBinaryExpression.getROperand()); final PsiExpression rlExpression = PsiUtil.skipParenthesizedExprDown(rBinaryExpression.getLOperand()); final PsiExpression rrExpression = PsiUtil.skipParenthesizedExprDown(rBinaryExpression.getROperand()); if (llExpression == null || lrExpression == null || rlExpression == null || rrExpression == null) { return; } final boolean eagerEvaluation = eagerTokens.contains(tokenType) && eagerTokens.contains(lTokenType); if (!maybeReplaceDuplicateExpression(expression, lBinaryExpression, llExpression, rlExpression, lrExpression, rrExpression, eagerEvaluation,false, true) && !maybeReplaceDuplicateExpression(expression, lBinaryExpression, llExpression, rrExpression, lrExpression, rlExpression, eagerEvaluation, false, false) && !maybeReplaceDuplicateExpression(expression, lBinaryExpression, lrExpression, rlExpression, llExpression, rrExpression, eagerEvaluation, true, true)) { maybeReplaceDuplicateExpression(expression, lBinaryExpression, lrExpression, rrExpression, llExpression, rlExpression, eagerEvaluation, true, false); } }