void (@NotNull ProblemReporter reporter, @NotNull DataFlowInstructionVisitor visitor) { visitor.getFailingCastExpressions().forKeyValue((typeCast, info) -> { boolean alwaysFails = info.getFirst(); PsiType realType = info.getSecond(); if (!REPORT_UNSOUND_WARNINGS && !alwaysFails) return; PsiExpression operand = typeCast.getOperand(); PsiTypeElement castType = typeCast.getCastType(); if (ExpressionUtils.isNullLiteral(operand) || DfTypes.NULL.equals(CommonDataflow.getDfType(operand, IGNORE_ASSERT_STATEMENTS))) { // Skip reporting if cast operand is always null: null can be cast to anything return; } assert castType != null; assert operand != null; List<LocalQuickFix> fixes = new ArrayList<>(createCastFixes(typeCast, realType, reporter.isOnTheFly(), alwaysFails)); ContainerUtil.addIfNotNull(fixes, createExplainFix(typeCast, new TrackingRunner.CastDfaProblemType())); String text = PsiExpressionTrimRenderer.render(operand); String message = alwaysFails ? JavaAnalysisBundle.message("dataflow.message.cce.always", text) : JavaAnalysisBundle.message("dataflow.message.cce", text); reporter.registerProblem(castType, message, fixes.toArray(LocalQuickFix.EMPTY_ARRAY)); }); }