Skip to content

Commit 567e716

Browse files
committed
[Java] Carry forward sinceVersion and description in IR for valid values and bit set choices. Issue aeron-io#414.
1 parent c6822f1 commit 567e716

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/IrGenerator.java

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -278,31 +278,27 @@ private void add(final EnumType type, final int offset, final Field field)
278278

279279
for (final EnumType.ValidValue validValue : type.validValues())
280280
{
281-
add(validValue, encodingType, field);
281+
add(validValue, encodingType);
282282
}
283283

284284
builder.signal(Signal.END_ENUM);
285285

286286
tokenList.add(builder.build());
287287
}
288288

289-
private void add(final EnumType.ValidValue value, final PrimitiveType encodingType, final Field field)
289+
private void add(final EnumType.ValidValue value, final PrimitiveType encodingType)
290290
{
291291
final Token.Builder builder = new Token.Builder()
292292
.signal(Signal.VALID_VALUE)
293293
.name(value.name())
294+
.version(value.sinceVersion())
295+
.description(value.description())
294296
.encoding(new Encoding.Builder()
295297
.byteOrder(byteOrder)
296298
.primitiveType(encodingType)
297299
.constValue(value.primitiveValue())
298300
.build());
299301

300-
if (field != null)
301-
{
302-
builder.version(field.sinceVersion());
303-
builder.description(field.description());
304-
}
305-
306302
tokenList.add(builder.build());
307303
}
308304

@@ -330,30 +326,27 @@ private void add(final SetType type, final int offset, final Field field)
330326

331327
for (final SetType.Choice choice : type.choices())
332328
{
333-
add(choice, encodingType, field);
329+
add(choice, encodingType);
334330
}
335331

336332
builder.signal(Signal.END_SET);
337333

338334
tokenList.add(builder.build());
339335
}
340336

341-
private void add(final SetType.Choice value, final PrimitiveType encodingType, final Field field)
337+
private void add(final SetType.Choice value, final PrimitiveType encodingType)
342338
{
343339
final Token.Builder builder = new Token.Builder()
344340
.signal(Signal.CHOICE)
345341
.name(value.name())
342+
.description(value.description())
343+
.version(value.sinceVersion())
346344
.encoding(new Encoding.Builder()
347345
.constValue(value.primitiveValue())
348346
.byteOrder(byteOrder)
349347
.primitiveType(encodingType)
350348
.build());
351349

352-
if (field != null)
353-
{
354-
builder.version(field.sinceVersion());
355-
}
356-
357350
tokenList.add(builder.build());
358351
}
359352

0 commit comments

Comments
 (0)