private static Set<GrVariable> collectReassignedVariables(PsiElement scope) {
    final Set<GrVariable> result = new HashSet<>();
    PsiTreeUtil.processElements(scope, new PsiElementProcessor() {
      @Override
      public boolean execute(@NotNull PsiElement element) {
        if (!(element instanceof GrReferenceExpression ref) || ref.isQualified()) {
          return true;
        }

        if (isWriteAccess(ref)) {
          PsiElement target = ref.resolve();
          if (target instanceof GrVariable && ((GrVariable)target).getInitializerGroovy() != null ||
              target instanceof GrParameter) {
            result.add((GrVariable)target);
          }
        }
        return true;
      }
    });
    return result;
  }
private static Set<GrVariable> collectReassignedVariables(PsiElement scope)