Skip to content

Commit f1f5ae4

Browse files
committed
[Java] Tidy up after merge of PR #819.
1 parent dd7f084 commit f1f5ae4

File tree

4 files changed

+16
-26
lines changed

4 files changed

+16
-26
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,8 +2074,7 @@ else if (encoding.primitiveType() == PrimitiveType.UINT8)
20742074
Generators.toUpperFirstChar(propertyName),
20752075
generateArrayFieldNotPresentCondition(propertyToken.version(), indent),
20762076
fieldLength,
2077-
offset
2078-
);
2077+
offset);
20792078

20802079
new Formatter(sb).format("\n" +
20812080
indent + " public int get%s(final %s dst, final int dstOffset, final int length)\n" +
@@ -2089,8 +2088,7 @@ else if (encoding.primitiveType() == PrimitiveType.UINT8)
20892088
fqMutableBuffer,
20902089
generateArrayFieldNotPresentCondition(propertyToken.version(), indent),
20912090
fieldLength,
2092-
offset
2093-
);
2091+
offset);
20942092

20952093
new Formatter(sb).format("\n" +
20962094
indent + " public void wrap%s(final %s wrapBuffer)\n" +
@@ -2103,8 +2101,7 @@ else if (encoding.primitiveType() == PrimitiveType.UINT8)
21032101
readOnlyBuffer,
21042102
fieldLength,
21052103
generateWrapFieldNotPresentCondition(propertyToken.version(), indent),
2106-
offset
2107-
);
2104+
offset);
21082105
}
21092106

21102107
return sb;

sbe-tool/src/test/java/uk/co/real_logic/sbe/generation/java/FixedSizeDataGeneratorTest.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ private Class<?> compile(final String className) throws Exception
166166
private Object getTestMessage2Encoder(final UnsafeBuffer buffer) throws Exception
167167
{
168168
final Object encoder = compile("TestMessage2Encoder").getConstructor().newInstance();
169-
return wrap(0, encoder, buffer, BUFFER_CLASS);
169+
return wrap(encoder, buffer);
170170
}
171171

172172
private Object getTestMessage2Decoder(final UnsafeBuffer buffer, final Object encoder) throws Exception
@@ -186,15 +186,13 @@ private static Object wrap(
186186
return decoder;
187187
}
188188

189-
private static Object wrap(
190-
final int bufferOffset, final Object flyweight, final MutableDirectBuffer buffer, final Class<?> bufferClass)
191-
throws Exception
189+
private static Object wrap(final Object flyweight, final UnsafeBuffer buffer) throws Exception
192190
{
193191
flyweight
194192
.getClass()
195-
.getDeclaredMethod("wrap", bufferClass, int.class)
196-
.invoke(flyweight, buffer, bufferOffset);
193+
.getDeclaredMethod("wrap", BUFFER_CLASS, int.class)
194+
.invoke(flyweight, buffer, 0);
195+
197196
return flyweight;
198197
}
199-
200198
}

sbe-tool/src/test/java/uk/co/real_logic/sbe/generation/java/ReflectionUtil.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import org.agrona.MutableDirectBuffer;
2020
import uk.co.real_logic.sbe.generation.Generators;
2121

22-
public final class ReflectionUtil
22+
final class ReflectionUtil
2323
{
2424
static int getSbeSchemaVersion(final Object encoder) throws Exception
2525
{
@@ -90,12 +90,12 @@ static boolean getCruiseControl(final Object extras) throws Exception
9090
return (boolean)extras.getClass().getMethod("cruiseControl").invoke(extras);
9191
}
9292

93-
public static int getCapacity(final Object flyweight) throws Exception
93+
static int getCapacity(final Object flyweight) throws Exception
9494
{
9595
return getInt(flyweight, "capacity");
9696
}
9797

98-
public static void setCapacity(final Object flyweight, final int value) throws Exception
98+
static void setCapacity(final Object flyweight, final int value) throws Exception
9999
{
100100
flyweight
101101
.getClass()
@@ -156,10 +156,7 @@ static int getDirectBuffer(
156156
.invoke(decoder, dst, dstOffset, length);
157157
}
158158

159-
static void wrapDirectBuffer(
160-
final Object decoder,
161-
final String name,
162-
final DirectBuffer dst) throws Exception
159+
static void wrapDirectBuffer(final Object decoder, final String name, final DirectBuffer dst) throws Exception
163160
{
164161
decoder
165162
.getClass()

sbe-tool/src/test/java/uk/co/real_logic/sbe/generation/java/SchemaExtensionTest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import static uk.co.real_logic.sbe.generation.java.ReflectionUtil.*;
3939
import static uk.co.real_logic.sbe.xml.XmlSchemaParser.parse;
4040

41+
@SuppressWarnings("MethodLength")
4142
public class SchemaExtensionTest
4243
{
4344
private static final Class<?> BUFFER_CLASS = MutableDirectBuffer.class;
@@ -63,7 +64,6 @@ public void setup() throws Exception
6364
generator().generate();
6465
}
6566

66-
@SuppressWarnings("MethodLength")
6767
@Test
6868
public void testMessage1() throws Exception
6969
{
@@ -185,7 +185,6 @@ public void testMessage1() throws Exception
185185
}
186186
}
187187

188-
@SuppressWarnings("MethodLength")
189188
@Test
190189
public void testMessage2() throws Exception
191190
{
@@ -454,19 +453,18 @@ private static Object wrap(
454453
return decoder;
455454
}
456455

457-
private static void wrap(
458-
final int bufferOffset, final Object flyweight, final MutableDirectBuffer buffer, final Class<?> bufferClass)
456+
private static void wrap(final Object flyweight, final UnsafeBuffer buffer, final Class<?> bufferClass)
459457
throws Exception
460458
{
461459
flyweight
462460
.getClass()
463461
.getDeclaredMethod("wrap", bufferClass, int.class)
464-
.invoke(flyweight, buffer, bufferOffset);
462+
.invoke(flyweight, buffer, 0);
465463
}
466464

467465
private static Object wrap(final UnsafeBuffer buffer, final Object encoder) throws Exception
468466
{
469-
wrap(0, encoder, buffer, BUFFER_CLASS);
467+
wrap(encoder, buffer, BUFFER_CLASS);
470468

471469
return encoder;
472470
}

0 commit comments

Comments
 (0)