@Override
	public void dataTypeReplaced(DataType oldDt, DataType newDt) {
		lock.acquire();
		try {
			checkIsValid();
			if (newDt == this || newDt.getLength() < 0) {
				newDt = DataType.DEFAULT;
			}

			if (oldDt == getDataType()) {

				int oldElementLength = getElementLength();
				int newElementLength =
					elementLength = newDt.getLength() < 0 ? oldElementLength : -1;

				// check for existing pointer to newDt
				ArrayDataType newArray =
					new ArrayDataType(newDt, getNumElements(), newElementLength, dataMgr);
				DataType existingArray =
					dataMgr.getDataType(newDt.getCategoryPath(), newArray.getName());
				if (existingArray != null && existingArray != this) {
					// avoid duplicate array - replace this array with existing one
					dataMgr.addDataTypeToReplace(this, existingArray);
					return;
				}

				if (!newDt.getCategoryPath().equals(oldDt.getCategoryPath())) {
					// move this pointer to same category as newDt
					try {
						super.setCategoryPath(newDt.getCategoryPath());
					}
					catch (DuplicateNameException e) {
						throw new RuntimeException(e); // already checked
					}
				}

				oldDt.removeParent(this);
				newDt.addParent(this);

				String myOldName = getOldName();
				int oldLength = getLength();
				int oldAlignment = getAlignment();

				record.setLongValue(ArrayDBAdapter.ARRAY_DT_ID_COL, dataMgr.getResolvedID(newDt));
				if (newDt instanceof Dynamic || newDt instanceof FactoryDataType) {
					newDt = DataType.DEFAULT;
				}
				elementLength = newDt.getLength() < 0 ? oldElementLength : -1;
				record.setIntValue(ArrayDBAdapter.ARRAY_ELEMENT_LENGTH_COL, elementLength);
				try {
					adapter.updateRecord(record);
				}
				catch (IOException e) {
					dataMgr.dbError(e);
				}
				refreshName();
				if (!oldDt.getName().equals(newDt.getName())) {
					notifyNameChanged(myOldName);
				}
				if (getLength() != oldLength || oldElementLength != getElementLength()) {
					notifySizeChanged(false);
				}
				else if (getAlignment() != oldAlignment) {
					notifyAlignmentChanged(false);
				}
				else {
					dataMgr.dataTypeChanged(this, false);
				}
			}
		}
		finally {
			lock.release();
		}
	}
Constructor
@param dataMgr
@param cache
@param adapter
@param record
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/data/ArrayDB.java