diff --git a/compiler/src/main/cpp/capnpc-java.c++ b/compiler/src/main/cpp/capnpc-java.c++ index 92f2a8d..20417a0 100644 --- a/compiler/src/main/cpp/capnpc-java.c++ +++ b/compiler/src/main/cpp/capnpc-java.c++ @@ -1028,8 +1028,6 @@ private: ",\n ::capnp::schemas::s_", kj::hex(typeId), ".encodedNode + ", defaultOffset, defaultSize == 0 ? kj::strTree() : kj::strTree(", ", defaultSize)); - kj::String elementReaderType; - kj::String elementBuilderType; kj::String builderFactoryArg = kj::str(""); kj::String readerFactoryArg = kj::str(""); kj::String fieldSize; @@ -1096,8 +1094,6 @@ private: case schema::Type::LIST: primitiveElement = false; fieldSize = kj::str("org.capnproto.FieldSize.POINTER"); - elementReaderType = kj::str(typeName(typeBody.getList().getElementType()), ".Reader"); - elementBuilderType = kj::str(typeName(typeBody.getList().getElementType()), ".Builder"); readerFactoryArg = kj::str(makeListListFactoryArg(typeBody.getList().getElementType()), ", "); builderFactoryArg = kj::str(readerFactoryArg); break; diff --git a/compiler/src/test/scala/org/capnproto/EncodingTest.scala b/compiler/src/test/scala/org/capnproto/EncodingTest.scala index f86302c..6a5f275 100644 --- a/compiler/src/test/scala/org/capnproto/EncodingTest.scala +++ b/compiler/src/test/scala/org/capnproto/EncodingTest.scala @@ -68,6 +68,36 @@ class EncodingSuite extends FunSuite { } } + + test("NestedLists") { + val builder = new MessageBuilder(); + val root = builder.initRoot(TestLists.factory); + { + val intListList = root.initInt32ListList(2); + val intList0 = intListList.init(0, 4); + intList0.set(0, 1); + intList0.set(1, 2); + intList0.set(2, 3); + intList0.set(3, 4); + val intList1 = intListList.init(1, 1); + intList1.set(0, 100); + } + { + val reader = root.asReader(); + val intListList = root.getInt32ListList(); + intListList.size() should equal (2); + val intList0 = intListList.get(0); + intList0.size() should equal (4); + intList0.get(0) should equal (1); + intList0.get(1) should equal (2); + intList0.get(2) should equal (3); + intList0.get(3) should equal (4); + val intList1 = intListList.get(1); + intList1.size() should equal (1); + intList1.get(0) should equal(100); + } + } + test("UpgradeStructInBuilder") { val builder = new MessageBuilder(); val root = builder.initRoot(TestAnyPointer.factory);