Shadow Variable listeners called alphabetically instead of in order of declaration
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
Research direction
The issue does not name a source file or test. Reproduce the ordering difference from the food-packaging quickstart, then trace how multiple ShadowVariable annotations are discovered and invoked. Done means listeners run in declaration order rather than alphabetical source-variable order, with coverage for the renamed-variable case.
Written by the indexing model from the issue text.
Description
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 technician;
@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 `previousJob``
@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: https://github.com/TimefoldAI/timefold-quickstarts/issues/315
- Dominant language
- Java
- Stars
- 1.8k
- Forks
- 228
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 46
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from TimefoldAI/timefold-solver
-
component/docs
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
TimefoldAI/timefold-solver#2671 ·
-
process/needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
TimefoldAI/timefold-solver#2652 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
TimefoldAI/timefold-solver#2647 · 1 reaction ·
-
component/service
Difficulty 3/5 1-2 days Newbie friendliness 66/100
TimefoldAI/timefold-solver#2629 ·
-
component/docs
TimefoldAI/timefold-solver#2626 · 1 assignee ·
All issues in TimefoldAI/timefold-solver
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
bug needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 1/5 Under an hour Newbie friendliness 94/100
objectionary/hone-maven-plugin#1061 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
spring-projects/spring-modulith#1895 ·