@Override
	public void replaceWith(DataType dataType) throws IllegalArgumentException {
		if (!(dataType instanceof UnionInternal)) {
			throw new IllegalArgumentException();
		}

		UnionInternal union = (UnionInternal) dataType;

		for (DataTypeComponent dtc : components) {
			dtc.getDataType().removeParent(this);
		}
		components.clear();
		unionAlignment = -1;

		this.packing = union.getStoredPackingValue();
		this.minimumAlignment = union.getStoredMinimumAlignment();

		DataTypeComponent[] compArray = union.getComponents();
		for (DataTypeComponent dtc : compArray) {
			DataType dt = dtc.getDataType();
			doAdd(dt, dtc.getLength(), dtc.getFieldName(), dtc.getComment());
		}

		repack(false);
		notifySizeChanged(); // assume size and/or alignment changed
	}
Construct a new UnionDataType.
NOTE: A constructor form which accepts a {@link DataTypeManager} should be used when possible
since there may be performance benefits during datatype resolution.
@param name the name of this dataType
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/UnionDataType.java