private static void checkSillyAssignment(@NotNull PsiAssignmentExpression assignment, @NotNull ProblemsHolder holder) {
    if (assignment.getOperationTokenType() != JavaTokenType.EQ) return;
    PsiExpression leftExpression = assignment.getLExpression();
    PsiExpression rightExpression = assignment.getRExpression();
    if (rightExpression == null) return;

    leftExpression = PsiUtil.deparenthesizeExpression(leftExpression);
    PsiExpression leftArrayExpressionOrItself = getArrayExpressionOrItself(leftExpression);
    if (!(leftArrayExpressionOrItself instanceof PsiReferenceExpression lRef)) return;
    final PsiElement resolved = lRef.resolve();
    if (!(resolved instanceof PsiVariable variable)) return;

    rightExpression = deparenthesizeRExpr(rightExpression, variable);
    PsiExpression rightArrayExpressionOrItself = getArrayExpressionOrItself(rightExpression);

    if (!(rightArrayExpressionOrItself instanceof PsiReferenceExpression)) {
      if (!(rightArrayExpressionOrItself instanceof PsiAssignmentExpression rAssignmentExpression)) return;
      rightExpression = deparenthesizeRExpr(rAssignmentExpression.getLExpression(), variable);
    }
    if (rightExpression == null) return;

    EquivalenceChecker checker = EquivalenceChecker.getCanonicalPsiEquivalence();
    if (!checker.expressionsAreEquivalent(leftExpression, rightExpression) || SideEffectChecker.mayHaveSideEffects(leftExpression)) return;
    String message = leftExpression instanceof PsiArrayAccessExpression
                     ? JavaBundle.message("assignment.array.element.to.itself.problem.descriptor")
                     : JavaBundle.message("assignment.to.itself.problem.descriptor", variable.getName());
    holder.registerProblem(rightExpression, message, createRemoveAssignmentFix(rightExpression));
  }
private static void checkSillyAssignment(@NotNull PsiAssignmentExpression assignment, @NotNull ProblemsHolder holder)