private boolean isEnumDataTypeCompatibleWithExistingData(Enum enumDT, Data existingData) {
		// This is a very fuzzy check to see if the value located at address is compatible.
		// Match if its an enum or integer with correct size.  The details about enum
		// members are ignored.
		DataType existingDT = existingData.getBaseDataType();
		if (!(existingDT instanceof Enum || existingDT instanceof AbstractIntegerDataType)) {
			return false;
		}
		if (existingDT instanceof BooleanDataType) {
			return false;
		}
		if (existingDT.getLength() != enumDT.getLength()) {
			return false;
		}
		return true;
	}
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