void (DataFlowInstructionVisitor visitor, ProblemReporter reporter) { visitor.redundantInstanceOfs().forEach(anchor -> { PsiExpression expression = anchor instanceof JavaExpressionAnchor ? ((JavaExpressionAnchor)anchor).getExpression() : anchor instanceof JavaMethodReferenceReturnAnchor ? ((JavaMethodReferenceReturnAnchor)anchor).getMethodReferenceExpression() : null; if (expression == null || shouldBeSuppressed(expression)) return; if (ContainerUtil.exists(JavaPsiPatternUtil.getExposedPatternVariables(expression), var -> VariableAccessUtils.variableIsUsed(var, var.getDeclarationScope()))) { return; } ModCommandAction action = new RedundantInstanceofFix(expression); reporter.registerProblem(expression, JavaAnalysisBundle.message("dataflow.message.redundant.instanceof"), LocalQuickFix.from(action)); }); }