void (ProblemsHolder reporter, PsiExpression ref, ConstantResult constant) { if (!REPORT_CONSTANT_REFERENCE_VALUES && ref instanceof PsiReferenceExpression) return; if (shouldBeSuppressed(ref) || constant == ConstantResult.UNKNOWN) return; String presentableName = constant.toString(); if (Integer.valueOf(0).equals(constant.value()) && !shouldReportZero(ref)) return; List<LocalQuickFix> fixes = new SmartList<>(); if (constant.value() instanceof Boolean) { fixes.add(createSimplifyBooleanExpressionFix(ref, (Boolean)constant.value())); } else { ModCommandAction action = new ReplaceWithConstantValueFix(ref, presentableName, presentableName); fixes.add(LocalQuickFix.from(action)); } Object value = constant.value(); boolean isAssertion = isAssertionEffectively(ref, constant); if (isAssertion && DONT_REPORT_TRUE_ASSERT_STATEMENTS) return; if (value instanceof Boolean) { ContainerUtil.addIfNotNull(fixes, createReplaceWithNullCheckFix(ref, (Boolean)value)); } if (reporter.isOnTheFly()) { if (ref instanceof PsiReferenceExpression) { fixes.add(LocalQuickFix.from(new UpdateInspectionOptionFix(this, "REPORT_CONSTANT_REFERENCE_VALUES", JavaAnalysisBundle.message( "inspection.data.flow.turn.off.constant.references.quickfix"), false))); } if (isAssertion) { 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, new FindDfaProblemCauseFix(IGNORE_ASSERT_STATEMENTS, ref, new TrackingRunner.ValueDfaProblemType(value))); ProblemHighlightType type; String message; if (ref instanceof PsiMethodCallExpression || ref instanceof PsiPolyadicExpression || ref instanceof PsiTypeCastExpression) { type = ProblemHighlightType.GENERIC_ERROR_OR_WARNING; message = JavaAnalysisBundle.message("dataflow.message.constant.expression", presentableName); } else { type = ProblemHighlightType.WEAK_WARNING; message = JavaAnalysisBundle.message("dataflow.message.constant.value", presentableName); } reporter.registerProblem(ref, message, type, fixes.toArray(LocalQuickFix.EMPTY_ARRAY)); }