Propogate onChange() event when getFooBuilder() is on an oneof message
field. Change-Id: Idb5b53da5accd24038a895aba49b684eeee95814
This commit is contained in:
parent
20042b72da
commit
e70329c6c0
2 changed files with 14 additions and 1 deletions
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue