public boolean isDataTypeCompatibleWithAddress(DataType dataType, Address address) {
		if (DataUtilities.isUndefinedRange(program, address,
			address.add(dataType.getLength() - 1))) {
			return true;
		}

		Data data = listing.getDataContaining(address);
		if (data == null) {
			return false; 	// will only get null if something is really screwed up
		}
		if (!data.getMinAddress().equals(address)) {
			return false;  // was pointing to something in the middle of an existing data instance
		}
		return isDataTypeCompatibleWithExistingData(dataType, data);
	}
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