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

Shadow Variable listeners called alphabetically instead of in order of declaration #680

Open
pieterdeschepper opened this issue Mar 4, 2024 · 0 comments
Labels
bug Something isn't working process/needs triage Requires initial assessment of validity, priority etc.

Comments

@pieterdeschepper
Copy link
Contributor

Describe the bug
When you have more than 1 Shadowvariable listeners on a variable, they are called alphabetically based on the source variable name.

Expected behavior
They are called in the order of declaration

Actual behavior
Describe clearly and concisely what actually happened.

To Reproduce
Taken from the food-packaging quickstart, this is the original

    @InverseRelationShadowVariable(sourceVariableName = "jobList")
    private Line line;
    @PreviousElementShadowVariable(sourceVariableName = "jobList")
    private Job previousJob;
   
    @ShadowVariable(variableListenerClass = StartDateTimeUpdatingVariableListener.class, sourceVariableName = "line")
    @ShadowVariable(variableListenerClass = StartDateTimeUpdatingVariableListener.class, sourceVariableName = "previousJob")
    private LocalDateTime startCleaningDateTime;

When you change it to e.g.

    @InverseRelationShadowVariable(sourceVariableName = "jobList")
    private Line line;
    @PreviousElementShadowVariable(sourceVariableName = "jobList")
    private Job previousJob;
   
    @ShadowVariable(variableListenerClass = StartDateTimeUpdatingVariableListener.class, sourceVariableName = "technician")
    @ShadowVariable(variableListenerClass = StartDateTimeUpdatingVariableListener.class, sourceVariableName = "previousJob")
    private LocalDateTime startCleaningDateTime;

You will notice that the variable listener is called in another order (because technician comes alphabetically after `perviousJob``

@ge0ffrey has an idea why it happens

Environment

Timefold Solver Version or Git ref:

Output of java -version:

Output of uname -a or ver:

Additional information

Related issue in quickstarts: TimefoldAI/timefold-quickstarts#315

@pieterdeschepper pieterdeschepper added bug Something isn't working process/needs triage Requires initial assessment of validity, priority etc. labels Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working process/needs triage Requires initial assessment of validity, priority etc.
Projects
None yet
Development

No branches or pull requests

1 participant