Closed
Description
If a SBE template new version updates an enum by adding a value to it ; then the generated code for the previous version will throw an exception when trying to decode the enum.
For example:
public static BlockTradeCode_enum get(final byte value)
{
switch (value)
{
case 66: return Block_Trade;
case 78: return Regular_trade_or_Negotiated_deal;
case 45: return Undefined;
}
if ((byte)0 == value)
{
return NULL_VAL;
}
throw new IllegalArgumentException("Unknown value: " + value);
}
Is this by design ?
An alternative would be to add the UNKNOWN value for the enum and return it instead of throwing, so existing code won't break in that case.
Metadata
Metadata
Assignees
Labels
No labels