Correct a Java SWIG type mapping that produces SEGV crashes by ateirney · Pull Request #1838 · google/or-tools

Whilst attempting to use dimension breaks via Java SWIG bindings I encountered SEGV crashes.

Below is a very simple code example that exhibits the SEGV crashes.

package tmp;

import com.google.ortools.constraintsolver.IntervalVar;
import com.google.ortools.constraintsolver.RoutingDimension;
import com.google.ortools.constraintsolver.RoutingIndexManager;
import com.google.ortools.constraintsolver.RoutingModel;

public class Tmp {
    static {
        System.loadLibrary("jniortools");
    }

    public static void main(String[] args) {
        RoutingIndexManager manager = new RoutingIndexManager(2, 1, new int[]{0}, new int[]{1});
        RoutingModel model = new RoutingModel(manager);
        model.addConstantDimension(0, 0, false, "tmp");
        RoutingDimension dimension = model.getMutableDimension("tmp");
        // The line below causes the SEGV
        dimension.setBreakIntervalsOfVehicle(new IntervalVar[]{}, 0, -1, -1);
    }
}

This changeset aims to correct the java swig in type maps for std::vector<CType*>