From b652fcc3a7708f0cf5027748fd4d2df134eb6974 Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Fri, 31 May 2019 13:00:55 -0700 Subject: [PATCH] Break internal Java/C# APIs This is done on purpose, to avoid API version mismatches that can cause bad decoding results, see: https://github.com/google/flatbuffers/issues/5368 Change-Id: I2c857438377e080caad0e2d8bcc758c9b19bd6ec --- .../google/flatbuffers/FlatBufferBuilder.java | 8 +-- net/FlatBuffers/FlatBufferBuilder.cs | 10 +-- src/idl_gen_general.cpp | 6 +- .../FlatBufferBuilderTests.cs | 2 +- .../FlatBuffers.Test/FlatBuffersFuzzTests.cs | 72 +++++++++---------- tests/MyGame/Example/Monster.cs | 4 +- tests/MyGame/Example/Monster.java | 4 +- tests/MyGame/Example/Referrable.cs | 6 +- tests/MyGame/Example/Referrable.java | 6 +- tests/MyGame/Example/Stat.cs | 6 +- tests/MyGame/Example/Stat.java | 6 +- .../MyGame/Example/TestSimpleTableWithEnum.cs | 6 +- .../Example/TestSimpleTableWithEnum.java | 6 +- tests/MyGame/Example/TypeAliases.cs | 6 +- tests/MyGame/Example/TypeAliases.java | 6 +- tests/MyGame/Example2/Monster.cs | 4 +- tests/MyGame/Example2/Monster.java | 4 +- tests/MyGame/InParentNamespace.cs | 4 +- tests/MyGame/InParentNamespace.java | 4 +- tests/MyGame/MonsterExtra.cs | 6 +- tests/MyGame/MonsterExtra.java | 6 +- .../NamespaceA/NamespaceB/TableInNestedNS.cs | 6 +- .../NamespaceB/TableInNestedNS.java | 6 +- .../NamespaceA/SecondTableInA.cs | 6 +- .../NamespaceA/SecondTableInA.java | 6 +- .../NamespaceA/TableInFirstNS.cs | 4 +- .../NamespaceA/TableInFirstNS.java | 4 +- tests/namespace_test/NamespaceC/TableInC.cs | 6 +- tests/namespace_test/NamespaceC/TableInC.java | 6 +- tests/union_vector/Attacker.cs | 6 +- tests/union_vector/Attacker.java | 6 +- tests/union_vector/Movie.cs | 6 +- tests/union_vector/Movie.java | 6 +- 33 files changed, 125 insertions(+), 125 deletions(-) diff --git a/java/com/google/flatbuffers/FlatBufferBuilder.java b/java/com/google/flatbuffers/FlatBufferBuilder.java index 9f3ae20ec..f224610c2 100644 --- a/java/com/google/flatbuffers/FlatBufferBuilder.java +++ b/java/com/google/flatbuffers/FlatBufferBuilder.java @@ -632,7 +632,7 @@ public class FlatBufferBuilder { * * @param numfields The number of fields found in this object. */ - public void startObject(int numfields) { + public void startTable(int numfields) { notNested(); if (vtable == null || vtable.length < numfields) vtable = new int[numfields]; vtable_in_use = numfields; @@ -757,11 +757,11 @@ public class FlatBufferBuilder { * Finish off writing the object that is under construction. * * @return The offset to the object inside {@link #dataBuffer()}. - * @see #startObject(int) + * @see #startTable(int) */ - public int endObject() { + public int endTable() { if (vtable == null || !nested) - throw new AssertionError("FlatBuffers: endObject called without startObject"); + throw new AssertionError("FlatBuffers: endTable called without startTable"); addInt(0); int vtableloc = offset(); // Write out the current vtable. diff --git a/net/FlatBuffers/FlatBufferBuilder.cs b/net/FlatBuffers/FlatBufferBuilder.cs index 908352d4d..07e3180fd 100644 --- a/net/FlatBuffers/FlatBufferBuilder.cs +++ b/net/FlatBuffers/FlatBufferBuilder.cs @@ -195,7 +195,7 @@ namespace FlatBuffers } /// - /// Puts an array of type T into this builder at the + /// Puts an array of type T into this builder at the /// current offset /// /// The type of the input data @@ -208,7 +208,7 @@ namespace FlatBuffers #if ENABLE_SPAN_T /// - /// Puts a span of type T into this builder at the + /// Puts a span of type T into this builder at the /// current offset /// /// The type of the input data @@ -411,7 +411,7 @@ namespace FlatBuffers "FlatBuffers: object serialization must not be nested."); } - public void StartObject(int numfields) + public void StartTable(int numfields) { if (numfields < 0) throw new ArgumentOutOfRangeException("Flatbuffers: invalid numfields"); @@ -621,11 +621,11 @@ namespace FlatBuffers } } - public int EndObject() + public int EndTable() { if (_vtableSize < 0) throw new InvalidOperationException( - "Flatbuffers: calling endObject without a startObject"); + "Flatbuffers: calling EndTable without a StartTable"); AddInt((int)0); var vtableloc = Offset; diff --git a/src/idl_gen_general.cpp b/src/idl_gen_general.cpp index 92a9a8799..e25eebaa8 100644 --- a/src/idl_gen_general.cpp +++ b/src/idl_gen_general.cpp @@ -1308,7 +1308,7 @@ class GeneralGenerator : public BaseGenerator { } } code += ") {\n builder."; - code += FunctionStart('S') + "tartObject("; + code += FunctionStart('S') + "tartTable("; code += NumToString(struct_def.fields.vec.size()) + ");\n"; for (size_t size = struct_def.sortbysize ? sizeof(largest_scalar_t) : 1; size; size /= 2) { @@ -1338,7 +1338,7 @@ class GeneralGenerator : public BaseGenerator { code += " public static void " + FunctionStart('S') + "tart"; code += struct_def.name; code += "(FlatBufferBuilder builder) { builder."; - code += FunctionStart('S') + "tartObject("; + code += FunctionStart('S') + "tartTable("; code += NumToString(struct_def.fields.vec.size()) + "); }\n"; for (auto it = struct_def.fields.vec.begin(); it != struct_def.fields.vec.end(); ++it) { @@ -1422,7 +1422,7 @@ class GeneralGenerator : public BaseGenerator { code += " public static " + GenOffsetType(struct_def) + " "; code += FunctionStart('E') + "nd" + struct_def.name; code += "(FlatBufferBuilder builder) {\n int o = builder."; - code += FunctionStart('E') + "ndObject();\n"; + code += FunctionStart('E') + "ndTable();\n"; for (auto it = struct_def.fields.vec.begin(); it != struct_def.fields.vec.end(); ++it) { auto &field = **it; diff --git a/tests/FlatBuffers.Test/FlatBufferBuilderTests.cs b/tests/FlatBuffers.Test/FlatBufferBuilderTests.cs index 4ddd9a8cb..d2f49f7b7 100644 --- a/tests/FlatBuffers.Test/FlatBufferBuilderTests.cs +++ b/tests/FlatBuffers.Test/FlatBufferBuilderTests.cs @@ -24,7 +24,7 @@ namespace FlatBuffers.Test private FlatBufferBuilder CreateBuffer(bool forceDefaults = true) { var fbb = new FlatBufferBuilder(16) {ForceDefaults = forceDefaults}; - fbb.StartObject(1); + fbb.StartTable(1); return fbb; } diff --git a/tests/FlatBuffers.Test/FlatBuffersFuzzTests.cs b/tests/FlatBuffers.Test/FlatBuffersFuzzTests.cs index 1bb391423..b6c60ea6d 100644 --- a/tests/FlatBuffers.Test/FlatBuffersFuzzTests.cs +++ b/tests/FlatBuffers.Test/FlatBuffersFuzzTests.cs @@ -174,9 +174,9 @@ namespace FlatBuffers.Test public void TestEmptyVTable() { var builder = new FlatBufferBuilder(1); - builder.StartObject(0); + builder.StartTable(0); Assert.ArrayEqual(new byte[] { 0 }, builder.DataBuffer.ToFullArray()); - builder.EndObject(); + builder.EndTable(); Assert.ArrayEqual(new byte[] { 4, 0, 4, 0, @@ -189,10 +189,10 @@ namespace FlatBuffers.Test public void TestVTableWithOneBool() { var builder = new FlatBufferBuilder(1); - builder.StartObject(1); + builder.StartTable(1); Assert.ArrayEqual(new byte[] { 0 }, builder.DataBuffer.ToFullArray()); builder.AddBool(0, true, false); - builder.EndObject(); + builder.EndTable(); Assert.ArrayEqual(new byte[] { 0, 0, // padding to 16 bytes @@ -210,10 +210,10 @@ namespace FlatBuffers.Test public void TestVTableWithOneBool_DefaultValue() { var builder = new FlatBufferBuilder(1); - builder.StartObject(1); + builder.StartTable(1); Assert.ArrayEqual(new byte[] { 0 }, builder.DataBuffer.ToFullArray()); builder.AddBool(0, false, false); - builder.EndObject(); + builder.EndTable(); Assert.ArrayEqual(new byte[] { // No padding. @@ -229,10 +229,10 @@ namespace FlatBuffers.Test public void TestVTableWithOneInt16() { var builder = new FlatBufferBuilder(1); - builder.StartObject(1); + builder.StartTable(1); Assert.ArrayEqual(new byte[] { 0 }, builder.DataBuffer.ToFullArray()); builder.AddShort(0, 0x789A, 0); - builder.EndObject(); + builder.EndTable(); Assert.ArrayEqual(new byte[] { 0, 0, // padding to 16 bytes @@ -250,11 +250,11 @@ namespace FlatBuffers.Test public void TestVTableWithTwoInt16() { var builder = new FlatBufferBuilder(1); - builder.StartObject(2); + builder.StartTable(2); Assert.ArrayEqual(new byte[] { 0 }, builder.DataBuffer.ToFullArray()); builder.AddShort(0, 0x3456, 0); builder.AddShort(1, 0x789A, 0); - builder.EndObject(); + builder.EndTable(); Assert.ArrayEqual(new byte[] { 8, 0, // vtable bytes @@ -272,11 +272,11 @@ namespace FlatBuffers.Test public void TestVTableWithInt16AndBool() { var builder = new FlatBufferBuilder(1); - builder.StartObject(2); + builder.StartTable(2); Assert.ArrayEqual(new byte[] { 0 }, builder.DataBuffer.ToFullArray()); builder.AddShort(0, 0x3456, 0); builder.AddBool(1, true, false); - builder.EndObject(); + builder.EndTable(); Assert.ArrayEqual(new byte[] { 8, 0, // vtable bytes @@ -297,10 +297,10 @@ namespace FlatBuffers.Test builder.StartVector(sizeof(byte), 0, 1); var vecEnd = builder.EndVector(); - builder.StartObject(1); + builder.StartTable(1); builder.AddOffset(0, vecEnd.Value, 0); - builder.EndObject(); + builder.EndTable(); Assert.ArrayEqual(new byte[] { 0, 0, 0, 0, @@ -324,10 +324,10 @@ namespace FlatBuffers.Test builder.StartVector(sizeof(byte), 0, 1); var vecEnd = builder.EndVector(); - builder.StartObject(2); + builder.StartTable(2); builder.AddShort(0, 55, 0); builder.AddOffset(1, vecEnd.Value, 0); - builder.EndObject(); + builder.EndTable(); Assert.ArrayEqual(new byte[] { 0, 0, 0, 0, @@ -354,10 +354,10 @@ namespace FlatBuffers.Test builder.AddShort(0x5678); var vecEnd = builder.EndVector(); - builder.StartObject(2); + builder.StartTable(2); builder.AddOffset(1, vecEnd.Value, 0); builder.AddShort(0, 55, 0); - builder.EndObject(); + builder.EndTable(); Assert.ArrayEqual(new byte[] { 0, 0, 0, 0, // Padding to 32 bytes @@ -379,7 +379,7 @@ namespace FlatBuffers.Test public void TestVTableWithAStruct_of_int8_int16_int32() { var builder = new FlatBufferBuilder(1); - builder.StartObject(1); + builder.StartTable(1); builder.Prep(4+4+4, 0); builder.AddSbyte(55); builder.Pad(3); @@ -388,7 +388,7 @@ namespace FlatBuffers.Test builder.AddInt(0x12345678); var structStart = builder.Offset; builder.AddStruct(0, structStart, 0); - builder.EndObject(); + builder.EndTable(); Assert.ArrayEqual(new byte[] { 0, 0, 0, 0, @@ -416,9 +416,9 @@ namespace FlatBuffers.Test builder.AddByte(66); var vecEnd = builder.EndVector(); - builder.StartObject(1); + builder.StartTable(1); builder.AddOffset(0, vecEnd.Value, 0); - builder.EndObject(); + builder.EndTable(); Assert.ArrayEqual(new byte[] { @@ -443,10 +443,10 @@ namespace FlatBuffers.Test public void TestVTableWithSomeElements() { var builder = new FlatBufferBuilder(1); - builder.StartObject(2); + builder.StartTable(2); builder.AddByte(0, 33, 0); builder.AddShort(1, 66, 0); - var off = builder.EndObject(); + var off = builder.EndTable(); builder.Finish(off); byte[] padded = new byte[] @@ -476,17 +476,17 @@ namespace FlatBuffers.Test public void TestTwoFinishTable() { var builder = new FlatBufferBuilder(1); - builder.StartObject(2); + builder.StartTable(2); builder.AddByte(0, 33, 0); builder.AddByte(1, 44, 0); - var off0 = builder.EndObject(); + var off0 = builder.EndTable(); builder.Finish(off0); - builder.StartObject(3); + builder.StartTable(3); builder.AddByte(0, 55, 0); builder.AddByte(1, 66, 0); builder.AddByte(2, 77, 0); - var off1 = builder.EndObject(); + var off1 = builder.EndTable(); builder.Finish(off1); Assert.ArrayEqual(new byte[] @@ -527,12 +527,12 @@ namespace FlatBuffers.Test public void TestBunchOfBools() { var builder = new FlatBufferBuilder(1); - builder.StartObject(8); + builder.StartTable(8); for (var i = 0; i < 8; i++) { builder.AddBool(i, true, false); } - var off = builder.EndObject(); + var off = builder.EndTable(); builder.Finish(off); byte[] padded = new byte[] @@ -575,12 +575,12 @@ namespace FlatBuffers.Test public void TestBunchOfBoolsSizePrefixed() { var builder = new FlatBufferBuilder(1); - builder.StartObject(8); + builder.StartTable(8); for (var i = 0; i < 8; i++) { builder.AddBool(i, true, false); } - var off = builder.EndObject(); + var off = builder.EndTable(); builder.FinishSizePrefixed(off); byte[] padded = new byte[] @@ -623,9 +623,9 @@ namespace FlatBuffers.Test public void TestWithFloat() { var builder = new FlatBufferBuilder(1); - builder.StartObject(1); + builder.StartTable(1); builder.AddFloat(0, 1, 0); - builder.EndObject(); + builder.EndTable(); Assert.ArrayEqual(new byte[] @@ -653,7 +653,7 @@ namespace FlatBuffers.Test for (var i = 0; i < objectCount; ++i) { - builder.StartObject(fieldCount); + builder.StartTable(fieldCount); for (var j = 0; j < fieldCount; ++j) { @@ -722,7 +722,7 @@ namespace FlatBuffers.Test } - var offset = builder.EndObject(); + var offset = builder.EndTable(); // Store the object offset objects[i] = offset; diff --git a/tests/MyGame/Example/Monster.cs b/tests/MyGame/Example/Monster.cs index dcb61dc38..2d0e27428 100644 --- a/tests/MyGame/Example/Monster.cs +++ b/tests/MyGame/Example/Monster.cs @@ -188,7 +188,7 @@ public struct Monster : IFlatbufferObject public Color[] GetVectorOfEnumsArray() { return __p.__vector_as_array(98); } public bool MutateVectorOfEnums(int j, Color vector_of_enums) { int o = __p.__offset(98); if (o != 0) { __p.bb.Put(__p.__vector(o) + j * 1, (byte)vector_of_enums); return true; } else { return false; } } - public static void StartMonster(FlatBufferBuilder builder) { builder.StartObject(48); } + public static void StartMonster(FlatBufferBuilder builder) { builder.StartTable(48); } public static void AddPos(FlatBufferBuilder builder, Offset posOffset) { builder.AddStruct(0, posOffset.Value, 0); } public static void AddMana(FlatBufferBuilder builder, short mana) { builder.AddShort(1, mana, 150); } public static void AddHp(FlatBufferBuilder builder, short hp) { builder.AddShort(2, hp, 100); } @@ -285,7 +285,7 @@ public struct Monster : IFlatbufferObject public static VectorOffset CreateVectorOfEnumsVectorBlock(FlatBufferBuilder builder, Color[] data) { builder.StartVector(1, data.Length, 1); builder.Add(data); return builder.EndVector(); } public static void StartVectorOfEnumsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(1, numElems, 1); } public static Offset EndMonster(FlatBufferBuilder builder) { - int o = builder.EndObject(); + int o = builder.EndTable(); builder.Required(o, 10); // name return new Offset(o); } diff --git a/tests/MyGame/Example/Monster.java b/tests/MyGame/Example/Monster.java index 1d7d994cd..e1208d735 100644 --- a/tests/MyGame/Example/Monster.java +++ b/tests/MyGame/Example/Monster.java @@ -159,7 +159,7 @@ public final class Monster extends Table { public ByteBuffer vectorOfEnumsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 98, 1); } public boolean mutateVectorOfEnums(int j, int vector_of_enums) { int o = __offset(98); if (o != 0) { bb.put(__vector(o) + j * 1, (byte)vector_of_enums); return true; } else { return false; } } - public static void startMonster(FlatBufferBuilder builder) { builder.startObject(48); } + public static void startMonster(FlatBufferBuilder builder) { builder.startTable(48); } public static void addPos(FlatBufferBuilder builder, int posOffset) { builder.addStruct(0, posOffset, 0); } public static void addMana(FlatBufferBuilder builder, short mana) { builder.addShort(1, mana, 150); } public static void addHp(FlatBufferBuilder builder, short hp) { builder.addShort(2, hp, 100); } @@ -241,7 +241,7 @@ public final class Monster extends Table { public static int createVectorOfEnumsVector(FlatBufferBuilder builder, byte[] data) { builder.startVector(1, data.length, 1); for (int i = data.length - 1; i >= 0; i--) builder.addByte(data[i]); return builder.endVector(); } public static void startVectorOfEnumsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); } public static int endMonster(FlatBufferBuilder builder) { - int o = builder.endObject(); + int o = builder.endTable(); builder.required(o, 10); // name return o; } diff --git a/tests/MyGame/Example/Referrable.cs b/tests/MyGame/Example/Referrable.cs index 5e1726bc9..0dc5f4443 100644 --- a/tests/MyGame/Example/Referrable.cs +++ b/tests/MyGame/Example/Referrable.cs @@ -22,15 +22,15 @@ public struct Referrable : IFlatbufferObject public static Offset CreateReferrable(FlatBufferBuilder builder, ulong id = 0) { - builder.StartObject(1); + builder.StartTable(1); Referrable.AddId(builder, id); return Referrable.EndReferrable(builder); } - public static void StartReferrable(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void StartReferrable(FlatBufferBuilder builder) { builder.StartTable(1); } public static void AddId(FlatBufferBuilder builder, ulong id) { builder.AddUlong(0, id, 0); } public static Offset EndReferrable(FlatBufferBuilder builder) { - int o = builder.EndObject(); + int o = builder.EndTable(); return new Offset(o); } diff --git a/tests/MyGame/Example/Referrable.java b/tests/MyGame/Example/Referrable.java index 4901c4302..135cba3a5 100644 --- a/tests/MyGame/Example/Referrable.java +++ b/tests/MyGame/Example/Referrable.java @@ -19,15 +19,15 @@ public final class Referrable extends Table { public static int createReferrable(FlatBufferBuilder builder, long id) { - builder.startObject(1); + builder.startTable(1); Referrable.addId(builder, id); return Referrable.endReferrable(builder); } - public static void startReferrable(FlatBufferBuilder builder) { builder.startObject(1); } + public static void startReferrable(FlatBufferBuilder builder) { builder.startTable(1); } public static void addId(FlatBufferBuilder builder, long id) { builder.addLong(0, id, 0L); } public static int endReferrable(FlatBufferBuilder builder) { - int o = builder.endObject(); + int o = builder.endTable(); return o; } diff --git a/tests/MyGame/Example/Stat.cs b/tests/MyGame/Example/Stat.cs index 34f04c4de..6148bed9a 100644 --- a/tests/MyGame/Example/Stat.cs +++ b/tests/MyGame/Example/Stat.cs @@ -33,19 +33,19 @@ public struct Stat : IFlatbufferObject StringOffset idOffset = default(StringOffset), long val = 0, ushort count = 0) { - builder.StartObject(3); + builder.StartTable(3); Stat.AddVal(builder, val); Stat.AddId(builder, idOffset); Stat.AddCount(builder, count); return Stat.EndStat(builder); } - public static void StartStat(FlatBufferBuilder builder) { builder.StartObject(3); } + public static void StartStat(FlatBufferBuilder builder) { builder.StartTable(3); } public static void AddId(FlatBufferBuilder builder, StringOffset idOffset) { builder.AddOffset(0, idOffset.Value, 0); } public static void AddVal(FlatBufferBuilder builder, long val) { builder.AddLong(1, val, 0); } public static void AddCount(FlatBufferBuilder builder, ushort count) { builder.AddUshort(2, count, 0); } public static Offset EndStat(FlatBufferBuilder builder) { - int o = builder.EndObject(); + int o = builder.EndTable(); return new Offset(o); } }; diff --git a/tests/MyGame/Example/Stat.java b/tests/MyGame/Example/Stat.java index f7f6b6970..4b72e1d12 100644 --- a/tests/MyGame/Example/Stat.java +++ b/tests/MyGame/Example/Stat.java @@ -26,19 +26,19 @@ public final class Stat extends Table { int idOffset, long val, int count) { - builder.startObject(3); + builder.startTable(3); Stat.addVal(builder, val); Stat.addId(builder, idOffset); Stat.addCount(builder, count); return Stat.endStat(builder); } - public static void startStat(FlatBufferBuilder builder) { builder.startObject(3); } + public static void startStat(FlatBufferBuilder builder) { builder.startTable(3); } public static void addId(FlatBufferBuilder builder, int idOffset) { builder.addOffset(0, idOffset, 0); } public static void addVal(FlatBufferBuilder builder, long val) { builder.addLong(1, val, 0L); } public static void addCount(FlatBufferBuilder builder, int count) { builder.addShort(2, (short)count, (short)0); } public static int endStat(FlatBufferBuilder builder) { - int o = builder.endObject(); + int o = builder.endTable(); return o; } } diff --git a/tests/MyGame/Example/TestSimpleTableWithEnum.cs b/tests/MyGame/Example/TestSimpleTableWithEnum.cs index 2f25db014..a03ab3306 100644 --- a/tests/MyGame/Example/TestSimpleTableWithEnum.cs +++ b/tests/MyGame/Example/TestSimpleTableWithEnum.cs @@ -22,15 +22,15 @@ internal partial struct TestSimpleTableWithEnum : IFlatbufferObject public static Offset CreateTestSimpleTableWithEnum(FlatBufferBuilder builder, Color color = Color.Green) { - builder.StartObject(1); + builder.StartTable(1); TestSimpleTableWithEnum.AddColor(builder, color); return TestSimpleTableWithEnum.EndTestSimpleTableWithEnum(builder); } - public static void StartTestSimpleTableWithEnum(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void StartTestSimpleTableWithEnum(FlatBufferBuilder builder) { builder.StartTable(1); } public static void AddColor(FlatBufferBuilder builder, Color color) { builder.AddByte(0, (byte)color, 2); } public static Offset EndTestSimpleTableWithEnum(FlatBufferBuilder builder) { - int o = builder.EndObject(); + int o = builder.EndTable(); return new Offset(o); } }; diff --git a/tests/MyGame/Example/TestSimpleTableWithEnum.java b/tests/MyGame/Example/TestSimpleTableWithEnum.java index cc16d604b..7bb5e0bb0 100644 --- a/tests/MyGame/Example/TestSimpleTableWithEnum.java +++ b/tests/MyGame/Example/TestSimpleTableWithEnum.java @@ -19,15 +19,15 @@ final class TestSimpleTableWithEnum extends Table { public static int createTestSimpleTableWithEnum(FlatBufferBuilder builder, int color) { - builder.startObject(1); + builder.startTable(1); TestSimpleTableWithEnum.addColor(builder, color); return TestSimpleTableWithEnum.endTestSimpleTableWithEnum(builder); } - public static void startTestSimpleTableWithEnum(FlatBufferBuilder builder) { builder.startObject(1); } + public static void startTestSimpleTableWithEnum(FlatBufferBuilder builder) { builder.startTable(1); } public static void addColor(FlatBufferBuilder builder, int color) { builder.addByte(0, (byte)color, (byte)2); } public static int endTestSimpleTableWithEnum(FlatBufferBuilder builder) { - int o = builder.endObject(); + int o = builder.endTable(); return o; } } diff --git a/tests/MyGame/Example/TypeAliases.cs b/tests/MyGame/Example/TypeAliases.cs index 8eb2d47f7..37dfeba32 100644 --- a/tests/MyGame/Example/TypeAliases.cs +++ b/tests/MyGame/Example/TypeAliases.cs @@ -69,7 +69,7 @@ public struct TypeAliases : IFlatbufferObject double f64 = 0.0, VectorOffset v8Offset = default(VectorOffset), VectorOffset vf64Offset = default(VectorOffset)) { - builder.StartObject(12); + builder.StartTable(12); TypeAliases.AddF64(builder, f64); TypeAliases.AddU64(builder, u64); TypeAliases.AddI64(builder, i64); @@ -85,7 +85,7 @@ public struct TypeAliases : IFlatbufferObject return TypeAliases.EndTypeAliases(builder); } - public static void StartTypeAliases(FlatBufferBuilder builder) { builder.StartObject(12); } + public static void StartTypeAliases(FlatBufferBuilder builder) { builder.StartTable(12); } public static void AddI8(FlatBufferBuilder builder, sbyte i8) { builder.AddSbyte(0, i8, 0); } public static void AddU8(FlatBufferBuilder builder, byte u8) { builder.AddByte(1, u8, 0); } public static void AddI16(FlatBufferBuilder builder, short i16) { builder.AddShort(2, i16, 0); } @@ -105,7 +105,7 @@ public struct TypeAliases : IFlatbufferObject public static VectorOffset CreateVf64VectorBlock(FlatBufferBuilder builder, double[] data) { builder.StartVector(8, data.Length, 8); builder.Add(data); return builder.EndVector(); } public static void StartVf64Vector(FlatBufferBuilder builder, int numElems) { builder.StartVector(8, numElems, 8); } public static Offset EndTypeAliases(FlatBufferBuilder builder) { - int o = builder.EndObject(); + int o = builder.EndTable(); return new Offset(o); } }; diff --git a/tests/MyGame/Example/TypeAliases.java b/tests/MyGame/Example/TypeAliases.java index f539b7235..80761b31c 100644 --- a/tests/MyGame/Example/TypeAliases.java +++ b/tests/MyGame/Example/TypeAliases.java @@ -58,7 +58,7 @@ public final class TypeAliases extends Table { double f64, int v8Offset, int vf64Offset) { - builder.startObject(12); + builder.startTable(12); TypeAliases.addF64(builder, f64); TypeAliases.addU64(builder, u64); TypeAliases.addI64(builder, i64); @@ -74,7 +74,7 @@ public final class TypeAliases extends Table { return TypeAliases.endTypeAliases(builder); } - public static void startTypeAliases(FlatBufferBuilder builder) { builder.startObject(12); } + public static void startTypeAliases(FlatBufferBuilder builder) { builder.startTable(12); } public static void addI8(FlatBufferBuilder builder, byte i8) { builder.addByte(0, i8, 0); } public static void addU8(FlatBufferBuilder builder, int u8) { builder.addByte(1, (byte)u8, (byte)0); } public static void addI16(FlatBufferBuilder builder, short i16) { builder.addShort(2, i16, 0); } @@ -92,7 +92,7 @@ public final class TypeAliases extends Table { public static int createVf64Vector(FlatBufferBuilder builder, double[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addDouble(data[i]); return builder.endVector(); } public static void startVf64Vector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); } public static int endTypeAliases(FlatBufferBuilder builder) { - int o = builder.endObject(); + int o = builder.endTable(); return o; } } diff --git a/tests/MyGame/Example2/Monster.cs b/tests/MyGame/Example2/Monster.cs index c72794e16..d365e790f 100644 --- a/tests/MyGame/Example2/Monster.cs +++ b/tests/MyGame/Example2/Monster.cs @@ -18,9 +18,9 @@ public struct Monster : IFlatbufferObject public Monster __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } - public static void StartMonster(FlatBufferBuilder builder) { builder.StartObject(0); } + public static void StartMonster(FlatBufferBuilder builder) { builder.StartTable(0); } public static Offset EndMonster(FlatBufferBuilder builder) { - int o = builder.EndObject(); + int o = builder.EndTable(); return new Offset(o); } }; diff --git a/tests/MyGame/Example2/Monster.java b/tests/MyGame/Example2/Monster.java index c91ba7b53..e98f11165 100644 --- a/tests/MyGame/Example2/Monster.java +++ b/tests/MyGame/Example2/Monster.java @@ -15,9 +15,9 @@ public final class Monster extends Table { public Monster __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } - public static void startMonster(FlatBufferBuilder builder) { builder.startObject(0); } + public static void startMonster(FlatBufferBuilder builder) { builder.startTable(0); } public static int endMonster(FlatBufferBuilder builder) { - int o = builder.endObject(); + int o = builder.endTable(); return o; } } diff --git a/tests/MyGame/InParentNamespace.cs b/tests/MyGame/InParentNamespace.cs index 6393fe419..0e2bf7446 100644 --- a/tests/MyGame/InParentNamespace.cs +++ b/tests/MyGame/InParentNamespace.cs @@ -18,9 +18,9 @@ public struct InParentNamespace : IFlatbufferObject public InParentNamespace __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } - public static void StartInParentNamespace(FlatBufferBuilder builder) { builder.StartObject(0); } + public static void StartInParentNamespace(FlatBufferBuilder builder) { builder.StartTable(0); } public static Offset EndInParentNamespace(FlatBufferBuilder builder) { - int o = builder.EndObject(); + int o = builder.EndTable(); return new Offset(o); } }; diff --git a/tests/MyGame/InParentNamespace.java b/tests/MyGame/InParentNamespace.java index 45466ae9f..48dcb6061 100644 --- a/tests/MyGame/InParentNamespace.java +++ b/tests/MyGame/InParentNamespace.java @@ -15,9 +15,9 @@ public final class InParentNamespace extends Table { public InParentNamespace __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } - public static void startInParentNamespace(FlatBufferBuilder builder) { builder.startObject(0); } + public static void startInParentNamespace(FlatBufferBuilder builder) { builder.startTable(0); } public static int endInParentNamespace(FlatBufferBuilder builder) { - int o = builder.endObject(); + int o = builder.endTable(); return o; } } diff --git a/tests/MyGame/MonsterExtra.cs b/tests/MyGame/MonsterExtra.cs index b134ef69c..56df4d912 100644 --- a/tests/MyGame/MonsterExtra.cs +++ b/tests/MyGame/MonsterExtra.cs @@ -58,7 +58,7 @@ public struct MonsterExtra : IFlatbufferObject double testd_ninf = Double.NegativeInfinity, VectorOffset testf_vecOffset = default(VectorOffset), VectorOffset testd_vecOffset = default(VectorOffset)) { - builder.StartObject(8); + builder.StartTable(8); MonsterExtra.AddTestdNinf(builder, testd_ninf); MonsterExtra.AddTestdPinf(builder, testd_pinf); MonsterExtra.AddTestdNan(builder, testd_nan); @@ -70,7 +70,7 @@ public struct MonsterExtra : IFlatbufferObject return MonsterExtra.EndMonsterExtra(builder); } - public static void StartMonsterExtra(FlatBufferBuilder builder) { builder.StartObject(8); } + public static void StartMonsterExtra(FlatBufferBuilder builder) { builder.StartTable(8); } public static void AddTestfNan(FlatBufferBuilder builder, float testfNan) { builder.AddFloat(0, testfNan, Single.NaN); } public static void AddTestfPinf(FlatBufferBuilder builder, float testfPinf) { builder.AddFloat(1, testfPinf, Single.PositiveInfinity); } public static void AddTestfNinf(FlatBufferBuilder builder, float testfNinf) { builder.AddFloat(2, testfNinf, Single.NegativeInfinity); } @@ -86,7 +86,7 @@ public struct MonsterExtra : IFlatbufferObject public static VectorOffset CreateTestdVecVectorBlock(FlatBufferBuilder builder, double[] data) { builder.StartVector(8, data.Length, 8); builder.Add(data); return builder.EndVector(); } public static void StartTestdVecVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(8, numElems, 8); } public static Offset EndMonsterExtra(FlatBufferBuilder builder) { - int o = builder.EndObject(); + int o = builder.EndTable(); return new Offset(o); } public static void FinishMonsterExtraBuffer(FlatBufferBuilder builder, Offset offset) { builder.Finish(offset.Value, "MONE"); } diff --git a/tests/MyGame/MonsterExtra.java b/tests/MyGame/MonsterExtra.java index dce720d81..1ca33809e 100644 --- a/tests/MyGame/MonsterExtra.java +++ b/tests/MyGame/MonsterExtra.java @@ -47,7 +47,7 @@ public final class MonsterExtra extends Table { double testd_ninf, int testf_vecOffset, int testd_vecOffset) { - builder.startObject(8); + builder.startTable(8); MonsterExtra.addTestdNinf(builder, testd_ninf); MonsterExtra.addTestdPinf(builder, testd_pinf); MonsterExtra.addTestdNan(builder, testd_nan); @@ -59,7 +59,7 @@ public final class MonsterExtra extends Table { return MonsterExtra.endMonsterExtra(builder); } - public static void startMonsterExtra(FlatBufferBuilder builder) { builder.startObject(8); } + public static void startMonsterExtra(FlatBufferBuilder builder) { builder.startTable(8); } public static void addTestfNan(FlatBufferBuilder builder, float testfNan) { builder.addFloat(0, testfNan, Float.NaN); } public static void addTestfPinf(FlatBufferBuilder builder, float testfPinf) { builder.addFloat(1, testfPinf, Float.POSITIVE_INFINITY); } public static void addTestfNinf(FlatBufferBuilder builder, float testfNinf) { builder.addFloat(2, testfNinf, Float.NEGATIVE_INFINITY); } @@ -73,7 +73,7 @@ public final class MonsterExtra extends Table { public static int createTestdVecVector(FlatBufferBuilder builder, double[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addDouble(data[i]); return builder.endVector(); } public static void startTestdVecVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); } public static int endMonsterExtra(FlatBufferBuilder builder) { - int o = builder.endObject(); + int o = builder.endTable(); return o; } public static void finishMonsterExtraBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset, "MONE"); } diff --git a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs index 7f2f2e9ec..b6a64cecb 100644 --- a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs +++ b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs @@ -22,15 +22,15 @@ public struct TableInNestedNS : IFlatbufferObject public static Offset CreateTableInNestedNS(FlatBufferBuilder builder, int foo = 0) { - builder.StartObject(1); + builder.StartTable(1); TableInNestedNS.AddFoo(builder, foo); return TableInNestedNS.EndTableInNestedNS(builder); } - public static void StartTableInNestedNS(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void StartTableInNestedNS(FlatBufferBuilder builder) { builder.StartTable(1); } public static void AddFoo(FlatBufferBuilder builder, int foo) { builder.AddInt(0, foo, 0); } public static Offset EndTableInNestedNS(FlatBufferBuilder builder) { - int o = builder.EndObject(); + int o = builder.EndTable(); return new Offset(o); } }; diff --git a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.java b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.java index 1f6a8b1c3..ec98258f1 100644 --- a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.java +++ b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.java @@ -19,15 +19,15 @@ public final class TableInNestedNS extends Table { public static int createTableInNestedNS(FlatBufferBuilder builder, int foo) { - builder.startObject(1); + builder.startTable(1); TableInNestedNS.addFoo(builder, foo); return TableInNestedNS.endTableInNestedNS(builder); } - public static void startTableInNestedNS(FlatBufferBuilder builder) { builder.startObject(1); } + public static void startTableInNestedNS(FlatBufferBuilder builder) { builder.startTable(1); } public static void addFoo(FlatBufferBuilder builder, int foo) { builder.addInt(0, foo, 0); } public static int endTableInNestedNS(FlatBufferBuilder builder) { - int o = builder.endObject(); + int o = builder.endTable(); return o; } } diff --git a/tests/namespace_test/NamespaceA/SecondTableInA.cs b/tests/namespace_test/NamespaceA/SecondTableInA.cs index 33e079d6e..059b0a173 100644 --- a/tests/namespace_test/NamespaceA/SecondTableInA.cs +++ b/tests/namespace_test/NamespaceA/SecondTableInA.cs @@ -21,15 +21,15 @@ public struct SecondTableInA : IFlatbufferObject public static Offset CreateSecondTableInA(FlatBufferBuilder builder, Offset refer_to_cOffset = default(Offset)) { - builder.StartObject(1); + builder.StartTable(1); SecondTableInA.AddReferToC(builder, refer_to_cOffset); return SecondTableInA.EndSecondTableInA(builder); } - public static void StartSecondTableInA(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void StartSecondTableInA(FlatBufferBuilder builder) { builder.StartTable(1); } public static void AddReferToC(FlatBufferBuilder builder, Offset referToCOffset) { builder.AddOffset(0, referToCOffset.Value, 0); } public static Offset EndSecondTableInA(FlatBufferBuilder builder) { - int o = builder.EndObject(); + int o = builder.EndTable(); return new Offset(o); } }; diff --git a/tests/namespace_test/NamespaceA/SecondTableInA.java b/tests/namespace_test/NamespaceA/SecondTableInA.java index eb45f7e4c..9827dfda6 100644 --- a/tests/namespace_test/NamespaceA/SecondTableInA.java +++ b/tests/namespace_test/NamespaceA/SecondTableInA.java @@ -19,15 +19,15 @@ public final class SecondTableInA extends Table { public static int createSecondTableInA(FlatBufferBuilder builder, int refer_to_cOffset) { - builder.startObject(1); + builder.startTable(1); SecondTableInA.addReferToC(builder, refer_to_cOffset); return SecondTableInA.endSecondTableInA(builder); } - public static void startSecondTableInA(FlatBufferBuilder builder) { builder.startObject(1); } + public static void startSecondTableInA(FlatBufferBuilder builder) { builder.startTable(1); } public static void addReferToC(FlatBufferBuilder builder, int referToCOffset) { builder.addOffset(0, referToCOffset, 0); } public static int endSecondTableInA(FlatBufferBuilder builder) { - int o = builder.endObject(); + int o = builder.endTable(); return o; } } diff --git a/tests/namespace_test/NamespaceA/TableInFirstNS.cs b/tests/namespace_test/NamespaceA/TableInFirstNS.cs index acb87bea5..85a9bfc4a 100644 --- a/tests/namespace_test/NamespaceA/TableInFirstNS.cs +++ b/tests/namespace_test/NamespaceA/TableInFirstNS.cs @@ -22,12 +22,12 @@ public struct TableInFirstNS : IFlatbufferObject public bool MutateFooEnum(NamespaceA.NamespaceB.EnumInNestedNS foo_enum) { int o = __p.__offset(6); if (o != 0) { __p.bb.PutSbyte(o + __p.bb_pos, (sbyte)foo_enum); return true; } else { return false; } } public NamespaceA.NamespaceB.StructInNestedNS? FooStruct { get { int o = __p.__offset(8); return o != 0 ? (NamespaceA.NamespaceB.StructInNestedNS?)(new NamespaceA.NamespaceB.StructInNestedNS()).__assign(o + __p.bb_pos, __p.bb) : null; } } - public static void StartTableInFirstNS(FlatBufferBuilder builder) { builder.StartObject(3); } + public static void StartTableInFirstNS(FlatBufferBuilder builder) { builder.StartTable(3); } public static void AddFooTable(FlatBufferBuilder builder, Offset fooTableOffset) { builder.AddOffset(0, fooTableOffset.Value, 0); } public static void AddFooEnum(FlatBufferBuilder builder, NamespaceA.NamespaceB.EnumInNestedNS fooEnum) { builder.AddSbyte(1, (sbyte)fooEnum, 0); } public static void AddFooStruct(FlatBufferBuilder builder, Offset fooStructOffset) { builder.AddStruct(2, fooStructOffset.Value, 0); } public static Offset EndTableInFirstNS(FlatBufferBuilder builder) { - int o = builder.EndObject(); + int o = builder.EndTable(); return new Offset(o); } }; diff --git a/tests/namespace_test/NamespaceA/TableInFirstNS.java b/tests/namespace_test/NamespaceA/TableInFirstNS.java index cf4bc190c..63a407db5 100644 --- a/tests/namespace_test/NamespaceA/TableInFirstNS.java +++ b/tests/namespace_test/NamespaceA/TableInFirstNS.java @@ -21,12 +21,12 @@ public final class TableInFirstNS extends Table { public NamespaceA.NamespaceB.StructInNestedNS fooStruct() { return fooStruct(new NamespaceA.NamespaceB.StructInNestedNS()); } public NamespaceA.NamespaceB.StructInNestedNS fooStruct(NamespaceA.NamespaceB.StructInNestedNS obj) { int o = __offset(8); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; } - public static void startTableInFirstNS(FlatBufferBuilder builder) { builder.startObject(3); } + public static void startTableInFirstNS(FlatBufferBuilder builder) { builder.startTable(3); } public static void addFooTable(FlatBufferBuilder builder, int fooTableOffset) { builder.addOffset(0, fooTableOffset, 0); } public static void addFooEnum(FlatBufferBuilder builder, byte fooEnum) { builder.addByte(1, fooEnum, 0); } public static void addFooStruct(FlatBufferBuilder builder, int fooStructOffset) { builder.addStruct(2, fooStructOffset, 0); } public static int endTableInFirstNS(FlatBufferBuilder builder) { - int o = builder.endObject(); + int o = builder.endTable(); return o; } } diff --git a/tests/namespace_test/NamespaceC/TableInC.cs b/tests/namespace_test/NamespaceC/TableInC.cs index bd5a709a1..e523d8ec9 100644 --- a/tests/namespace_test/NamespaceC/TableInC.cs +++ b/tests/namespace_test/NamespaceC/TableInC.cs @@ -23,17 +23,17 @@ public struct TableInC : IFlatbufferObject public static Offset CreateTableInC(FlatBufferBuilder builder, Offset refer_to_a1Offset = default(Offset), Offset refer_to_a2Offset = default(Offset)) { - builder.StartObject(2); + builder.StartTable(2); TableInC.AddReferToA2(builder, refer_to_a2Offset); TableInC.AddReferToA1(builder, refer_to_a1Offset); return TableInC.EndTableInC(builder); } - public static void StartTableInC(FlatBufferBuilder builder) { builder.StartObject(2); } + public static void StartTableInC(FlatBufferBuilder builder) { builder.StartTable(2); } public static void AddReferToA1(FlatBufferBuilder builder, Offset referToA1Offset) { builder.AddOffset(0, referToA1Offset.Value, 0); } public static void AddReferToA2(FlatBufferBuilder builder, Offset referToA2Offset) { builder.AddOffset(1, referToA2Offset.Value, 0); } public static Offset EndTableInC(FlatBufferBuilder builder) { - int o = builder.EndObject(); + int o = builder.EndTable(); return new Offset(o); } }; diff --git a/tests/namespace_test/NamespaceC/TableInC.java b/tests/namespace_test/NamespaceC/TableInC.java index e0a8c43a2..f07590faa 100644 --- a/tests/namespace_test/NamespaceC/TableInC.java +++ b/tests/namespace_test/NamespaceC/TableInC.java @@ -22,17 +22,17 @@ public final class TableInC extends Table { public static int createTableInC(FlatBufferBuilder builder, int refer_to_a1Offset, int refer_to_a2Offset) { - builder.startObject(2); + builder.startTable(2); TableInC.addReferToA2(builder, refer_to_a2Offset); TableInC.addReferToA1(builder, refer_to_a1Offset); return TableInC.endTableInC(builder); } - public static void startTableInC(FlatBufferBuilder builder) { builder.startObject(2); } + public static void startTableInC(FlatBufferBuilder builder) { builder.startTable(2); } public static void addReferToA1(FlatBufferBuilder builder, int referToA1Offset) { builder.addOffset(0, referToA1Offset, 0); } public static void addReferToA2(FlatBufferBuilder builder, int referToA2Offset) { builder.addOffset(1, referToA2Offset, 0); } public static int endTableInC(FlatBufferBuilder builder) { - int o = builder.endObject(); + int o = builder.endTable(); return o; } } diff --git a/tests/union_vector/Attacker.cs b/tests/union_vector/Attacker.cs index ff2dbcf87..91a191936 100644 --- a/tests/union_vector/Attacker.cs +++ b/tests/union_vector/Attacker.cs @@ -19,15 +19,15 @@ public struct Attacker : IFlatbufferObject public static Offset CreateAttacker(FlatBufferBuilder builder, int sword_attack_damage = 0) { - builder.StartObject(1); + builder.StartTable(1); Attacker.AddSwordAttackDamage(builder, sword_attack_damage); return Attacker.EndAttacker(builder); } - public static void StartAttacker(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void StartAttacker(FlatBufferBuilder builder) { builder.StartTable(1); } public static void AddSwordAttackDamage(FlatBufferBuilder builder, int swordAttackDamage) { builder.AddInt(0, swordAttackDamage, 0); } public static Offset EndAttacker(FlatBufferBuilder builder) { - int o = builder.EndObject(); + int o = builder.EndTable(); return new Offset(o); } }; diff --git a/tests/union_vector/Attacker.java b/tests/union_vector/Attacker.java index d68d3312c..7f0e15a4a 100644 --- a/tests/union_vector/Attacker.java +++ b/tests/union_vector/Attacker.java @@ -17,15 +17,15 @@ public final class Attacker extends Table { public static int createAttacker(FlatBufferBuilder builder, int sword_attack_damage) { - builder.startObject(1); + builder.startTable(1); Attacker.addSwordAttackDamage(builder, sword_attack_damage); return Attacker.endAttacker(builder); } - public static void startAttacker(FlatBufferBuilder builder) { builder.startObject(1); } + public static void startAttacker(FlatBufferBuilder builder) { builder.startTable(1); } public static void addSwordAttackDamage(FlatBufferBuilder builder, int swordAttackDamage) { builder.addInt(0, swordAttackDamage, 0); } public static int endAttacker(FlatBufferBuilder builder) { - int o = builder.endObject(); + int o = builder.endTable(); return o; } } diff --git a/tests/union_vector/Movie.cs b/tests/union_vector/Movie.cs index b9479694e..e436d0025 100644 --- a/tests/union_vector/Movie.cs +++ b/tests/union_vector/Movie.cs @@ -35,7 +35,7 @@ public struct Movie : IFlatbufferObject int main_characterOffset = 0, VectorOffset characters_typeOffset = default(VectorOffset), VectorOffset charactersOffset = default(VectorOffset)) { - builder.StartObject(4); + builder.StartTable(4); Movie.AddCharacters(builder, charactersOffset); Movie.AddCharactersType(builder, characters_typeOffset); Movie.AddMainCharacter(builder, main_characterOffset); @@ -43,7 +43,7 @@ public struct Movie : IFlatbufferObject return Movie.EndMovie(builder); } - public static void StartMovie(FlatBufferBuilder builder) { builder.StartObject(4); } + public static void StartMovie(FlatBufferBuilder builder) { builder.StartTable(4); } public static void AddMainCharacterType(FlatBufferBuilder builder, Character mainCharacterType) { builder.AddByte(0, (byte)mainCharacterType, 0); } public static void AddMainCharacter(FlatBufferBuilder builder, int mainCharacterOffset) { builder.AddOffset(1, mainCharacterOffset, 0); } public static void AddCharactersType(FlatBufferBuilder builder, VectorOffset charactersTypeOffset) { builder.AddOffset(2, charactersTypeOffset.Value, 0); } @@ -55,7 +55,7 @@ public struct Movie : IFlatbufferObject public static VectorOffset CreateCharactersVectorBlock(FlatBufferBuilder builder, int[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } public static void StartCharactersVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } public static Offset EndMovie(FlatBufferBuilder builder) { - int o = builder.EndObject(); + int o = builder.EndTable(); return new Offset(o); } public static void FinishMovieBuffer(FlatBufferBuilder builder, Offset offset) { builder.Finish(offset.Value, "MOVI"); } diff --git a/tests/union_vector/Movie.java b/tests/union_vector/Movie.java index 5d8a00058..f3ec659d4 100644 --- a/tests/union_vector/Movie.java +++ b/tests/union_vector/Movie.java @@ -29,7 +29,7 @@ public final class Movie extends Table { int main_characterOffset, int characters_typeOffset, int charactersOffset) { - builder.startObject(4); + builder.startTable(4); Movie.addCharacters(builder, charactersOffset); Movie.addCharactersType(builder, characters_typeOffset); Movie.addMainCharacter(builder, main_characterOffset); @@ -37,7 +37,7 @@ public final class Movie extends Table { return Movie.endMovie(builder); } - public static void startMovie(FlatBufferBuilder builder) { builder.startObject(4); } + public static void startMovie(FlatBufferBuilder builder) { builder.startTable(4); } public static void addMainCharacterType(FlatBufferBuilder builder, byte mainCharacterType) { builder.addByte(0, mainCharacterType, 0); } public static void addMainCharacter(FlatBufferBuilder builder, int mainCharacterOffset) { builder.addOffset(1, mainCharacterOffset, 0); } public static void addCharactersType(FlatBufferBuilder builder, int charactersTypeOffset) { builder.addOffset(2, charactersTypeOffset, 0); } @@ -47,7 +47,7 @@ public final class Movie extends Table { public static int createCharactersVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); } public static void startCharactersVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } public static int endMovie(FlatBufferBuilder builder) { - int o = builder.endObject(); + int o = builder.endTable(); return o; } public static void finishMovieBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset, "MOVI"); }