0

New to OptaPlanner and want to debug the example Task Assigning in Eclipse to learn. Found that the breakpoints are hit only when the code are called by the UI related code, such as

org.optaplanner.examples.taskassigning.domain.Affinity(int durationMultiplier)
org.optaplanner.examples.taskassigning.domain.TaskAssigningSolution.getEmployeeList()

when set breakpoint at:

org.optaplanner.examples.taskassigning.domain.TaskAssigningSolution.setEmployeeList(List<Employee> employeeList)

it won't be hit. My questions are, why the breakpoints are not hit? how can the breakpoints be hit?

brewphone
  • 1,316
  • 4
  • 24
  • 32

1 Answers1

1

A solution like TaskAssigningSolution is planning cloned (see docs for what this is) through reflection on the fields. See FieldAccessingSolutionCloner. You can write your own solution cloner to avoid that behavior (but that's very error prone to write correctly).

We have a RFE running to support something like accessFieldsThroughGetterSetters=true to be more JDK 17 friendly, which will force OptaPlanner never to use field access for non-public fields.

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120
  • New to Quarkus and Optaplanner. Can you help me understand how I can run the employee roster code on debug mode? I want the remote debugging to be enabled in eclipse for this. Any suggestions? – Balu Apr 19 '22 at 05:42
  • You can run quarkus -Ddebug [as explained here](https://stackoverflow.com/questions/55190015/how-can-i-debug-my-quarkus-application-that-is-running-in-dev-mode) and connect to it with a remote debugger. I've done that a few times in IntelliJ. – Geoffrey De Smet Apr 19 '22 at 09:38
  • I was using eclipse. However I could run the debugger just by adding the quarkus plugin to it from the market place, and running the application in debug mode. Adding it here just in case if someone using eclipse find this useful. – Balu Apr 22 '22 at 07:33