Skip to content

Commit d587bc4

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents d325cbc + ade3ba2 commit d587bc4

File tree

8 files changed

+22
-40
lines changed

8 files changed

+22
-40
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ subprojects {
128128
dependencies {
129129
checkstyle 'com.puppycrawl.tools:checkstyle:8.25'
130130

131-
compile 'org.agrona:agrona:1.0.9'
131+
compile 'org.agrona:agrona:1.0.10'
132132

133133
testCompile 'org.hamcrest:hamcrest:2.1'
134134
testCompile 'org.mockito:mockito-core:3.1.0'

sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaGenerator.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,16 +1477,14 @@ private CharSequence generateEnumLookupMethod(final List<Token> tokens, final St
14771477
sb.append(" case ").append(constStr).append(": return ").append(name).append(";\n");
14781478
}
14791479

1480+
final String nullValue = tokens.get(0).encoding().applicableNullValue().toString();
1481+
sb.append(" case ").append(nullValue).append(": return NULL_VAL").append(";\n");
1482+
14801483
final String handleUnknownLogic = shouldDecodeUnknownEnumValues ?
14811484
INDENT + INDENT + "return SBE_UNKNOWN;\n" :
14821485
INDENT + INDENT + "throw new IllegalArgumentException(\"Unknown value: \" + value);\n";
14831486

1484-
final String nullValue = tokens.get(0).encoding().applicableNullValue().toString();
14851487
sb.append(" }\n\n")
1486-
.append(" if (").append(generateLiteral(primitiveType, nullValue)).append(" == value)\n")
1487-
.append(" {\n")
1488-
.append(" return NULL_VAL;\n")
1489-
.append(" }\n\n")
14901488
.append(handleUnknownLogic)
14911489
.append(" }\n");
14921490

sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/generated/ByteOrderCodec.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ public static ByteOrderCodec get(final short value)
3333
{
3434
case 0: return SBE_LITTLE_ENDIAN;
3535
case 1: return SBE_BIG_ENDIAN;
36-
}
37-
38-
if ((short)255 == value)
39-
{
40-
return NULL_VAL;
36+
case 255: return NULL_VAL;
4137
}
4238

4339
throw new IllegalArgumentException("Unknown value: " + value);

sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/generated/FrameCodecDecoder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,13 +592,13 @@ public StringBuilder appendTo(final StringBuilder builder)
592592
builder.append(schemaVersion());
593593
builder.append('|');
594594
builder.append("packageName=");
595-
builder.append('\'' + packageName() + '\'');
595+
builder.append('\'').append(packageName()).append('\'');
596596
builder.append('|');
597597
builder.append("namespaceName=");
598-
builder.append('\'' + namespaceName() + '\'');
598+
builder.append('\'').append(namespaceName()).append('\'');
599599
builder.append('|');
600600
builder.append("semanticVersion=");
601-
builder.append('\'' + semanticVersion() + '\'');
601+
builder.append('\'').append(semanticVersion()).append('\'');
602602

603603
limit(originalLimit);
604604

sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/generated/PresenceCodec.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ public static PresenceCodec get(final short value)
3636
case 0: return SBE_REQUIRED;
3737
case 1: return SBE_OPTIONAL;
3838
case 2: return SBE_CONSTANT;
39-
}
40-
41-
if ((short)255 == value)
42-
{
43-
return NULL_VAL;
39+
case 255: return NULL_VAL;
4440
}
4541

4642
throw new IllegalArgumentException("Unknown value: " + value);

sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/generated/PrimitiveTypeCodec.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,7 @@ public static PrimitiveTypeCodec get(final short value)
6363
case 9: return UINT64;
6464
case 10: return FLOAT;
6565
case 11: return DOUBLE;
66-
}
67-
68-
if ((short)255 == value)
69-
{
70-
return NULL_VAL;
66+
case 255: return NULL_VAL;
7167
}
7268

7369
throw new IllegalArgumentException("Unknown value: " + value);

sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/generated/SignalCodec.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,7 @@ public static SignalCodec get(final short value)
7878
case 15: return BEGIN_VAR_DATA;
7979
case 16: return END_VAR_DATA;
8080
case 17: return ENCODING;
81-
}
82-
83-
if ((short)255 == value)
84-
{
85-
return NULL_VAL;
81+
case 255: return NULL_VAL;
8682
}
8783

8884
throw new IllegalArgumentException("Unknown value: " + value);

sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/generated/TokenCodecDecoder.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,37 +1731,37 @@ public StringBuilder appendTo(final StringBuilder builder)
17311731
builder.append(deprecated());
17321732
builder.append('|');
17331733
builder.append("name=");
1734-
builder.append('\'' + name() + '\'');
1734+
builder.append('\'').append(name()).append('\'');
17351735
builder.append('|');
17361736
builder.append("constValue=");
1737-
builder.append('\'' + constValue() + '\'');
1737+
builder.append('\'').append(constValue()).append('\'');
17381738
builder.append('|');
17391739
builder.append("minValue=");
1740-
builder.append('\'' + minValue() + '\'');
1740+
builder.append('\'').append(minValue()).append('\'');
17411741
builder.append('|');
17421742
builder.append("maxValue=");
1743-
builder.append('\'' + maxValue() + '\'');
1743+
builder.append('\'').append(maxValue()).append('\'');
17441744
builder.append('|');
17451745
builder.append("nullValue=");
1746-
builder.append('\'' + nullValue() + '\'');
1746+
builder.append('\'').append(nullValue()).append('\'');
17471747
builder.append('|');
17481748
builder.append("characterEncoding=");
1749-
builder.append('\'' + characterEncoding() + '\'');
1749+
builder.append('\'').append(characterEncoding()).append('\'');
17501750
builder.append('|');
17511751
builder.append("epoch=");
1752-
builder.append('\'' + epoch() + '\'');
1752+
builder.append('\'').append(epoch()).append('\'');
17531753
builder.append('|');
17541754
builder.append("timeUnit=");
1755-
builder.append('\'' + timeUnit() + '\'');
1755+
builder.append('\'').append(timeUnit()).append('\'');
17561756
builder.append('|');
17571757
builder.append("semanticType=");
1758-
builder.append('\'' + semanticType() + '\'');
1758+
builder.append('\'').append(semanticType()).append('\'');
17591759
builder.append('|');
17601760
builder.append("description=");
1761-
builder.append('\'' + description() + '\'');
1761+
builder.append('\'').append(description()).append('\'');
17621762
builder.append('|');
17631763
builder.append("referencedName=");
1764-
builder.append('\'' + referencedName() + '\'');
1764+
builder.append('\'').append(referencedName()).append('\'');
17651765

17661766
limit(originalLimit);
17671767

0 commit comments

Comments
 (0)