private static boolean checkAssignmentToFieldExists(PsiParameter parameter) {
    for (PsiReference reference : ReferencesSearch.search(parameter).findAll()) {
      PsiElement element = reference.getElement();
      if (element instanceof GrReferenceExpression &&
          element.getParent() instanceof GrAssignmentExpression parent &&
          parent.getRValue() == element) {
        GrExpression value = parent.getLValue();
        if (value instanceof GrReferenceExpression ref && ref.resolve() instanceof PsiField) return true;
      }
    }
    return false;
  }
private static boolean checkAssignmentToFieldExists(PsiParameter parameter)