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

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

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: