Commit e70329c6 authored by Jisi Liu's avatar Jisi Liu

Propogate onChange() event when getFooBuilder() is on an oneof message

field.

Change-Id: Idb5b53da5accd24038a895aba49b684eeee95814
parent 20042b72
......@@ -56,9 +56,10 @@ import protobuf_unittest.UnittestProto;
import protobuf_unittest.UnittestProto.ForeignEnum;
import protobuf_unittest.UnittestProto.ForeignMessage;
import protobuf_unittest.UnittestProto.ForeignMessageOrBuilder;
import protobuf_unittest.UnittestProto.NestedTestAllTypes;
import protobuf_unittest.UnittestProto.TestAllExtensions;
import protobuf_unittest.UnittestProto.TestAllTypes;
import protobuf_unittest.UnittestProto.TestAllTypes.NestedMessage;
import protobuf_unittest.UnittestProto.TestAllTypes;
import protobuf_unittest.UnittestProto.TestAllTypesOrBuilder;
import protobuf_unittest.UnittestProto.TestExtremeDefaultValues;
import protobuf_unittest.UnittestProto.TestOneof2;
......@@ -1510,6 +1511,17 @@ public class GeneratedMessageTest extends TestCase {
}
}
public void testOneofNestedBuilderOnChangePropagation() {
NestedTestAllTypes.Builder parentBuilder = NestedTestAllTypes.newBuilder();
TestAllTypes.Builder builder = parentBuilder.getPayloadBuilder();
builder.getOneofNestedMessageBuilder();
assertTrue(builder.hasOneofNestedMessage());
assertTrue(parentBuilder.hasPayload());
NestedTestAllTypes message = parentBuilder.build();
assertTrue(message.hasPayload());
assertTrue(message.getPayload().hasOneofNestedMessage());
}
public void testGetRepeatedFieldBuilder() {
Descriptor descriptor = TestAllTypes.getDescriptor();
......
......@@ -718,6 +718,7 @@ GenerateBuilderMembers(io::Printer* printer) const {
" $oneof_name$_ = null;\n"
" }\n"
" $set_oneof_case_message$;\n"
" $on_changed$;\n"
" return $name$Builder_;\n"
"}\n");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment