diff --git a/java_tools/configuration_definition/src/main/java/com/rusefi/EnumPair.java b/java_tools/configuration_definition/src/main/java/com/rusefi/EnumPair.java index 32b7437451..64dcf1ff2e 100644 --- a/java_tools/configuration_definition/src/main/java/com/rusefi/EnumPair.java +++ b/java_tools/configuration_definition/src/main/java/com/rusefi/EnumPair.java @@ -16,4 +16,10 @@ public class EnumPair { public String getArrayForm() { return arrayForm; } + + public boolean isEmpty() { + if (arrayForm.isEmpty() ^ keyValueForm.isEmpty()) + throw new IllegalStateException("Expecting either both empty or both not empty [" + arrayForm + "][" + keyValueForm + "]"); + return arrayForm.isEmpty(); + } } diff --git a/java_tools/configuration_definition/src/main/java/com/rusefi/pinout/PinoutLogic.java b/java_tools/configuration_definition/src/main/java/com/rusefi/pinout/PinoutLogic.java index 7478f40291..0056bb35de 100644 --- a/java_tools/configuration_definition/src/main/java/com/rusefi/pinout/PinoutLogic.java +++ b/java_tools/configuration_definition/src/main/java/com/rusefi/pinout/PinoutLogic.java @@ -81,7 +81,7 @@ public class PinoutLogic { String nothingName = namePinType.getNothingName(); EnumsReader.EnumState enumList = enumsReader.getEnums().get(pinType); EnumPair pair = enumToOptionsList(nothingName, enumList, kv.getValue()); - if (pair.getArrayForm().length() > 0) { + if (!pair.isEmpty()) { // we seem to be here if specific pin category like switch_inputs has no pins parseState.addDefinition(registry, outputEnumName + KEY_VALUE_FORMAT_ENUM, pair.getKeyValueForm(), Definition.OverwritePolicy.IgnoreNew); }