void (PsiElement compareExpression) { PsiBinaryExpression binOp = ObjectUtils.tryCast(PsiUtil.skipParenthesizedExprUp(compareExpression.getParent()), PsiBinaryExpression.class); if (binOp == null) return; PsiJavaToken sign = binOp.getOperationSign(); IElementType tokenType = sign.getTokenType(); RelationType relation = DfaPsiUtil.getRelationByToken(tokenType); if (relation == null) return; PsiExpression constOperand = PsiTreeUtil.isAncestor(binOp.getLOperand(), compareExpression, false) ? binOp.getROperand() : binOp.getLOperand(); if (constOperand == null) return; Object constantExpression = ExpressionUtils.computeConstantExpression(constOperand); if (!(constantExpression instanceof Integer)) return; int value = ((Integer)constantExpression).intValue(); if (value == 0) return; boolean yodaCondition = constOperand == binOp.getLOperand(); if (yodaCondition) { relation = relation.getFlipped(); } LongRangeSet rangeSet = LongRangeSet.point(value).fromRelation(relation); if (coversPartially(rangeSet, NEGATIVE_INTEGERS)) { register(sign, yodaCondition, rangeSet.intersects(POSITIVE_INTEGERS) ? null : RelationType.LT); } else if (coversPartially(rangeSet, POSITIVE_INTEGERS)) { register(sign, yodaCondition, rangeSet.intersects(NEGATIVE_INTEGERS) ? null : RelationType.GT); } }