Skip to content

Commit 52a6342

Browse files
committed
[Java] Since version in the IR should be the result of the max of either the field or type rather than just letting the field take precedence.
1 parent ed3aa11 commit 52a6342

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ private void add(final CompositeType type, final int currOffset, final Field fie
221221

222222
if (field != null)
223223
{
224-
builder.version(field.sinceVersion());
224+
builder.version(Math.max(field.sinceVersion(), type.sinceVersion()));
225225
}
226226

227227
tokenList.add(builder.build());
@@ -283,7 +283,7 @@ private void add(final EnumType type, final int offset, final Field field)
283283

284284
if (field != null)
285285
{
286-
builder.version(field.sinceVersion());
286+
builder.version(Math.max(field.sinceVersion(), type.sinceVersion()));
287287
}
288288

289289
tokenList.add(builder.build());
@@ -335,7 +335,7 @@ private void add(final SetType type, final int offset, final Field field)
335335

336336
if (field != null)
337337
{
338-
builder.version(field.sinceVersion());
338+
builder.version(Math.max(field.sinceVersion(), type.sinceVersion()));
339339
}
340340

341341
tokenList.add(builder.build());
@@ -393,7 +393,7 @@ private void add(final EncodedDataType type, final int offset, final Field field
393393

394394
if (field != null && !(field.type() instanceof CompositeType))
395395
{
396-
tokenBuilder.version(field.sinceVersion());
396+
tokenBuilder.version(Math.max(field.sinceVersion(), type.sinceVersion()));
397397
tokenBuilder.deprecated(field.deprecated());
398398

399399
final String description = field.description();

0 commit comments

Comments
 (0)