private boolean isPointerDataTypeCompatibleWithExistingData(Pointer pdt, Data existingData) {
		DataType existingDT = existingData.getBaseDataType();

		// allow 'upgrading' an integer type to a pointer
		boolean isRightType =
			(existingDT instanceof Pointer) || (existingDT instanceof AbstractIntegerDataType);
		return isRightType && existingDT.getLength() == pdt.getLength();
	}
Logic to test if a Data instance is replaceable with a data type.
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/DWARFDataInstanceHelper.java