Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-2888

Provide a more specific fail-fast message for missing Entity classes

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Minor Minor
    • 8.34.0.Final
    • None
    • optaplanner-core
    • None
    • 2023 Week 03-05 (from Jan 16)
    • NEW
    • NEW

      If an Entity class is not properly registered in the SolverConfig, the fail-fast message gives no guidance by providing a general message that the class is not a valid planning entity.

      See:
      Exception in thread "main" java.lang.IllegalArgumentException: The entityClass (class com.Foo) has an @InverseRelationShadowVariable annotated property (nap) with a sourceClass (class com.Bar) which is not a valid planning entity.

      Caused by:
      SolverConfig()
      .withSolutionClass(Something::class.java)
      .withEntityClasses(Foo::class.java)
      .withEntityClasses(Bar::class.java) // overrides the previous line

      Proposal:
      the message could be slightly extended to guide the user better by adding the "Maybe" sentence about registering the class in the SolverConfig.

              rsynek@redhat.com Radovan Synek (Inactive)
              rsynek@redhat.com Radovan Synek (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: