boolean (PsiElement element) { if (!(element instanceof PsiBinaryExpression expression)) { return false; } if (!ComparisonUtils.isComparison(expression)) { return false; } final PsiJavaToken sign = expression.getOperationSign(); final PsiExpression rhs = expression.getROperand(); if (rhs == null) { return false; } if (">".equals(sign.getText()) && rhs instanceof PsiReferenceExpression) { // would get parsed as type element when flipped and reparsed PsiElement parent = PsiTreeUtil.skipParentsOfType(expression, PsiPolyadicExpression.class); if (parent instanceof PsiExpressionStatement) { return false; } } if (expression.getParent() instanceof PsiAssignmentExpression && ((PsiAssignmentExpression)expression.getParent()).getLExpression() == expression) { return false; } return !expression.getLOperand().getText().equals(rhs.getText()) && !ErrorUtil.containsDeepError(element); }