@Override
      public void visitTypeCastExpression(@NotNull PsiTypeCastExpression expression) {
        InstanceOfCandidateResult result = findInstanceOfCandidateResult(expression);
        if (result == null) return;
        if (result.instanceOf() != null) {
          PsiPattern pattern = result.instanceOf().getPattern();
          PsiPatternVariable existingPatternVariable = JavaPsiPatternUtil.getPatternVariable(pattern);
          if (pattern != null && existingPatternVariable == null) {
            return;
          }
          if (existingPatternVariable != null) {
            if (!isFinalOrEffectivelyFinal(existingPatternVariable)) {
              return;
            }
            holder.registerProblem(result.castTypeElement(),
                                   InspectionGadgetsBundle.message("inspection.pattern.variable.can.be.used.existing.cast.message",
                                                                   existingPatternVariable.getName()),
                                   new ExistingPatternVariableCanBeUsedFix(null, existingPatternVariable));
          }
          else {
            if (!reportAlsoCastWithIntroducingNewVariable) {
              if (isOnTheFly) {
                holder.registerProblem(expression,
                                       InspectionGadgetsBundle.message("inspection.pattern.variable.can.be.used.instead.of.cast.message"),
                                       ProblemHighlightType.INFORMATION,
                                       new CastExpressionsCanBeReplacedWithPatternVariableFix(result.instanceOf()));
              }
              return;
            }
            holder.registerProblem(result.castTypeElement(),
                                   InspectionGadgetsBundle.message("inspection.pattern.variable.can.be.used.instead.of.cast.message"),
                                   new CastExpressionsCanBeReplacedWithPatternVariableFix(result.instanceOf()));
          }
        }
      }
@Override
      public void visitTypeCastExpression(@NotNull PsiTypeCastExpression expression)