Skip to content

chore: fix value-range validation with null values#2300

Merged
triceo merged 3 commits into
TimefoldAI:mainfrom
zepfred:fix/npe
May 11, 2026
Merged

chore: fix value-range validation with null values#2300
triceo merged 3 commits into
TimefoldAI:mainfrom
zepfred:fix/npe

Conversation

@zepfred
Copy link
Copy Markdown
Contributor

@zepfred zepfred commented May 11, 2026

No description provided.

Copilot AI review requested due to automatic review settings May 11, 2026 17:24
@zepfred zepfred requested a review from triceo as a code owner May 11, 2026 17:24
@triceo triceo linked an issue May 11, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a failure in value-range validation when a @ValueRangeProvider returns a SortedSet implementation (such as TreeSet) that may throw when contains(null) is invoked, and adds a regression test to cover the scenario.

Changes:

  • Add a new list-variable test domain where the entity provides a TreeSet-backed value range (SortedSet).
  • Add a regression test to ensure solving works when the entity-provided value range is a TreeSet.
  • Adjust set-based value-range null validation logic in AbstractFromPropertyValueRangeDescriptor.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
core/src/main/java/ai/timefold/solver/core/impl/domain/valuerange/descriptor/AbstractFromPropertyValueRangeDescriptor.java Tweaks null-element validation for Set-backed value ranges to avoid contains(null) for SortedSet.
core/src/test/java/ai/timefold/solver/core/impl/solver/DefaultSolverTest.java Adds a regression test that solves a problem where the entity value range is a TreeSet.
core/src/test/java/ai/timefold/solver/core/testdomain/list/valuerange/unassignedvar/sortedset/TestdataListUnassignedEntityProvidingSortedSetEntity.java Introduces a planning entity whose value range provider returns a SortedSet (TreeSet).
core/src/test/java/ai/timefold/solver/core/testdomain/list/valuerange/unassignedvar/sortedset/TestdataListUnassignedEntityProvidingSortedSetSolution.java Introduces a planning solution wiring the new entity and generating a minimal problem instance.

Copy link
Copy Markdown
Collaborator

@triceo triceo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this one.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
66.7% Coverage on New Code (required ≥ 70%)

See analysis details on SonarQube Cloud

@triceo triceo merged commit 06081ca into TimefoldAI:main May 11, 2026
18 of 19 checks passed
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

Successfully merging this pull request may close these issues.

ValueRange should support SortedSet (regression?)

3 participants