@Override
  public @NotNull PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder,
                                                 boolean isOnTheFly) {
    if (!PsiUtil.isLanguageLevel7OrHigher(holder.getFile())) return PsiElementVisitor.EMPTY_VISITOR;
    return new JavaElementVisitor() {
      @Override
      public void visitNewExpression(@NotNull PsiNewExpression newExpression) {
        super.visitNewExpression(newExpression);
        IOStreamConstructorModel constructorModel = IOStreamConstructorModel.create(newExpression);
        if (constructorModel == null) return;
        StreamType streamType = constructorModel.myStreamType;
        PsiType expectedType = ExpectedTypeUtils.findExpectedType(newExpression, false);
        if (expectedType == null) return;
        if (isFileNotFoundHandled(newExpression)) return;
        boolean canUseBaseType = TypeConversionUtil.isAssignable(expectedType, streamType.baseType(newExpression));
        if (!canUseBaseType) return;
        boolean isInfoLevel = PsiUtil.getLanguageLevel(holder.getFile()).isAtLeast(LanguageLevel.JDK_10);
        if (isInfoLevel && !isOnTheFly) return;
        ProblemHighlightType highlightType = isInfoLevel ? ProblemHighlightType.INFORMATION : ProblemHighlightType.WARNING;
        ReplaceWithNioCallFix fix = new ReplaceWithNioCallFix(streamType.myReplacement, isOnTheFly);
        holder.registerProblem(newExpression, JavaBundle.message(streamType.myErrorText), highlightType, fix);
      }
    };
  }
@Override
  public @NotNull PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder,
                                                 boolean isOnTheFly)