Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State change lost on object variable if not set read only #674

Open
ptorkko opened this issue Mar 6, 2025 · 0 comments
Open

State change lost on object variable if not set read only #674

ptorkko opened this issue Mar 6, 2025 · 0 comments

Comments

@ptorkko
Copy link
Contributor

ptorkko commented Mar 6, 2025

In this example the state change is lost:

public record ComplexObject(...) {}

public NextAction myFancyState(StateExecution e, @StateVar("complex") ComplexObject o) {
    ...
    e.setVariable("complex", new ComplexObject(....));
    ...
}

ObjectStringMapper#storeArguments overwrites the change made via StateExecution#setVariable because the @StateVar annotation does not have readOnly = true. Doesn't seem to apply to primitive or "simple" types as they get interpreted as read only due to their types.

Debatable if bug or feature, but definitely confusing and error prone.

Applies to version 10 at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant