PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { @Override public void visitMethodCallExpression(@NotNull PsiMethodCallExpression call) { if (!COMPARE_METHODS.test(call)) return; PsiBinaryExpression binOp = ObjectUtils.tryCast(PsiUtil.skipParenthesizedExprUp(call.getParent()), PsiBinaryExpression.class); if (binOp == null) return; RelationType type = DfaPsiUtil.getRelationByToken(binOp.getOperationTokenType()); if (type == null) return; if (ExpressionUtils.isZero(binOp.getLOperand())) { type = type.getFlipped(); if (type == null) return; } else if (!ExpressionUtils.isZero(binOp.getROperand())) { return; } holder.registerProblem(call, InspectionGadgetsBundle.message("redundant.call.problem.descriptor"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new TextRange(0, call.getArgumentList().getStartOffsetInParent()), new InlineCompareCallFix(type)); } }; }