Por que este programa usando o Collections.sort falha apenas em listas de tamanho 32 ou mais?

O programa a seguir lança a seguinte exceção:

java.lang.IllegalArgumentException: Comparison method violates its general contract!

Eu entendo o problema com oComparator. VejoNão foi possível replicar: "O método de comparação viola seu contrato geral!"

Eu não entendo por que só falha porLists de tamanho 32 ou mais. Alguém pode explicar?

class Experiment {

    private static final class MyInteger {
        private final Integer num;

        MyInteger(Integer num) {
            this.num = num;
        }
    }

    private static final Comparator<MyInteger> COMPARATOR = (r1, r2) -> {
        if (r1.num == null || r2.num == null)
            return 0;
        return Integer.compare(r1.num, r2.num);
    };

    public static void main(String[] args) {
        MyInteger[] array = {new MyInteger(0), new MyInteger(1), new MyInteger(null)};
        Random random = new Random();
        for (int length = 0;; length++) {
            for (int attempt = 0; attempt < 100000; attempt++) {
                List<MyInteger> list = new ArrayList<>();
                int[] arr = new int[length];
                for (int k = 0; k < length; k++) {
                    int rand = random.nextInt(3);
                    arr[k] = rand;
                    list.add(array[rand]);
                }
                try {
                    Collections.sort(list, COMPARATOR);
                } catch (Exception e) {
                    System.out.println(arr.length + " " + Arrays.toString(arr));
                    return;
                }
            }
        }
    }
}

questionAnswers(2)

yourAnswerToTheQuestion