Skip to content

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

@ptorkko

Description

@ptorkko

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions