diff options
author | Sydney Acksman <ObsidianMinor@users.noreply.github.com> | 2018-09-24 15:42:24 -0500 |
---|---|---|
committer | Jie Luo <anandolee@gmail.com> | 2018-09-24 13:42:24 -0700 |
commit | 54176b26a9be6c9903b375596b778f51f5947921 (patch) | |
tree | a441d2831ecdb3db5e1f867b8fabc94ed523de13 /csharp/src/Google.Protobuf.Test | |
parent | fb0a74b66076d6c55022a9bccabf6cdb08dbab83 (diff) | |
download | protobuf-54176b26a9be6c9903b375596b778f51f5947921.tar.gz protobuf-54176b26a9be6c9903b375596b778f51f5947921.tar.bz2 protobuf-54176b26a9be6c9903b375596b778f51f5947921.zip |
C# Proto2 feature : Field presence and default values (#4642)
* Compiler changes
* Generated code changes
* Library changes
* Compiler style changes
* Generated style changes
* Fix Windows build errors
* Implement changes from review
* Reintroduce proto2 check
* Compiler changes (required handling review)
* Generated code changes (required handling review)
* Library changes (required handling review
* Field presence rewrite (compiler changes)
* Field presence rewrite (generated code changes)
* Compiler comment
* IFieldAccessor.HasValue library implementation
* Remove Clear methods and default values from proto3 code (Compiler)
* Remove Clear methods and default values from proto3 code (Generated)
* Remove Clear methods and default values from proto3 code (Library)
* Fix distcheck error
* Rewrite default string values to use base64 and convert
* Library changes (IMessage2)
* Compiler changes (IMessage2)
* Generated changes (IMessage2)
* Rebased and regenerated
* Compiler changes (initialized extension)
* Generated changes (initialized extension)
* Library changes (initialized extension)
* Refactor MessageExtensions.IsRequired
* Move string default value creator and bytes default value creator back to seperate methods
* Dead code cleanup
* Fixed segmentation fault
Removed unused header method declarations
Diffstat (limited to 'csharp/src/Google.Protobuf.Test')
6 files changed, 139 insertions, 121 deletions
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs index 51715a0c..6d3cd026 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs @@ -724,7 +724,7 @@ namespace Google.Protobuf.TestProtos { } if (other.testMap_ != null) { if (testMap_ == null) { - testMap_ = new global::Google.Protobuf.TestProtos.TestMap(); + TestMap = new global::Google.Protobuf.TestProtos.TestMap(); } TestMap.MergeFrom(other.TestMap); } @@ -741,9 +741,9 @@ namespace Google.Protobuf.TestProtos { break; case 10: { if (testMap_ == null) { - testMap_ = new global::Google.Protobuf.TestProtos.TestMap(); + TestMap = new global::Google.Protobuf.TestProtos.TestMap(); } - input.ReadMessage(testMap_); + input.ReadMessage(TestMap); break; } } diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs index 7353be7b..d74422b5 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs @@ -1171,6 +1171,7 @@ namespace ProtobufTestMessages.Proto3 { } } + /// <summary>Field number for the "optional_int32_wrapper" field.</summary> public const int OptionalInt32WrapperFieldNumber = 202; private static readonly pb::FieldCodec<int?> _single_optionalInt32Wrapper_codec = pb::FieldCodec.ForStructWrapper<int>(1618); @@ -1183,6 +1184,7 @@ namespace ProtobufTestMessages.Proto3 { } } + /// <summary>Field number for the "optional_int64_wrapper" field.</summary> public const int OptionalInt64WrapperFieldNumber = 203; private static readonly pb::FieldCodec<long?> _single_optionalInt64Wrapper_codec = pb::FieldCodec.ForStructWrapper<long>(1626); @@ -1195,6 +1197,7 @@ namespace ProtobufTestMessages.Proto3 { } } + /// <summary>Field number for the "optional_uint32_wrapper" field.</summary> public const int OptionalUint32WrapperFieldNumber = 204; private static readonly pb::FieldCodec<uint?> _single_optionalUint32Wrapper_codec = pb::FieldCodec.ForStructWrapper<uint>(1634); @@ -1207,6 +1210,7 @@ namespace ProtobufTestMessages.Proto3 { } } + /// <summary>Field number for the "optional_uint64_wrapper" field.</summary> public const int OptionalUint64WrapperFieldNumber = 205; private static readonly pb::FieldCodec<ulong?> _single_optionalUint64Wrapper_codec = pb::FieldCodec.ForStructWrapper<ulong>(1642); @@ -1219,6 +1223,7 @@ namespace ProtobufTestMessages.Proto3 { } } + /// <summary>Field number for the "optional_float_wrapper" field.</summary> public const int OptionalFloatWrapperFieldNumber = 206; private static readonly pb::FieldCodec<float?> _single_optionalFloatWrapper_codec = pb::FieldCodec.ForStructWrapper<float>(1650); @@ -1231,6 +1236,7 @@ namespace ProtobufTestMessages.Proto3 { } } + /// <summary>Field number for the "optional_double_wrapper" field.</summary> public const int OptionalDoubleWrapperFieldNumber = 207; private static readonly pb::FieldCodec<double?> _single_optionalDoubleWrapper_codec = pb::FieldCodec.ForStructWrapper<double>(1658); @@ -1243,6 +1249,7 @@ namespace ProtobufTestMessages.Proto3 { } } + /// <summary>Field number for the "optional_string_wrapper" field.</summary> public const int OptionalStringWrapperFieldNumber = 208; private static readonly pb::FieldCodec<string> _single_optionalStringWrapper_codec = pb::FieldCodec.ForClassWrapper<string>(1666); @@ -1255,6 +1262,7 @@ namespace ProtobufTestMessages.Proto3 { } } + /// <summary>Field number for the "optional_bytes_wrapper" field.</summary> public const int OptionalBytesWrapperFieldNumber = 209; private static readonly pb::FieldCodec<pb::ByteString> _single_optionalBytesWrapper_codec = pb::FieldCodec.ForClassWrapper<pb::ByteString>(1674); @@ -1267,6 +1275,7 @@ namespace ProtobufTestMessages.Proto3 { } } + /// <summary>Field number for the "repeated_bool_wrapper" field.</summary> public const int RepeatedBoolWrapperFieldNumber = 211; private static readonly pb::FieldCodec<bool?> _repeated_repeatedBoolWrapper_codec @@ -2598,13 +2607,13 @@ namespace ProtobufTestMessages.Proto3 { } if (other.optionalNestedMessage_ != null) { if (optionalNestedMessage_ == null) { - optionalNestedMessage_ = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage(); + OptionalNestedMessage = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage(); } OptionalNestedMessage.MergeFrom(other.OptionalNestedMessage); } if (other.optionalForeignMessage_ != null) { if (optionalForeignMessage_ == null) { - optionalForeignMessage_ = new global::ProtobufTestMessages.Proto3.ForeignMessage(); + OptionalForeignMessage = new global::ProtobufTestMessages.Proto3.ForeignMessage(); } OptionalForeignMessage.MergeFrom(other.OptionalForeignMessage); } @@ -2622,7 +2631,7 @@ namespace ProtobufTestMessages.Proto3 { } if (other.recursiveMessage_ != null) { if (recursiveMessage_ == null) { - recursiveMessage_ = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3(); + RecursiveMessage = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3(); } RecursiveMessage.MergeFrom(other.RecursiveMessage); } @@ -2722,37 +2731,37 @@ namespace ProtobufTestMessages.Proto3 { repeatedBytesWrapper_.Add(other.repeatedBytesWrapper_); if (other.optionalDuration_ != null) { if (optionalDuration_ == null) { - optionalDuration_ = new global::Google.Protobuf.WellKnownTypes.Duration(); + OptionalDuration = new global::Google.Protobuf.WellKnownTypes.Duration(); } OptionalDuration.MergeFrom(other.OptionalDuration); } if (other.optionalTimestamp_ != null) { if (optionalTimestamp_ == null) { - optionalTimestamp_ = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + OptionalTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } OptionalTimestamp.MergeFrom(other.OptionalTimestamp); } if (other.optionalFieldMask_ != null) { if (optionalFieldMask_ == null) { - optionalFieldMask_ = new global::Google.Protobuf.WellKnownTypes.FieldMask(); + OptionalFieldMask = new global::Google.Protobuf.WellKnownTypes.FieldMask(); } OptionalFieldMask.MergeFrom(other.OptionalFieldMask); } if (other.optionalStruct_ != null) { if (optionalStruct_ == null) { - optionalStruct_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + OptionalStruct = new global::Google.Protobuf.WellKnownTypes.Struct(); } OptionalStruct.MergeFrom(other.OptionalStruct); } if (other.optionalAny_ != null) { if (optionalAny_ == null) { - optionalAny_ = new global::Google.Protobuf.WellKnownTypes.Any(); + OptionalAny = new global::Google.Protobuf.WellKnownTypes.Any(); } OptionalAny.MergeFrom(other.OptionalAny); } if (other.optionalValue_ != null) { if (optionalValue_ == null) { - optionalValue_ = new global::Google.Protobuf.WellKnownTypes.Value(); + OptionalValue = new global::Google.Protobuf.WellKnownTypes.Value(); } OptionalValue.MergeFrom(other.OptionalValue); } @@ -2922,24 +2931,24 @@ namespace ProtobufTestMessages.Proto3 { } case 146: { if (optionalNestedMessage_ == null) { - optionalNestedMessage_ = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage(); + OptionalNestedMessage = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage(); } - input.ReadMessage(optionalNestedMessage_); + input.ReadMessage(OptionalNestedMessage); break; } case 154: { if (optionalForeignMessage_ == null) { - optionalForeignMessage_ = new global::ProtobufTestMessages.Proto3.ForeignMessage(); + OptionalForeignMessage = new global::ProtobufTestMessages.Proto3.ForeignMessage(); } - input.ReadMessage(optionalForeignMessage_); + input.ReadMessage(OptionalForeignMessage); break; } case 168: { - optionalNestedEnum_ = (global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedEnum) input.ReadEnum(); + OptionalNestedEnum = (global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedEnum) input.ReadEnum(); break; } case 176: { - optionalForeignEnum_ = (global::ProtobufTestMessages.Proto3.ForeignEnum) input.ReadEnum(); + OptionalForeignEnum = (global::ProtobufTestMessages.Proto3.ForeignEnum) input.ReadEnum(); break; } case 194: { @@ -2952,9 +2961,9 @@ namespace ProtobufTestMessages.Proto3 { } case 218: { if (recursiveMessage_ == null) { - recursiveMessage_ = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3(); + RecursiveMessage = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3(); } - input.ReadMessage(recursiveMessage_); + input.ReadMessage(RecursiveMessage); break; } case 250: @@ -3275,44 +3284,44 @@ namespace ProtobufTestMessages.Proto3 { } case 2410: { if (optionalDuration_ == null) { - optionalDuration_ = new global::Google.Protobuf.WellKnownTypes.Duration(); + OptionalDuration = new global::Google.Protobuf.WellKnownTypes.Duration(); } - input.ReadMessage(optionalDuration_); + input.ReadMessage(OptionalDuration); break; } case 2418: { if (optionalTimestamp_ == null) { - optionalTimestamp_ = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + OptionalTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } - input.ReadMessage(optionalTimestamp_); + input.ReadMessage(OptionalTimestamp); break; } case 2426: { if (optionalFieldMask_ == null) { - optionalFieldMask_ = new global::Google.Protobuf.WellKnownTypes.FieldMask(); + OptionalFieldMask = new global::Google.Protobuf.WellKnownTypes.FieldMask(); } - input.ReadMessage(optionalFieldMask_); + input.ReadMessage(OptionalFieldMask); break; } case 2434: { if (optionalStruct_ == null) { - optionalStruct_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + OptionalStruct = new global::Google.Protobuf.WellKnownTypes.Struct(); } - input.ReadMessage(optionalStruct_); + input.ReadMessage(OptionalStruct); break; } case 2442: { if (optionalAny_ == null) { - optionalAny_ = new global::Google.Protobuf.WellKnownTypes.Any(); + OptionalAny = new global::Google.Protobuf.WellKnownTypes.Any(); } - input.ReadMessage(optionalAny_); + input.ReadMessage(OptionalAny); break; } case 2450: { if (optionalValue_ == null) { - optionalValue_ = new global::Google.Protobuf.WellKnownTypes.Value(); + OptionalValue = new global::Google.Protobuf.WellKnownTypes.Value(); } - input.ReadMessage(optionalValue_); + input.ReadMessage(OptionalValue); break; } case 2490: { @@ -3560,7 +3569,7 @@ namespace ProtobufTestMessages.Proto3 { } if (other.corecursive_ != null) { if (corecursive_ == null) { - corecursive_ = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3(); + Corecursive = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3(); } Corecursive.MergeFrom(other.Corecursive); } @@ -3581,9 +3590,9 @@ namespace ProtobufTestMessages.Proto3 { } case 18: { if (corecursive_ == null) { - corecursive_ = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3(); + Corecursive = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3(); } - input.ReadMessage(corecursive_); + input.ReadMessage(Corecursive); break; } } diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs index 3ab5a48b..2a9efe55 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs @@ -1879,7 +1879,7 @@ namespace UnitTest.Issues.TestProtos { } if (other.bar_ != null) { if (bar_ == null) { - bar_ = new global::UnitTest.Issues.TestProtos.ComplexOptionType1(); + Bar = new global::UnitTest.Issues.TestProtos.ComplexOptionType1(); } Bar.MergeFrom(other.Bar); } @@ -1888,7 +1888,7 @@ namespace UnitTest.Issues.TestProtos { } if (other.fred_ != null) { if (fred_ == null) { - fred_ = new global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4(); + Fred = new global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4(); } Fred.MergeFrom(other.Fred); } @@ -1906,9 +1906,9 @@ namespace UnitTest.Issues.TestProtos { break; case 10: { if (bar_ == null) { - bar_ = new global::UnitTest.Issues.TestProtos.ComplexOptionType1(); + Bar = new global::UnitTest.Issues.TestProtos.ComplexOptionType1(); } - input.ReadMessage(bar_); + input.ReadMessage(Bar); break; } case 16: { @@ -1917,9 +1917,9 @@ namespace UnitTest.Issues.TestProtos { } case 26: { if (fred_ == null) { - fred_ = new global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4(); + Fred = new global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4(); } - input.ReadMessage(fred_); + input.ReadMessage(Fred); break; } case 34: { @@ -2462,7 +2462,7 @@ namespace UnitTest.Issues.TestProtos { } if (other.sub_ != null) { if (sub_ == null) { - sub_ = new global::UnitTest.Issues.TestProtos.Aggregate(); + Sub = new global::UnitTest.Issues.TestProtos.Aggregate(); } Sub.MergeFrom(other.Sub); } @@ -2487,9 +2487,9 @@ namespace UnitTest.Issues.TestProtos { } case 26: { if (sub_ == null) { - sub_ = new global::UnitTest.Issues.TestProtos.Aggregate(); + Sub = new global::UnitTest.Issues.TestProtos.Aggregate(); } - input.ReadMessage(sub_); + input.ReadMessage(Sub); break; } } diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs index 819fc201..f27ab640 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs @@ -557,7 +557,7 @@ namespace UnitTest.Issues.TestProtos { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { - value_ = (global::UnitTest.Issues.TestProtos.NegativeEnum) input.ReadEnum(); + Value = (global::UnitTest.Issues.TestProtos.NegativeEnum) input.ReadEnum(); break; } case 18: @@ -881,7 +881,7 @@ namespace UnitTest.Issues.TestProtos { primitiveArray_.Add(other.primitiveArray_); if (other.messageValue_ != null) { if (messageValue_ == null) { - messageValue_ = new global::UnitTest.Issues.TestProtos.DeprecatedChild(); + MessageValue = new global::UnitTest.Issues.TestProtos.DeprecatedChild(); } MessageValue.MergeFrom(other.MessageValue); } @@ -912,9 +912,9 @@ namespace UnitTest.Issues.TestProtos { } case 26: { if (messageValue_ == null) { - messageValue_ = new global::UnitTest.Issues.TestProtos.DeprecatedChild(); + MessageValue = new global::UnitTest.Issues.TestProtos.DeprecatedChild(); } - input.ReadMessage(messageValue_); + input.ReadMessage(MessageValue); break; } case 34: { @@ -922,7 +922,7 @@ namespace UnitTest.Issues.TestProtos { break; } case 40: { - enumValue_ = (global::UnitTest.Issues.TestProtos.DeprecatedEnum) input.ReadEnum(); + EnumValue = (global::UnitTest.Issues.TestProtos.DeprecatedEnum) input.ReadEnum(); break; } case 50: diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs index 04221536..bbbee22c 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs @@ -1307,19 +1307,19 @@ namespace Google.Protobuf.TestProtos { } if (other.singleNestedMessage_ != null) { if (singleNestedMessage_ == null) { - singleNestedMessage_ = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage(); + SingleNestedMessage = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage(); } SingleNestedMessage.MergeFrom(other.SingleNestedMessage); } if (other.singleForeignMessage_ != null) { if (singleForeignMessage_ == null) { - singleForeignMessage_ = new global::Google.Protobuf.TestProtos.ForeignMessage(); + SingleForeignMessage = new global::Google.Protobuf.TestProtos.ForeignMessage(); } SingleForeignMessage.MergeFrom(other.SingleForeignMessage); } if (other.singleImportMessage_ != null) { if (singleImportMessage_ == null) { - singleImportMessage_ = new global::Google.Protobuf.TestProtos.ImportMessage(); + SingleImportMessage = new global::Google.Protobuf.TestProtos.ImportMessage(); } SingleImportMessage.MergeFrom(other.SingleImportMessage); } @@ -1334,7 +1334,7 @@ namespace Google.Protobuf.TestProtos { } if (other.singlePublicImportMessage_ != null) { if (singlePublicImportMessage_ == null) { - singlePublicImportMessage_ = new global::Google.Protobuf.TestProtos.PublicImportMessage(); + SinglePublicImportMessage = new global::Google.Protobuf.TestProtos.PublicImportMessage(); } SinglePublicImportMessage.MergeFrom(other.SinglePublicImportMessage); } @@ -1451,42 +1451,42 @@ namespace Google.Protobuf.TestProtos { } case 146: { if (singleNestedMessage_ == null) { - singleNestedMessage_ = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage(); + SingleNestedMessage = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage(); } - input.ReadMessage(singleNestedMessage_); + input.ReadMessage(SingleNestedMessage); break; } case 154: { if (singleForeignMessage_ == null) { - singleForeignMessage_ = new global::Google.Protobuf.TestProtos.ForeignMessage(); + SingleForeignMessage = new global::Google.Protobuf.TestProtos.ForeignMessage(); } - input.ReadMessage(singleForeignMessage_); + input.ReadMessage(SingleForeignMessage); break; } case 162: { if (singleImportMessage_ == null) { - singleImportMessage_ = new global::Google.Protobuf.TestProtos.ImportMessage(); + SingleImportMessage = new global::Google.Protobuf.TestProtos.ImportMessage(); } - input.ReadMessage(singleImportMessage_); + input.ReadMessage(SingleImportMessage); break; } case 168: { - singleNestedEnum_ = (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum) input.ReadEnum(); + SingleNestedEnum = (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum) input.ReadEnum(); break; } case 176: { - singleForeignEnum_ = (global::Google.Protobuf.TestProtos.ForeignEnum) input.ReadEnum(); + SingleForeignEnum = (global::Google.Protobuf.TestProtos.ForeignEnum) input.ReadEnum(); break; } case 184: { - singleImportEnum_ = (global::Google.Protobuf.TestProtos.ImportEnum) input.ReadEnum(); + SingleImportEnum = (global::Google.Protobuf.TestProtos.ImportEnum) input.ReadEnum(); break; } case 210: { if (singlePublicImportMessage_ == null) { - singlePublicImportMessage_ = new global::Google.Protobuf.TestProtos.PublicImportMessage(); + SinglePublicImportMessage = new global::Google.Protobuf.TestProtos.PublicImportMessage(); } - input.ReadMessage(singlePublicImportMessage_); + input.ReadMessage(SinglePublicImportMessage); break; } case 250: @@ -1918,13 +1918,13 @@ namespace Google.Protobuf.TestProtos { } if (other.child_ != null) { if (child_ == null) { - child_ = new global::Google.Protobuf.TestProtos.NestedTestAllTypes(); + Child = new global::Google.Protobuf.TestProtos.NestedTestAllTypes(); } Child.MergeFrom(other.Child); } if (other.payload_ != null) { if (payload_ == null) { - payload_ = new global::Google.Protobuf.TestProtos.TestAllTypes(); + Payload = new global::Google.Protobuf.TestProtos.TestAllTypes(); } Payload.MergeFrom(other.Payload); } @@ -1942,16 +1942,16 @@ namespace Google.Protobuf.TestProtos { break; case 10: { if (child_ == null) { - child_ = new global::Google.Protobuf.TestProtos.NestedTestAllTypes(); + Child = new global::Google.Protobuf.TestProtos.NestedTestAllTypes(); } - input.ReadMessage(child_); + input.ReadMessage(Child); break; } case 18: { if (payload_ == null) { - payload_ = new global::Google.Protobuf.TestProtos.TestAllTypes(); + Payload = new global::Google.Protobuf.TestProtos.TestAllTypes(); } - input.ReadMessage(payload_); + input.ReadMessage(Payload); break; } case 26: { @@ -2438,7 +2438,7 @@ namespace Google.Protobuf.TestProtos { } if (other.foreignNested_ != null) { if (foreignNested_ == null) { - foreignNested_ = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage(); + ForeignNested = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage(); } ForeignNested.MergeFrom(other.ForeignNested); } @@ -2455,9 +2455,9 @@ namespace Google.Protobuf.TestProtos { break; case 10: { if (foreignNested_ == null) { - foreignNested_ = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage(); + ForeignNested = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage(); } - input.ReadMessage(foreignNested_); + input.ReadMessage(ForeignNested); break; } } @@ -2758,7 +2758,7 @@ namespace Google.Protobuf.TestProtos { } if (other.a_ != null) { if (a_ == null) { - a_ = new global::Google.Protobuf.TestProtos.TestRecursiveMessage(); + A = new global::Google.Protobuf.TestProtos.TestRecursiveMessage(); } A.MergeFrom(other.A); } @@ -2778,9 +2778,9 @@ namespace Google.Protobuf.TestProtos { break; case 10: { if (a_ == null) { - a_ = new global::Google.Protobuf.TestProtos.TestRecursiveMessage(); + A = new global::Google.Protobuf.TestProtos.TestRecursiveMessage(); } - input.ReadMessage(a_); + input.ReadMessage(A); break; } case 16: { @@ -2903,7 +2903,7 @@ namespace Google.Protobuf.TestProtos { } if (other.bb_ != null) { if (bb_ == null) { - bb_ = new global::Google.Protobuf.TestProtos.TestMutualRecursionB(); + Bb = new global::Google.Protobuf.TestProtos.TestMutualRecursionB(); } Bb.MergeFrom(other.Bb); } @@ -2920,9 +2920,9 @@ namespace Google.Protobuf.TestProtos { break; case 10: { if (bb_ == null) { - bb_ = new global::Google.Protobuf.TestProtos.TestMutualRecursionB(); + Bb = new global::Google.Protobuf.TestProtos.TestMutualRecursionB(); } - input.ReadMessage(bb_); + input.ReadMessage(Bb); break; } } @@ -3059,7 +3059,7 @@ namespace Google.Protobuf.TestProtos { } if (other.a_ != null) { if (a_ == null) { - a_ = new global::Google.Protobuf.TestProtos.TestMutualRecursionA(); + A = new global::Google.Protobuf.TestProtos.TestMutualRecursionA(); } A.MergeFrom(other.A); } @@ -3079,9 +3079,9 @@ namespace Google.Protobuf.TestProtos { break; case 10: { if (a_ == null) { - a_ = new global::Google.Protobuf.TestProtos.TestMutualRecursionA(); + A = new global::Google.Protobuf.TestProtos.TestMutualRecursionA(); } - input.ReadMessage(a_); + input.ReadMessage(A); break; } case 16: { @@ -3214,7 +3214,7 @@ namespace Google.Protobuf.TestProtos { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { - value_ = (global::Google.Protobuf.TestProtos.TestEnumWithDupValue) input.ReadEnum(); + Value = (global::Google.Protobuf.TestProtos.TestEnumWithDupValue) input.ReadEnum(); break; } } @@ -3466,7 +3466,7 @@ namespace Google.Protobuf.TestProtos { } if (other.messageField_ != null) { if (messageField_ == null) { - messageField_ = new global::Google.Protobuf.TestProtos.ForeignMessage(); + MessageField = new global::Google.Protobuf.TestProtos.ForeignMessage(); } MessageField.MergeFrom(other.MessageField); } @@ -3494,14 +3494,14 @@ namespace Google.Protobuf.TestProtos { break; } case 24: { - enumField_ = (global::Google.Protobuf.TestProtos.ForeignEnum) input.ReadEnum(); + EnumField = (global::Google.Protobuf.TestProtos.ForeignEnum) input.ReadEnum(); break; } case 34: { if (messageField_ == null) { - messageField_ = new global::Google.Protobuf.TestProtos.ForeignMessage(); + MessageField = new global::Google.Protobuf.TestProtos.ForeignMessage(); } - input.ReadMessage(messageField_); + input.ReadMessage(MessageField); break; } case 58: @@ -3711,7 +3711,7 @@ namespace Google.Protobuf.TestProtos { } if (other.singleNestedMessage_ != null) { if (singleNestedMessage_ == null) { - singleNestedMessage_ = new global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage(); + SingleNestedMessage = new global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage(); } SingleNestedMessage.MergeFrom(other.SingleNestedMessage); } @@ -3740,9 +3740,9 @@ namespace Google.Protobuf.TestProtos { } case 1602: { if (singleNestedMessage_ == null) { - singleNestedMessage_ = new global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage(); + SingleNestedMessage = new global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage(); } - input.ReadMessage(singleNestedMessage_); + input.ReadMessage(SingleNestedMessage); break; } } @@ -4040,7 +4040,7 @@ namespace Google.Protobuf.TestProtos { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { - sparseEnum_ = (global::Google.Protobuf.TestProtos.TestSparseEnum) input.ReadEnum(); + SparseEnum = (global::Google.Protobuf.TestProtos.TestSparseEnum) input.ReadEnum(); break; } } diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs index fe913802..45f8ece6 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs @@ -342,6 +342,7 @@ namespace Google.Protobuf.TestProtos { } } + /// <summary>Field number for the "float_field" field.</summary> public const int FloatFieldFieldNumber = 11; private static readonly pb::FieldCodec<float?> _single_floatField_codec = pb::FieldCodec.ForStructWrapper<float>(90); @@ -354,6 +355,7 @@ namespace Google.Protobuf.TestProtos { } } + /// <summary>Field number for the "int64_field" field.</summary> public const int Int64FieldFieldNumber = 12; private static readonly pb::FieldCodec<long?> _single_int64Field_codec = pb::FieldCodec.ForStructWrapper<long>(98); @@ -366,6 +368,7 @@ namespace Google.Protobuf.TestProtos { } } + /// <summary>Field number for the "uint64_field" field.</summary> public const int Uint64FieldFieldNumber = 13; private static readonly pb::FieldCodec<ulong?> _single_uint64Field_codec = pb::FieldCodec.ForStructWrapper<ulong>(106); @@ -378,6 +381,7 @@ namespace Google.Protobuf.TestProtos { } } + /// <summary>Field number for the "int32_field" field.</summary> public const int Int32FieldFieldNumber = 14; private static readonly pb::FieldCodec<int?> _single_int32Field_codec = pb::FieldCodec.ForStructWrapper<int>(114); @@ -390,6 +394,7 @@ namespace Google.Protobuf.TestProtos { } } + /// <summary>Field number for the "uint32_field" field.</summary> public const int Uint32FieldFieldNumber = 15; private static readonly pb::FieldCodec<uint?> _single_uint32Field_codec = pb::FieldCodec.ForStructWrapper<uint>(122); @@ -402,6 +407,7 @@ namespace Google.Protobuf.TestProtos { } } + /// <summary>Field number for the "bool_field" field.</summary> public const int BoolFieldFieldNumber = 16; private static readonly pb::FieldCodec<bool?> _single_boolField_codec = pb::FieldCodec.ForStructWrapper<bool>(130); @@ -414,6 +420,7 @@ namespace Google.Protobuf.TestProtos { } } + /// <summary>Field number for the "string_field" field.</summary> public const int StringFieldFieldNumber = 17; private static readonly pb::FieldCodec<string> _single_stringField_codec = pb::FieldCodec.ForClassWrapper<string>(138); @@ -426,6 +433,7 @@ namespace Google.Protobuf.TestProtos { } } + /// <summary>Field number for the "bytes_field" field.</summary> public const int BytesFieldFieldNumber = 18; private static readonly pb::FieldCodec<pb::ByteString> _single_bytesField_codec = pb::FieldCodec.ForClassWrapper<pb::ByteString>(146); @@ -438,6 +446,7 @@ namespace Google.Protobuf.TestProtos { } } + /// <summary>Field number for the "value_field" field.</summary> public const int ValueFieldFieldNumber = 19; private global::Google.Protobuf.WellKnownTypes.Value valueField_; @@ -667,55 +676,55 @@ namespace Google.Protobuf.TestProtos { } if (other.anyField_ != null) { if (anyField_ == null) { - anyField_ = new global::Google.Protobuf.WellKnownTypes.Any(); + AnyField = new global::Google.Protobuf.WellKnownTypes.Any(); } AnyField.MergeFrom(other.AnyField); } if (other.apiField_ != null) { if (apiField_ == null) { - apiField_ = new global::Google.Protobuf.WellKnownTypes.Api(); + ApiField = new global::Google.Protobuf.WellKnownTypes.Api(); } ApiField.MergeFrom(other.ApiField); } if (other.durationField_ != null) { if (durationField_ == null) { - durationField_ = new global::Google.Protobuf.WellKnownTypes.Duration(); + DurationField = new global::Google.Protobuf.WellKnownTypes.Duration(); } DurationField.MergeFrom(other.DurationField); } if (other.emptyField_ != null) { if (emptyField_ == null) { - emptyField_ = new global::Google.Protobuf.WellKnownTypes.Empty(); + EmptyField = new global::Google.Protobuf.WellKnownTypes.Empty(); } EmptyField.MergeFrom(other.EmptyField); } if (other.fieldMaskField_ != null) { if (fieldMaskField_ == null) { - fieldMaskField_ = new global::Google.Protobuf.WellKnownTypes.FieldMask(); + FieldMaskField = new global::Google.Protobuf.WellKnownTypes.FieldMask(); } FieldMaskField.MergeFrom(other.FieldMaskField); } if (other.sourceContextField_ != null) { if (sourceContextField_ == null) { - sourceContextField_ = new global::Google.Protobuf.WellKnownTypes.SourceContext(); + SourceContextField = new global::Google.Protobuf.WellKnownTypes.SourceContext(); } SourceContextField.MergeFrom(other.SourceContextField); } if (other.structField_ != null) { if (structField_ == null) { - structField_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + StructField = new global::Google.Protobuf.WellKnownTypes.Struct(); } StructField.MergeFrom(other.StructField); } if (other.timestampField_ != null) { if (timestampField_ == null) { - timestampField_ = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + TimestampField = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } TimestampField.MergeFrom(other.TimestampField); } if (other.typeField_ != null) { if (typeField_ == null) { - typeField_ = new global::Google.Protobuf.WellKnownTypes.Type(); + TypeField = new global::Google.Protobuf.WellKnownTypes.Type(); } TypeField.MergeFrom(other.TypeField); } @@ -766,7 +775,7 @@ namespace Google.Protobuf.TestProtos { } if (other.valueField_ != null) { if (valueField_ == null) { - valueField_ = new global::Google.Protobuf.WellKnownTypes.Value(); + ValueField = new global::Google.Protobuf.WellKnownTypes.Value(); } ValueField.MergeFrom(other.ValueField); } @@ -783,65 +792,65 @@ namespace Google.Protobuf.TestProtos { break; case 10: { if (anyField_ == null) { - anyField_ = new global::Google.Protobuf.WellKnownTypes.Any(); + AnyField = new global::Google.Protobuf.WellKnownTypes.Any(); } - input.ReadMessage(anyField_); + input.ReadMessage(AnyField); break; } case 18: { if (apiField_ == null) { - apiField_ = new global::Google.Protobuf.WellKnownTypes.Api(); + ApiField = new global::Google.Protobuf.WellKnownTypes.Api(); } - input.ReadMessage(apiField_); + input.ReadMessage(ApiField); break; } case 26: { if (durationField_ == null) { - durationField_ = new global::Google.Protobuf.WellKnownTypes.Duration(); + DurationField = new global::Google.Protobuf.WellKnownTypes.Duration(); } - input.ReadMessage(durationField_); + input.ReadMessage(DurationField); break; } case 34: { if (emptyField_ == null) { - emptyField_ = new global::Google.Protobuf.WellKnownTypes.Empty(); + EmptyField = new global::Google.Protobuf.WellKnownTypes.Empty(); } - input.ReadMessage(emptyField_); + input.ReadMessage(EmptyField); break; } case 42: { if (fieldMaskField_ == null) { - fieldMaskField_ = new global::Google.Protobuf.WellKnownTypes.FieldMask(); + FieldMaskField = new global::Google.Protobuf.WellKnownTypes.FieldMask(); } - input.ReadMessage(fieldMaskField_); + input.ReadMessage(FieldMaskField); break; } case 50: { if (sourceContextField_ == null) { - sourceContextField_ = new global::Google.Protobuf.WellKnownTypes.SourceContext(); + SourceContextField = new global::Google.Protobuf.WellKnownTypes.SourceContext(); } - input.ReadMessage(sourceContextField_); + input.ReadMessage(SourceContextField); break; } case 58: { if (structField_ == null) { - structField_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + StructField = new global::Google.Protobuf.WellKnownTypes.Struct(); } - input.ReadMessage(structField_); + input.ReadMessage(StructField); break; } case 66: { if (timestampField_ == null) { - timestampField_ = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + TimestampField = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } - input.ReadMessage(timestampField_); + input.ReadMessage(TimestampField); break; } case 74: { if (typeField_ == null) { - typeField_ = new global::Google.Protobuf.WellKnownTypes.Type(); + TypeField = new global::Google.Protobuf.WellKnownTypes.Type(); } - input.ReadMessage(typeField_); + input.ReadMessage(TypeField); break; } case 82: { @@ -909,9 +918,9 @@ namespace Google.Protobuf.TestProtos { } case 154: { if (valueField_ == null) { - valueField_ = new global::Google.Protobuf.WellKnownTypes.Value(); + ValueField = new global::Google.Protobuf.WellKnownTypes.Value(); } - input.ReadMessage(valueField_); + input.ReadMessage(ValueField); break; } } |