Runtime exception occurs when using s.setNoGoodRecordingFromRestarts();. It's due to the accessibility level of some fields in the class SatSolver in the submodule choco-sat:1.0.2. The given error msg is the following:
Exception in thread "main" java.lang.IllegalAccessError: class org.chocosolver.solver.constraints.nary.sat.PropNogoods tried to access field org.chocosolver.sat.SatSolver.ok_ (org.chocosolver.solver.constraints.nary.sat.PropNogoods and org.chocosolver.sat.SatSolver are in unnamed module of loader 'app')
at org.chocosolver.solver.constraints.nary.sat.PropNogoods.propagate(PropNogoods.java:156)
at org.chocosolver.solver.propagation.PropagationEngine.execute(PropagationEngine.java:225)
at org.chocosolver.solver.propagation.PropagationEngine.activatePropagators(PropagationEngine.java:209)
at org.chocosolver.solver.propagation.PropagationEngine.propagate(PropagationEngine.java:173)
at org.chocosolver.solver.search.loop.propagate.PropagateBasic.execute(PropagateBasic.java:46)
at org.chocosolver.solver.Solver.initialize(Solver.java:367)
at org.chocosolver.solver.Solver.solve(Solver.java:255)
at Example.main(Example.java:24)
The IDE indicates that `` is trying to access a field outside its package:
// module choco-solver
package org.chocosolver.solver.constraints.nary.sat;
public class PropNogoods extends Propagator<Variable> {
...
@Override
public void propagate(int evtmask) throws ContradictionException {
initialize();
if (!sat_.ok_) fails(); // sat_.ok_ is package private
fp.clear();
sat_.cancelUntil(0); // sat_.cancelUntil(0) is also package private
storeEarlyDeductions();
applyEarlyDeductions();
for (int i = 0; i < vars.length; ++i) {
doVariableBound(vars[i]);
}
while (fp.size() > 0) {
doVariableBound(fp.pollFirst());
}
}
...
}
// module choco-sat
public class SatSolver implements SatFactory {
...
boolean ok_; // The field ok_ is package private.
...
}
Behavior
Runtime exception occurs when using
s.setNoGoodRecordingFromRestarts();
. It's due to the accessibility level of some fields in the classSatSolver
in the submodule choco-sat:1.0.2. The given error msg is the following:The IDE indicates that `` is trying to access a field outside its package:
Possible Solution
Fixing scope accessibility.
Steps to Reproduce (for bugs)
A gradle project to reproduce the bug is available at: https://github.com/rloic/choco-sat-bug
Environment