Skip to content

Fluent method is not exact replica of setter method #1331

Description

@fjtirado

If the generated setXX method is not trivial, his withXXX counterpart wont be aligned.
For example

@OneOfSetter(String.class)
    public void setExpressionErrorDetails(String expressionErrorDetails) {
        this.value = expressionErrorDetails;
        if (expressionErrorDetails_Pattern.matcher(expressionErrorDetails).matches()) {
            this.expressionErrorDetails = expressionErrorDetails;
        } else {
            if (literalErrorDetails_Pattern.matcher(expressionErrorDetails).matches()) {
                this.literalErrorDetails = expressionErrorDetails;
            } else {
                throw new ConstraintViolationException(String.format("%s does not match any pattern", expressionErrorDetails), null);
            }
        }
    }

is quite different from

public ErrorDetails withExpressionErrorDetails(String value) {
        expressionErrorDetails = value;
        this.value = value;
        return this;
    }

To fix that, withXXX should call setXXX

Activity

  1. self-assigned this
    on Apr 21, 2026
  2. added 2 commits that reference this issue on Apr 21, 2026
    8b9e991
    e695182
  3. added a commit that references this issue on Apr 22, 2026
    3aadb94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions