@Override
  @NotNull
  public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
    return new JavaElementVisitor() {

      @Override public void visitAssignmentExpression(@NotNull PsiAssignmentExpression expression) {
        checkSillyAssignment(expression, holder);
      }

      @Override public void visitReferenceExpression(@NotNull PsiReferenceExpression expression) {
        visitElement(expression);
      }

      @Override public void visitVariable(final @NotNull PsiVariable variable) {
        final PsiExpression initializer = PsiUtil.deparenthesizeExpression(variable.getInitializer());
        if (initializer instanceof PsiAssignmentExpression assignment) {
          if (assignment.getOperationTokenType() != JavaTokenType.EQ) {
            return; // skip red unfixable code for local variables and green unfixable code for fields
          } 
          checkExpression(variable, PsiUtil.deparenthesizeExpression(assignment.getLExpression()));
        }
        else {
          checkExpression(variable, initializer);
        }
      }

      private void checkExpression(PsiVariable variable, PsiExpression expression) {
        if (!(expression instanceof PsiReferenceExpression refExpr)) {
          return;
        }
        final PsiExpression qualifier = refExpr.getQualifierExpression();
        if ((qualifier == null || qualifier instanceof PsiQualifiedExpression || variable.hasModifierProperty(PsiModifier.STATIC)) 
            && refExpr.isReferenceTo(variable)) {
          holder.registerProblem(refExpr,
                                 JavaBundle.message("assignment.to.declared.variable.problem.descriptor", variable.getName()),
                                 LocalQuickFix.notNullElements(createRemoveAssignmentFix(refExpr)));
        }
      }
    };
  }
@Override
  @NotNull
  public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly)