@Override
	public void dataTypeReplaced(DataType oldDt, DataType newDt) throws IllegalArgumentException {
		DataType replacementDt = newDt;
		try {
			replacementDt = validateDataType(replacementDt); // blocks DEFAULT use for packed
			replacementDt = replacementDt.clone(dataMgr);
			checkAncestry(replacementDt);
		}
		catch (Exception e) {
			// Handle bad replacement with use of undefined component
			replacementDt = isPackingEnabled() ? Undefined1DataType.dataType : DataType.DEFAULT;
		}

		boolean changed = false;
		for (int i = components.size() - 1; i >= 0; i--) {
			DataTypeComponentImpl comp = components.get(i);
			if (comp.isBitFieldComponent()) {
				changed |= updateBitFieldDataType(comp, oldDt, replacementDt);
			}
			else if (comp.getDataType() == oldDt) {
				setComponentDataType(comp, replacementDt, i);
				changed = true;
			}
		}
		if (changed) {
			repack(false);
			notifySizeChanged(); // also handles alignment change
		}
	}
Replaces the internal components of this structure with components of the given structure
including packing and alignment settings.

@param dataType the structure to get the component information from.
@throws IllegalArgumentException if any of the component data types are not allowed to
            replace a component in this composite data type. For example, suppose dt1
            contains dt2. Therefore it is not valid to replace a dt2 component with dt1 since
            this would cause a cyclic dependency.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/StructureDataType.java