Shipment/EventListener/AbstractShipmentListener.php
protected function preventForbiddenChange(ShipmentInterface $shipment)
    {
        if ($this->persistenceHelper->isChanged($shipment, 'return')) {
            list($old, $new) = $this->persistenceHelper->getChangeSet($shipment, 'return');
            if ($old != $new) {
                throw new RuntimeException("Changing the shipment type is not yet supported.");
            }
        }
    }
protected function preventForbiddenChange(ShipmentInterface $shipment)
    {
        if ($this->persistenceHelper->isChanged($shipment, 'return')) {
            list($old, $new) = $this->persistenceHelper->getChangeSet($shipment, 'return');
            if ($old != $new) {
                throw new RuntimeException("Changing the shipment type is not yet supported.");
            }
        }
    }
Prevents some of the shipment's fields to change.

@param ShipmentInterface $shipment