From cb0fdba7b8d1f762f8262f2b3266d1fe8c16ed53 Mon Sep 17 00:00:00 2001 From: Amer Banet Date: Fri, 16 Dec 2016 19:51:16 +0100 Subject: [PATCH] Fixed code generator. Added missing union type initialization when using lists in unions. --- compiler/src/main/cpp/capnpc-java.c++ | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/src/main/cpp/capnpc-java.c++ b/compiler/src/main/cpp/capnpc-java.c++ index c9c3595..1f3e9af 100644 --- a/compiler/src/main/cpp/capnpc-java.c++ +++ b/compiler/src/main/cpp/capnpc-java.c++ @@ -1177,6 +1177,7 @@ private: spaces(indent), " }\n", spaces(indent), " public final ", builderType, " init", titleCase, "(int size) {\n", + unionDiscrim.set, spaces(indent), " return _initPointerField(", factory, ", ", offset, ", size);\n", spaces(indent), " }\n"), }; @@ -1273,11 +1274,13 @@ private: "> ")), "void set", titleCase, "(org.capnproto.SetPointerBuilder<", builderType, ", ", readerType, "> factory, ", readerType, " value) {\n", + unionDiscrim.set, spaces(indent), " _setPointerField(factory, ", offset, ", value);\n", spaces(indent), " }\n" ) : kj::strTree( spaces(indent), " public final void set", titleCase, "(", readerType, " value) {\n", + unionDiscrim.set, spaces(indent), " _setPointerField(", listFactory, ", ", offset, ", value);\n", spaces(indent), " }\n" ) @@ -1295,12 +1298,14 @@ private: "> ")), builderType, " init", titleCase, "( org.capnproto.ListFactory<", builderType, ", ", readerType, "> factory, int size) {\n", + unionDiscrim.set, spaces(indent), " return _initPointerField(factory, ", offset, ", size);\n", spaces(indent), " }\n" ) : kj::strTree( spaces(indent), " public final ", builderType, " init", titleCase, "(int size) {\n", + unionDiscrim.set, spaces(indent), " return _initPointerField(", listFactory, ", ", offset, ", size);\n", spaces(indent), " }\n") )