Skip to content

feat: improve error message when a declarative supplier is missing in Quarkus#1687

Merged
triceo merged 3 commits into
TimefoldAI:mainfrom
Christopher-Chianelli:feat/1663
Jul 7, 2025
Merged

feat: improve error message when a declarative supplier is missing in Quarkus#1687
triceo merged 3 commits into
TimefoldAI:mainfrom
Christopher-Chianelli:feat/1663

Conversation

@Christopher-Chianelli

Copy link
Copy Markdown
Contributor

Does not affect Spring since Spring does not generate it own member accessors.

… Quarkus

Does not affect Spring since Spring does not generate it own member
accessors.

@triceo triceo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, with small adjustments.

@triceo triceo requested a review from Copilot July 7, 2025 16:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 enhances the error reporting when a declarative shadow‐variable’s supplier method is missing, and adds end‐to‐end tests in both Quarkus and Spring to verify the improved message.

  • Added Spring test domain and configuration for missing supplier variable error
  • Added Quarkus test domain and processor logic to detect missing supplier and throw a clear exception
  • Updated core and Quarkus processor code to validate supplier method existence and format a detailed error

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
spring-integration/.../TestdataSpringMissingSupplierVariableSolution.java New Spring test solution for missing supplier variable
spring-integration/.../TestdataSpringMissingSupplierVariableEntity.java New entity with @ShadowVariable to trigger missing-supplier case
spring-integration/.../TimefoldSolverAutoConfigurationTest.java Added missingSupplierVariables test to assert Spring error
quarkus-integration/quarkus/.../TimefoldProcessor.java Validates supplier method existence, throws improved exception
core/src/main/.../DeclarativeShadowVariableDescriptor.java Improved error message when supplier method is not found
quarkus-integration/quarkus/.../TestdataQuarkusDeclarativeMissingSupplierValue.java New Quarkus test entity missing supplier methods
quarkus-integration/quarkus/.../TimefoldProcessorMissingSupplierForDeclarativeVariableTest.java Added Quarkus unit test for missing supplier declarative var
Comments suppressed due to low confidence (5)

quarkus-integration/quarkus/deployment/src/test/java/ai/timefold/solver/quarkus/testdomain/suppliervariable/missing/TestdataQuarkusDeclarativeMissingSupplierSolution.java:60

  • [nitpick] The toString() output uses TestdataDeclarativeMissingSupplierSolution but the class is named TestdataQuarkusDeclarativeMissingSupplierSolution. Update the string for consistency.
        return "TestdataDeclarativeMissingSupplierSolution{" +

quarkus-integration/quarkus/deployment/src/test/java/ai/timefold/solver/quarkus/testdomain/suppliervariable/missing/TestdataQuarkusDeclarativeMissingSupplierEntity.java:52

  • [nitpick] The toString() uses TestdataDeclarativeMissingSupplierEntity but the class name includes Quarkus. Align the string to TestdataQuarkusDeclarativeMissingSupplierEntity for clarity.
        return "TestdataDeclarativeMissingSupplierEntity{" +

spring-integration/spring-boot-autoconfigure/src/test/java/ai/timefold/solver/spring/boot/autoconfigure/missingsuppliervariable/constraints/TestdataSpringMissingSupplierVariableConstraintProvider.java:23

  • Throwing new IllegalStateException() without a message makes debugging harder. Consider providing a descriptive message to explain why the exception is thrown (e.g., "shadow variable not initialized before constraint").
                                throw new IllegalStateException();

quarkus-integration/quarkus/deployment/src/main/java/ai/timefold/solver/quarkus/deployment/TimefoldProcessor.java:1046

  • The multiline string literal for this exception message starts with a newline and indentation, which will introduce unwanted whitespace in the error output. Consider moving the first """ up to the same line as the annotation or trimming leading whitespace.
                        throw new IllegalArgumentException("""

core/src/main/java/ai/timefold/solver/core/impl/domain/variable/declarative/DeclarativeShadowVariableDescriptor.java:54

  • Leading newline and indentation in this multiline exception message will show extra whitespace. It’s clearer to start the text immediately after the opening """ or use .stripIndent() to clean it up.
            throw new IllegalArgumentException("""

@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2025

Copy link
Copy Markdown

@triceo triceo merged commit 4b57022 into TimefoldAI:main Jul 7, 2025
43 checks passed
@Christopher-Chianelli Christopher-Chianelli deleted the feat/1663 branch May 14, 2026 18:02
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.

Feat: Clear error message in Quarkus when ShadowVar annotation points to non-existing supplier

3 participants