@Override
    public void visitReferenceExpression(@NotNull PsiReferenceExpression reference) {
      if (!indexVariableUsedOnlyAsIndex) {
        return;
      }
      super.visitReferenceExpression(reference);
      final PsiElement element = reference.resolve();
      if (!indexVariable.equals(element)) {
        return;
      }
      final PsiElement parent = getParentSkipParentheses(reference);
      if (!(parent instanceof PsiArrayAccessExpression arrayAccessExpression)) {
        indexVariableUsedOnlyAsIndex = false;
        return;
      }
      final PsiExpression arrayExpression = PsiUtil.skipParenthesizedExprDown(arrayAccessExpression.getArrayExpression());
      if (!(arrayExpression instanceof PsiReferenceExpression referenceExpression)) {
        indexVariableUsedOnlyAsIndex = false;
        return;
      }
      final PsiExpression qualifier = referenceExpression.getQualifierExpression();
      if (qualifier != null && !(qualifier instanceof PsiThisExpression) && !(qualifier instanceof PsiSuperExpression)) {
        indexVariableUsedOnlyAsIndex = false;
        return;
      }
      final PsiElement target = referenceExpression.resolve();
      if (!arrayVariable.equals(target)) {
        indexVariableUsedOnlyAsIndex = false;
        return;
      }
      arrayAccessed = true;
      final PsiElement arrayExpressionContext = getParentSkipParentheses(arrayAccessExpression);
      if (arrayExpressionContext instanceof PsiAssignmentExpression assignment) {
        final PsiExpression lhs = assignment.getLExpression();
        if (lhs.equals(arrayAccessExpression)) {
          indexVariableUsedOnlyAsIndex = false;
        }
      }
    }
@Override
    public void visitReferenceExpression(@NotNull PsiReferenceExpression reference)