chore: remove support for the identity map from the value range cache#2140
Merged
triceo merged 4 commits intoTimefoldAI:1.xfrom Feb 23, 2026
Merged
chore: remove support for the identity map from the value range cache#2140triceo merged 4 commits intoTimefoldAI:1.xfrom
triceo merged 4 commits intoTimefoldAI:1.xfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes identity-based caching/indexing behavior in value range infrastructure, standardizing lookups and deduplication on equals/hashCode semantics across value range caches and related indexing.
Changes:
- Simplified
ValueRangeCacheby removing the builder/trusted-vs-user modes and introducingof(...)factory methods backed by standard hash-based collections. - Removed
isValueImmutableplumbing from collection/composite value ranges and stopped using immutability to decide identity vs equals-based maps inValueRangeState. - Updated/extended unit tests to assert
contains()works for different instances that are equal by planning ID/code.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| core/src/main/java/ai/timefold/solver/core/impl/domain/valuerange/ValueRangeCache.java | Removes identity-map support and introduces new of(...) factories for hash-based caching. |
| core/src/main/java/ai/timefold/solver/core/impl/domain/valuerange/AbstractCountableValueRange.java | Removes isValueImmutable() hook and its documentation. |
| core/src/main/java/ai/timefold/solver/core/impl/domain/valuerange/buildin/collection/ListValueRange.java | Drops immutability flag usage and builds cache via ValueRangeCache.of(...). |
| core/src/main/java/ai/timefold/solver/core/impl/domain/valuerange/buildin/collection/SetValueRange.java | Drops immutability flag usage and builds cache via ValueRangeCache.of(...). |
| core/src/main/java/ai/timefold/solver/core/impl/domain/valuerange/buildin/composite/CompositeCountableValueRange.java | Drops immutability tracking and uses ValueRangeCache.of(int) for dedup/cache creation. |
| core/src/main/java/ai/timefold/solver/core/impl/domain/valuerange/descriptor/AbstractFromPropertyValueRangeDescriptor.java | Updates construction of SetValueRange/ListValueRange to new constructors. |
| core/src/main/java/ai/timefold/solver/core/impl/score/director/ValueRangeState.java | Simplifies index map building to hash-based maps (no identity-map path). |
| core/src/test/java/ai/timefold/solver/core/impl/domain/valuerange/buildin/collection/ListValueRangeTest.java | Adds coverage asserting contains() works across equal-but-distinct instances. |
| core/src/test/java/ai/timefold/solver/core/impl/domain/valuerange/buildin/collection/SetValueRangeTest.java | Adds coverage asserting contains() works across equal-but-distinct instances. |
| core/src/test/java/ai/timefold/solver/core/impl/domain/valuerange/buildin/composite/CompositeCountableValueRangeTest.java | Adds coverage asserting contains() works across equal-but-distinct instances in composite ranges. |
core/src/main/java/ai/timefold/solver/core/impl/domain/valuerange/ValueRangeCache.java
Show resolved
Hide resolved
triceo
approved these changes
Feb 23, 2026
Collaborator
triceo
left a comment
There was a problem hiding this comment.
LGTM when comments resolved.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.