From c978b9ef1f74c4918a33ee26217c85e5a5949a5b Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Fri, 31 May 2019 11:29:09 -0700 Subject: Enforce matching version in Java and C#. Change-Id: I7f1f12f2f97e5227e0dabc2965ce66a6d41c229c --- grpc/flatbuffers-java-grpc/pom.xml | 4 ++-- grpc/pom.xml | 2 +- grpc/tests/pom.xml | 4 ++-- java/com/google/flatbuffers/Constants.java | 8 ++++++++ net/FlatBuffers/FlatBufferConstants.cs | 8 ++++++++ pom.xml | 2 +- src/idl_gen_general.cpp | 5 +++++ tests/MyGame/Example/Monster.cs | 2 +- tests/MyGame/Example/Monster.java | 2 +- tests/MyGame/Example/Referrable.cs | 2 +- tests/MyGame/Example/Referrable.java | 2 +- tests/MyGame/Example/Stat.cs | 2 +- tests/MyGame/Example/Stat.java | 2 +- tests/MyGame/Example/TestSimpleTableWithEnum.cs | 2 +- tests/MyGame/Example/TestSimpleTableWithEnum.java | 2 +- tests/MyGame/Example/TypeAliases.cs | 2 +- tests/MyGame/Example/TypeAliases.java | 2 +- tests/MyGame/Example2/Monster.cs | 2 +- tests/MyGame/Example2/Monster.java | 2 +- tests/MyGame/InParentNamespace.cs | 2 +- tests/MyGame/InParentNamespace.java | 2 +- tests/MyGame/MonsterExtra.cs | 2 +- tests/MyGame/MonsterExtra.java | 2 +- tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs | 2 +- tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.java | 2 +- tests/namespace_test/NamespaceA/SecondTableInA.cs | 2 +- tests/namespace_test/NamespaceA/SecondTableInA.java | 2 +- tests/namespace_test/NamespaceA/TableInFirstNS.cs | 2 +- tests/namespace_test/NamespaceA/TableInFirstNS.java | 2 +- tests/namespace_test/NamespaceC/TableInC.cs | 2 +- tests/namespace_test/NamespaceC/TableInC.java | 2 +- tests/union_vector/Attacker.cs | 2 +- tests/union_vector/Attacker.java | 2 +- tests/union_vector/Movie.cs | 2 +- tests/union_vector/Movie.java | 2 +- 35 files changed, 55 insertions(+), 34 deletions(-) diff --git a/grpc/flatbuffers-java-grpc/pom.xml b/grpc/flatbuffers-java-grpc/pom.xml index 40799aea..b5b88cb5 100644 --- a/grpc/flatbuffers-java-grpc/pom.xml +++ b/grpc/flatbuffers-java-grpc/pom.xml @@ -6,7 +6,7 @@ com.google.flatbuffers flatbuffers-parent - 1.11.0 + 1.11.1 flatbuffers-java-grpc ${project.artifactId} @@ -24,7 +24,7 @@ - 1.11.0 + 1.11.1 diff --git a/grpc/pom.xml b/grpc/pom.xml index c51348d5..a0fca794 100644 --- a/grpc/pom.xml +++ b/grpc/pom.xml @@ -4,7 +4,7 @@ com.google.flatbuffers flatbuffers-parent pom - 1.11.0 + 1.11.1 flatbuffers-parent parent pom for flatbuffers java artifacts diff --git a/grpc/tests/pom.xml b/grpc/tests/pom.xml index 5f8731e5..addc9fac 100644 --- a/grpc/tests/pom.xml +++ b/grpc/tests/pom.xml @@ -4,13 +4,13 @@ com.google.flatbuffers flatbuffers-parent - 1.11.0 + 1.11.1 grpc-test Example/Test project demonstrating usage of flatbuffers with GRPC-Java instead of protobufs - 1.11.0 + 1.11.1 diff --git a/java/com/google/flatbuffers/Constants.java b/java/com/google/flatbuffers/Constants.java index 751f4a65..e974a802 100644 --- a/java/com/google/flatbuffers/Constants.java +++ b/java/com/google/flatbuffers/Constants.java @@ -39,6 +39,14 @@ public class Constants { static final int FILE_IDENTIFIER_LENGTH = 4; /** The number of bytes in a size prefix. */ public static final int SIZE_PREFIX_LENGTH = 4; + /** A version identifier to force a compile error if someone + accidentally tries to build generated code with a runtime of + two mismatched version. Versions need to always match, as + the runtime and generated code are modified in sync. + Changes to the Java implementation need to be sure to change + the version here and in the code generator on every possible + incompatible change */ + public static void FLATBUFFERS_1_11_1() {} } /// @endcond diff --git a/net/FlatBuffers/FlatBufferConstants.cs b/net/FlatBuffers/FlatBufferConstants.cs index e30f3f39..730d7efd 100644 --- a/net/FlatBuffers/FlatBufferConstants.cs +++ b/net/FlatBuffers/FlatBufferConstants.cs @@ -25,5 +25,13 @@ namespace FlatBuffers { public const int FileIdentifierLength = 4; public const int SizePrefixLength = 4; + /** A version identifier to force a compile error if someone + accidentally tries to build generated code with a runtime of + two mismatched version. Versions need to always match, as + the runtime and generated code are modified in sync. + Changes to the C# implementation need to be sure to change + the version here and in the code generator on every possible + incompatible change */ + public static void FLATBUFFERS_1_11_1() {} } } diff --git a/pom.xml b/pom.xml index 3928ebff..cb410ccb 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.flatbuffers flatbuffers-java - 1.11.1-SNAPSHOT + 1.11.1 bundle FlatBuffers Java API diff --git a/src/idl_gen_general.cpp b/src/idl_gen_general.cpp index 4e1be8b2..92a9a879 100644 --- a/src/idl_gen_general.cpp +++ b/src/idl_gen_general.cpp @@ -848,6 +848,11 @@ class GeneralGenerator : public BaseGenerator { // create method that allows object reuse code += method_signature + "(ByteBuffer _bb, " + struct_def.name + " obj) { "; + // Force compile time error if not using the same version runtime. + if (lang_.language == IDLOptions::kCSharp) + code += "FlatBufferConstants.FLATBUFFERS_1_11_1(); "; + else + code += "Constants.FLATBUFFERS_1_11_1(); "; code += lang_.set_bb_byteorder; code += "return (obj.__assign(_bb." + FunctionStart('G') + "etInt(_bb."; code += lang_.get_bb_position; diff --git a/tests/MyGame/Example/Monster.cs b/tests/MyGame/Example/Monster.cs index 596cdce0..dcb61dc3 100644 --- a/tests/MyGame/Example/Monster.cs +++ b/tests/MyGame/Example/Monster.cs @@ -14,7 +14,7 @@ public struct Monster : IFlatbufferObject private Table __p; public ByteBuffer ByteBuffer { get { return __p.bb; } } public static Monster GetRootAsMonster(ByteBuffer _bb) { return GetRootAsMonster(_bb, new Monster()); } - public static Monster GetRootAsMonster(ByteBuffer _bb, Monster obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public static Monster GetRootAsMonster(ByteBuffer _bb, Monster obj) { FlatBufferConstants.FLATBUFFERS_1_11_1(); return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public static bool MonsterBufferHasIdentifier(ByteBuffer _bb) { return Table.__has_identifier(_bb, "MONS"); } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } public Monster __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/MyGame/Example/Monster.java b/tests/MyGame/Example/Monster.java index 967b4a72..1d7d994c 100644 --- a/tests/MyGame/Example/Monster.java +++ b/tests/MyGame/Example/Monster.java @@ -13,7 +13,7 @@ import com.google.flatbuffers.*; */ public final class Monster extends Table { public static Monster getRootAsMonster(ByteBuffer _bb) { return getRootAsMonster(_bb, new Monster()); } - public static Monster getRootAsMonster(ByteBuffer _bb, Monster obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } + public static Monster getRootAsMonster(ByteBuffer _bb, Monster obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public static boolean MonsterBufferHasIdentifier(ByteBuffer _bb) { return __has_identifier(_bb, "MONS"); } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); } public Monster __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/MyGame/Example/Referrable.cs b/tests/MyGame/Example/Referrable.cs index ce068087..5e1726bc 100644 --- a/tests/MyGame/Example/Referrable.cs +++ b/tests/MyGame/Example/Referrable.cs @@ -13,7 +13,7 @@ public struct Referrable : IFlatbufferObject private Table __p; public ByteBuffer ByteBuffer { get { return __p.bb; } } public static Referrable GetRootAsReferrable(ByteBuffer _bb) { return GetRootAsReferrable(_bb, new Referrable()); } - public static Referrable GetRootAsReferrable(ByteBuffer _bb, Referrable obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public static Referrable GetRootAsReferrable(ByteBuffer _bb, Referrable obj) { FlatBufferConstants.FLATBUFFERS_1_11_1(); return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } public Referrable __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/MyGame/Example/Referrable.java b/tests/MyGame/Example/Referrable.java index 6a117451..4901c430 100644 --- a/tests/MyGame/Example/Referrable.java +++ b/tests/MyGame/Example/Referrable.java @@ -10,7 +10,7 @@ import com.google.flatbuffers.*; @SuppressWarnings("unused") public final class Referrable extends Table { public static Referrable getRootAsReferrable(ByteBuffer _bb) { return getRootAsReferrable(_bb, new Referrable()); } - public static Referrable getRootAsReferrable(ByteBuffer _bb, Referrable obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } + public static Referrable getRootAsReferrable(ByteBuffer _bb, Referrable obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); } public Referrable __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/MyGame/Example/Stat.cs b/tests/MyGame/Example/Stat.cs index fdd7e856..34f04c4d 100644 --- a/tests/MyGame/Example/Stat.cs +++ b/tests/MyGame/Example/Stat.cs @@ -13,7 +13,7 @@ public struct Stat : IFlatbufferObject private Table __p; public ByteBuffer ByteBuffer { get { return __p.bb; } } public static Stat GetRootAsStat(ByteBuffer _bb) { return GetRootAsStat(_bb, new Stat()); } - public static Stat GetRootAsStat(ByteBuffer _bb, Stat obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public static Stat GetRootAsStat(ByteBuffer _bb, Stat obj) { FlatBufferConstants.FLATBUFFERS_1_11_1(); return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } public Stat __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/MyGame/Example/Stat.java b/tests/MyGame/Example/Stat.java index c995eb1e..f7f6b697 100644 --- a/tests/MyGame/Example/Stat.java +++ b/tests/MyGame/Example/Stat.java @@ -10,7 +10,7 @@ import com.google.flatbuffers.*; @SuppressWarnings("unused") public final class Stat extends Table { public static Stat getRootAsStat(ByteBuffer _bb) { return getRootAsStat(_bb, new Stat()); } - public static Stat getRootAsStat(ByteBuffer _bb, Stat obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } + public static Stat getRootAsStat(ByteBuffer _bb, Stat obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); } public Stat __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/MyGame/Example/TestSimpleTableWithEnum.cs b/tests/MyGame/Example/TestSimpleTableWithEnum.cs index e58d6699..2f25db01 100644 --- a/tests/MyGame/Example/TestSimpleTableWithEnum.cs +++ b/tests/MyGame/Example/TestSimpleTableWithEnum.cs @@ -13,7 +13,7 @@ internal partial struct TestSimpleTableWithEnum : IFlatbufferObject private Table __p; public ByteBuffer ByteBuffer { get { return __p.bb; } } public static TestSimpleTableWithEnum GetRootAsTestSimpleTableWithEnum(ByteBuffer _bb) { return GetRootAsTestSimpleTableWithEnum(_bb, new TestSimpleTableWithEnum()); } - public static TestSimpleTableWithEnum GetRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public static TestSimpleTableWithEnum GetRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { FlatBufferConstants.FLATBUFFERS_1_11_1(); return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } public TestSimpleTableWithEnum __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/MyGame/Example/TestSimpleTableWithEnum.java b/tests/MyGame/Example/TestSimpleTableWithEnum.java index 9a9d600d..cc16d604 100644 --- a/tests/MyGame/Example/TestSimpleTableWithEnum.java +++ b/tests/MyGame/Example/TestSimpleTableWithEnum.java @@ -10,7 +10,7 @@ import com.google.flatbuffers.*; @SuppressWarnings("unused") final class TestSimpleTableWithEnum extends Table { public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb) { return getRootAsTestSimpleTableWithEnum(_bb, new TestSimpleTableWithEnum()); } - public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } + public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); } public TestSimpleTableWithEnum __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/MyGame/Example/TypeAliases.cs b/tests/MyGame/Example/TypeAliases.cs index 5ff10117..8eb2d47f 100644 --- a/tests/MyGame/Example/TypeAliases.cs +++ b/tests/MyGame/Example/TypeAliases.cs @@ -13,7 +13,7 @@ public struct TypeAliases : IFlatbufferObject private Table __p; public ByteBuffer ByteBuffer { get { return __p.bb; } } public static TypeAliases GetRootAsTypeAliases(ByteBuffer _bb) { return GetRootAsTypeAliases(_bb, new TypeAliases()); } - public static TypeAliases GetRootAsTypeAliases(ByteBuffer _bb, TypeAliases obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public static TypeAliases GetRootAsTypeAliases(ByteBuffer _bb, TypeAliases obj) { FlatBufferConstants.FLATBUFFERS_1_11_1(); return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } public TypeAliases __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/MyGame/Example/TypeAliases.java b/tests/MyGame/Example/TypeAliases.java index cccb722a..f539b723 100644 --- a/tests/MyGame/Example/TypeAliases.java +++ b/tests/MyGame/Example/TypeAliases.java @@ -10,7 +10,7 @@ import com.google.flatbuffers.*; @SuppressWarnings("unused") public final class TypeAliases extends Table { public static TypeAliases getRootAsTypeAliases(ByteBuffer _bb) { return getRootAsTypeAliases(_bb, new TypeAliases()); } - public static TypeAliases getRootAsTypeAliases(ByteBuffer _bb, TypeAliases obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } + public static TypeAliases getRootAsTypeAliases(ByteBuffer _bb, TypeAliases obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); } public TypeAliases __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/MyGame/Example2/Monster.cs b/tests/MyGame/Example2/Monster.cs index e880ebbe..c72794e1 100644 --- a/tests/MyGame/Example2/Monster.cs +++ b/tests/MyGame/Example2/Monster.cs @@ -13,7 +13,7 @@ public struct Monster : IFlatbufferObject private Table __p; public ByteBuffer ByteBuffer { get { return __p.bb; } } public static Monster GetRootAsMonster(ByteBuffer _bb) { return GetRootAsMonster(_bb, new Monster()); } - public static Monster GetRootAsMonster(ByteBuffer _bb, Monster obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public static Monster GetRootAsMonster(ByteBuffer _bb, Monster obj) { FlatBufferConstants.FLATBUFFERS_1_11_1(); return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } public Monster __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/MyGame/Example2/Monster.java b/tests/MyGame/Example2/Monster.java index f65e7d4c..c91ba7b5 100644 --- a/tests/MyGame/Example2/Monster.java +++ b/tests/MyGame/Example2/Monster.java @@ -10,7 +10,7 @@ import com.google.flatbuffers.*; @SuppressWarnings("unused") public final class Monster extends Table { public static Monster getRootAsMonster(ByteBuffer _bb) { return getRootAsMonster(_bb, new Monster()); } - public static Monster getRootAsMonster(ByteBuffer _bb, Monster obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } + public static Monster getRootAsMonster(ByteBuffer _bb, Monster obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); } public Monster __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/MyGame/InParentNamespace.cs b/tests/MyGame/InParentNamespace.cs index 7b8ffc2d..6393fe41 100644 --- a/tests/MyGame/InParentNamespace.cs +++ b/tests/MyGame/InParentNamespace.cs @@ -13,7 +13,7 @@ public struct InParentNamespace : IFlatbufferObject private Table __p; public ByteBuffer ByteBuffer { get { return __p.bb; } } public static InParentNamespace GetRootAsInParentNamespace(ByteBuffer _bb) { return GetRootAsInParentNamespace(_bb, new InParentNamespace()); } - public static InParentNamespace GetRootAsInParentNamespace(ByteBuffer _bb, InParentNamespace obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public static InParentNamespace GetRootAsInParentNamespace(ByteBuffer _bb, InParentNamespace obj) { FlatBufferConstants.FLATBUFFERS_1_11_1(); return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } public InParentNamespace __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/MyGame/InParentNamespace.java b/tests/MyGame/InParentNamespace.java index 42784b79..45466ae9 100644 --- a/tests/MyGame/InParentNamespace.java +++ b/tests/MyGame/InParentNamespace.java @@ -10,7 +10,7 @@ import com.google.flatbuffers.*; @SuppressWarnings("unused") public final class InParentNamespace extends Table { public static InParentNamespace getRootAsInParentNamespace(ByteBuffer _bb) { return getRootAsInParentNamespace(_bb, new InParentNamespace()); } - public static InParentNamespace getRootAsInParentNamespace(ByteBuffer _bb, InParentNamespace obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } + public static InParentNamespace getRootAsInParentNamespace(ByteBuffer _bb, InParentNamespace obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); } public InParentNamespace __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/MyGame/MonsterExtra.cs b/tests/MyGame/MonsterExtra.cs index e67ecd90..b134ef69 100644 --- a/tests/MyGame/MonsterExtra.cs +++ b/tests/MyGame/MonsterExtra.cs @@ -13,7 +13,7 @@ public struct MonsterExtra : IFlatbufferObject private Table __p; public ByteBuffer ByteBuffer { get { return __p.bb; } } public static MonsterExtra GetRootAsMonsterExtra(ByteBuffer _bb) { return GetRootAsMonsterExtra(_bb, new MonsterExtra()); } - public static MonsterExtra GetRootAsMonsterExtra(ByteBuffer _bb, MonsterExtra obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public static MonsterExtra GetRootAsMonsterExtra(ByteBuffer _bb, MonsterExtra obj) { FlatBufferConstants.FLATBUFFERS_1_11_1(); return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public static bool MonsterExtraBufferHasIdentifier(ByteBuffer _bb) { return Table.__has_identifier(_bb, "MONE"); } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } public MonsterExtra __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/MyGame/MonsterExtra.java b/tests/MyGame/MonsterExtra.java index 330d61ff..dce720d8 100644 --- a/tests/MyGame/MonsterExtra.java +++ b/tests/MyGame/MonsterExtra.java @@ -10,7 +10,7 @@ import com.google.flatbuffers.*; @SuppressWarnings("unused") public final class MonsterExtra extends Table { public static MonsterExtra getRootAsMonsterExtra(ByteBuffer _bb) { return getRootAsMonsterExtra(_bb, new MonsterExtra()); } - public static MonsterExtra getRootAsMonsterExtra(ByteBuffer _bb, MonsterExtra obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } + public static MonsterExtra getRootAsMonsterExtra(ByteBuffer _bb, MonsterExtra obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public static boolean MonsterExtraBufferHasIdentifier(ByteBuffer _bb) { return __has_identifier(_bb, "MONE"); } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); } public MonsterExtra __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs index 89217449..7f2f2e9e 100644 --- a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs +++ b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs @@ -13,7 +13,7 @@ public struct TableInNestedNS : IFlatbufferObject private Table __p; public ByteBuffer ByteBuffer { get { return __p.bb; } } public static TableInNestedNS GetRootAsTableInNestedNS(ByteBuffer _bb) { return GetRootAsTableInNestedNS(_bb, new TableInNestedNS()); } - public static TableInNestedNS GetRootAsTableInNestedNS(ByteBuffer _bb, TableInNestedNS obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public static TableInNestedNS GetRootAsTableInNestedNS(ByteBuffer _bb, TableInNestedNS obj) { FlatBufferConstants.FLATBUFFERS_1_11_1(); return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } public TableInNestedNS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.java b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.java index f3216c1c..1f6a8b1c 100644 --- a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.java +++ b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.java @@ -10,7 +10,7 @@ import com.google.flatbuffers.*; @SuppressWarnings("unused") public final class TableInNestedNS extends Table { public static TableInNestedNS getRootAsTableInNestedNS(ByteBuffer _bb) { return getRootAsTableInNestedNS(_bb, new TableInNestedNS()); } - public static TableInNestedNS getRootAsTableInNestedNS(ByteBuffer _bb, TableInNestedNS obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } + public static TableInNestedNS getRootAsTableInNestedNS(ByteBuffer _bb, TableInNestedNS obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); } public TableInNestedNS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/namespace_test/NamespaceA/SecondTableInA.cs b/tests/namespace_test/NamespaceA/SecondTableInA.cs index 99c82ccb..33e079d6 100644 --- a/tests/namespace_test/NamespaceA/SecondTableInA.cs +++ b/tests/namespace_test/NamespaceA/SecondTableInA.cs @@ -13,7 +13,7 @@ public struct SecondTableInA : IFlatbufferObject private Table __p; public ByteBuffer ByteBuffer { get { return __p.bb; } } public static SecondTableInA GetRootAsSecondTableInA(ByteBuffer _bb) { return GetRootAsSecondTableInA(_bb, new SecondTableInA()); } - public static SecondTableInA GetRootAsSecondTableInA(ByteBuffer _bb, SecondTableInA obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public static SecondTableInA GetRootAsSecondTableInA(ByteBuffer _bb, SecondTableInA obj) { FlatBufferConstants.FLATBUFFERS_1_11_1(); return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } public SecondTableInA __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/namespace_test/NamespaceA/SecondTableInA.java b/tests/namespace_test/NamespaceA/SecondTableInA.java index 8386446a..eb45f7e4 100644 --- a/tests/namespace_test/NamespaceA/SecondTableInA.java +++ b/tests/namespace_test/NamespaceA/SecondTableInA.java @@ -10,7 +10,7 @@ import com.google.flatbuffers.*; @SuppressWarnings("unused") public final class SecondTableInA extends Table { public static SecondTableInA getRootAsSecondTableInA(ByteBuffer _bb) { return getRootAsSecondTableInA(_bb, new SecondTableInA()); } - public static SecondTableInA getRootAsSecondTableInA(ByteBuffer _bb, SecondTableInA obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } + public static SecondTableInA getRootAsSecondTableInA(ByteBuffer _bb, SecondTableInA obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); } public SecondTableInA __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/namespace_test/NamespaceA/TableInFirstNS.cs b/tests/namespace_test/NamespaceA/TableInFirstNS.cs index 48b5b205..acb87bea 100644 --- a/tests/namespace_test/NamespaceA/TableInFirstNS.cs +++ b/tests/namespace_test/NamespaceA/TableInFirstNS.cs @@ -13,7 +13,7 @@ public struct TableInFirstNS : IFlatbufferObject private Table __p; public ByteBuffer ByteBuffer { get { return __p.bb; } } public static TableInFirstNS GetRootAsTableInFirstNS(ByteBuffer _bb) { return GetRootAsTableInFirstNS(_bb, new TableInFirstNS()); } - public static TableInFirstNS GetRootAsTableInFirstNS(ByteBuffer _bb, TableInFirstNS obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public static TableInFirstNS GetRootAsTableInFirstNS(ByteBuffer _bb, TableInFirstNS obj) { FlatBufferConstants.FLATBUFFERS_1_11_1(); return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } public TableInFirstNS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/namespace_test/NamespaceA/TableInFirstNS.java b/tests/namespace_test/NamespaceA/TableInFirstNS.java index 396d0b47..cf4bc190 100644 --- a/tests/namespace_test/NamespaceA/TableInFirstNS.java +++ b/tests/namespace_test/NamespaceA/TableInFirstNS.java @@ -10,7 +10,7 @@ import com.google.flatbuffers.*; @SuppressWarnings("unused") public final class TableInFirstNS extends Table { public static TableInFirstNS getRootAsTableInFirstNS(ByteBuffer _bb) { return getRootAsTableInFirstNS(_bb, new TableInFirstNS()); } - public static TableInFirstNS getRootAsTableInFirstNS(ByteBuffer _bb, TableInFirstNS obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } + public static TableInFirstNS getRootAsTableInFirstNS(ByteBuffer _bb, TableInFirstNS obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); } public TableInFirstNS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/namespace_test/NamespaceC/TableInC.cs b/tests/namespace_test/NamespaceC/TableInC.cs index 0c454acb..bd5a709a 100644 --- a/tests/namespace_test/NamespaceC/TableInC.cs +++ b/tests/namespace_test/NamespaceC/TableInC.cs @@ -13,7 +13,7 @@ public struct TableInC : IFlatbufferObject private Table __p; public ByteBuffer ByteBuffer { get { return __p.bb; } } public static TableInC GetRootAsTableInC(ByteBuffer _bb) { return GetRootAsTableInC(_bb, new TableInC()); } - public static TableInC GetRootAsTableInC(ByteBuffer _bb, TableInC obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public static TableInC GetRootAsTableInC(ByteBuffer _bb, TableInC obj) { FlatBufferConstants.FLATBUFFERS_1_11_1(); return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } public TableInC __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/namespace_test/NamespaceC/TableInC.java b/tests/namespace_test/NamespaceC/TableInC.java index 80d6a123..e0a8c43a 100644 --- a/tests/namespace_test/NamespaceC/TableInC.java +++ b/tests/namespace_test/NamespaceC/TableInC.java @@ -10,7 +10,7 @@ import com.google.flatbuffers.*; @SuppressWarnings("unused") public final class TableInC extends Table { public static TableInC getRootAsTableInC(ByteBuffer _bb) { return getRootAsTableInC(_bb, new TableInC()); } - public static TableInC getRootAsTableInC(ByteBuffer _bb, TableInC obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } + public static TableInC getRootAsTableInC(ByteBuffer _bb, TableInC obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); } public TableInC __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/union_vector/Attacker.cs b/tests/union_vector/Attacker.cs index 7f20fff8..ff2dbcf8 100644 --- a/tests/union_vector/Attacker.cs +++ b/tests/union_vector/Attacker.cs @@ -10,7 +10,7 @@ public struct Attacker : IFlatbufferObject private Table __p; public ByteBuffer ByteBuffer { get { return __p.bb; } } public static Attacker GetRootAsAttacker(ByteBuffer _bb) { return GetRootAsAttacker(_bb, new Attacker()); } - public static Attacker GetRootAsAttacker(ByteBuffer _bb, Attacker obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public static Attacker GetRootAsAttacker(ByteBuffer _bb, Attacker obj) { FlatBufferConstants.FLATBUFFERS_1_11_1(); return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } public Attacker __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/union_vector/Attacker.java b/tests/union_vector/Attacker.java index ae84a4a2..d68d3312 100644 --- a/tests/union_vector/Attacker.java +++ b/tests/union_vector/Attacker.java @@ -8,7 +8,7 @@ import com.google.flatbuffers.*; @SuppressWarnings("unused") public final class Attacker extends Table { public static Attacker getRootAsAttacker(ByteBuffer _bb) { return getRootAsAttacker(_bb, new Attacker()); } - public static Attacker getRootAsAttacker(ByteBuffer _bb, Attacker obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } + public static Attacker getRootAsAttacker(ByteBuffer _bb, Attacker obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); } public Attacker __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/union_vector/Movie.cs b/tests/union_vector/Movie.cs index 6a9130a7..b9479694 100644 --- a/tests/union_vector/Movie.cs +++ b/tests/union_vector/Movie.cs @@ -10,7 +10,7 @@ public struct Movie : IFlatbufferObject private Table __p; public ByteBuffer ByteBuffer { get { return __p.bb; } } public static Movie GetRootAsMovie(ByteBuffer _bb) { return GetRootAsMovie(_bb, new Movie()); } - public static Movie GetRootAsMovie(ByteBuffer _bb, Movie obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public static Movie GetRootAsMovie(ByteBuffer _bb, Movie obj) { FlatBufferConstants.FLATBUFFERS_1_11_1(); return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public static bool MovieBufferHasIdentifier(ByteBuffer _bb) { return Table.__has_identifier(_bb, "MOVI"); } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } public Movie __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } diff --git a/tests/union_vector/Movie.java b/tests/union_vector/Movie.java index 75791d31..5d8a0005 100644 --- a/tests/union_vector/Movie.java +++ b/tests/union_vector/Movie.java @@ -8,7 +8,7 @@ import com.google.flatbuffers.*; @SuppressWarnings("unused") public final class Movie extends Table { public static Movie getRootAsMovie(ByteBuffer _bb) { return getRootAsMovie(_bb, new Movie()); } - public static Movie getRootAsMovie(ByteBuffer _bb, Movie obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } + public static Movie getRootAsMovie(ByteBuffer _bb, Movie obj) { Constants.FLATBUFFERS_1_11_1(); _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public static boolean MovieBufferHasIdentifier(ByteBuffer _bb) { return __has_identifier(_bb, "MOVI"); } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; vtable_start = bb_pos - bb.getInt(bb_pos); vtable_size = bb.getShort(vtable_start); } public Movie __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } -- cgit v1.2.3