void (ProblemsHolder reporter, PsiElement psiAnchor, boolean evaluatesToTrue) { while (psiAnchor instanceof PsiParenthesizedExpression parenthesized) { psiAnchor = parenthesized.getExpression(); } if (psiAnchor == null || shouldBeSuppressed(psiAnchor)) return; boolean isAssertion = psiAnchor instanceof PsiExpression expr && DfaPsiUtil.isAssertionEffectively(expr, evaluatesToTrue); if (DONT_REPORT_TRUE_ASSERT_STATEMENTS && isAssertion) return; if (PsiUtil.skipParenthesizedExprUp(psiAnchor.getParent()) instanceof PsiAssignmentExpression assignment && PsiTreeUtil.isAncestor(assignment.getLExpression(), psiAnchor, false)) { IElementType tokenType = assignment.getOperationTokenType(); if (tokenType.equals(JavaTokenType.ANDEQ) || tokenType.equals(JavaTokenType.OREQ)) { if (isFlagSetChain(assignment.getLExpression(), tokenType.equals(JavaTokenType.ANDEQ))) return; } reporter.registerProblem( psiAnchor, JavaAnalysisBundle.message("dataflow.message.pointless.assignment.expression", Boolean.toString(evaluatesToTrue)), createConditionalAssignmentFixes(evaluatesToTrue, assignment, reporter.isOnTheFly()) ); return; } List<LocalQuickFix> fixes = new ArrayList<>(); if (!isCoveredBySurroundingFix(psiAnchor, evaluatesToTrue)) { ContainerUtil.addIfNotNull(fixes, createSimplifyBooleanExpressionFix(psiAnchor, evaluatesToTrue)); if (isAssertion && reporter.isOnTheFly()) { fixes.add(LocalQuickFix.from(new UpdateInspectionOptionFix(this, "DONT_REPORT_TRUE_ASSERT_STATEMENTS", JavaAnalysisBundle.message( "inspection.data.flow.turn.off.true.asserts.quickfix"), true))); } ContainerUtil.addIfNotNull(fixes, createReplaceWithNullCheckFix(psiAnchor, evaluatesToTrue)); } if (psiAnchor instanceof PsiExpression expression) { ContainerUtil.addIfNotNull(fixes, new FindDfaProblemCauseFix(IGNORE_ASSERT_STATEMENTS, expression, new TrackingRunner.ValueDfaProblemType(evaluatesToTrue))); } String message = JavaAnalysisBundle.message(isAtRHSOfBooleanAnd(psiAnchor) ? "dataflow.message.constant.condition.when.reached" : "dataflow.message.constant.condition", evaluatesToTrue ? 1 : 0); reporter.registerProblem(psiAnchor, message, fixes.toArray(LocalQuickFix.EMPTY_ARRAY)); }