public static List<? extends MethodContract> toNonIntersectingContracts(List<? extends MethodContract> contracts) {
    if (contracts.size() == 1) return contracts;
    if (contracts.stream().allMatch(StandardMethodContract.class::isInstance)) {
      @SuppressWarnings("unchecked") List<StandardMethodContract> standardContracts = (List<StandardMethodContract>)contracts;
      return StandardMethodContract.toNonIntersectingStandardContracts(standardContracts);
    }
    if (contracts.size() == 2 && contracts.get(1).isTrivial()) {
      List<MethodContract> result = new ArrayList<>();
      result.add(contracts.get(0));
      List<ContractValue> conditions = contracts.get(0).getConditions();
      for (ContractValue condition : conditions) {
        ContractValue inverted = condition.invert();
        if (inverted == null) {
          return null;
        }
        result.add(singleConditionContract(inverted, contracts.get(1).getReturnValue()));
      }
      return result;
    }
    return null;
  }
public static List<? extends MethodContract> toNonIntersectingContracts(List<? extends MethodContract> contracts)