code: 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.");
              }
          }
      }
docs: Prevents some of the shipment's fields to change.
  
  @param ShipmentInterface $shipment