void checkUsedNonFinalFields(PsiMethod method) {
    method.accept(new JavaRecursiveElementWalkingVisitor() {

      @Override
      public void visitClass(@NotNull PsiClass aClass) {
        // Do not recurse into.
      }

      @Override
      public void visitReferenceExpression(
        @NotNull PsiReferenceExpression expression) {
        super.visitReferenceExpression(expression);
        final PsiElement element = expression.resolve();
        if (!(element instanceof PsiField field)) {
          return;
        }
        if (field.hasModifierProperty(PsiModifier.FINAL)) {
          return;
        }
        registerError(expression, field);
      }
    });
  }
void checkUsedNonFinalFields(PsiMethod method)