diff --git a/csharp/src/AddressBook/Addressbook.pb.cs b/csharp/src/AddressBook/Addressbook.pb.cs
index 2d5b6358ec536..12c67a559da16 100644
--- a/csharp/src/AddressBook/Addressbook.pb.cs
+++ b/csharp/src/AddressBook/Addressbook.pb.cs
@@ -99,6 +99,21 @@ public Person Clone() {
return new Person(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ name_ = "";
+ id_ = 0;
+ email_ = "";
+ phones_.Clear();
+ if (lastUpdated_ != null) {
+ lastUpdated_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private string name_ = "";
@@ -452,6 +467,16 @@ public PhoneNumber Clone() {
return new PhoneNumber(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ number_ = "";
+ type_ = global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "number" field.
public const int NumberFieldNumber = 1;
private string number_ = "";
@@ -694,6 +719,15 @@ public AddressBook Clone() {
return new AddressBook(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ people_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "people" field.
public const int PeopleFieldNumber = 1;
private static readonly pb::FieldCodec _repeated_people_codec
diff --git a/csharp/src/Google.Protobuf.Conformance/Conformance.pb.cs b/csharp/src/Google.Protobuf.Conformance/Conformance.pb.cs
index 810e5e2cacae7..7e3616342376f 100644
--- a/csharp/src/Google.Protobuf.Conformance/Conformance.pb.cs
+++ b/csharp/src/Google.Protobuf.Conformance/Conformance.pb.cs
@@ -160,6 +160,17 @@ public TestStatus Clone() {
return new TestStatus(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ name_ = "";
+ failureMessage_ = "";
+ matchedName_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private string name_ = "";
@@ -439,6 +450,15 @@ public FailureSet Clone() {
return new FailureSet(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ test_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "test" field.
public const int TestFieldNumber = 2;
private static readonly pb::FieldCodec _repeated_test_codec
@@ -652,6 +672,23 @@ public ConformanceRequest Clone() {
return new ConformanceRequest(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ requestedOutputFormat_ = global::Conformance.WireFormat.Unspecified;
+ messageType_ = "";
+ testCategory_ = global::Conformance.TestCategory.UnspecifiedTest;
+ if (jspbEncodingOptions_ != null) {
+ jspbEncodingOptions_.Clear();
+ }
+ printUnknownFields_ = false;
+ payloadCase_ = PayloadOneofCase.None;
+ payload_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "protobuf_payload" field.
public const int ProtobufPayloadFieldNumber = 1;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -1289,6 +1326,16 @@ public ConformanceResponse Clone() {
return new ConformanceResponse(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ resultCase_ = ResultOneofCase.None;
+ result_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "parse_error" field.
public const int ParseErrorFieldNumber = 1;
///
@@ -1980,6 +2027,15 @@ public JspbEncodingConfig Clone() {
return new JspbEncodingConfig(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ useJspbArrayAnyFormat_ = false;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "use_jspb_array_any_format" field.
public const int UseJspbArrayAnyFormatFieldNumber = 1;
private bool useJspbArrayAnyFormat_;
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.pb.cs
index 7edec51e72044..7febcca0ec69e 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.pb.cs
@@ -238,6 +238,31 @@ public TestMap Clone() {
return new TestMap(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ mapInt32Int32_.Clear();
+ mapInt64Int64_.Clear();
+ mapUint32Uint32_.Clear();
+ mapUint64Uint64_.Clear();
+ mapSint32Sint32_.Clear();
+ mapSint64Sint64_.Clear();
+ mapFixed32Fixed32_.Clear();
+ mapFixed64Fixed64_.Clear();
+ mapSfixed32Sfixed32_.Clear();
+ mapSfixed64Sfixed64_.Clear();
+ mapInt32Float_.Clear();
+ mapInt32Double_.Clear();
+ mapBoolBool_.Clear();
+ mapStringString_.Clear();
+ mapInt32Bytes_.Clear();
+ mapInt32Enum_.Clear();
+ mapInt32ForeignMessage_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "map_int32_int32" field.
public const int MapInt32Int32FieldNumber = 1;
private static readonly pbc::MapField.Codec _map_mapInt32Int32_codec
@@ -825,6 +850,17 @@ public TestMapSubmessage Clone() {
return new TestMapSubmessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (testMap_ != null) {
+ testMap_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "test_map" field.
public const int TestMapFieldNumber = 1;
private global::Google.Protobuf.TestProtos.TestMap testMap_;
@@ -1032,6 +1068,15 @@ public TestMessageMap Clone() {
return new TestMessageMap(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ mapInt32Message_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "map_int32_message" field.
public const int MapInt32MessageFieldNumber = 1;
private static readonly pbc::MapField.Codec _map_mapInt32Message_codec
@@ -1223,6 +1268,16 @@ public TestSameTypeMap Clone() {
return new TestSameTypeMap(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ map1_.Clear();
+ map2_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "map1" field.
public const int Map1FieldNumber = 1;
private static readonly pbc::MapField.Codec _map_map1_codec
@@ -1449,6 +1504,29 @@ public TestArenaMap Clone() {
return new TestArenaMap(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ mapInt32Int32_.Clear();
+ mapInt64Int64_.Clear();
+ mapUint32Uint32_.Clear();
+ mapUint64Uint64_.Clear();
+ mapSint32Sint32_.Clear();
+ mapSint64Sint64_.Clear();
+ mapFixed32Fixed32_.Clear();
+ mapFixed64Fixed64_.Clear();
+ mapSfixed32Sfixed32_.Clear();
+ mapSfixed64Sfixed64_.Clear();
+ mapInt32Float_.Clear();
+ mapInt32Double_.Clear();
+ mapBoolBool_.Clear();
+ mapInt32Enum_.Clear();
+ mapInt32ForeignMessage_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "map_int32_int32" field.
public const int MapInt32Int32FieldNumber = 1;
private static readonly pbc::MapField.Codec _map_mapInt32Int32_codec
@@ -1990,6 +2068,15 @@ public MessageContainingEnumCalledType Clone() {
return new MessageContainingEnumCalledType(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ type_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "type" field.
public const int TypeFieldNumber = 1;
private static readonly pbc::MapField.Codec _map_type_codec
@@ -2192,6 +2279,15 @@ public MessageContainingMapCalledEntry Clone() {
return new MessageContainingMapCalledEntry(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ entry_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "entry" field.
public const int EntryFieldNumber = 1;
private static readonly pbc::MapField.Codec _map_entry_codec
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/OldExtensions1.cs b/csharp/src/Google.Protobuf.Test.TestProtos/OldExtensions1.cs
index 3824f4c6eabc5..52b9e7a4445e6 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/OldExtensions1.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/OldExtensions1.cs
@@ -73,6 +73,13 @@ public TestMessage Clone() {
return new TestMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void Clear() {
+ if(_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as TestMessage);
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesEdition2023.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesEdition2023.pb.cs
index 890ae67117ac5..ab299a9cd2223 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesEdition2023.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesEdition2023.pb.cs
@@ -276,6 +276,16 @@ public ComplexMessage Clone() {
return new ComplexMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ d_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "d" field.
public const int DFieldNumber = 1;
private readonly static int DDefaultValue = 0;
@@ -615,6 +625,122 @@ public TestAllTypesEdition2023 Clone() {
return new TestAllTypesEdition2023(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ optionalInt32_ = 0;
+ optionalInt64_ = 0L;
+ optionalUint32_ = 0;
+ optionalUint64_ = 0UL;
+ optionalSint32_ = 0;
+ optionalSint64_ = 0L;
+ optionalFixed32_ = 0;
+ optionalFixed64_ = 0UL;
+ optionalSfixed32_ = 0;
+ optionalSfixed64_ = 0L;
+ optionalFloat_ = 0F;
+ optionalDouble_ = 0D;
+ optionalBool_ = false;
+ optionalString_ = "";
+ optionalBytes_ = pb::ByteString.Empty;
+ if (optionalNestedMessage_ != null) {
+ optionalNestedMessage_.Clear();
+ }
+ if (optionalForeignMessage_ != null) {
+ optionalForeignMessage_.Clear();
+ }
+ optionalNestedEnum_ = global::ProtobufTestMessages.Editions.TestAllTypesEdition2023.Types.NestedEnum.Foo;
+ optionalForeignEnum_ = global::ProtobufTestMessages.Editions.ForeignEnumEdition2023.ForeignFoo;
+ optionalStringPiece_ = "";
+ optionalCord_ = "";
+ if (recursiveMessage_ != null) {
+ recursiveMessage_.Clear();
+ }
+ repeatedInt32_.Clear();
+ repeatedInt64_.Clear();
+ repeatedUint32_.Clear();
+ repeatedUint64_.Clear();
+ repeatedSint32_.Clear();
+ repeatedSint64_.Clear();
+ repeatedFixed32_.Clear();
+ repeatedFixed64_.Clear();
+ repeatedSfixed32_.Clear();
+ repeatedSfixed64_.Clear();
+ repeatedFloat_.Clear();
+ repeatedDouble_.Clear();
+ repeatedBool_.Clear();
+ repeatedString_.Clear();
+ repeatedBytes_.Clear();
+ repeatedNestedMessage_.Clear();
+ repeatedForeignMessage_.Clear();
+ repeatedNestedEnum_.Clear();
+ repeatedForeignEnum_.Clear();
+ repeatedStringPiece_.Clear();
+ repeatedCord_.Clear();
+ packedInt32_.Clear();
+ packedInt64_.Clear();
+ packedUint32_.Clear();
+ packedUint64_.Clear();
+ packedSint32_.Clear();
+ packedSint64_.Clear();
+ packedFixed32_.Clear();
+ packedFixed64_.Clear();
+ packedSfixed32_.Clear();
+ packedSfixed64_.Clear();
+ packedFloat_.Clear();
+ packedDouble_.Clear();
+ packedBool_.Clear();
+ packedNestedEnum_.Clear();
+ unpackedInt32_.Clear();
+ unpackedInt64_.Clear();
+ unpackedUint32_.Clear();
+ unpackedUint64_.Clear();
+ unpackedSint32_.Clear();
+ unpackedSint64_.Clear();
+ unpackedFixed32_.Clear();
+ unpackedFixed64_.Clear();
+ unpackedSfixed32_.Clear();
+ unpackedSfixed64_.Clear();
+ unpackedFloat_.Clear();
+ unpackedDouble_.Clear();
+ unpackedBool_.Clear();
+ unpackedNestedEnum_.Clear();
+ mapInt32Int32_.Clear();
+ mapInt64Int64_.Clear();
+ mapUint32Uint32_.Clear();
+ mapUint64Uint64_.Clear();
+ mapSint32Sint32_.Clear();
+ mapSint64Sint64_.Clear();
+ mapFixed32Fixed32_.Clear();
+ mapFixed64Fixed64_.Clear();
+ mapSfixed32Sfixed32_.Clear();
+ mapSfixed64Sfixed64_.Clear();
+ mapInt32Float_.Clear();
+ mapInt32Double_.Clear();
+ mapBoolBool_.Clear();
+ mapStringString_.Clear();
+ mapStringBytes_.Clear();
+ mapStringNestedMessage_.Clear();
+ mapStringForeignMessage_.Clear();
+ mapStringNestedEnum_.Clear();
+ mapStringForeignEnum_.Clear();
+ if (groupLikeType_ != null) {
+ groupLikeType_.Clear();
+ }
+ if (delimitedField_ != null) {
+ delimitedField_.Clear();
+ }
+ oneofFieldCase_ = OneofFieldOneofCase.None;
+ oneofField_ = null;
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "optional_int32" field.
public const int OptionalInt32FieldNumber = 1;
private readonly static int OptionalInt32DefaultValue = 0;
@@ -4338,6 +4464,19 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ if (corecursive_ != null) {
+ corecursive_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private readonly static int ADefaultValue = 0;
@@ -4602,6 +4741,17 @@ public GroupLikeType Clone() {
return new GroupLikeType(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ groupInt32_ = 0;
+ groupUint32_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "group_int32" field.
public const int GroupInt32FieldNumber = 202;
private readonly static int GroupInt32DefaultValue = 0;
@@ -4873,6 +5023,16 @@ public ForeignMessageEdition2023 Clone() {
return new ForeignMessageEdition2023(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ c_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "c" field.
public const int CFieldNumber = 1;
private readonly static int CDefaultValue = 0;
@@ -5088,6 +5248,16 @@ public GroupLikeType Clone() {
return new GroupLikeType(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ c_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "c" field.
public const int CFieldNumber = 1;
private readonly static int CDefaultValue = 0;
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.pb.cs
index 2b205887eb619..2dd2cfc1f68e7 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.pb.cs
@@ -577,6 +577,161 @@ public TestAllTypesProto2 Clone() {
return new TestAllTypesProto2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ _hasBits1 = 0;
+ optionalInt32_ = 0;
+ optionalInt64_ = 0L;
+ optionalUint32_ = 0;
+ optionalUint64_ = 0UL;
+ optionalSint32_ = 0;
+ optionalSint64_ = 0L;
+ optionalFixed32_ = 0;
+ optionalFixed64_ = 0UL;
+ optionalSfixed32_ = 0;
+ optionalSfixed64_ = 0L;
+ optionalFloat_ = 0F;
+ optionalDouble_ = 0D;
+ optionalBool_ = false;
+ optionalString_ = "";
+ optionalBytes_ = pb::ByteString.Empty;
+ if (optionalNestedMessage_ != null) {
+ optionalNestedMessage_.Clear();
+ }
+ if (optionalForeignMessage_ != null) {
+ optionalForeignMessage_.Clear();
+ }
+ optionalNestedEnum_ = global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedEnum.Foo;
+ optionalForeignEnum_ = global::ProtobufTestMessages.Proto2.ForeignEnumProto2.ForeignFoo;
+ optionalStringPiece_ = "";
+ optionalCord_ = "";
+ if (recursiveMessage_ != null) {
+ recursiveMessage_.Clear();
+ }
+ repeatedInt32_.Clear();
+ repeatedInt64_.Clear();
+ repeatedUint32_.Clear();
+ repeatedUint64_.Clear();
+ repeatedSint32_.Clear();
+ repeatedSint64_.Clear();
+ repeatedFixed32_.Clear();
+ repeatedFixed64_.Clear();
+ repeatedSfixed32_.Clear();
+ repeatedSfixed64_.Clear();
+ repeatedFloat_.Clear();
+ repeatedDouble_.Clear();
+ repeatedBool_.Clear();
+ repeatedString_.Clear();
+ repeatedBytes_.Clear();
+ repeatedNestedMessage_.Clear();
+ repeatedForeignMessage_.Clear();
+ repeatedNestedEnum_.Clear();
+ repeatedForeignEnum_.Clear();
+ repeatedStringPiece_.Clear();
+ repeatedCord_.Clear();
+ packedInt32_.Clear();
+ packedInt64_.Clear();
+ packedUint32_.Clear();
+ packedUint64_.Clear();
+ packedSint32_.Clear();
+ packedSint64_.Clear();
+ packedFixed32_.Clear();
+ packedFixed64_.Clear();
+ packedSfixed32_.Clear();
+ packedSfixed64_.Clear();
+ packedFloat_.Clear();
+ packedDouble_.Clear();
+ packedBool_.Clear();
+ packedNestedEnum_.Clear();
+ unpackedInt32_.Clear();
+ unpackedInt64_.Clear();
+ unpackedUint32_.Clear();
+ unpackedUint64_.Clear();
+ unpackedSint32_.Clear();
+ unpackedSint64_.Clear();
+ unpackedFixed32_.Clear();
+ unpackedFixed64_.Clear();
+ unpackedSfixed32_.Clear();
+ unpackedSfixed64_.Clear();
+ unpackedFloat_.Clear();
+ unpackedDouble_.Clear();
+ unpackedBool_.Clear();
+ unpackedNestedEnum_.Clear();
+ mapInt32Int32_.Clear();
+ mapInt64Int64_.Clear();
+ mapUint32Uint32_.Clear();
+ mapUint64Uint64_.Clear();
+ mapSint32Sint32_.Clear();
+ mapSint64Sint64_.Clear();
+ mapFixed32Fixed32_.Clear();
+ mapFixed64Fixed64_.Clear();
+ mapSfixed32Sfixed32_.Clear();
+ mapSfixed64Sfixed64_.Clear();
+ mapInt32Bool_.Clear();
+ mapInt32Float_.Clear();
+ mapInt32Double_.Clear();
+ mapInt32NestedMessage_.Clear();
+ mapBoolBool_.Clear();
+ mapStringString_.Clear();
+ mapStringBytes_.Clear();
+ mapStringNestedMessage_.Clear();
+ mapStringForeignMessage_.Clear();
+ mapStringNestedEnum_.Clear();
+ mapStringForeignEnum_.Clear();
+ if (data_ != null) {
+ data_.Clear();
+ }
+ if (multiWordGroupField_ != null) {
+ multiWordGroupField_.Clear();
+ }
+ defaultInt32_ = -123456789;
+ defaultInt64_ = -9123456789123456789L;
+ defaultUint32_ = 2123456789;
+ defaultUint64_ = 10123456789123456789UL;
+ defaultSint32_ = -123456789;
+ defaultSint64_ = -9123456789123456789L;
+ defaultFixed32_ = 2123456789;
+ defaultFixed64_ = 10123456789123456789UL;
+ defaultSfixed32_ = -123456789;
+ defaultSfixed64_ = -9123456789123456789L;
+ defaultFloat_ = 9e+09F;
+ defaultDouble_ = 7e+22D;
+ defaultBool_ = true;
+ defaultString_ = global::System.Text.Encoding.UTF8.GetString(global::System.Convert.FromBase64String("Um9zZWJ1ZA=="), 0, 7);
+ defaultBytes_ = pb::ByteString.FromBase64("am9zaHVh");
+ fieldname1_ = 0;
+ fieldName2_ = 0;
+ FieldName3_ = 0;
+ fieldName4_ = 0;
+ field0Name5_ = 0;
+ field0Name6_ = 0;
+ fieldName7_ = 0;
+ fieldName8_ = 0;
+ fieldName9_ = 0;
+ fieldName10_ = 0;
+ fIELDNAME11_ = 0;
+ fIELDName12_ = 0;
+ FieldName13_ = 0;
+ FieldName14_ = 0;
+ fieldName15_ = 0;
+ fieldName16_ = 0;
+ fieldName17_ = 0;
+ fieldName18_ = 0;
+ if (messageSetCorrect_ != null) {
+ messageSetCorrect_.Clear();
+ }
+ oneofFieldCase_ = OneofFieldOneofCase.None;
+ oneofField_ = null;
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "optional_int32" field.
public const int OptionalInt32FieldNumber = 1;
private readonly static int OptionalInt32DefaultValue = 0;
@@ -6083,6 +6238,19 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ if (corecursive_ != null) {
+ corecursive_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private readonly static int ADefaultValue = 0;
@@ -6347,6 +6515,17 @@ public Data Clone() {
return new Data(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ groupInt32_ = 0;
+ groupUint32_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "group_int32" field.
public const int GroupInt32FieldNumber = 202;
private readonly static int GroupInt32DefaultValue = 0;
@@ -6614,6 +6793,17 @@ public MultiWordGroupField Clone() {
return new MultiWordGroupField(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ groupInt32_ = 0;
+ groupUint32_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "group_int32" field.
public const int GroupInt32FieldNumber = 205;
private readonly static int GroupInt32DefaultValue = 0;
@@ -6883,6 +7073,17 @@ public MessageSetCorrect Clone() {
return new MessageSetCorrect(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -7087,6 +7288,15 @@ public MessageSetCorrectExtension1 Clone() {
return new MessageSetCorrectExtension1(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ str_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "str" field.
public const int StrFieldNumber = 25;
private readonly static string StrDefaultValue = "";
@@ -7311,6 +7521,16 @@ public MessageSetCorrectExtension2 Clone() {
return new MessageSetCorrectExtension2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ i_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "i" field.
public const int IFieldNumber = 9;
private readonly static int IDefaultValue = 0;
@@ -7542,6 +7762,16 @@ public ExtensionWithOneof Clone() {
return new ExtensionWithOneof(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ oneofFieldCase_ = OneofFieldOneofCase.None;
+ oneofField_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -7847,6 +8077,16 @@ public ForeignMessageProto2 Clone() {
return new ForeignMessageProto2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ c_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "c" field.
public const int CFieldNumber = 1;
private readonly static int CDefaultValue = 0;
@@ -8063,6 +8303,17 @@ public GroupField Clone() {
return new GroupField(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ groupInt32_ = 0;
+ groupUint32_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "group_int32" field.
public const int GroupInt32FieldNumber = 122;
private readonly static int GroupInt32DefaultValue = 0;
@@ -8334,6 +8585,25 @@ public UnknownToTestAllTypes Clone() {
return new UnknownToTestAllTypes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ optionalInt32_ = 0;
+ optionalString_ = "";
+ if (nestedMessage_ != null) {
+ nestedMessage_.Clear();
+ }
+ if (optionalGroup_ != null) {
+ optionalGroup_.Clear();
+ }
+ optionalBool_ = false;
+ repeatedInt32_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "optional_int32" field.
public const int OptionalInt32FieldNumber = 1001;
private readonly static int OptionalInt32DefaultValue = 0;
@@ -8784,6 +9054,16 @@ public OptionalGroup Clone() {
return new OptionalGroup(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private readonly static int ADefaultValue = 0;
@@ -9001,6 +9281,14 @@ public NullHypothesisProto2 Clone() {
return new NullHypothesisProto2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -9162,6 +9450,14 @@ public EnumOnlyProto2 Clone() {
return new EnumOnlyProto2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -9337,6 +9633,15 @@ public OneStringProto2 Clone() {
return new OneStringProto2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ data_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private readonly static string DataDefaultValue = "";
@@ -9553,6 +9858,18 @@ public ProtoWithKeywords Clone() {
return new ProtoWithKeywords(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ inline_ = 0;
+ concept_ = "";
+ requires_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "inline" field.
public const int InlineFieldNumber = 1;
private readonly static int InlineDefaultValue = 0;
@@ -9884,6 +10201,67 @@ public TestAllRequiredTypesProto2 Clone() {
return new TestAllRequiredTypesProto2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ requiredInt32_ = 0;
+ requiredInt64_ = 0L;
+ requiredUint32_ = 0;
+ requiredUint64_ = 0UL;
+ requiredSint32_ = 0;
+ requiredSint64_ = 0L;
+ requiredFixed32_ = 0;
+ requiredFixed64_ = 0UL;
+ requiredSfixed32_ = 0;
+ requiredSfixed64_ = 0L;
+ requiredFloat_ = 0F;
+ requiredDouble_ = 0D;
+ requiredBool_ = false;
+ requiredString_ = "";
+ requiredBytes_ = pb::ByteString.Empty;
+ if (requiredNestedMessage_ != null) {
+ requiredNestedMessage_.Clear();
+ }
+ if (requiredForeignMessage_ != null) {
+ requiredForeignMessage_.Clear();
+ }
+ requiredNestedEnum_ = global::ProtobufTestMessages.Proto2.TestAllRequiredTypesProto2.Types.NestedEnum.Foo;
+ requiredForeignEnum_ = global::ProtobufTestMessages.Proto2.ForeignEnumProto2.ForeignFoo;
+ requiredStringPiece_ = "";
+ requiredCord_ = "";
+ if (recursiveMessage_ != null) {
+ recursiveMessage_.Clear();
+ }
+ if (optionalRecursiveMessage_ != null) {
+ optionalRecursiveMessage_.Clear();
+ }
+ if (data_ != null) {
+ data_.Clear();
+ }
+ defaultInt32_ = -123456789;
+ defaultInt64_ = -9123456789123456789L;
+ defaultUint32_ = 2123456789;
+ defaultUint64_ = 10123456789123456789UL;
+ defaultSint32_ = -123456789;
+ defaultSint64_ = -9123456789123456789L;
+ defaultFixed32_ = 2123456789;
+ defaultFixed64_ = 10123456789123456789UL;
+ defaultSfixed32_ = -123456789;
+ defaultSfixed64_ = -9123456789123456789L;
+ defaultFloat_ = 9e+09F;
+ defaultDouble_ = 7e+22D;
+ defaultBool_ = true;
+ defaultString_ = global::System.Text.Encoding.UTF8.GetString(global::System.Convert.FromBase64String("Um9zZWJ1ZA=="), 0, 7);
+ defaultBytes_ = pb::ByteString.FromBase64("am9zaHVh");
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "required_int32" field.
public const int RequiredInt32FieldNumber = 1;
private readonly static int RequiredInt32DefaultValue = 0;
@@ -12078,6 +12456,22 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ if (corecursive_ != null) {
+ corecursive_.Clear();
+ }
+ if (optionalCorecursive_ != null) {
+ optionalCorecursive_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private readonly static int ADefaultValue = 0;
@@ -12387,6 +12781,17 @@ public Data Clone() {
return new Data(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ groupInt32_ = 0;
+ groupUint32_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "group_int32" field.
public const int GroupInt32FieldNumber = 202;
private readonly static int GroupInt32DefaultValue = 0;
@@ -12656,6 +13061,17 @@ public MessageSetCorrect Clone() {
return new MessageSetCorrect(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -12860,6 +13276,15 @@ public MessageSetCorrectExtension1 Clone() {
return new MessageSetCorrectExtension1(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ str_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "str" field.
public const int StrFieldNumber = 25;
private readonly static string StrDefaultValue = "";
@@ -13084,6 +13509,16 @@ public MessageSetCorrectExtension2 Clone() {
return new MessageSetCorrectExtension2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ i_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "i" field.
public const int IFieldNumber = 9;
private readonly static int IDefaultValue = 0;
@@ -13329,6 +13764,16 @@ public TestLargeOneof Clone() {
return new TestLargeOneof(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ largeOneofCase_ = LargeOneofOneofCase.None;
+ largeOneof_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a1" field.
public const int A1FieldNumber = 1;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -13767,6 +14212,14 @@ public A1 Clone() {
return new A1(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -13928,6 +14381,14 @@ public A2 Clone() {
return new A2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -14089,6 +14550,14 @@ public A3 Clone() {
return new A3(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -14250,6 +14719,14 @@ public A4 Clone() {
return new A4(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -14411,6 +14888,14 @@ public A5 Clone() {
return new A5(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2Editions.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2Editions.pb.cs
index e2cbea33ed80f..1f1da26a5251d 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2Editions.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2Editions.pb.cs
@@ -600,6 +600,161 @@ public TestAllTypesProto2 Clone() {
return new TestAllTypesProto2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ _hasBits1 = 0;
+ optionalInt32_ = 0;
+ optionalInt64_ = 0L;
+ optionalUint32_ = 0;
+ optionalUint64_ = 0UL;
+ optionalSint32_ = 0;
+ optionalSint64_ = 0L;
+ optionalFixed32_ = 0;
+ optionalFixed64_ = 0UL;
+ optionalSfixed32_ = 0;
+ optionalSfixed64_ = 0L;
+ optionalFloat_ = 0F;
+ optionalDouble_ = 0D;
+ optionalBool_ = false;
+ optionalString_ = "";
+ optionalBytes_ = pb::ByteString.Empty;
+ if (optionalNestedMessage_ != null) {
+ optionalNestedMessage_.Clear();
+ }
+ if (optionalForeignMessage_ != null) {
+ optionalForeignMessage_.Clear();
+ }
+ optionalNestedEnum_ = global::ProtobufTestMessages.Editions.Proto2.TestAllTypesProto2.Types.NestedEnum.Foo;
+ optionalForeignEnum_ = global::ProtobufTestMessages.Editions.Proto2.ForeignEnumProto2.ForeignFoo;
+ optionalStringPiece_ = "";
+ optionalCord_ = "";
+ if (recursiveMessage_ != null) {
+ recursiveMessage_.Clear();
+ }
+ repeatedInt32_.Clear();
+ repeatedInt64_.Clear();
+ repeatedUint32_.Clear();
+ repeatedUint64_.Clear();
+ repeatedSint32_.Clear();
+ repeatedSint64_.Clear();
+ repeatedFixed32_.Clear();
+ repeatedFixed64_.Clear();
+ repeatedSfixed32_.Clear();
+ repeatedSfixed64_.Clear();
+ repeatedFloat_.Clear();
+ repeatedDouble_.Clear();
+ repeatedBool_.Clear();
+ repeatedString_.Clear();
+ repeatedBytes_.Clear();
+ repeatedNestedMessage_.Clear();
+ repeatedForeignMessage_.Clear();
+ repeatedNestedEnum_.Clear();
+ repeatedForeignEnum_.Clear();
+ repeatedStringPiece_.Clear();
+ repeatedCord_.Clear();
+ packedInt32_.Clear();
+ packedInt64_.Clear();
+ packedUint32_.Clear();
+ packedUint64_.Clear();
+ packedSint32_.Clear();
+ packedSint64_.Clear();
+ packedFixed32_.Clear();
+ packedFixed64_.Clear();
+ packedSfixed32_.Clear();
+ packedSfixed64_.Clear();
+ packedFloat_.Clear();
+ packedDouble_.Clear();
+ packedBool_.Clear();
+ packedNestedEnum_.Clear();
+ unpackedInt32_.Clear();
+ unpackedInt64_.Clear();
+ unpackedUint32_.Clear();
+ unpackedUint64_.Clear();
+ unpackedSint32_.Clear();
+ unpackedSint64_.Clear();
+ unpackedFixed32_.Clear();
+ unpackedFixed64_.Clear();
+ unpackedSfixed32_.Clear();
+ unpackedSfixed64_.Clear();
+ unpackedFloat_.Clear();
+ unpackedDouble_.Clear();
+ unpackedBool_.Clear();
+ unpackedNestedEnum_.Clear();
+ mapInt32Int32_.Clear();
+ mapInt64Int64_.Clear();
+ mapUint32Uint32_.Clear();
+ mapUint64Uint64_.Clear();
+ mapSint32Sint32_.Clear();
+ mapSint64Sint64_.Clear();
+ mapFixed32Fixed32_.Clear();
+ mapFixed64Fixed64_.Clear();
+ mapSfixed32Sfixed32_.Clear();
+ mapSfixed64Sfixed64_.Clear();
+ mapInt32Bool_.Clear();
+ mapInt32Float_.Clear();
+ mapInt32Double_.Clear();
+ mapInt32NestedMessage_.Clear();
+ mapBoolBool_.Clear();
+ mapStringString_.Clear();
+ mapStringBytes_.Clear();
+ mapStringNestedMessage_.Clear();
+ mapStringForeignMessage_.Clear();
+ mapStringNestedEnum_.Clear();
+ mapStringForeignEnum_.Clear();
+ if (data_ != null) {
+ data_.Clear();
+ }
+ if (multiWordGroupField_ != null) {
+ multiWordGroupField_.Clear();
+ }
+ defaultInt32_ = -123456789;
+ defaultInt64_ = -9123456789123456789L;
+ defaultUint32_ = 2123456789;
+ defaultUint64_ = 10123456789123456789UL;
+ defaultSint32_ = -123456789;
+ defaultSint64_ = -9123456789123456789L;
+ defaultFixed32_ = 2123456789;
+ defaultFixed64_ = 10123456789123456789UL;
+ defaultSfixed32_ = -123456789;
+ defaultSfixed64_ = -9123456789123456789L;
+ defaultFloat_ = 9e+09F;
+ defaultDouble_ = 7e+22D;
+ defaultBool_ = true;
+ defaultString_ = global::System.Text.Encoding.UTF8.GetString(global::System.Convert.FromBase64String("Um9zZWJ1ZA=="), 0, 7);
+ defaultBytes_ = pb::ByteString.FromBase64("am9zaHVh");
+ fieldname1_ = 0;
+ fieldName2_ = 0;
+ FieldName3_ = 0;
+ fieldName4_ = 0;
+ field0Name5_ = 0;
+ field0Name6_ = 0;
+ fieldName7_ = 0;
+ fieldName8_ = 0;
+ fieldName9_ = 0;
+ fieldName10_ = 0;
+ fIELDNAME11_ = 0;
+ fIELDName12_ = 0;
+ FieldName13_ = 0;
+ FieldName14_ = 0;
+ fieldName15_ = 0;
+ fieldName16_ = 0;
+ fieldName17_ = 0;
+ fieldName18_ = 0;
+ if (messageSetCorrect_ != null) {
+ messageSetCorrect_.Clear();
+ }
+ oneofFieldCase_ = OneofFieldOneofCase.None;
+ oneofField_ = null;
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "optional_int32" field.
public const int OptionalInt32FieldNumber = 1;
private readonly static int OptionalInt32DefaultValue = 0;
@@ -6106,6 +6261,19 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ if (corecursive_ != null) {
+ corecursive_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private readonly static int ADefaultValue = 0;
@@ -6370,6 +6538,17 @@ public Data Clone() {
return new Data(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ groupInt32_ = 0;
+ groupUint32_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "group_int32" field.
public const int GroupInt32FieldNumber = 202;
private readonly static int GroupInt32DefaultValue = 0;
@@ -6637,6 +6816,17 @@ public MultiWordGroupField Clone() {
return new MultiWordGroupField(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ groupInt32_ = 0;
+ groupUint32_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "group_int32" field.
public const int GroupInt32FieldNumber = 205;
private readonly static int GroupInt32DefaultValue = 0;
@@ -6906,6 +7096,17 @@ public MessageSetCorrect Clone() {
return new MessageSetCorrect(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -7110,6 +7311,15 @@ public MessageSetCorrectExtension1 Clone() {
return new MessageSetCorrectExtension1(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ str_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "str" field.
public const int StrFieldNumber = 25;
private readonly static string StrDefaultValue = "";
@@ -7334,6 +7544,16 @@ public MessageSetCorrectExtension2 Clone() {
return new MessageSetCorrectExtension2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ i_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "i" field.
public const int IFieldNumber = 9;
private readonly static int IDefaultValue = 0;
@@ -7565,6 +7785,16 @@ public ExtensionWithOneof Clone() {
return new ExtensionWithOneof(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ oneofFieldCase_ = OneofFieldOneofCase.None;
+ oneofField_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -7870,6 +8100,16 @@ public ForeignMessageProto2 Clone() {
return new ForeignMessageProto2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ c_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "c" field.
public const int CFieldNumber = 1;
private readonly static int CDefaultValue = 0;
@@ -8086,6 +8326,17 @@ public GroupField Clone() {
return new GroupField(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ groupInt32_ = 0;
+ groupUint32_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "group_int32" field.
public const int GroupInt32FieldNumber = 122;
private readonly static int GroupInt32DefaultValue = 0;
@@ -8357,6 +8608,25 @@ public UnknownToTestAllTypes Clone() {
return new UnknownToTestAllTypes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ optionalInt32_ = 0;
+ optionalString_ = "";
+ if (nestedMessage_ != null) {
+ nestedMessage_.Clear();
+ }
+ if (optionalGroup_ != null) {
+ optionalGroup_.Clear();
+ }
+ optionalBool_ = false;
+ repeatedInt32_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "optional_int32" field.
public const int OptionalInt32FieldNumber = 1001;
private readonly static int OptionalInt32DefaultValue = 0;
@@ -8807,6 +9077,16 @@ public OptionalGroup Clone() {
return new OptionalGroup(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private readonly static int ADefaultValue = 0;
@@ -9024,6 +9304,14 @@ public NullHypothesisProto2 Clone() {
return new NullHypothesisProto2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -9185,6 +9473,14 @@ public EnumOnlyProto2 Clone() {
return new EnumOnlyProto2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -9360,6 +9656,15 @@ public OneStringProto2 Clone() {
return new OneStringProto2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ data_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private readonly static string DataDefaultValue = "";
@@ -9576,6 +9881,18 @@ public ProtoWithKeywords Clone() {
return new ProtoWithKeywords(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ inline_ = 0;
+ concept_ = "";
+ requires_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "inline" field.
public const int InlineFieldNumber = 1;
private readonly static int InlineDefaultValue = 0;
@@ -9907,6 +10224,67 @@ public TestAllRequiredTypesProto2 Clone() {
return new TestAllRequiredTypesProto2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ requiredInt32_ = 0;
+ requiredInt64_ = 0L;
+ requiredUint32_ = 0;
+ requiredUint64_ = 0UL;
+ requiredSint32_ = 0;
+ requiredSint64_ = 0L;
+ requiredFixed32_ = 0;
+ requiredFixed64_ = 0UL;
+ requiredSfixed32_ = 0;
+ requiredSfixed64_ = 0L;
+ requiredFloat_ = 0F;
+ requiredDouble_ = 0D;
+ requiredBool_ = false;
+ requiredString_ = "";
+ requiredBytes_ = pb::ByteString.Empty;
+ if (requiredNestedMessage_ != null) {
+ requiredNestedMessage_.Clear();
+ }
+ if (requiredForeignMessage_ != null) {
+ requiredForeignMessage_.Clear();
+ }
+ requiredNestedEnum_ = global::ProtobufTestMessages.Editions.Proto2.TestAllRequiredTypesProto2.Types.NestedEnum.Foo;
+ requiredForeignEnum_ = global::ProtobufTestMessages.Editions.Proto2.ForeignEnumProto2.ForeignFoo;
+ requiredStringPiece_ = "";
+ requiredCord_ = "";
+ if (recursiveMessage_ != null) {
+ recursiveMessage_.Clear();
+ }
+ if (optionalRecursiveMessage_ != null) {
+ optionalRecursiveMessage_.Clear();
+ }
+ if (data_ != null) {
+ data_.Clear();
+ }
+ defaultInt32_ = -123456789;
+ defaultInt64_ = -9123456789123456789L;
+ defaultUint32_ = 2123456789;
+ defaultUint64_ = 10123456789123456789UL;
+ defaultSint32_ = -123456789;
+ defaultSint64_ = -9123456789123456789L;
+ defaultFixed32_ = 2123456789;
+ defaultFixed64_ = 10123456789123456789UL;
+ defaultSfixed32_ = -123456789;
+ defaultSfixed64_ = -9123456789123456789L;
+ defaultFloat_ = 9e+09F;
+ defaultDouble_ = 7e+22D;
+ defaultBool_ = true;
+ defaultString_ = global::System.Text.Encoding.UTF8.GetString(global::System.Convert.FromBase64String("Um9zZWJ1ZA=="), 0, 7);
+ defaultBytes_ = pb::ByteString.FromBase64("am9zaHVh");
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "required_int32" field.
public const int RequiredInt32FieldNumber = 1;
private readonly static int RequiredInt32DefaultValue = 0;
@@ -12101,6 +12479,22 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ if (corecursive_ != null) {
+ corecursive_.Clear();
+ }
+ if (optionalCorecursive_ != null) {
+ optionalCorecursive_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private readonly static int ADefaultValue = 0;
@@ -12410,6 +12804,17 @@ public Data Clone() {
return new Data(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ groupInt32_ = 0;
+ groupUint32_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "group_int32" field.
public const int GroupInt32FieldNumber = 202;
private readonly static int GroupInt32DefaultValue = 0;
@@ -12679,6 +13084,17 @@ public MessageSetCorrect Clone() {
return new MessageSetCorrect(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -12883,6 +13299,15 @@ public MessageSetCorrectExtension1 Clone() {
return new MessageSetCorrectExtension1(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ str_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "str" field.
public const int StrFieldNumber = 25;
private readonly static string StrDefaultValue = "";
@@ -13107,6 +13532,16 @@ public MessageSetCorrectExtension2 Clone() {
return new MessageSetCorrectExtension2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ i_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "i" field.
public const int IFieldNumber = 9;
private readonly static int IDefaultValue = 0;
@@ -13352,6 +13787,16 @@ public TestLargeOneof Clone() {
return new TestLargeOneof(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ largeOneofCase_ = LargeOneofOneofCase.None;
+ largeOneof_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a1" field.
public const int A1FieldNumber = 1;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -13790,6 +14235,14 @@ public A1 Clone() {
return new A1(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -13951,6 +14404,14 @@ public A2 Clone() {
return new A2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -14112,6 +14573,14 @@ public A3 Clone() {
return new A3(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -14273,6 +14742,14 @@ public A4 Clone() {
return new A4(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -14434,6 +14911,14 @@ public A5 Clone() {
return new A5(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.pb.cs
index 2f7805ca87fea..251346e77e851 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.pb.cs
@@ -483,6 +483,175 @@ public TestAllTypesProto3 Clone() {
return new TestAllTypesProto3(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ optionalInt32_ = 0;
+ optionalInt64_ = 0L;
+ optionalUint32_ = 0;
+ optionalUint64_ = 0UL;
+ optionalSint32_ = 0;
+ optionalSint64_ = 0L;
+ optionalFixed32_ = 0;
+ optionalFixed64_ = 0UL;
+ optionalSfixed32_ = 0;
+ optionalSfixed64_ = 0L;
+ optionalFloat_ = 0F;
+ optionalDouble_ = 0D;
+ optionalBool_ = false;
+ optionalString_ = "";
+ optionalBytes_ = pb::ByteString.Empty;
+ if (optionalNestedMessage_ != null) {
+ optionalNestedMessage_.Clear();
+ }
+ if (optionalForeignMessage_ != null) {
+ optionalForeignMessage_.Clear();
+ }
+ optionalNestedEnum_ = global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedEnum.Foo;
+ optionalForeignEnum_ = global::ProtobufTestMessages.Proto3.ForeignEnum.ForeignFoo;
+ optionalAliasedEnum_ = global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.AliasedEnum.AliasFoo;
+ optionalStringPiece_ = "";
+ optionalCord_ = "";
+ if (recursiveMessage_ != null) {
+ recursiveMessage_.Clear();
+ }
+ repeatedInt32_.Clear();
+ repeatedInt64_.Clear();
+ repeatedUint32_.Clear();
+ repeatedUint64_.Clear();
+ repeatedSint32_.Clear();
+ repeatedSint64_.Clear();
+ repeatedFixed32_.Clear();
+ repeatedFixed64_.Clear();
+ repeatedSfixed32_.Clear();
+ repeatedSfixed64_.Clear();
+ repeatedFloat_.Clear();
+ repeatedDouble_.Clear();
+ repeatedBool_.Clear();
+ repeatedString_.Clear();
+ repeatedBytes_.Clear();
+ repeatedNestedMessage_.Clear();
+ repeatedForeignMessage_.Clear();
+ repeatedNestedEnum_.Clear();
+ repeatedForeignEnum_.Clear();
+ repeatedStringPiece_.Clear();
+ repeatedCord_.Clear();
+ packedInt32_.Clear();
+ packedInt64_.Clear();
+ packedUint32_.Clear();
+ packedUint64_.Clear();
+ packedSint32_.Clear();
+ packedSint64_.Clear();
+ packedFixed32_.Clear();
+ packedFixed64_.Clear();
+ packedSfixed32_.Clear();
+ packedSfixed64_.Clear();
+ packedFloat_.Clear();
+ packedDouble_.Clear();
+ packedBool_.Clear();
+ packedNestedEnum_.Clear();
+ unpackedInt32_.Clear();
+ unpackedInt64_.Clear();
+ unpackedUint32_.Clear();
+ unpackedUint64_.Clear();
+ unpackedSint32_.Clear();
+ unpackedSint64_.Clear();
+ unpackedFixed32_.Clear();
+ unpackedFixed64_.Clear();
+ unpackedSfixed32_.Clear();
+ unpackedSfixed64_.Clear();
+ unpackedFloat_.Clear();
+ unpackedDouble_.Clear();
+ unpackedBool_.Clear();
+ unpackedNestedEnum_.Clear();
+ mapInt32Int32_.Clear();
+ mapInt64Int64_.Clear();
+ mapUint32Uint32_.Clear();
+ mapUint64Uint64_.Clear();
+ mapSint32Sint32_.Clear();
+ mapSint64Sint64_.Clear();
+ mapFixed32Fixed32_.Clear();
+ mapFixed64Fixed64_.Clear();
+ mapSfixed32Sfixed32_.Clear();
+ mapSfixed64Sfixed64_.Clear();
+ mapInt32Float_.Clear();
+ mapInt32Double_.Clear();
+ mapBoolBool_.Clear();
+ mapStringString_.Clear();
+ mapStringBytes_.Clear();
+ mapStringNestedMessage_.Clear();
+ mapStringForeignMessage_.Clear();
+ mapStringNestedEnum_.Clear();
+ mapStringForeignEnum_.Clear();
+ optionalBoolWrapper_ = false;
+ optionalInt32Wrapper_ = 0;
+ optionalInt64Wrapper_ = 0L;
+ optionalUint32Wrapper_ = 0;
+ optionalUint64Wrapper_ = 0UL;
+ optionalFloatWrapper_ = 0F;
+ optionalDoubleWrapper_ = 0D;
+ optionalStringWrapper_ = "";
+ optionalBytesWrapper_ = pb::ByteString.Empty;
+ repeatedBoolWrapper_.Clear();
+ repeatedInt32Wrapper_.Clear();
+ repeatedInt64Wrapper_.Clear();
+ repeatedUint32Wrapper_.Clear();
+ repeatedUint64Wrapper_.Clear();
+ repeatedFloatWrapper_.Clear();
+ repeatedDoubleWrapper_.Clear();
+ repeatedStringWrapper_.Clear();
+ repeatedBytesWrapper_.Clear();
+ if (optionalDuration_ != null) {
+ optionalDuration_.Clear();
+ }
+ if (optionalTimestamp_ != null) {
+ optionalTimestamp_.Clear();
+ }
+ if (optionalFieldMask_ != null) {
+ optionalFieldMask_.Clear();
+ }
+ if (optionalStruct_ != null) {
+ optionalStruct_.Clear();
+ }
+ if (optionalAny_ != null) {
+ optionalAny_.Clear();
+ }
+ if (optionalValue_ != null) {
+ optionalValue_.Clear();
+ }
+ optionalNullValue_ = global::Google.Protobuf.WellKnownTypes.NullValue.NullValue;
+ repeatedDuration_.Clear();
+ repeatedTimestamp_.Clear();
+ repeatedFieldmask_.Clear();
+ repeatedStruct_.Clear();
+ repeatedAny_.Clear();
+ repeatedValue_.Clear();
+ repeatedListValue_.Clear();
+ fieldname1_ = 0;
+ fieldName2_ = 0;
+ FieldName3_ = 0;
+ fieldName4_ = 0;
+ field0Name5_ = 0;
+ field0Name6_ = 0;
+ fieldName7_ = 0;
+ fieldName8_ = 0;
+ fieldName9_ = 0;
+ fieldName10_ = 0;
+ fIELDNAME11_ = 0;
+ fIELDName12_ = 0;
+ FieldName13_ = 0;
+ FieldName14_ = 0;
+ fieldName15_ = 0;
+ fieldName16_ = 0;
+ fieldName17_ = 0;
+ fieldName18_ = 0;
+ oneofFieldCase_ = OneofFieldOneofCase.None;
+ oneofField_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "optional_int32" field.
public const int OptionalInt32FieldNumber = 1;
private int optionalInt32_;
@@ -5619,6 +5788,18 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ a_ = 0;
+ if (corecursive_ != null) {
+ corecursive_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private int a_;
@@ -5867,6 +6048,15 @@ public ForeignMessage Clone() {
return new ForeignMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ c_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "c" field.
public const int CFieldNumber = 1;
private int c_;
@@ -6064,6 +6254,14 @@ public NullHypothesisProto3 Clone() {
return new NullHypothesisProto3(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -6225,6 +6423,14 @@ public EnumOnlyProto3 Clone() {
return new EnumOnlyProto3(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3Editions.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3Editions.pb.cs
index f07f4c74a1a64..dc2b5cc8893fd 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3Editions.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3Editions.pb.cs
@@ -491,6 +491,175 @@ public TestAllTypesProto3 Clone() {
return new TestAllTypesProto3(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ optionalInt32_ = 0;
+ optionalInt64_ = 0L;
+ optionalUint32_ = 0;
+ optionalUint64_ = 0UL;
+ optionalSint32_ = 0;
+ optionalSint64_ = 0L;
+ optionalFixed32_ = 0;
+ optionalFixed64_ = 0UL;
+ optionalSfixed32_ = 0;
+ optionalSfixed64_ = 0L;
+ optionalFloat_ = 0F;
+ optionalDouble_ = 0D;
+ optionalBool_ = false;
+ optionalString_ = "";
+ optionalBytes_ = pb::ByteString.Empty;
+ if (optionalNestedMessage_ != null) {
+ optionalNestedMessage_.Clear();
+ }
+ if (optionalForeignMessage_ != null) {
+ optionalForeignMessage_.Clear();
+ }
+ optionalNestedEnum_ = global::ProtobufTestMessages.Editions.Proto3.TestAllTypesProto3.Types.NestedEnum.Foo;
+ optionalForeignEnum_ = global::ProtobufTestMessages.Editions.Proto3.ForeignEnum.ForeignFoo;
+ optionalAliasedEnum_ = global::ProtobufTestMessages.Editions.Proto3.TestAllTypesProto3.Types.AliasedEnum.AliasFoo;
+ optionalStringPiece_ = "";
+ optionalCord_ = "";
+ if (recursiveMessage_ != null) {
+ recursiveMessage_.Clear();
+ }
+ repeatedInt32_.Clear();
+ repeatedInt64_.Clear();
+ repeatedUint32_.Clear();
+ repeatedUint64_.Clear();
+ repeatedSint32_.Clear();
+ repeatedSint64_.Clear();
+ repeatedFixed32_.Clear();
+ repeatedFixed64_.Clear();
+ repeatedSfixed32_.Clear();
+ repeatedSfixed64_.Clear();
+ repeatedFloat_.Clear();
+ repeatedDouble_.Clear();
+ repeatedBool_.Clear();
+ repeatedString_.Clear();
+ repeatedBytes_.Clear();
+ repeatedNestedMessage_.Clear();
+ repeatedForeignMessage_.Clear();
+ repeatedNestedEnum_.Clear();
+ repeatedForeignEnum_.Clear();
+ repeatedStringPiece_.Clear();
+ repeatedCord_.Clear();
+ packedInt32_.Clear();
+ packedInt64_.Clear();
+ packedUint32_.Clear();
+ packedUint64_.Clear();
+ packedSint32_.Clear();
+ packedSint64_.Clear();
+ packedFixed32_.Clear();
+ packedFixed64_.Clear();
+ packedSfixed32_.Clear();
+ packedSfixed64_.Clear();
+ packedFloat_.Clear();
+ packedDouble_.Clear();
+ packedBool_.Clear();
+ packedNestedEnum_.Clear();
+ unpackedInt32_.Clear();
+ unpackedInt64_.Clear();
+ unpackedUint32_.Clear();
+ unpackedUint64_.Clear();
+ unpackedSint32_.Clear();
+ unpackedSint64_.Clear();
+ unpackedFixed32_.Clear();
+ unpackedFixed64_.Clear();
+ unpackedSfixed32_.Clear();
+ unpackedSfixed64_.Clear();
+ unpackedFloat_.Clear();
+ unpackedDouble_.Clear();
+ unpackedBool_.Clear();
+ unpackedNestedEnum_.Clear();
+ mapInt32Int32_.Clear();
+ mapInt64Int64_.Clear();
+ mapUint32Uint32_.Clear();
+ mapUint64Uint64_.Clear();
+ mapSint32Sint32_.Clear();
+ mapSint64Sint64_.Clear();
+ mapFixed32Fixed32_.Clear();
+ mapFixed64Fixed64_.Clear();
+ mapSfixed32Sfixed32_.Clear();
+ mapSfixed64Sfixed64_.Clear();
+ mapInt32Float_.Clear();
+ mapInt32Double_.Clear();
+ mapBoolBool_.Clear();
+ mapStringString_.Clear();
+ mapStringBytes_.Clear();
+ mapStringNestedMessage_.Clear();
+ mapStringForeignMessage_.Clear();
+ mapStringNestedEnum_.Clear();
+ mapStringForeignEnum_.Clear();
+ optionalBoolWrapper_ = false;
+ optionalInt32Wrapper_ = 0;
+ optionalInt64Wrapper_ = 0L;
+ optionalUint32Wrapper_ = 0;
+ optionalUint64Wrapper_ = 0UL;
+ optionalFloatWrapper_ = 0F;
+ optionalDoubleWrapper_ = 0D;
+ optionalStringWrapper_ = "";
+ optionalBytesWrapper_ = pb::ByteString.Empty;
+ repeatedBoolWrapper_.Clear();
+ repeatedInt32Wrapper_.Clear();
+ repeatedInt64Wrapper_.Clear();
+ repeatedUint32Wrapper_.Clear();
+ repeatedUint64Wrapper_.Clear();
+ repeatedFloatWrapper_.Clear();
+ repeatedDoubleWrapper_.Clear();
+ repeatedStringWrapper_.Clear();
+ repeatedBytesWrapper_.Clear();
+ if (optionalDuration_ != null) {
+ optionalDuration_.Clear();
+ }
+ if (optionalTimestamp_ != null) {
+ optionalTimestamp_.Clear();
+ }
+ if (optionalFieldMask_ != null) {
+ optionalFieldMask_.Clear();
+ }
+ if (optionalStruct_ != null) {
+ optionalStruct_.Clear();
+ }
+ if (optionalAny_ != null) {
+ optionalAny_.Clear();
+ }
+ if (optionalValue_ != null) {
+ optionalValue_.Clear();
+ }
+ optionalNullValue_ = global::Google.Protobuf.WellKnownTypes.NullValue.NullValue;
+ repeatedDuration_.Clear();
+ repeatedTimestamp_.Clear();
+ repeatedFieldmask_.Clear();
+ repeatedStruct_.Clear();
+ repeatedAny_.Clear();
+ repeatedValue_.Clear();
+ repeatedListValue_.Clear();
+ fieldname1_ = 0;
+ fieldName2_ = 0;
+ FieldName3_ = 0;
+ fieldName4_ = 0;
+ field0Name5_ = 0;
+ field0Name6_ = 0;
+ fieldName7_ = 0;
+ fieldName8_ = 0;
+ fieldName9_ = 0;
+ fieldName10_ = 0;
+ fIELDNAME11_ = 0;
+ fIELDName12_ = 0;
+ FieldName13_ = 0;
+ FieldName14_ = 0;
+ fieldName15_ = 0;
+ fieldName16_ = 0;
+ fieldName17_ = 0;
+ fieldName18_ = 0;
+ oneofFieldCase_ = OneofFieldOneofCase.None;
+ oneofField_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "optional_int32" field.
public const int OptionalInt32FieldNumber = 1;
private int optionalInt32_;
@@ -5627,6 +5796,18 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ a_ = 0;
+ if (corecursive_ != null) {
+ corecursive_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private int a_;
@@ -5875,6 +6056,15 @@ public ForeignMessage Clone() {
return new ForeignMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ c_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "c" field.
public const int CFieldNumber = 1;
private int c_;
@@ -6072,6 +6262,14 @@ public NullHypothesisProto3 Clone() {
return new NullHypothesisProto3(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -6233,6 +6431,14 @@ public EnumOnlyProto3 Clone() {
return new EnumOnlyProto3(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/Unittest.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/Unittest.pb.cs
index e0d884998094b..2c510fa9d3b2a 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/Unittest.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/Unittest.pb.cs
@@ -1255,6 +1255,101 @@ public TestAllTypes Clone() {
return new TestAllTypes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ _hasBits1 = 0;
+ optionalInt32_ = 0;
+ optionalInt64_ = 0L;
+ optionalUint32_ = 0;
+ optionalUint64_ = 0UL;
+ optionalSint32_ = 0;
+ optionalSint64_ = 0L;
+ optionalFixed32_ = 0;
+ optionalFixed64_ = 0UL;
+ optionalSfixed32_ = 0;
+ optionalSfixed64_ = 0L;
+ optionalFloat_ = 0F;
+ optionalDouble_ = 0D;
+ optionalBool_ = false;
+ optionalString_ = "";
+ optionalBytes_ = pb::ByteString.Empty;
+ if (optionalGroup_ != null) {
+ optionalGroup_.Clear();
+ }
+ if (optionalNestedMessage_ != null) {
+ optionalNestedMessage_.Clear();
+ }
+ if (optionalForeignMessage_ != null) {
+ optionalForeignMessage_.Clear();
+ }
+ if (optionalImportMessage_ != null) {
+ optionalImportMessage_.Clear();
+ }
+ optionalNestedEnum_ = global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedEnum.Foo;
+ optionalForeignEnum_ = global::Google.Protobuf.TestProtos.Proto2.ForeignEnum.ForeignFoo;
+ optionalImportEnum_ = global::Google.Protobuf.TestProtos.Proto2.ImportEnum.ImportFoo;
+ optionalStringPiece_ = "";
+ optionalCord_ = "";
+ if (optionalPublicImportMessage_ != null) {
+ optionalPublicImportMessage_.Clear();
+ }
+ if (optionalLazyMessage_ != null) {
+ optionalLazyMessage_.Clear();
+ }
+ repeatedInt32_.Clear();
+ repeatedInt64_.Clear();
+ repeatedUint32_.Clear();
+ repeatedUint64_.Clear();
+ repeatedSint32_.Clear();
+ repeatedSint64_.Clear();
+ repeatedFixed32_.Clear();
+ repeatedFixed64_.Clear();
+ repeatedSfixed32_.Clear();
+ repeatedSfixed64_.Clear();
+ repeatedFloat_.Clear();
+ repeatedDouble_.Clear();
+ repeatedBool_.Clear();
+ repeatedString_.Clear();
+ repeatedBytes_.Clear();
+ repeatedGroup_.Clear();
+ repeatedNestedMessage_.Clear();
+ repeatedForeignMessage_.Clear();
+ repeatedImportMessage_.Clear();
+ repeatedNestedEnum_.Clear();
+ repeatedForeignEnum_.Clear();
+ repeatedImportEnum_.Clear();
+ repeatedStringPiece_.Clear();
+ repeatedCord_.Clear();
+ repeatedLazyMessage_.Clear();
+ defaultInt32_ = 41;
+ defaultInt64_ = 42L;
+ defaultUint32_ = 43;
+ defaultUint64_ = 44UL;
+ defaultSint32_ = -45;
+ defaultSint64_ = 46L;
+ defaultFixed32_ = 47;
+ defaultFixed64_ = 48UL;
+ defaultSfixed32_ = 49;
+ defaultSfixed64_ = -50L;
+ defaultFloat_ = 51.5F;
+ defaultDouble_ = 52000D;
+ defaultBool_ = true;
+ defaultString_ = global::System.Text.Encoding.UTF8.GetString(global::System.Convert.FromBase64String("aGVsbG8="), 0, 5);
+ defaultBytes_ = pb::ByteString.FromBase64("d29ybGQ=");
+ defaultNestedEnum_ = global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedEnum.Bar;
+ defaultForeignEnum_ = global::Google.Protobuf.TestProtos.Proto2.ForeignEnum.ForeignBar;
+ defaultImportEnum_ = global::Google.Protobuf.TestProtos.Proto2.ImportEnum.ImportBar;
+ defaultStringPiece_ = global::System.Text.Encoding.UTF8.GetString(global::System.Convert.FromBase64String("YWJj"), 0, 3);
+ defaultCord_ = global::System.Text.Encoding.UTF8.GetString(global::System.Convert.FromBase64String("MTIz"), 0, 3);
+ oneofFieldCase_ = OneofFieldOneofCase.None;
+ oneofField_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "optional_int32" field.
public const int OptionalInt32FieldNumber = 1;
private readonly static int OptionalInt32DefaultValue = 0;
@@ -4644,6 +4739,16 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ bb_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "bb" field.
public const int BbFieldNumber = 1;
private readonly static int BbDefaultValue = 0;
@@ -4864,6 +4969,16 @@ public OptionalGroup Clone() {
return new OptionalGroup(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 17;
private readonly static int ADefaultValue = 0;
@@ -5079,6 +5194,16 @@ public RepeatedGroup Clone() {
return new RepeatedGroup(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 47;
private readonly static int ADefaultValue = 0;
@@ -5302,6 +5427,21 @@ public NestedTestAllTypes Clone() {
return new NestedTestAllTypes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (child_ != null) {
+ child_.Clear();
+ }
+ if (payload_ != null) {
+ payload_.Clear();
+ }
+ repeatedChild_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "child" field.
public const int ChildFieldNumber = 1;
private global::Google.Protobuf.TestProtos.Proto2.NestedTestAllTypes child_;
@@ -5587,6 +5727,18 @@ public TestDeprecatedFields Clone() {
return new TestDeprecatedFields(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ deprecatedInt32_ = 0;
+ oneofFieldsCase_ = OneofFieldsOneofCase.None;
+ oneofFields_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "deprecated_int32" field.
public const int DeprecatedInt32FieldNumber = 1;
private readonly static int DeprecatedInt32DefaultValue = 0;
@@ -5881,6 +6033,14 @@ public TestDeprecatedMessage Clone() {
return new TestDeprecatedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -6050,6 +6210,17 @@ public ForeignMessage Clone() {
return new ForeignMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ c_ = 0;
+ d_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "c" field.
public const int CFieldNumber = 1;
private readonly static int CDefaultValue = 0;
@@ -6313,6 +6484,14 @@ public TestReservedFields Clone() {
return new TestReservedFields(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -6477,6 +6656,17 @@ public TestAllExtensions Clone() {
return new TestAllExtensions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -6683,6 +6873,16 @@ public OptionalGroup_extension Clone() {
return new OptionalGroup_extension(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 17;
private readonly static int ADefaultValue = 0;
@@ -6898,6 +7098,16 @@ public RepeatedGroup_extension Clone() {
return new RepeatedGroup_extension(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 47;
private readonly static int ADefaultValue = 0;
@@ -7114,6 +7324,19 @@ public TestGroup Clone() {
return new TestGroup(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ if (optionalGroup_ != null) {
+ optionalGroup_.Clear();
+ }
+ optionalForeignEnum_ = global::Google.Protobuf.TestProtos.Proto2.ForeignEnum.ForeignFoo;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "optionalgroup" field.
public const int OptionalGroupFieldNumber = 16;
private global::Google.Protobuf.TestProtos.Proto2.TestGroup.Types.OptionalGroup optionalGroup_;
@@ -7391,6 +7614,16 @@ public OptionalGroup Clone() {
return new OptionalGroup(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 17;
private readonly static int ADefaultValue = 0;
@@ -7611,6 +7844,17 @@ public TestGroupExtension Clone() {
return new TestGroupExtension(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -7814,6 +8058,14 @@ public TestNestedExtension Clone() {
return new TestNestedExtension(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -7981,6 +8233,16 @@ public OptionalGroup_extension Clone() {
return new OptionalGroup_extension(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 17;
private readonly static int ADefaultValue = 0;
@@ -8266,6 +8528,49 @@ public TestRequired Clone() {
return new TestRequired(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ _hasBits1 = 0;
+ a_ = 0;
+ dummy2_ = 0;
+ b_ = 0;
+ dummy4_ = 0;
+ dummy5_ = 0;
+ dummy6_ = 0;
+ dummy7_ = 0;
+ dummy8_ = 0;
+ dummy9_ = 0;
+ dummy10_ = 0;
+ dummy11_ = 0;
+ dummy12_ = 0;
+ dummy13_ = 0;
+ dummy14_ = 0;
+ dummy15_ = 0;
+ dummy16_ = 0;
+ dummy17_ = 0;
+ dummy18_ = 0;
+ dummy19_ = 0;
+ dummy20_ = 0;
+ dummy21_ = 0;
+ dummy22_ = 0;
+ dummy23_ = 0;
+ dummy24_ = 0;
+ dummy25_ = 0;
+ dummy26_ = 0;
+ dummy27_ = 0;
+ dummy28_ = 0;
+ dummy29_ = 0;
+ dummy30_ = 0;
+ dummy31_ = 0;
+ dummy32_ = 0;
+ c_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private readonly static int ADefaultValue = 0;
@@ -10131,6 +10436,20 @@ public TestRequiredForeign Clone() {
return new TestRequiredForeign(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ if (optionalMessage_ != null) {
+ optionalMessage_.Clear();
+ }
+ repeatedMessage_.Clear();
+ dummy_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "optional_message" field.
public const int OptionalMessageFieldNumber = 1;
private global::Google.Protobuf.TestProtos.Proto2.TestRequired optionalMessage_;
@@ -10416,6 +10735,21 @@ public TestRequiredMessage Clone() {
return new TestRequiredMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (optionalMessage_ != null) {
+ optionalMessage_.Clear();
+ }
+ repeatedMessage_.Clear();
+ if (requiredMessage_ != null) {
+ requiredMessage_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "optional_message" field.
public const int OptionalMessageFieldNumber = 1;
private global::Google.Protobuf.TestProtos.Proto2.TestRequired optionalMessage_;
@@ -10696,6 +11030,17 @@ public TestForeignNested Clone() {
return new TestForeignNested(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (foreignNested_ != null) {
+ foreignNested_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "foreign_nested" field.
public const int ForeignNestedFieldNumber = 1;
private global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage foreignNested_;
@@ -10905,6 +11250,14 @@ public TestEmptyMessage Clone() {
return new TestEmptyMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -11073,6 +11426,17 @@ public TestEmptyMessageWithExtensions Clone() {
return new TestEmptyMessageWithExtensions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -11279,6 +11643,17 @@ public TestMultipleExtensionRanges Clone() {
return new TestMultipleExtensionRanges(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -11489,6 +11864,17 @@ public TestReallyLargeTagNumber Clone() {
return new TestReallyLargeTagNumber(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ bb_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private readonly static int ADefaultValue = 0;
@@ -11760,6 +12146,19 @@ public TestRecursiveMessage Clone() {
return new TestRecursiveMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ if (a_ != null) {
+ a_.Clear();
+ }
+ i_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private global::Google.Protobuf.TestProtos.Proto2.TestRecursiveMessage a_;
@@ -12022,6 +12421,20 @@ public TestMutualRecursionA Clone() {
return new TestMutualRecursionA(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (bb_ != null) {
+ bb_.Clear();
+ }
+ if (subGroup_ != null) {
+ subGroup_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "bb" field.
public const int BbFieldNumber = 1;
private global::Google.Protobuf.TestProtos.Proto2.TestMutualRecursionB bb_;
@@ -12291,6 +12704,17 @@ public SubMessage Clone() {
return new SubMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (b_ != null) {
+ b_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "b" field.
public const int BFieldNumber = 1;
private global::Google.Protobuf.TestProtos.Proto2.TestMutualRecursionB b_;
@@ -12499,6 +12923,20 @@ public SubGroup Clone() {
return new SubGroup(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (subMessage_ != null) {
+ subMessage_.Clear();
+ }
+ if (notInThisScc_ != null) {
+ notInThisScc_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "sub_message" field.
public const int SubMessageFieldNumber = 3;
private global::Google.Protobuf.TestProtos.Proto2.TestMutualRecursionA.Types.SubMessage subMessage_;
@@ -12762,6 +13200,19 @@ public TestMutualRecursionB Clone() {
return new TestMutualRecursionB(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ if (a_ != null) {
+ a_.Clear();
+ }
+ optionalInt32_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private global::Google.Protobuf.TestProtos.Proto2.TestMutualRecursionA a_;
@@ -13020,6 +13471,17 @@ public TestIsInitialized Clone() {
return new TestIsInitialized(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (subMessage_ != null) {
+ subMessage_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "sub_message" field.
public const int SubMessageFieldNumber = 1;
private global::Google.Protobuf.TestProtos.Proto2.TestIsInitialized.Types.SubMessage subMessage_;
@@ -13230,6 +13692,17 @@ public SubMessage Clone() {
return new SubMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (subGroup_ != null) {
+ subGroup_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "subgroup" field.
public const int SubGroupFieldNumber = 1;
private global::Google.Protobuf.TestProtos.Proto2.TestIsInitialized.Types.SubMessage.Types.SubGroup subGroup_;
@@ -13456,6 +13929,16 @@ public SubGroup Clone() {
return new SubGroup(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ i_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "i" field.
public const int IFieldNumber = 2;
private readonly static int IDefaultValue = 0;
@@ -13689,6 +14172,22 @@ public TestDupFieldNumber Clone() {
return new TestDupFieldNumber(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ if (foo_ != null) {
+ foo_.Clear();
+ }
+ if (bar_ != null) {
+ bar_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private readonly static int ADefaultValue = 0;
@@ -14028,6 +14527,16 @@ public Foo Clone() {
return new Foo(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private readonly static int ADefaultValue = 0;
@@ -14243,6 +14752,16 @@ public Bar Clone() {
return new Bar(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private readonly static int ADefaultValue = 0;
@@ -14464,6 +14983,17 @@ public TestEagerMessage Clone() {
return new TestEagerMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (subMessage_ != null) {
+ subMessage_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "sub_message" field.
public const int SubMessageFieldNumber = 1;
private global::Google.Protobuf.TestProtos.Proto2.TestAllTypes subMessage_;
@@ -14671,6 +15201,17 @@ public TestLazyMessage Clone() {
return new TestLazyMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (subMessage_ != null) {
+ subMessage_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "sub_message" field.
public const int SubMessageFieldNumber = 1;
private global::Google.Protobuf.TestProtos.Proto2.TestAllTypes subMessage_;
@@ -14881,6 +15422,17 @@ public TestNestedMessageHasBits Clone() {
return new TestNestedMessageHasBits(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (optionalNestedMessage_ != null) {
+ optionalNestedMessage_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "optional_nested_message" field.
public const int OptionalNestedMessageFieldNumber = 1;
private global::Google.Protobuf.TestProtos.Proto2.TestNestedMessageHasBits.Types.NestedMessage optionalNestedMessage_;
@@ -15092,6 +15644,16 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ nestedmessageRepeatedInt32_.Clear();
+ nestedmessageRepeatedForeignmessage_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "nestedmessage_repeated_int32" field.
public const int NestedmessageRepeatedInt32FieldNumber = 1;
private static readonly pb::FieldCodec _repeated_nestedmessageRepeatedInt32_codec
@@ -15328,6 +15890,29 @@ public TestCamelCaseFieldNames Clone() {
return new TestCamelCaseFieldNames(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ primitiveField_ = 0;
+ stringField_ = "";
+ enumField_ = global::Google.Protobuf.TestProtos.Proto2.ForeignEnum.ForeignFoo;
+ if (messageField_ != null) {
+ messageField_.Clear();
+ }
+ stringPieceField_ = "";
+ cordField_ = "";
+ repeatedPrimitiveField_.Clear();
+ repeatedStringField_.Clear();
+ repeatedEnumField_.Clear();
+ repeatedMessageField_.Clear();
+ repeatedStringPieceField_.Clear();
+ repeatedCordField_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "PrimitiveField" field.
public const int PrimitiveFieldFieldNumber = 1;
private readonly static int PrimitiveFieldDefaultValue = 0;
@@ -15953,6 +16538,24 @@ public TestFieldOrderings Clone() {
return new TestFieldOrderings(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ myString_ = "";
+ myInt_ = 0L;
+ myFloat_ = 0F;
+ if (optionalNestedMessage_ != null) {
+ optionalNestedMessage_.Clear();
+ }
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "my_string" field.
public const int MyStringFieldNumber = 11;
private readonly static string MyStringDefaultValue = "";
@@ -16360,6 +16963,17 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ oo_ = 0L;
+ bb_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "oo" field.
public const int OoFieldNumber = 2;
private readonly static long OoDefaultValue = 0L;
@@ -16634,6 +17248,15 @@ public TestExtensionOrderings1 Clone() {
return new TestExtensionOrderings1(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ myString_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "my_string" field.
public const int MyStringFieldNumber = 1;
private readonly static string MyStringDefaultValue = "";
@@ -16856,6 +17479,15 @@ public TestExtensionOrderings2 Clone() {
return new TestExtensionOrderings2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ myString_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "my_string" field.
public const int MyStringFieldNumber = 1;
private readonly static string MyStringDefaultValue = "";
@@ -17071,6 +17703,15 @@ public TestExtensionOrderings3 Clone() {
return new TestExtensionOrderings3(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ myString_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "my_string" field.
public const int MyStringFieldNumber = 1;
private readonly static string MyStringDefaultValue = "";
@@ -17336,6 +17977,42 @@ public TestExtremeDefaultValues Clone() {
return new TestExtremeDefaultValues(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ escapedBytes_ = pb::ByteString.FromBase64("AAEHCAwKDQkLXCci/g==");
+ largeUint32_ = 4294967295;
+ largeUint64_ = 18446744073709551615UL;
+ smallInt32_ = -2147483647;
+ smallInt64_ = -9223372036854775807L;
+ reallySmallInt32_ = -2147483648;
+ reallySmallInt64_ = -9223372036854775808L;
+ utf8String_ = global::System.Text.Encoding.UTF8.GetString(global::System.Convert.FromBase64String("4Yi0"), 0, 3);
+ zeroFloat_ = 0F;
+ oneFloat_ = 1F;
+ smallFloat_ = 1.5F;
+ negativeOneFloat_ = -1F;
+ negativeFloat_ = -1.5F;
+ largeFloat_ = 2e+08F;
+ smallNegativeFloat_ = -8e-28F;
+ infDouble_ = double.PositiveInfinity;
+ negInfDouble_ = double.NegativeInfinity;
+ nanDouble_ = double.NaN;
+ infFloat_ = float.PositiveInfinity;
+ negInfFloat_ = float.NegativeInfinity;
+ nanFloat_ = float.NaN;
+ cppTrigraph_ = global::System.Text.Encoding.UTF8.GetString(global::System.Convert.FromBase64String("PyA/ID8/ID8/ID8/PyA/Py8gPz8t"), 0, 21);
+ stringWithZero_ = global::System.Text.Encoding.UTF8.GetString(global::System.Convert.FromBase64String("aGVsAGxv"), 0, 6);
+ bytesWithZero_ = pb::ByteString.FromBase64("d29yAGxk");
+ stringPieceWithZero_ = global::System.Text.Encoding.UTF8.GetString(global::System.Convert.FromBase64String("YWIAYw=="), 0, 4);
+ cordWithZero_ = global::System.Text.Encoding.UTF8.GetString(global::System.Convert.FromBase64String("MTIAMw=="), 0, 4);
+ replacementString_ = global::System.Text.Encoding.UTF8.GetString(global::System.Convert.FromBase64String("JHt1bmtub3dufQ=="), 0, 10);
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "escaped_bytes" field.
public const int EscapedBytesFieldNumber = 1;
private readonly static pb::ByteString EscapedBytesDefaultValue = pb::ByteString.FromBase64("AAEHCAwKDQkLXCci/g==");
@@ -18893,6 +19570,16 @@ public SparseEnumMessage Clone() {
return new SparseEnumMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ sparseEnum_ = global::Google.Protobuf.TestProtos.Proto2.TestSparseEnum.SparseA;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "sparse_enum" field.
public const int SparseEnumFieldNumber = 1;
private readonly static global::Google.Protobuf.TestProtos.Proto2.TestSparseEnum SparseEnumDefaultValue = global::Google.Protobuf.TestProtos.Proto2.TestSparseEnum.SparseA;
@@ -19109,6 +19796,15 @@ public OneString Clone() {
return new OneString(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ data_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private readonly static string DataDefaultValue = "";
@@ -19321,6 +20017,15 @@ public MoreString Clone() {
return new MoreString(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ data_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private static readonly pb::FieldCodec _repeated_data_codec
@@ -19508,6 +20213,15 @@ public OneBytes Clone() {
return new OneBytes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ data_ = pb::ByteString.Empty;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private readonly static pb::ByteString DataDefaultValue = pb::ByteString.Empty;
@@ -19720,6 +20434,15 @@ public MoreBytes Clone() {
return new MoreBytes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ data_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private static readonly pb::FieldCodec _repeated_data_codec
@@ -19912,6 +20635,16 @@ public Int32Message Clone() {
return new Int32Message(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ data_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private readonly static int DataDefaultValue = 0;
@@ -20127,6 +20860,16 @@ public Uint32Message Clone() {
return new Uint32Message(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ data_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private readonly static uint DataDefaultValue = 0;
@@ -20342,6 +21085,16 @@ public Int64Message Clone() {
return new Int64Message(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ data_ = 0L;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private readonly static long DataDefaultValue = 0L;
@@ -20557,6 +21310,16 @@ public Uint64Message Clone() {
return new Uint64Message(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ data_ = 0UL;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private readonly static ulong DataDefaultValue = 0UL;
@@ -20772,6 +21535,16 @@ public BoolMessage Clone() {
return new BoolMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ data_ = false;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private readonly static bool DataDefaultValue = false;
@@ -21002,6 +21775,16 @@ public TestOneof Clone() {
return new TestOneof(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ fooCase_ = FooOneofCase.None;
+ foo_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "foo_int" field.
public const int FooIntFieldNumber = 1;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -21412,6 +22195,17 @@ public FooGroup Clone() {
return new FooGroup(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ b_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 5;
private readonly static int ADefaultValue = 0;
@@ -21685,6 +22479,23 @@ public TestOneofBackwardsCompatible Clone() {
return new TestOneofBackwardsCompatible(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ fooInt_ = 0;
+ fooString_ = "";
+ if (fooMessage_ != null) {
+ fooMessage_.Clear();
+ }
+ if (fooGroup_ != null) {
+ fooGroup_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "foo_int" field.
public const int FooIntFieldNumber = 1;
private readonly static int FooIntDefaultValue = 0;
@@ -22058,6 +22869,17 @@ public FooGroup Clone() {
return new FooGroup(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ b_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 5;
private readonly static int ADefaultValue = 0;
@@ -22380,6 +23202,21 @@ public TestOneof2 Clone() {
return new TestOneof2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ bazInt_ = 0;
+ bazString_ = global::System.Text.Encoding.UTF8.GetString(global::System.Convert.FromBase64String("QkFa"), 0, 3);
+ fooCase_ = FooOneofCase.None;
+ foo_ = null;
+ barCase_ = BarOneofCase.None;
+ bar_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "foo_int" field.
public const int FooIntFieldNumber = 1;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -23485,6 +24322,17 @@ public FooGroup Clone() {
return new FooGroup(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ a_ = 0;
+ b_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 9;
private readonly static int ADefaultValue = 0;
@@ -23751,6 +24599,17 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ quxInt_ = 0L;
+ corgeInt_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "qux_int" field.
public const int QuxIntFieldNumber = 1;
private readonly static long QuxIntDefaultValue = 0L;
@@ -24007,6 +24866,16 @@ public TestRequiredOneof Clone() {
return new TestRequiredOneof(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ fooCase_ = FooOneofCase.None;
+ foo_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "foo_int" field.
public const int FooIntFieldNumber = 1;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -24350,6 +25219,16 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ requiredDouble_ = 0D;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "required_double" field.
public const int RequiredDoubleFieldNumber = 1;
private readonly static double RequiredDoubleDefaultValue = 0D;
@@ -24568,6 +25447,15 @@ public TestRequiredMap Clone() {
return new TestRequiredMap(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ foo_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "foo" field.
public const int FooFieldNumber = 1;
private static readonly pbc::MapField.Codec _map_foo_codec
@@ -24760,6 +25648,16 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ requiredInt32_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "required_int32" field.
public const int RequiredInt32FieldNumber = 1;
private readonly static int RequiredInt32DefaultValue = 0;
@@ -24991,6 +25889,28 @@ public TestPackedTypes Clone() {
return new TestPackedTypes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ packedInt32_.Clear();
+ packedInt64_.Clear();
+ packedUint32_.Clear();
+ packedUint64_.Clear();
+ packedSint32_.Clear();
+ packedSint64_.Clear();
+ packedFixed32_.Clear();
+ packedFixed64_.Clear();
+ packedSfixed32_.Clear();
+ packedSfixed64_.Clear();
+ packedFloat_.Clear();
+ packedDouble_.Clear();
+ packedBool_.Clear();
+ packedEnum_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "packed_int32" field.
public const int PackedInt32FieldNumber = 90;
private static readonly pb::FieldCodec _repeated_packedInt32_codec
@@ -25548,6 +26468,28 @@ public TestUnpackedTypes Clone() {
return new TestUnpackedTypes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ unpackedInt32_.Clear();
+ unpackedInt64_.Clear();
+ unpackedUint32_.Clear();
+ unpackedUint64_.Clear();
+ unpackedSint32_.Clear();
+ unpackedSint64_.Clear();
+ unpackedFixed32_.Clear();
+ unpackedFixed64_.Clear();
+ unpackedSfixed32_.Clear();
+ unpackedSfixed64_.Clear();
+ unpackedFloat_.Clear();
+ unpackedDouble_.Clear();
+ unpackedBool_.Clear();
+ unpackedEnum_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "unpacked_int32" field.
public const int UnpackedInt32FieldNumber = 90;
private static readonly pb::FieldCodec _repeated_unpackedInt32_codec
@@ -26090,6 +27032,17 @@ public TestPackedExtensions Clone() {
return new TestPackedExtensions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -26296,6 +27249,17 @@ public TestUnpackedExtensions Clone() {
return new TestUnpackedExtensions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -26513,6 +27477,26 @@ public TestDynamicExtensions Clone() {
return new TestDynamicExtensions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ scalarExtension_ = 0;
+ enumExtension_ = global::Google.Protobuf.TestProtos.Proto2.ForeignEnum.ForeignFoo;
+ dynamicEnumExtension_ = global::Google.Protobuf.TestProtos.Proto2.TestDynamicExtensions.Types.DynamicEnumType.DynamicFoo;
+ if (messageExtension_ != null) {
+ messageExtension_.Clear();
+ }
+ if (dynamicMessageExtension_ != null) {
+ dynamicMessageExtension_.Clear();
+ }
+ repeatedExtension_.Clear();
+ packedExtension_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "scalar_extension" field.
public const int ScalarExtensionFieldNumber = 2000;
private readonly static uint ScalarExtensionDefaultValue = 0;
@@ -26981,6 +27965,16 @@ public DynamicMessageType Clone() {
return new DynamicMessageType(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ dynamicField_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "dynamic_field" field.
public const int DynamicFieldFieldNumber = 2100;
private readonly static int DynamicFieldDefaultValue = 0;
@@ -27204,6 +28198,20 @@ public TestRepeatedScalarDifferentTagSizes Clone() {
return new TestRepeatedScalarDifferentTagSizes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ repeatedFixed32_.Clear();
+ repeatedInt32_.Clear();
+ repeatedFixed64_.Clear();
+ repeatedInt64_.Clear();
+ repeatedFloat_.Clear();
+ repeatedUint64_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "repeated_fixed32" field.
public const int RepeatedFixed32FieldNumber = 12;
private static readonly pb::FieldCodec _repeated_repeatedFixed32_codec
@@ -27553,6 +28561,28 @@ public TestParsingMerge Clone() {
return new TestParsingMerge(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (requiredAllTypes_ != null) {
+ requiredAllTypes_.Clear();
+ }
+ if (optionalAllTypes_ != null) {
+ optionalAllTypes_.Clear();
+ }
+ repeatedAllTypes_.Clear();
+ if (optionalGroup_ != null) {
+ optionalGroup_.Clear();
+ }
+ repeatedGroup_.Clear();
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "required_all_types" field.
public const int RequiredAllTypesFieldNumber = 1;
private global::Google.Protobuf.TestProtos.Proto2.TestAllTypes requiredAllTypes_;
@@ -27972,6 +29002,21 @@ public RepeatedFieldsGenerator Clone() {
return new RepeatedFieldsGenerator(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ field1_.Clear();
+ field2_.Clear();
+ field3_.Clear();
+ group1_.Clear();
+ group2_.Clear();
+ ext1_.Clear();
+ ext2_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "field1" field.
public const int Field1FieldNumber = 1;
private static readonly pb::FieldCodec _repeated_field1_codec
@@ -28312,6 +29357,17 @@ public Group1 Clone() {
return new Group1(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (field1_ != null) {
+ field1_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "field1" field.
public const int Field1FieldNumber = 11;
private global::Google.Protobuf.TestProtos.Proto2.TestAllTypes field1_;
@@ -28519,6 +29575,17 @@ public Group2 Clone() {
return new Group2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (field1_ != null) {
+ field1_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "field1" field.
public const int Field1FieldNumber = 21;
private global::Google.Protobuf.TestProtos.Proto2.TestAllTypes field1_;
@@ -28731,6 +29798,17 @@ public OptionalGroup Clone() {
return new OptionalGroup(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (optionalGroupAllTypes_ != null) {
+ optionalGroupAllTypes_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "optional_group_all_types" field.
public const int OptionalGroupAllTypesFieldNumber = 11;
private global::Google.Protobuf.TestProtos.Proto2.TestAllTypes optionalGroupAllTypes_;
@@ -28938,6 +30016,17 @@ public RepeatedGroup Clone() {
return new RepeatedGroup(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (repeatedGroupAllTypes_ != null) {
+ repeatedGroupAllTypes_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "repeated_group_all_types" field.
public const int RepeatedGroupAllTypesFieldNumber = 21;
private global::Google.Protobuf.TestProtos.Proto2.TestAllTypes repeatedGroupAllTypes_;
@@ -29162,6 +30251,15 @@ public TestCommentInjectionMessage Clone() {
return new TestCommentInjectionMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ a_ = global::System.Text.Encoding.UTF8.GetString(global::System.Convert.FromBase64String("Ki8gPC0gTmVpdGhlciBzaG91bGQgdGhpcy4="), 0, 26);
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private readonly static string ADefaultValue = global::System.Text.Encoding.UTF8.GetString(global::System.Convert.FromBase64String("Ki8gPC0gTmVpdGhlciBzaG91bGQgdGhpcy4="), 0, 26);
@@ -29379,6 +30477,14 @@ public FooRequest Clone() {
return new FooRequest(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -29540,6 +30646,14 @@ public FooResponse Clone() {
return new FooResponse(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -29701,6 +30815,14 @@ public FooClientMessage Clone() {
return new FooClientMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -29862,6 +30984,14 @@ public FooServerMessage Clone() {
return new FooServerMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -30023,6 +31153,14 @@ public BarRequest Clone() {
return new BarRequest(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -30184,6 +31322,14 @@ public BarResponse Clone() {
return new BarResponse(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -30353,6 +31499,21 @@ public TestJsonName Clone() {
return new TestJsonName(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ fieldName1_ = 0;
+ fieldName2_ = 0;
+ fieldName3_ = 0;
+ FieldName4_ = 0;
+ fIELDNAME5_ = 0;
+ fieldName6_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "field_name1" field.
public const int FieldName1FieldNumber = 1;
private readonly static int FieldName1DefaultValue = 0;
@@ -30850,6 +32011,34 @@ public TestHugeFieldNumbers Clone() {
return new TestHugeFieldNumbers(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ optionalInt32_ = 0;
+ fixed32_ = 0;
+ repeatedInt32_.Clear();
+ packedInt32_.Clear();
+ optionalEnum_ = global::Google.Protobuf.TestProtos.Proto2.ForeignEnum.ForeignFoo;
+ optionalString_ = "";
+ optionalBytes_ = pb::ByteString.Empty;
+ if (optionalMessage_ != null) {
+ optionalMessage_.Clear();
+ }
+ if (optionalGroup_ != null) {
+ optionalGroup_.Clear();
+ }
+ stringStringMap_.Clear();
+ oneofFieldCase_ = OneofFieldOneofCase.None;
+ oneofField_ = null;
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "optional_int32" field.
public const int OptionalInt32FieldNumber = 536870000;
private readonly static int OptionalInt32DefaultValue = 0;
@@ -31722,6 +32911,16 @@ public OptionalGroup Clone() {
return new OptionalGroup(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ groupA_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "group_a" field.
public const int GroupAFieldNumber = 536870009;
private readonly static int GroupADefaultValue = 0;
@@ -31953,6 +33152,27 @@ public TestExtensionInsideTable Clone() {
return new TestExtensionInsideTable(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ field1_ = 0;
+ field2_ = 0;
+ field3_ = 0;
+ field4_ = 0;
+ field6_ = 0;
+ field7_ = 0;
+ field8_ = 0;
+ field9_ = 0;
+ field10_ = 0;
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "field1" field.
public const int Field1FieldNumber = 1;
private readonly static int Field1DefaultValue = 0;
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.pb.cs
index 613db968eee91..ace040daf252d 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.pb.cs
@@ -307,6 +307,17 @@ public TestMessageWithCustomOptions Clone() {
return new TestMessageWithCustomOptions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ field1_ = "";
+ anOneofCase_ = AnOneofOneofCase.None;
+ anOneof_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "field1" field.
public const int Field1FieldNumber = 1;
private string field1_ = "";
@@ -597,6 +608,14 @@ public CustomOptionFooRequest Clone() {
return new CustomOptionFooRequest(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -758,6 +777,14 @@ public CustomOptionFooResponse Clone() {
return new CustomOptionFooResponse(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -919,6 +946,14 @@ public CustomOptionFooClientMessage Clone() {
return new CustomOptionFooClientMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -1080,6 +1115,14 @@ public CustomOptionFooServerMessage Clone() {
return new CustomOptionFooServerMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -1241,6 +1284,14 @@ public DummyMessageContainingEnum Clone() {
return new DummyMessageContainingEnum(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -1416,6 +1467,14 @@ public DummyMessageInvalidAsOptionType Clone() {
return new DummyMessageInvalidAsOptionType(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -1577,6 +1636,14 @@ public CustomOptionMinIntegerValues Clone() {
return new CustomOptionMinIntegerValues(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -1738,6 +1805,14 @@ public CustomOptionMaxIntegerValues Clone() {
return new CustomOptionMaxIntegerValues(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -1899,6 +1974,14 @@ public CustomOptionOtherValues Clone() {
return new CustomOptionOtherValues(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -2060,6 +2143,14 @@ public SettingRealsFromPositiveInts Clone() {
return new SettingRealsFromPositiveInts(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -2221,6 +2312,14 @@ public SettingRealsFromNegativeInts Clone() {
return new SettingRealsFromNegativeInts(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -2386,6 +2485,18 @@ public ComplexOptionType1 Clone() {
return new ComplexOptionType1(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ foo_ = 0;
+ foo2_ = 0;
+ foo3_ = 0;
+ foo4_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "foo" field.
public const int FooFieldNumber = 1;
private int foo_;
@@ -2686,6 +2797,22 @@ public ComplexOptionType2 Clone() {
return new ComplexOptionType2(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (bar_ != null) {
+ bar_.Clear();
+ }
+ baz_ = 0;
+ if (fred_ != null) {
+ fred_.Clear();
+ }
+ barney_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "bar" field.
public const int BarFieldNumber = 1;
private global::UnitTest.Issues.TestProtos.ComplexOptionType1 bar_;
@@ -3002,6 +3129,15 @@ public ComplexOptionType4 Clone() {
return new ComplexOptionType4(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ waldo_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "waldo" field.
public const int WaldoFieldNumber = 1;
private int waldo_;
@@ -3215,6 +3351,15 @@ public ComplexOptionType3 Clone() {
return new ComplexOptionType3(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ qux_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "qux" field.
public const int QuxFieldNumber = 1;
private int qux_;
@@ -3415,6 +3560,14 @@ public VariousComplexOptions Clone() {
return new VariousComplexOptions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -3582,6 +3735,19 @@ public Aggregate Clone() {
return new Aggregate(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ i_ = 0;
+ s_ = "";
+ if (sub_ != null) {
+ sub_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "i" field.
public const int IFieldNumber = 1;
private int i_;
@@ -3864,6 +4030,15 @@ public AggregateMessage Clone() {
return new AggregateMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ fieldname_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "fieldname" field.
public const int FieldnameFieldNumber = 1;
private int fieldname_;
@@ -4064,6 +4239,14 @@ public NestedOptionType Clone() {
return new NestedOptionType(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -4234,6 +4417,15 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ nestedField_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "nested_field" field.
public const int NestedFieldFieldNumber = 1;
private int nestedField_;
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestFeatures.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestFeatures.pb.cs
index 25ea351cd3353..dcf79ad3f6e78 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestFeatures.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestFeatures.pb.cs
@@ -173,6 +173,14 @@ public TestMessage Clone() {
return new TestMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -337,6 +345,14 @@ public Nested Clone() {
return new Nested(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -542,6 +558,32 @@ public TestFeatures Clone() {
return new TestFeatures(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ fileFeature_ = global::Pb.EnumFeature.TestEnumFeatureUnknown;
+ extensionRangeFeature_ = global::Pb.EnumFeature.TestEnumFeatureUnknown;
+ messageFeature_ = global::Pb.EnumFeature.TestEnumFeatureUnknown;
+ fieldFeature_ = global::Pb.EnumFeature.TestEnumFeatureUnknown;
+ oneofFeature_ = global::Pb.EnumFeature.TestEnumFeatureUnknown;
+ enumFeature_ = global::Pb.EnumFeature.TestEnumFeatureUnknown;
+ enumEntryFeature_ = global::Pb.EnumFeature.TestEnumFeatureUnknown;
+ serviceFeature_ = global::Pb.EnumFeature.TestEnumFeatureUnknown;
+ methodFeature_ = global::Pb.EnumFeature.TestEnumFeatureUnknown;
+ multipleFeature_ = global::Pb.EnumFeature.TestEnumFeatureUnknown;
+ boolFieldFeature_ = false;
+ sourceFeature_ = global::Pb.EnumFeature.TestEnumFeatureUnknown;
+ sourceFeature2_ = global::Pb.EnumFeature.TestEnumFeatureUnknown;
+ removedFeature_ = global::Pb.EnumFeature.TestEnumFeatureUnknown;
+ futureFeature_ = global::Pb.EnumFeature.TestEnumFeatureUnknown;
+ legacyFeature_ = global::Pb.EnumFeature.TestEnumFeatureUnknown;
+ valueLifetimeFeature_ = global::Pb.ValueLifetimeFeature.TestValueLifetimeUnknown;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "file_feature" field.
public const int FileFeatureFieldNumber = 1;
private readonly static global::Pb.EnumFeature FileFeatureDefaultValue = global::Pb.EnumFeature.TestEnumFeatureUnknown;
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.pb.cs
index a21ee5ee26935..f4995aa2d9f8c 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.pb.cs
@@ -106,6 +106,16 @@ public ImportMessage Clone() {
return new ImportMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ d_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "d" field.
public const int DFieldNumber = 1;
private readonly static int DDefaultValue = 0;
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.pb.cs
index 69d4524018a6f..e1116ff7246f5 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.pb.cs
@@ -96,6 +96,15 @@ public ImportMessage Clone() {
return new ImportMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ d_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "d" field.
public const int DFieldNumber = 1;
private int d_;
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.pb.cs
index 36ab2ff7ace70..a202c7658227f 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.pb.cs
@@ -85,6 +85,16 @@ public PublicImportMessage Clone() {
return new PublicImportMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ e_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "e" field.
public const int EFieldNumber = 1;
private readonly static int EDefaultValue = 0;
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.pb.cs
index dbc5b56f452a6..a7827e9071adf 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.pb.cs
@@ -83,6 +83,15 @@ public PublicImportMessage Clone() {
return new PublicImportMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ e_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "e" field.
public const int EFieldNumber = 1;
private int e_;
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.pb.cs
index b9abf609728bf..d87bc01009665 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.pb.cs
@@ -82,6 +82,14 @@ public Foo Clone() {
return new Foo(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.pb.cs
index d45c5f34f450a..1bbbc2d98f179 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.pb.cs
@@ -85,6 +85,17 @@ public Bar Clone() {
return new Bar(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (foo_ != null) {
+ foo_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "foo" field.
public const int FooFieldNumber = 1;
private global::UnitTest.Issues.TestProtos.Foo foo_;
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.pb.cs
index cb2d1d2dab88a..087d68b6eb14b 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.pb.cs
@@ -158,6 +158,14 @@ public Issue307 Clone() {
return new Issue307(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -322,6 +330,14 @@ public NestedOnce Clone() {
return new NestedOnce(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -486,6 +502,14 @@ public NestedTwice Clone() {
return new NestedTwice(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -660,6 +684,17 @@ public NegativeEnumMessage Clone() {
return new NegativeEnumMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ value_ = global::UnitTest.Issues.TestProtos.NegativeEnum.Zero;
+ values_.Clear();
+ packedValues_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "value" field.
public const int ValueFieldNumber = 1;
private global::UnitTest.Issues.TestProtos.NegativeEnum value_ = global::UnitTest.Issues.TestProtos.NegativeEnum.Zero;
@@ -912,6 +947,14 @@ public DeprecatedChild Clone() {
return new DeprecatedChild(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -1079,6 +1122,22 @@ public DeprecatedFieldsMessage Clone() {
return new DeprecatedFieldsMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ primitiveValue_ = 0;
+ primitiveArray_.Clear();
+ if (messageValue_ != null) {
+ messageValue_.Clear();
+ }
+ messageArray_.Clear();
+ enumValue_ = global::UnitTest.Issues.TestProtos.DeprecatedEnum.DeprecatedZero;
+ enumArray_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "PrimitiveValue" field.
public const int PrimitiveValueFieldNumber = 1;
private int primitiveValue_;
@@ -1446,6 +1505,15 @@ public ItemField Clone() {
return new ItemField(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ item_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "item" field.
public const int ItemFieldNumber = 1;
private int item_;
@@ -1645,6 +1713,16 @@ public ReservedNames Clone() {
return new ReservedNames(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ types_ = 0;
+ descriptor_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "types" field.
public const int Types_FieldNumber = 1;
private int types_;
@@ -1884,6 +1962,14 @@ public SomeNestedType Clone() {
return new SomeNestedType(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -2082,6 +2168,20 @@ public TestJsonFieldOrdering Clone() {
return new TestJsonFieldOrdering(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ plainInt32_ = 0;
+ plainString_ = "";
+ o1Case_ = O1OneofCase.None;
+ o1_ = null;
+ o2Case_ = O2OneofCase.None;
+ o2_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "plain_int32" field.
public const int PlainInt32FieldNumber = 4;
private int plainInt32_;
@@ -2570,6 +2670,17 @@ public TestJsonName Clone() {
return new TestJsonName(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ name_ = "";
+ description_ = "";
+ guid_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private string name_ = "";
@@ -2856,6 +2967,16 @@ public OneofMerging Clone() {
return new OneofMerging(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ valueCase_ = ValueOneofCase.None;
+ value_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "text" field.
public const int TextFieldNumber = 1;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3147,6 +3268,16 @@ public Nested Clone() {
return new Nested(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ x_ = 0;
+ y_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "x" field.
public const int XFieldNumber = 1;
private int x_;
@@ -3394,6 +3525,16 @@ public NullValueOutsideStruct Clone() {
return new NullValueOutsideStruct(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ valueCase_ = ValueOneofCase.None;
+ value_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "string_value" field.
public const int StringValueFieldNumber = 1;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -3684,6 +3825,15 @@ public NullValueNotInOneof Clone() {
return new NullValueNotInOneof(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ nullValue_ = global::Google.Protobuf.WellKnownTypes.NullValue.NullValue;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "null_value" field.
public const int NullValueFieldNumber = 2;
private global::Google.Protobuf.WellKnownTypes.NullValue nullValue_ = global::Google.Protobuf.WellKnownTypes.NullValue.NullValue;
@@ -3883,6 +4033,16 @@ public MixedRegularAndOptional Clone() {
return new MixedRegularAndOptional(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ regularField_ = "";
+ optionalField_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "regular_field" field.
public const int RegularFieldFieldNumber = 1;
private string regularField_ = "";
@@ -4139,6 +4299,16 @@ public OneofWithNoneField Clone() {
return new OneofWithNoneField(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ testCase_ = TestOneofCase.None;
+ test_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "x" field.
public const int XFieldNumber = 1;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4435,6 +4605,16 @@ public OneofWithNoneName Clone() {
return new OneofWithNoneName(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ noneCase_ = NoneOneofCase.None;
+ none_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "x" field.
public const int XFieldNumber = 1;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -4737,6 +4917,26 @@ public DisambiguateCommonMembers Clone() {
return new DisambiguateCommonMembers(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ disambiguateCommonMembers_ = 0;
+ types_ = 0;
+ descriptor_ = 0;
+ equals_ = 0;
+ toString_ = 0;
+ getHashCode_ = 0;
+ writeTo_ = 0;
+ clone_ = 0;
+ calculateSize_ = 0;
+ mergeFrom_ = 0;
+ onConstruction_ = 0;
+ parser_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "disambiguate_common_members" field.
public const int DisambiguateCommonMembers_FieldNumber = 1;
private int disambiguateCommonMembers_;
@@ -5333,6 +5533,17 @@ public Issue11987Message Clone() {
return new Issue11987Message(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ a_ = 0;
+ b_ = 0;
+ c_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private int a_;
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestLegacyFeatures.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestLegacyFeatures.pb.cs
index 541a2d99fbe90..6e5431755b5de 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestLegacyFeatures.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestLegacyFeatures.pb.cs
@@ -87,6 +87,19 @@ public TestEditionsMessage Clone() {
return new TestEditionsMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ requiredField_ = 0;
+ if (delimitedField_ != null) {
+ delimitedField_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "required_field" field.
public const int RequiredFieldFieldNumber = 1;
private readonly static int RequiredFieldDefaultValue = 0;
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.pb.cs
index 1e4ed8bb4f6a3..3cc742fdf9a7a 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.pb.cs
@@ -358,6 +358,68 @@ public TestAllTypes Clone() {
return new TestAllTypes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ singleInt32_ = 0;
+ singleInt64_ = 0L;
+ singleUint32_ = 0;
+ singleUint64_ = 0UL;
+ singleSint32_ = 0;
+ singleSint64_ = 0L;
+ singleFixed32_ = 0;
+ singleFixed64_ = 0UL;
+ singleSfixed32_ = 0;
+ singleSfixed64_ = 0L;
+ singleFloat_ = 0F;
+ singleDouble_ = 0D;
+ singleBool_ = false;
+ singleString_ = "";
+ singleBytes_ = pb::ByteString.Empty;
+ if (singleNestedMessage_ != null) {
+ singleNestedMessage_.Clear();
+ }
+ if (singleForeignMessage_ != null) {
+ singleForeignMessage_.Clear();
+ }
+ if (singleImportMessage_ != null) {
+ singleImportMessage_.Clear();
+ }
+ singleNestedEnum_ = global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum.Unspecified;
+ singleForeignEnum_ = global::Google.Protobuf.TestProtos.ForeignEnum.ForeignUnspecified;
+ singleImportEnum_ = global::Google.Protobuf.TestProtos.ImportEnum.Unspecified;
+ if (singlePublicImportMessage_ != null) {
+ singlePublicImportMessage_.Clear();
+ }
+ repeatedInt32_.Clear();
+ repeatedInt64_.Clear();
+ repeatedUint32_.Clear();
+ repeatedUint64_.Clear();
+ repeatedSint32_.Clear();
+ repeatedSint64_.Clear();
+ repeatedFixed32_.Clear();
+ repeatedFixed64_.Clear();
+ repeatedSfixed32_.Clear();
+ repeatedSfixed64_.Clear();
+ repeatedFloat_.Clear();
+ repeatedDouble_.Clear();
+ repeatedBool_.Clear();
+ repeatedString_.Clear();
+ repeatedBytes_.Clear();
+ repeatedNestedMessage_.Clear();
+ repeatedForeignMessage_.Clear();
+ repeatedImportMessage_.Clear();
+ repeatedNestedEnum_.Clear();
+ repeatedForeignEnum_.Clear();
+ repeatedImportEnum_.Clear();
+ repeatedPublicImportMessage_.Clear();
+ oneofFieldCase_ = OneofFieldOneofCase.None;
+ oneofField_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "single_int32" field.
public const int SingleInt32FieldNumber = 1;
private int singleInt32_;
@@ -2183,6 +2245,15 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ bb_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "bb" field.
public const int BbFieldNumber = 1;
private int bb_;
@@ -2396,6 +2467,21 @@ public NestedTestAllTypes Clone() {
return new NestedTestAllTypes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (child_ != null) {
+ child_.Clear();
+ }
+ if (payload_ != null) {
+ payload_.Clear();
+ }
+ repeatedChild_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "child" field.
public const int ChildFieldNumber = 1;
private global::Google.Protobuf.TestProtos.NestedTestAllTypes child_;
@@ -2673,6 +2759,15 @@ public TestDeprecatedFields Clone() {
return new TestDeprecatedFields(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ deprecatedInt32_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "deprecated_int32" field.
public const int DeprecatedInt32FieldNumber = 1;
private int deprecatedInt32_;
@@ -2876,6 +2971,15 @@ public ForeignMessage Clone() {
return new ForeignMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ c_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "c" field.
public const int CFieldNumber = 1;
private int c_;
@@ -3073,6 +3177,14 @@ public TestReservedFields Clone() {
return new TestReservedFields(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -3238,6 +3350,17 @@ public TestForeignNested Clone() {
return new TestForeignNested(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (foreignNested_ != null) {
+ foreignNested_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "foreign_nested" field.
public const int ForeignNestedFieldNumber = 1;
private global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage foreignNested_;
@@ -3449,6 +3572,16 @@ public TestReallyLargeTagNumber Clone() {
return new TestReallyLargeTagNumber(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ a_ = 0;
+ bb_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private int a_;
@@ -3688,6 +3821,18 @@ public TestRecursiveMessage Clone() {
return new TestRecursiveMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (a_ != null) {
+ a_.Clear();
+ }
+ i_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private global::Google.Protobuf.TestProtos.TestRecursiveMessage a_;
@@ -3934,6 +4079,17 @@ public TestMutualRecursionA Clone() {
return new TestMutualRecursionA(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (bb_ != null) {
+ bb_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "bb" field.
public const int BbFieldNumber = 1;
private global::Google.Protobuf.TestProtos.TestMutualRecursionB bb_;
@@ -4142,6 +4298,18 @@ public TestMutualRecursionB Clone() {
return new TestMutualRecursionB(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (a_ != null) {
+ a_.Clear();
+ }
+ optionalInt32_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private global::Google.Protobuf.TestProtos.TestMutualRecursionA a_;
@@ -4385,6 +4553,15 @@ public TestEnumAllowAlias Clone() {
return new TestEnumAllowAlias(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ value_ = global::Google.Protobuf.TestProtos.TestEnumWithDupValue.Unspecified;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "value" field.
public const int ValueFieldNumber = 1;
private global::Google.Protobuf.TestProtos.TestEnumWithDupValue value_ = global::Google.Protobuf.TestProtos.TestEnumWithDupValue.Unspecified;
@@ -4594,6 +4771,24 @@ public TestCamelCaseFieldNames Clone() {
return new TestCamelCaseFieldNames(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ primitiveField_ = 0;
+ stringField_ = "";
+ enumField_ = global::Google.Protobuf.TestProtos.ForeignEnum.ForeignUnspecified;
+ if (messageField_ != null) {
+ messageField_.Clear();
+ }
+ repeatedPrimitiveField_.Clear();
+ repeatedStringField_.Clear();
+ repeatedEnumField_.Clear();
+ repeatedMessageField_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "PrimitiveField" field.
public const int PrimitiveFieldFieldNumber = 1;
private int primitiveField_;
@@ -5020,6 +5215,20 @@ public TestFieldOrderings Clone() {
return new TestFieldOrderings(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ myString_ = "";
+ myInt_ = 0L;
+ myFloat_ = 0F;
+ if (singleNestedMessage_ != null) {
+ singleNestedMessage_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "my_string" field.
public const int MyStringFieldNumber = 11;
private string myString_ = "";
@@ -5339,6 +5548,16 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ oo_ = 0L;
+ bb_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "oo" field.
public const int OoFieldNumber = 2;
private long oo_;
@@ -5583,6 +5802,15 @@ public SparseEnumMessage Clone() {
return new SparseEnumMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ sparseEnum_ = global::Google.Protobuf.TestProtos.TestSparseEnum.Unspecified;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "sparse_enum" field.
public const int SparseEnumFieldNumber = 1;
private global::Google.Protobuf.TestProtos.TestSparseEnum sparseEnum_ = global::Google.Protobuf.TestProtos.TestSparseEnum.Unspecified;
@@ -5784,6 +6012,15 @@ public OneString Clone() {
return new OneString(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ data_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private string data_ = "";
@@ -5982,6 +6219,15 @@ public MoreString Clone() {
return new MoreString(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ data_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private static readonly pb::FieldCodec _repeated_data_codec
@@ -6169,6 +6415,15 @@ public OneBytes Clone() {
return new OneBytes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ data_ = pb::ByteString.Empty;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private pb::ByteString data_ = pb::ByteString.Empty;
@@ -6367,6 +6622,15 @@ public MoreBytes Clone() {
return new MoreBytes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ data_ = pb::ByteString.Empty;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private pb::ByteString data_ = pb::ByteString.Empty;
@@ -6568,6 +6832,15 @@ public Int32Message Clone() {
return new Int32Message(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ data_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private int data_;
@@ -6766,6 +7039,15 @@ public Uint32Message Clone() {
return new Uint32Message(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ data_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private uint data_;
@@ -6964,6 +7246,15 @@ public Int64Message Clone() {
return new Int64Message(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ data_ = 0L;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private long data_;
@@ -7162,6 +7453,15 @@ public Uint64Message Clone() {
return new Uint64Message(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ data_ = 0UL;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private ulong data_;
@@ -7360,6 +7660,15 @@ public BoolMessage Clone() {
return new BoolMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ data_ = false;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "data" field.
public const int DataFieldNumber = 1;
private bool data_;
@@ -7572,6 +7881,16 @@ public TestOneof Clone() {
return new TestOneof(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ fooCase_ = FooOneofCase.None;
+ foo_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "foo_int" field.
public const int FooIntFieldNumber = 1;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -7923,6 +8242,28 @@ public TestPackedTypes Clone() {
return new TestPackedTypes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ packedInt32_.Clear();
+ packedInt64_.Clear();
+ packedUint32_.Clear();
+ packedUint64_.Clear();
+ packedSint32_.Clear();
+ packedSint64_.Clear();
+ packedFixed32_.Clear();
+ packedFixed64_.Clear();
+ packedSfixed32_.Clear();
+ packedSfixed64_.Clear();
+ packedFloat_.Clear();
+ packedDouble_.Clear();
+ packedBool_.Clear();
+ packedEnum_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "packed_int32" field.
public const int PackedInt32FieldNumber = 90;
private static readonly pb::FieldCodec _repeated_packedInt32_codec
@@ -8480,6 +8821,28 @@ public TestUnpackedTypes Clone() {
return new TestUnpackedTypes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ unpackedInt32_.Clear();
+ unpackedInt64_.Clear();
+ unpackedUint32_.Clear();
+ unpackedUint64_.Clear();
+ unpackedSint32_.Clear();
+ unpackedSint64_.Clear();
+ unpackedFixed32_.Clear();
+ unpackedFixed64_.Clear();
+ unpackedSfixed32_.Clear();
+ unpackedSfixed64_.Clear();
+ unpackedFloat_.Clear();
+ unpackedDouble_.Clear();
+ unpackedBool_.Clear();
+ unpackedEnum_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "unpacked_int32" field.
public const int UnpackedInt32FieldNumber = 90;
private static readonly pb::FieldCodec _repeated_unpackedInt32_codec
@@ -9025,6 +9388,20 @@ public TestRepeatedScalarDifferentTagSizes Clone() {
return new TestRepeatedScalarDifferentTagSizes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ repeatedFixed32_.Clear();
+ repeatedInt32_.Clear();
+ repeatedFixed64_.Clear();
+ repeatedInt64_.Clear();
+ repeatedFloat_.Clear();
+ repeatedUint64_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "repeated_fixed32" field.
public const int RepeatedFixed32FieldNumber = 12;
private static readonly pb::FieldCodec _repeated_repeatedFixed32_codec
@@ -9363,6 +9740,15 @@ public TestCommentInjectionMessage Clone() {
return new TestCommentInjectionMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ a_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private string a_ = "";
@@ -9566,6 +9952,14 @@ public FooRequest Clone() {
return new FooRequest(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -9727,6 +10121,14 @@ public FooResponse Clone() {
return new FooResponse(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -9888,6 +10290,14 @@ public FooClientMessage Clone() {
return new FooClientMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -10049,6 +10459,14 @@ public FooServerMessage Clone() {
return new FooServerMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -10210,6 +10628,14 @@ public BarRequest Clone() {
return new BarRequest(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -10371,6 +10797,14 @@ public BarResponse Clone() {
return new BarResponse(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -10532,6 +10966,14 @@ public TestEmptyMessage Clone() {
return new TestEmptyMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -10697,6 +11139,15 @@ public CommentMessage Clone() {
return new CommentMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ text_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "text" field.
public const int TextFieldNumber = 1;
private string text_ = "";
@@ -10914,6 +11365,15 @@ public NestedCommentMessage Clone() {
return new NestedCommentMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ nestedText_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "nested_text" field.
public const int NestedTextFieldNumber = 1;
private string nestedText_ = "";
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.pb.cs
index 318454c01d00c..22a4931ef13f8 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.pb.cs
@@ -146,6 +146,40 @@ public TestProto3Optional Clone() {
return new TestProto3Optional(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ optionalInt32_ = 0;
+ optionalInt64_ = 0L;
+ optionalUint32_ = 0;
+ optionalUint64_ = 0UL;
+ optionalSint32_ = 0;
+ optionalSint64_ = 0L;
+ optionalFixed32_ = 0;
+ optionalFixed64_ = 0UL;
+ optionalSfixed32_ = 0;
+ optionalSfixed64_ = 0L;
+ optionalFloat_ = 0F;
+ optionalDouble_ = 0D;
+ optionalBool_ = false;
+ optionalString_ = "";
+ optionalBytes_ = pb::ByteString.Empty;
+ optionalCord_ = "";
+ if (optionalNestedMessage_ != null) {
+ optionalNestedMessage_.Clear();
+ }
+ if (lazyNestedMessage_ != null) {
+ lazyNestedMessage_.Clear();
+ }
+ optionalNestedEnum_ = global::ProtobufUnittest.TestProto3Optional.Types.NestedEnum.Unspecified;
+ singularInt32_ = 0;
+ singularInt64_ = 0L;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "optional_int32" field.
public const int OptionalInt32FieldNumber = 1;
private readonly static int OptionalInt32DefaultValue = 0;
@@ -1356,6 +1390,16 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ bb_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "bb" field.
public const int BbFieldNumber = 1;
private readonly static int BbDefaultValue = 0;
@@ -1580,6 +1624,20 @@ public TestProto3OptionalMessage Clone() {
return new TestProto3OptionalMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (nestedMessage_ != null) {
+ nestedMessage_.Clear();
+ }
+ if (optionalNestedMessage_ != null) {
+ optionalNestedMessage_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "nested_message" field.
public const int NestedMessageFieldNumber = 1;
private global::ProtobufUnittest.TestProto3OptionalMessage.Types.NestedMessage nestedMessage_;
@@ -1835,6 +1893,15 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ s_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "s" field.
public const int SFieldNumber = 1;
private string s_ = "";
@@ -2037,6 +2104,14 @@ public Proto3OptionalExtensions Clone() {
return new Proto3OptionalExtensions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestRetention.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestRetention.pb.cs
index c2d24652cbfd8..0b52ba6567be5 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestRetention.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestRetention.pb.cs
@@ -169,6 +169,18 @@ public OptionsMessage Clone() {
return new OptionsMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ plainField_ = 0;
+ runtimeRetentionField_ = 0;
+ sourceRetentionField_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "plain_field" field.
public const int PlainFieldFieldNumber = 1;
private readonly static int PlainFieldDefaultValue = 0;
@@ -486,6 +498,17 @@ public Extendee Clone() {
return new Extendee(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -701,6 +724,21 @@ public TopLevelMessage Clone() {
return new TopLevelMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ f_ = 0F;
+ oCase_ = OOneofCase.None;
+ o_ = null;
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "f" field.
public const int FFieldNumber = 1;
private readonly static float FDefaultValue = 0F;
@@ -1037,6 +1075,14 @@ public NestedMessage Clone() {
return new NestedMessage(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.pb.cs
index bf48e14db3037..e8146dd559f6d 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.pb.cs
@@ -115,6 +115,20 @@ public FooOptions Clone() {
return new FooOptions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ intOpt_ = 0;
+ foo_ = 0;
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "int_opt" field.
public const int IntOptFieldNumber = 1;
private readonly static int IntOptDefaultValue = 0;
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.pb.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.pb.cs
index fc0bb9bf82665..3193642e6aa8c 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.pb.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.pb.cs
@@ -241,6 +241,53 @@ public TestWellKnownTypes Clone() {
return new TestWellKnownTypes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (anyField_ != null) {
+ anyField_.Clear();
+ }
+ if (apiField_ != null) {
+ apiField_.Clear();
+ }
+ if (durationField_ != null) {
+ durationField_.Clear();
+ }
+ if (emptyField_ != null) {
+ emptyField_.Clear();
+ }
+ if (fieldMaskField_ != null) {
+ fieldMaskField_.Clear();
+ }
+ if (sourceContextField_ != null) {
+ sourceContextField_.Clear();
+ }
+ if (structField_ != null) {
+ structField_.Clear();
+ }
+ if (timestampField_ != null) {
+ timestampField_.Clear();
+ }
+ if (typeField_ != null) {
+ typeField_.Clear();
+ }
+ doubleField_ = 0D;
+ floatField_ = 0F;
+ int64Field_ = 0L;
+ uint64Field_ = 0UL;
+ int32Field_ = 0;
+ uint32Field_ = 0;
+ boolField_ = false;
+ stringField_ = "";
+ bytesField_ = pb::ByteString.Empty;
+ if (valueField_ != null) {
+ valueField_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "any_field" field.
public const int AnyFieldFieldNumber = 1;
private global::Google.Protobuf.WellKnownTypes.Any anyField_;
@@ -1272,6 +1319,32 @@ public RepeatedWellKnownTypes Clone() {
return new RepeatedWellKnownTypes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ anyField_.Clear();
+ apiField_.Clear();
+ durationField_.Clear();
+ emptyField_.Clear();
+ fieldMaskField_.Clear();
+ sourceContextField_.Clear();
+ structField_.Clear();
+ timestampField_.Clear();
+ typeField_.Clear();
+ doubleField_.Clear();
+ floatField_.Clear();
+ int64Field_.Clear();
+ uint64Field_.Clear();
+ int32Field_.Clear();
+ uint32Field_.Clear();
+ boolField_.Clear();
+ stringField_.Clear();
+ bytesField_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "any_field" field.
public const int AnyFieldFieldNumber = 1;
private static readonly pb::FieldCodec _repeated_anyField_codec
@@ -1943,6 +2016,16 @@ public OneofWellKnownTypes Clone() {
return new OneofWellKnownTypes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ oneofFieldCase_ = OneofFieldOneofCase.None;
+ oneofField_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "any_field" field.
public const int AnyFieldFieldNumber = 1;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -2925,6 +3008,32 @@ public MapWellKnownTypes Clone() {
return new MapWellKnownTypes(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ anyField_.Clear();
+ apiField_.Clear();
+ durationField_.Clear();
+ emptyField_.Clear();
+ fieldMaskField_.Clear();
+ sourceContextField_.Clear();
+ structField_.Clear();
+ timestampField_.Clear();
+ typeField_.Clear();
+ doubleField_.Clear();
+ floatField_.Clear();
+ int64Field_.Clear();
+ uint64Field_.Clear();
+ int32Field_.Clear();
+ uint32Field_.Clear();
+ boolField_.Clear();
+ stringField_.Clear();
+ bytesField_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "any_field" field.
public const int AnyFieldFieldNumber = 1;
private static readonly pbc::MapField.Codec _map_anyField_codec
diff --git a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.Proto2.cs b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.Proto2.cs
index aa1a1301615da..8c7e5ce7ad456 100644
--- a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.Proto2.cs
+++ b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.Proto2.cs
@@ -400,5 +400,492 @@ public void RoundTrip_ParseUsingCodedInput()
var parsed = TestAllExtensions.Parser.WithExtensionRegistry(new ExtensionRegistry() { UnittestExtensions.OptionalBoolExtension }).ParseFrom(input);
Assert.AreEqual(message, parsed);
}
+
+ [Test]
+ public void TestClearProto2()
+ {
+ var message = new TestAllTypes();
+
+ Assert.AreEqual(false, message.OptionalBool);
+ message.OptionalBool = true;
+ Assert.AreNotEqual(false, message.OptionalBool);
+ message.Clear();
+ Assert.AreEqual(false, message.OptionalBool);
+
+ Assert.AreEqual(ByteString.Empty, message.OptionalBytes);
+ message.OptionalBytes = ByteString.CopyFromUtf8("test1");
+ Assert.AreNotEqual(ByteString.Empty, message.OptionalBytes);
+ message.Clear();
+ Assert.AreEqual(ByteString.Empty, message.OptionalBytes);
+
+ Assert.AreEqual(0.0, message.OptionalDouble);
+ message.OptionalDouble = 123.0;
+ Assert.AreNotEqual(0.0, message.OptionalDouble);
+ message.Clear();
+ Assert.AreEqual(0.0, message.OptionalDouble);
+
+ Assert.AreEqual(0, message.OptionalFixed32);
+ message.OptionalFixed32 = 123;
+ Assert.AreNotEqual(0, message.OptionalFixed32);
+ message.Clear();
+ Assert.AreEqual(0, message.OptionalFixed32);
+
+ Assert.AreEqual(0L, message.OptionalFixed64);
+ message.OptionalFixed64 = 123L;
+ Assert.AreNotEqual(0L, message.OptionalFixed64);
+ message.Clear();
+ Assert.AreEqual(0L, message.OptionalFixed64);
+
+ Assert.AreEqual(0.0f, message.OptionalFloat);
+ message.OptionalFloat = 123.0f;
+ Assert.AreNotEqual(0.0f, message.OptionalFloat);
+ message.Clear();
+ Assert.AreEqual(0.0f, message.OptionalFloat);
+
+ Assert.AreEqual(ForeignEnum.ForeignFoo, message.OptionalForeignEnum);
+ message.OptionalForeignEnum = ForeignEnum.ForeignBar;
+ Assert.AreNotEqual(ForeignEnum.ForeignFoo, message.OptionalForeignEnum);
+ message.Clear();
+ Assert.AreEqual(ForeignEnum.ForeignFoo, message.OptionalForeignEnum);
+
+ Assert.IsNull(message.OptionalForeignMessage);
+ message.Clear();
+ Assert.IsNull(message.OptionalForeignMessage);
+ var foreignMessage = new global::Google.Protobuf.TestProtos.Proto2.ForeignMessage();
+ message.OptionalForeignMessage = foreignMessage;
+ Assert.AreEqual(foreignMessage, message.OptionalForeignMessage);
+ message.Clear();
+ Assert.AreEqual(foreignMessage, message.OptionalForeignMessage);
+
+ Assert.AreEqual(ImportEnum.ImportFoo, message.OptionalImportEnum);
+ message.OptionalImportEnum = ImportEnum.ImportBar;
+ Assert.AreNotEqual(ImportEnum.ImportFoo, message.OptionalImportEnum);
+ message.Clear();
+ Assert.AreEqual(ImportEnum.ImportFoo, message.OptionalImportEnum);
+
+ Assert.IsNull(message.OptionalImportMessage);
+ message.Clear();
+ Assert.IsNull(message.OptionalImportMessage);
+ var importMessage = new global::Google.Protobuf.TestProtos.Proto2.ImportMessage();
+ message.OptionalImportMessage = importMessage;
+ Assert.AreEqual(importMessage, message.OptionalImportMessage);
+ message.Clear();
+ Assert.AreEqual(importMessage, message.OptionalImportMessage);
+
+ Assert.AreEqual(0, message.OptionalInt32);
+ message.OptionalInt32 = 123;
+ Assert.AreNotEqual(0, message.OptionalInt32);
+ message.Clear();
+ Assert.AreEqual(0, message.OptionalInt32);
+
+ Assert.AreEqual(0L, message.OptionalInt64);
+ message.OptionalInt64 = 123L;
+ Assert.AreNotEqual(0L, message.OptionalInt64);
+ message.Clear();
+ Assert.AreEqual(0L, message.OptionalInt64);
+
+ Assert.AreEqual(Proto2.TestAllTypes.Types.NestedEnum.Foo, message.OptionalNestedEnum);
+ message.OptionalNestedEnum = Proto2.TestAllTypes.Types.NestedEnum.Bar;
+ Assert.AreNotEqual(Proto2.TestAllTypes.Types.NestedEnum.Foo, message.OptionalNestedEnum);
+ message.Clear();
+ Assert.AreEqual(Proto2.TestAllTypes.Types.NestedEnum.Foo, message.OptionalNestedEnum);
+
+ Assert.IsNull(message.OptionalNestedMessage);
+ message.Clear();
+ Assert.IsNull(message.OptionalNestedMessage);
+ var nestedMessage = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage();
+ message.OptionalNestedMessage = nestedMessage;
+ Assert.AreEqual(nestedMessage, message.OptionalNestedMessage);
+ message.Clear();
+ Assert.AreEqual(nestedMessage, message.OptionalNestedMessage);
+
+ Assert.IsNull(message.OptionalPublicImportMessage);
+ message.Clear();
+ Assert.IsNull(message.OptionalPublicImportMessage);
+ var publicImportMessage = new global::Google.Protobuf.TestProtos.Proto2.PublicImportMessage();
+ message.OptionalPublicImportMessage = publicImportMessage;
+ Assert.AreEqual(publicImportMessage, message.OptionalPublicImportMessage);
+ message.Clear();
+ Assert.AreEqual(publicImportMessage, message.OptionalPublicImportMessage);
+
+ Assert.AreEqual(0, message.OptionalSfixed32);
+ message.OptionalSfixed32 = 123;
+ Assert.AreNotEqual(0, message.OptionalSfixed32);
+ message.Clear();
+ Assert.AreEqual(0, message.OptionalSfixed32);
+
+ Assert.AreEqual(0L, message.OptionalSfixed64);
+ message.OptionalSfixed64 = 123L;
+ Assert.AreNotEqual(0L, message.OptionalSfixed64);
+ message.Clear();
+ Assert.AreEqual(0L, message.OptionalSfixed64);
+
+ Assert.AreEqual(0, message.OptionalSint32);
+ message.OptionalSint32 = 123;
+ Assert.AreNotEqual(0, message.OptionalSint32);
+ message.Clear();
+ Assert.AreEqual(0, message.OptionalSint32);
+
+ Assert.AreEqual(0L, message.OptionalSint64);
+ message.OptionalSint64 = 123L;
+ Assert.AreNotEqual(0L, message.OptionalSint64);
+ message.Clear();
+ Assert.AreEqual(0L, message.OptionalSint64);
+
+ Assert.AreEqual("", message.OptionalString);
+ message.OptionalString = "test2";
+ Assert.AreNotEqual("", message.OptionalString);
+ message.Clear();
+ Assert.AreEqual("", message.OptionalString);
+
+ Assert.AreEqual(0U, message.OptionalUint32);
+ message.OptionalUint32 = 123U;
+ Assert.AreNotEqual(0U, message.OptionalUint32);
+ message.Clear();
+ Assert.AreEqual(0U, message.OptionalUint32);
+
+ Assert.AreEqual(0UL, message.OptionalUint64);
+ message.OptionalUint64 = 123UL;
+ Assert.AreNotEqual(0UL, message.OptionalUint64);
+ message.Clear();
+ Assert.AreEqual(0UL, message.OptionalUint64);
+ }
+ [Test]
+ public void TestClearRepeatedFieldsProto2()
+ {
+ // Repeated fields
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedBool.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedBool.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedBytes.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedBytes.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedDouble.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedDouble.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedFixed32.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedFixed32.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedFixed64.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedFixed64.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedFloat.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedFloat.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedForeignEnum.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedForeignEnum.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedForeignMessage.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedForeignMessage.Count);
+ }
+
+ {
+
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedImportEnum.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedImportEnum.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedImportMessage.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedImportMessage.Count);
+
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedNestedEnum.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedNestedEnum.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedNestedMessage.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedNestedMessage.Count);
+ }
+
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedSfixed32.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedSfixed32.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedSfixed64.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedSfixed64.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedSint32.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedSint32.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedSint64.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedSint64.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedString.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedString.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedUint32.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedUint32.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypesProto2();
+ Assert.AreNotEqual(0, message.RepeatedUint64.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedUint64.Count);
+ }
+ }
+
+ [Test]
+ public void TestClearOneofFieldsProto2()
+ {
+ // Oneof fields
+ {
+ var message = new Proto2.TestAllTypes();
+
+ Assert.AreEqual(Proto2.TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
+ Assert.AreEqual(0, message.OneofUint32);
+
+ message.OneofUint32 = 123;
+ Assert.AreEqual(Proto2.TestAllTypes.OneofFieldOneofCase.OneofUint32, message.OneofFieldCase);
+ Assert.AreEqual(123, message.OneofUint32);
+
+ message.Clear();
+
+ Assert.AreEqual(Proto2.TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
+ Assert.AreEqual(0, message.OneofUint32);
+ }
+
+ {
+ var message = new Proto2.TestAllTypes();
+
+ Assert.AreEqual(Proto2.TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
+ Assert.AreEqual("", message.OneofString);
+
+ message.OneofString = "test3";
+ Assert.AreEqual(Proto2.TestAllTypes.OneofFieldOneofCase.OneofString, message.OneofFieldCase);
+ Assert.AreEqual("test3", message.OneofString);
+
+ message.Clear();
+
+ Assert.AreEqual(Proto2.TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
+ Assert.AreEqual("", message.OneofString);
+ }
+
+ {
+ var message = new Proto2.TestAllTypes();
+
+ Assert.AreEqual(Proto2.TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
+ Assert.AreEqual(ByteString.Empty, message.OneofBytes);
+
+ var byteString = ByteString.CopyFromUtf8("test4");
+ message.OneofBytes = byteString;
+ Assert.AreEqual(Proto2.TestAllTypes.OneofFieldOneofCase.OneofBytes, message.OneofFieldCase);
+ Assert.AreEqual(byteString, message.OneofBytes);
+
+ message.Clear();
+
+ Assert.AreEqual(Proto2.TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
+ Assert.AreEqual(ByteString.Empty, message.OneofBytes);
+ }
+
+ {
+ var message = new Proto2.TestAllTypes();
+
+ Assert.AreEqual(Proto2.TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
+ Assert.IsNull(message.OneofNestedMessage);
+
+ var nestedMessage = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage();
+ message.OneofNestedMessage = nestedMessage;
+ Assert.AreEqual(Proto2.TestAllTypes.OneofFieldOneofCase.OneofNestedMessage, message.OneofFieldCase);
+ Assert.AreEqual(nestedMessage, message.OneofNestedMessage);
+
+ message.Clear();
+
+ Assert.AreEqual(Proto2.TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
+ Assert.IsNull(message.OneofNestedMessage);
+ }
+ }
+
+ [Test]
+ public void TestClearDefaultProto2()
+ {
+ var message = new TestAllTypes();
+
+ Assert.AreEqual(true, message.DefaultBool);
+ message.DefaultBool = false;
+ Assert.AreNotEqual(true, message.DefaultBool);
+ message.Clear();
+ Assert.AreEqual(true, message.DefaultBool);
+
+ Assert.AreEqual(ByteString.CopyFromUtf8("world"), message.DefaultBytes);
+ message.DefaultBytes = ByteString.CopyFromUtf8("test1");
+ Assert.AreNotEqual(ByteString.CopyFromUtf8("world"), message.DefaultBytes);
+ message.Clear();
+ Assert.AreEqual(ByteString.CopyFromUtf8("world"), message.DefaultBytes);
+
+ Assert.AreEqual("123", message.DefaultCord);
+ message.DefaultCord = "456";
+ Assert.AreNotEqual("123", message.DefaultCord);
+ message.Clear();
+ Assert.AreEqual("123", message.DefaultCord);
+
+ Assert.AreEqual(52e3, message.DefaultDouble);
+ message.DefaultDouble = 37e1;
+ Assert.AreNotEqual(52e3, message.DefaultDouble);
+ message.Clear();
+ Assert.AreEqual(52e3, message.DefaultDouble);
+
+ Assert.AreEqual(47, message.DefaultFixed32);
+ message.DefaultFixed32 = 23;
+ Assert.AreNotEqual(47, message.DefaultFixed32);
+ message.Clear();
+ Assert.AreEqual(47, message.DefaultFixed32);
+
+ Assert.AreEqual(48, message.DefaultFixed64);
+ message.DefaultFixed64 = 32;
+ Assert.AreNotEqual(48, message.DefaultFixed64);
+ message.Clear();
+ Assert.AreEqual(48, message.DefaultFixed64);
+
+ Assert.AreEqual(51.5f, message.DefaultFloat);
+ message.DefaultFloat = 5.15f;
+ Assert.AreNotEqual(51.5f, message.DefaultFloat);
+ message.Clear();
+ Assert.AreEqual(51.5f, message.DefaultFloat);
+
+ Assert.AreEqual(ForeignEnum.ForeignBar, message.DefaultForeignEnum);
+ message.DefaultForeignEnum = ForeignEnum.ForeignBaz;
+ Assert.AreNotEqual(ForeignEnum.ForeignBar, message.DefaultForeignEnum);
+ message.Clear();
+ Assert.AreEqual(ForeignEnum.ForeignBar, message.DefaultForeignEnum);
+
+ Assert.AreEqual(ImportEnum.ImportBar, message.DefaultImportEnum);
+ message.DefaultImportEnum = ImportEnum.ImportBaz;
+ Assert.AreNotEqual(ImportEnum.ImportBar, message.DefaultImportEnum);
+ message.Clear();
+ Assert.AreEqual(ImportEnum.ImportBar, message.DefaultImportEnum);
+
+ Assert.AreEqual(41, message.DefaultInt32);
+ message.DefaultInt32 = 4;
+ Assert.AreNotEqual(41, message.DefaultInt32);
+ message.Clear();
+ Assert.AreEqual(41, message.DefaultInt32);
+
+ Assert.AreEqual(42, message.DefaultInt64);
+ message.DefaultInt64 = 8;
+ Assert.AreNotEqual(42, message.DefaultInt64);
+ message.Clear();
+ Assert.AreEqual(42, message.DefaultInt64);
+
+ Assert.AreEqual(Proto2.TestAllTypes.Types.NestedEnum.Bar, message.DefaultNestedEnum);
+ message.DefaultNestedEnum = Proto2.TestAllTypes.Types.NestedEnum.Baz;
+ Assert.AreNotEqual(Proto2.TestAllTypes.Types.NestedEnum.Bar, message.DefaultNestedEnum);
+ message.Clear();
+ Assert.AreEqual(Proto2.TestAllTypes.Types.NestedEnum.Bar, message.DefaultNestedEnum);
+
+ Assert.AreEqual(49, message.DefaultSfixed32);
+ message.DefaultSfixed32 = 36;
+ Assert.AreNotEqual(49, message.DefaultSfixed32);
+ message.Clear();
+ Assert.AreEqual(49, message.DefaultSfixed32);
+
+ Assert.AreEqual(-50, message.DefaultSfixed64);
+ message.DefaultSfixed64 = -17;
+ Assert.AreNotEqual(-50, message.DefaultSfixed64);
+ message.Clear();
+ Assert.AreEqual(-50, message.DefaultSfixed64);
+
+ Assert.AreEqual(-45, message.DefaultSint32);
+ message.DefaultSint32 = -20;
+ Assert.AreNotEqual(-45, message.DefaultSint32);
+ message.Clear();
+ Assert.AreEqual(-45, message.DefaultSint32);
+
+ Assert.AreEqual(46, message.DefaultSint64);
+ message.DefaultSint64 = 24;
+ Assert.AreNotEqual(46, message.DefaultSint64);
+ message.Clear();
+ Assert.AreEqual(46, message.DefaultSint64);
+
+ Assert.AreEqual("hello", message.DefaultString);
+ message.DefaultString = "world";
+ Assert.AreNotEqual("hello", message.DefaultString);
+ message.Clear();
+ Assert.AreEqual("hello", message.DefaultString);
+
+ Assert.AreEqual("abc", message.DefaultStringPiece);
+ message.DefaultStringPiece = "def";
+ Assert.AreNotEqual("abc", message.DefaultStringPiece);
+ message.Clear();
+ Assert.AreEqual("abc", message.DefaultStringPiece);
+
+ Assert.AreEqual(43, message.DefaultUint32);
+ message.DefaultUint32 = 12;
+ Assert.AreNotEqual(43, message.DefaultUint32);
+ message.Clear();
+ Assert.AreEqual(43, message.DefaultUint32);
+
+ Assert.AreEqual(44, message.DefaultUint64);
+ message.DefaultUint64 = 16;
+ Assert.AreNotEqual(44, message.DefaultUint64);
+ message.Clear();
+ Assert.AreEqual(44, message.DefaultUint64);
+ }
}
}
diff --git a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
index 734c1d0555c8a..5cae32441c992 100644
--- a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
+++ b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
@@ -904,5 +904,376 @@ public void MapFieldMerging(bool direct)
};
Assert.AreEqual(expected, message1.MapStringString);
}
+
+ [Test]
+ public void TestClearSingleFields()
+ {
+ // Single fields
+ var message = new TestAllTypes();
+
+ Assert.AreEqual(false, message.SingleBool);
+ message.SingleBool = true;
+ Assert.AreNotEqual(false, message.SingleBool);
+ message.Clear();
+ Assert.AreEqual(false, message.SingleBool);
+
+ Assert.AreEqual(ByteString.Empty, message.SingleBytes);
+ message.SingleBytes = ByteString.CopyFromUtf8("test1");
+ Assert.AreNotEqual(ByteString.Empty, message.SingleBytes);
+ message.Clear();
+ Assert.AreEqual(ByteString.Empty, message.SingleBytes);
+
+ Assert.AreEqual(0.0, message.SingleDouble);
+ message.SingleDouble = 1.23;
+ Assert.AreNotEqual(0.0, message.SingleDouble);
+ message.Clear();
+ Assert.AreEqual(0.0, message.SingleDouble);
+
+ Assert.AreEqual(0, message.SingleFixed32);
+ message.SingleFixed32 = 123;
+ Assert.AreNotEqual(0, message.SingleFixed32);
+ message.Clear();
+ Assert.AreEqual(0, message.SingleFixed32);
+
+ Assert.AreEqual(0L, message.SingleFixed64);
+ message.SingleFixed64 = 123L;
+ Assert.AreNotEqual(0L, message.SingleFixed64);
+ message.Clear();
+ Assert.AreEqual(0L, message.SingleFixed64);
+
+ Assert.AreEqual(0.0f, message.SingleFloat);
+ message.SingleFloat = 1.23f;
+ Assert.AreNotEqual(0.0f, message.SingleFloat);
+ message.Clear();
+ Assert.AreEqual(0.0f, message.SingleFloat);
+
+ Assert.AreEqual(ForeignEnum.ForeignUnspecified, message.SingleForeignEnum);
+ message.SingleForeignEnum = ForeignEnum.ForeignFoo;
+ Assert.AreNotEqual(ForeignEnum.ForeignUnspecified, message.SingleForeignEnum);
+ message.Clear();
+ Assert.AreEqual(ForeignEnum.ForeignUnspecified, message.SingleForeignEnum);
+
+ Assert.IsNull(message.SingleForeignMessage);
+ message.Clear();
+ Assert.IsNull(message.SingleForeignMessage);
+ var singleForeignMessage = new global::Google.Protobuf.TestProtos.ForeignMessage();
+ message.SingleForeignMessage = singleForeignMessage;
+ Assert.AreEqual(singleForeignMessage, message.SingleForeignMessage);
+ message.Clear();
+ Assert.AreEqual(singleForeignMessage, message.SingleForeignMessage);
+
+ Assert.AreEqual(ImportEnum.Unspecified, message.SingleImportEnum);
+ message.SingleImportEnum = ImportEnum.ImportFoo;
+ Assert.AreNotEqual(ImportEnum.Unspecified, message.SingleImportEnum);
+ message.Clear();
+ Assert.AreEqual(ImportEnum.Unspecified, message.SingleImportEnum);
+
+ Assert.IsNull(message.SingleImportMessage);
+ message.Clear();
+ Assert.IsNull(message.SingleImportMessage);
+ var importMessage = new global::Google.Protobuf.TestProtos.ImportMessage();
+ message.SingleImportMessage = importMessage;
+ Assert.AreEqual(importMessage, message.SingleImportMessage);
+ message.Clear();
+ Assert.AreEqual(importMessage, message.SingleImportMessage);
+
+ Assert.AreEqual(0, message.SingleInt32);
+ message.SingleInt32 = 123;
+ Assert.AreNotEqual(0, message.SingleInt32);
+ message.Clear();
+ Assert.AreEqual(0, message.SingleInt32);
+
+ Assert.AreEqual(0L, message.SingleInt64);
+ message.SingleInt64 = 123;
+ Assert.AreNotEqual(0L, message.SingleInt64);
+ message.Clear();
+ Assert.AreEqual(0L, message.SingleInt64);
+
+ Assert.AreEqual(TestAllTypes.Types.NestedEnum.Unspecified, message.SingleNestedEnum);
+ message.SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo;
+ Assert.AreNotEqual(TestAllTypes.Types.NestedEnum.Unspecified, message.SingleNestedEnum);
+ message.Clear();
+ Assert.AreEqual(TestAllTypes.Types.NestedEnum.Unspecified, message.SingleNestedEnum);
+
+ Assert.IsNull(message.SingleNestedMessage);
+ message.Clear();
+ Assert.IsNull(message.SingleNestedMessage);
+ var nestedMessage = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
+ message.SingleNestedMessage = nestedMessage;
+ Assert.AreEqual(nestedMessage, message.SingleNestedMessage);
+ message.Clear();
+ Assert.AreEqual(nestedMessage, message.SingleNestedMessage);
+
+ Assert.IsNull(message.SinglePublicImportMessage);
+ message.Clear();
+ Assert.IsNull(message.SinglePublicImportMessage);
+ var publicImportMessage = new global::Google.Protobuf.TestProtos.PublicImportMessage();
+ message.SinglePublicImportMessage = publicImportMessage;
+ Assert.AreEqual(publicImportMessage, message.SinglePublicImportMessage);
+ message.Clear();
+ Assert.AreEqual(publicImportMessage, message.SinglePublicImportMessage);
+
+ Assert.AreEqual(0, message.SingleSfixed32);
+ message.SingleSfixed32 = 123;
+ Assert.AreNotEqual(0, message.SingleSfixed32);
+ message.Clear();
+ Assert.AreEqual(0, message.SingleSfixed32);
+
+ Assert.AreEqual(0L, message.SingleSfixed64);
+ message.SingleSfixed64 = 123L;
+ Assert.AreNotEqual(0L, message.SingleSfixed64);
+ message.Clear();
+ Assert.AreEqual(0L, message.SingleSfixed64);
+
+ Assert.AreEqual(0, message.SingleSint32);
+ message.SingleSint32 = 123;
+ Assert.AreNotEqual(0, message.SingleSint32);
+ message.Clear();
+ Assert.AreEqual(0, message.SingleSint32);
+
+ Assert.AreEqual(0L, message.SingleSint64);
+ message.SingleSint64 = 123L;
+ Assert.AreNotEqual(0L, message.SingleSint64);
+ message.Clear();
+ Assert.AreEqual(0L, message.SingleSint64);
+
+ Assert.AreEqual("", message.SingleString);
+ message.SingleString = "test2";
+ Assert.AreNotEqual("", message.SingleString);
+ message.Clear();
+ Assert.AreEqual("", message.SingleString);
+
+ Assert.AreEqual(0U, message.SingleUint32);
+ message.SingleUint32 = 123U;
+ Assert.AreNotEqual(0U, message.SingleUint32);
+ message.Clear();
+ Assert.AreEqual(0U, message.SingleUint32);
+
+ Assert.AreEqual(0UL, message.SingleUint64);
+ message.SingleUint64 = 123UL;
+ Assert.AreNotEqual(0UL, message.SingleUint64);
+ message.Clear();
+ Assert.AreEqual(0UL, message.SingleUint64);
+ }
+
+ [Test]
+ public void TestClearRepeatedFields()
+ {
+ // Repeated fields
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedBool.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedBool.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedBytes.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedBytes.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedDouble.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedDouble.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedFixed32.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedFixed32.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedFixed64.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedFixed64.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedFloat.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedFloat.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedForeignEnum.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedForeignEnum.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedForeignMessage.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedForeignMessage.Count);
+ }
+
+ {
+
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedImportEnum.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedImportEnum.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedImportMessage.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedImportMessage.Count);
+
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedNestedEnum.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedNestedEnum.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedNestedMessage.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedNestedMessage.Count);
+ }
+
+ {
+
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedPublicImportMessage.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedPublicImportMessage.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedSfixed32.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedSfixed32.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedSfixed64.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedSfixed64.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedSint32.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedSint32.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedSint64.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedSint64.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedString.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedString.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedUint32.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedUint32.Count);
+ }
+
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ Assert.AreNotEqual(0, message.RepeatedUint64.Count);
+ message.Clear();
+ Assert.AreEqual(0, message.RepeatedUint64.Count);
+ }
+ }
+
+
+ [Test]
+ public void TestClearOneofFields()
+ {
+ // Oneof fields
+ {
+ var message = new TestAllTypes();
+
+ Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
+ Assert.AreEqual(0, message.OneofUint32);
+
+ message.OneofUint32 = 123;
+ Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message.OneofFieldCase);
+ Assert.AreEqual(123, message.OneofUint32);
+
+ message.Clear();
+
+ Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
+ Assert.AreEqual(0, message.OneofUint32);
+ }
+
+ {
+ var message = new TestAllTypes();
+
+ Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
+ Assert.AreEqual("", message.OneofString);
+
+ message.OneofString = "test3";
+ Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofString, message.OneofFieldCase);
+ Assert.AreEqual("test3", message.OneofString);
+
+ message.Clear();
+
+ Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
+ Assert.AreEqual("", message.OneofString);
+ }
+
+ {
+ var message = new TestAllTypes();
+
+ Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
+ Assert.AreEqual(ByteString.Empty, message.OneofBytes);
+
+ var byteString = ByteString.CopyFromUtf8("test4");
+ message.OneofBytes = byteString;
+ Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofBytes, message.OneofFieldCase);
+ Assert.AreEqual(byteString, message.OneofBytes);
+
+ message.Clear();
+
+ Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
+ Assert.AreEqual(ByteString.Empty, message.OneofBytes);
+ }
+
+ {
+ var message = new TestAllTypes();
+
+ Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
+ Assert.IsNull(message.OneofNestedMessage);
+
+ var nestedMessage = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
+ message.OneofNestedMessage = nestedMessage;
+ Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofNestedMessage, message.OneofFieldCase);
+ Assert.AreEqual(nestedMessage, message.OneofNestedMessage);
+
+ message.Clear();
+
+ Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase);
+ Assert.IsNull(message.OneofNestedMessage);
+ }
+ }
}
}
diff --git a/csharp/src/Google.Protobuf.Test/LegacyGeneratedCodeTest.cs b/csharp/src/Google.Protobuf.Test/LegacyGeneratedCodeTest.cs
index 0e41eca2d7cf5..259abfc5ccb1a 100644
--- a/csharp/src/Google.Protobuf.Test/LegacyGeneratedCodeTest.cs
+++ b/csharp/src/Google.Protobuf.Test/LegacyGeneratedCodeTest.cs
@@ -129,6 +129,15 @@ private sealed partial class LegacyGeneratedCodeMessageA : pb::IMessage {
pbr::MessageDescriptor pb::IMessage.Descriptor => throw new System.NotImplementedException();
+ public void Clear() {
+ if (bb_ != null) {
+ bb_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "bb" field.
public const int BbFieldNumber = 1;
private ParseContextEnabledMessageB bb_;
@@ -186,6 +195,13 @@ private sealed partial class ParseContextEnabledMessageB : pb::IBufferMessage {
pbr::MessageDescriptor pb::IMessage.Descriptor => throw new System.NotImplementedException();
+ public void Clear() {
+ if (a_ != null) {
+ a_.Clear();
+ }
+ optionalInt32_ = 0;
+ }
+
/// Field number for the "a" field.
public const int AFieldNumber = 1;
private LegacyGeneratedCodeMessageA a_;
diff --git a/csharp/src/Google.Protobuf/Compiler/Plugin.pb.cs b/csharp/src/Google.Protobuf/Compiler/Plugin.pb.cs
index 55d7f2ebc5d32..a505bf9680708 100644
--- a/csharp/src/Google.Protobuf/Compiler/Plugin.pb.cs
+++ b/csharp/src/Google.Protobuf/Compiler/Plugin.pb.cs
@@ -111,6 +111,19 @@ public Version Clone() {
return new Version(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ major_ = 0;
+ minor_ = 0;
+ patch_ = 0;
+ suffix_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "major" field.
public const int MajorFieldNumber = 1;
private readonly static int MajorDefaultValue = 0;
@@ -487,6 +500,21 @@ public CodeGeneratorRequest Clone() {
return new CodeGeneratorRequest(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ fileToGenerate_.Clear();
+ parameter_ = "";
+ protoFile_.Clear();
+ sourceFileDescriptors_.Clear();
+ if (compilerVersion_ != null) {
+ compilerVersion_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "file_to_generate" field.
public const int FileToGenerateFieldNumber = 1;
private static readonly pb::FieldCodec _repeated_fileToGenerate_codec
@@ -865,6 +893,20 @@ public CodeGeneratorResponse Clone() {
return new CodeGeneratorResponse(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ error_ = "";
+ supportedFeatures_ = 0UL;
+ minimumEdition_ = 0;
+ maximumEdition_ = 0;
+ file_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "error" field.
public const int ErrorFieldNumber = 1;
private readonly static string ErrorDefaultValue = "";
@@ -1299,6 +1341,20 @@ public File Clone() {
return new File(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ name_ = "";
+ insertionPoint_ = "";
+ content_ = "";
+ if (generatedCodeInfo_ != null) {
+ generatedCodeInfo_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private readonly static string NameDefaultValue = "";
diff --git a/csharp/src/Google.Protobuf/ExtensionSet.cs b/csharp/src/Google.Protobuf/ExtensionSet.cs
index 2fb17c22390db..89be5b2ed2b53 100644
--- a/csharp/src/Google.Protobuf/ExtensionSet.cs
+++ b/csharp/src/Google.Protobuf/ExtensionSet.cs
@@ -399,5 +399,13 @@ internal bool IsInitialized()
{
return ValuesByNumber.Values.All(v => v.IsInitialized());
}
+
+ ///
+ /// Clear this extension set
+ ///
+ public void Clear()
+ {
+ ValuesByNumber.Clear();
+ }
}
}
diff --git a/csharp/src/Google.Protobuf/IMessage.cs b/csharp/src/Google.Protobuf/IMessage.cs
index 2fe0d55ff8070..3e0023db8cedb 100644
--- a/csharp/src/Google.Protobuf/IMessage.cs
+++ b/csharp/src/Google.Protobuf/IMessage.cs
@@ -38,6 +38,11 @@ public interface IMessage
/// to a coded output stream.
int CalculateSize();
+ ///
+ /// Clear current message.
+ ///
+ void Clear();
+
///
/// Descriptor for this message. All instances are expected to return the same descriptor,
/// and for generated types this will be an explicitly-implemented member, returning the
diff --git a/csharp/src/Google.Protobuf/Reflection/Descriptor.pb.cs b/csharp/src/Google.Protobuf/Reflection/Descriptor.pb.cs
index 268de951d4fa6..bc43bd056ea45 100644
--- a/csharp/src/Google.Protobuf/Reflection/Descriptor.pb.cs
+++ b/csharp/src/Google.Protobuf/Reflection/Descriptor.pb.cs
@@ -414,6 +414,18 @@ public FileDescriptorSet Clone() {
return new FileDescriptorSet(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ file_.Clear();
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "file" field.
public const int FileFieldNumber = 1;
private static readonly pb::FieldCodec _repeated_file_codec
@@ -661,6 +673,33 @@ public FileDescriptorProto Clone() {
return new FileDescriptorProto(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ name_ = "";
+ package_ = "";
+ dependency_.Clear();
+ publicDependency_.Clear();
+ weakDependency_.Clear();
+ optionDependency_.Clear();
+ messageType_.Clear();
+ enumType_.Clear();
+ service_.Clear();
+ extension_.Clear();
+ if (options_ != null) {
+ options_.Clear();
+ }
+ if (sourceCodeInfo_ != null) {
+ sourceCodeInfo_.Clear();
+ }
+ syntax_ = "";
+ edition_ = global::Google.Protobuf.Reflection.Edition.Unknown;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private readonly static string NameDefaultValue = "";
@@ -1377,6 +1416,28 @@ public DescriptorProto Clone() {
return new DescriptorProto(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ name_ = "";
+ field_.Clear();
+ extension_.Clear();
+ nestedType_.Clear();
+ enumType_.Clear();
+ extensionRange_.Clear();
+ oneofDecl_.Clear();
+ if (options_ != null) {
+ options_.Clear();
+ }
+ reservedRange_.Clear();
+ reservedName_.Clear();
+ visibility_ = global::Google.Protobuf.Reflection.SymbolVisibility.VisibilityUnset;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private readonly static string NameDefaultValue = "";
@@ -1899,6 +1960,20 @@ public ExtensionRange Clone() {
return new ExtensionRange(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ start_ = 0;
+ end_ = 0;
+ if (options_ != null) {
+ options_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "start" field.
public const int StartFieldNumber = 1;
private readonly static int StartDefaultValue = 0;
@@ -2222,6 +2297,17 @@ public ReservedRange Clone() {
return new ReservedRange(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ start_ = 0;
+ end_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "start" field.
public const int StartFieldNumber = 1;
private readonly static int StartDefaultValue = 0;
@@ -2505,6 +2591,24 @@ public ExtensionRangeOptions Clone() {
return new ExtensionRangeOptions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ uninterpretedOption_.Clear();
+ declaration_.Clear();
+ if (features_ != null) {
+ features_.Clear();
+ }
+ verification_ = global::Google.Protobuf.Reflection.ExtensionRangeOptions.Types.VerificationState.Unverified;
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "uninterpreted_option" field.
public const int UninterpretedOptionFieldNumber = 999;
private static readonly pb::FieldCodec _repeated_uninterpretedOption_codec
@@ -2891,6 +2995,20 @@ public Declaration Clone() {
return new Declaration(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ number_ = 0;
+ fullName_ = "";
+ type_ = "";
+ reserved_ = false;
+ repeated_ = false;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "number" field.
public const int NumberFieldNumber = 1;
private readonly static int NumberDefaultValue = 0;
@@ -3347,6 +3465,28 @@ public FieldDescriptorProto Clone() {
return new FieldDescriptorProto(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ name_ = "";
+ number_ = 0;
+ label_ = global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label.Optional;
+ type_ = global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type.Double;
+ typeName_ = "";
+ extendee_ = "";
+ defaultValue_ = "";
+ oneofIndex_ = 0;
+ jsonName_ = "";
+ if (options_ != null) {
+ options_.Clear();
+ }
+ proto3Optional_ = false;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private readonly static string NameDefaultValue = "";
@@ -4191,6 +4331,18 @@ public OneofDescriptorProto Clone() {
return new OneofDescriptorProto(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ name_ = "";
+ if (options_ != null) {
+ options_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private readonly static string NameDefaultValue = "";
@@ -4458,6 +4610,23 @@ public EnumDescriptorProto Clone() {
return new EnumDescriptorProto(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ name_ = "";
+ value_.Clear();
+ if (options_ != null) {
+ options_.Clear();
+ }
+ reservedRange_.Clear();
+ reservedName_.Clear();
+ visibility_ = global::Google.Protobuf.Reflection.SymbolVisibility.VisibilityUnset;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private readonly static string NameDefaultValue = "";
@@ -4867,6 +5036,17 @@ public EnumReservedRange Clone() {
return new EnumReservedRange(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ start_ = 0;
+ end_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "start" field.
public const int StartFieldNumber = 1;
private readonly static int StartDefaultValue = 0;
@@ -5149,6 +5329,20 @@ public EnumValueDescriptorProto Clone() {
return new EnumValueDescriptorProto(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ name_ = "";
+ number_ = 0;
+ if (options_ != null) {
+ options_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private readonly static string NameDefaultValue = "";
@@ -5462,6 +5656,19 @@ public ServiceDescriptorProto Clone() {
return new ServiceDescriptorProto(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ name_ = "";
+ method_.Clear();
+ if (options_ != null) {
+ options_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private readonly static string NameDefaultValue = "";
@@ -5754,6 +5961,23 @@ public MethodDescriptorProto Clone() {
return new MethodDescriptorProto(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ name_ = "";
+ inputType_ = "";
+ outputType_ = "";
+ if (options_ != null) {
+ options_.Clear();
+ }
+ clientStreaming_ = false;
+ serverStreaming_ = false;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private readonly static string NameDefaultValue = "";
@@ -6248,6 +6472,41 @@ public FileOptions Clone() {
return new FileOptions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ javaPackage_ = "";
+ javaOuterClassname_ = "";
+ javaMultipleFiles_ = false;
+ javaGenerateEqualsAndHash_ = false;
+ javaStringCheckUtf8_ = false;
+ optimizeFor_ = global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode.Speed;
+ goPackage_ = "";
+ ccGenericServices_ = false;
+ javaGenericServices_ = false;
+ pyGenericServices_ = false;
+ deprecated_ = false;
+ ccEnableArenas_ = true;
+ objcClassPrefix_ = "";
+ csharpNamespace_ = "";
+ swiftPrefix_ = "";
+ phpClassPrefix_ = "";
+ phpNamespace_ = "";
+ phpMetadataNamespace_ = "";
+ rubyPackage_ = "";
+ if (features_ != null) {
+ features_.Clear();
+ }
+ uninterpretedOption_.Clear();
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "java_package" field.
public const int JavaPackageFieldNumber = 1;
private readonly static string JavaPackageDefaultValue = "";
@@ -7628,6 +7887,27 @@ public MessageOptions Clone() {
return new MessageOptions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ messageSetWireFormat_ = false;
+ noStandardDescriptorAccessor_ = false;
+ deprecated_ = false;
+ mapEntry_ = false;
+ deprecatedLegacyJsonFieldConflicts_ = false;
+ if (features_ != null) {
+ features_.Clear();
+ }
+ uninterpretedOption_.Clear();
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "message_set_wire_format" field.
public const int MessageSetWireFormatFieldNumber = 1;
private readonly static bool MessageSetWireFormatDefaultValue = false;
@@ -8253,6 +8533,36 @@ public FieldOptions Clone() {
return new FieldOptions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ ctype_ = global::Google.Protobuf.Reflection.FieldOptions.Types.CType.String;
+ packed_ = false;
+ jstype_ = global::Google.Protobuf.Reflection.FieldOptions.Types.JSType.JsNormal;
+ lazy_ = false;
+ unverifiedLazy_ = false;
+ deprecated_ = false;
+ weak_ = false;
+ debugRedact_ = false;
+ retention_ = global::Google.Protobuf.Reflection.FieldOptions.Types.OptionRetention.RetentionUnknown;
+ targets_.Clear();
+ editionDefaults_.Clear();
+ if (features_ != null) {
+ features_.Clear();
+ }
+ if (featureSupport_ != null) {
+ featureSupport_.Clear();
+ }
+ uninterpretedOption_.Clear();
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "ctype" field.
public const int CtypeFieldNumber = 1;
private readonly static global::Google.Protobuf.Reflection.FieldOptions.Types.CType CtypeDefaultValue = global::Google.Protobuf.Reflection.FieldOptions.Types.CType.String;
@@ -9230,6 +9540,17 @@ public EditionDefault Clone() {
return new EditionDefault(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ edition_ = global::Google.Protobuf.Reflection.Edition.Unknown;
+ value_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "edition" field.
public const int EditionFieldNumber = 3;
private readonly static global::Google.Protobuf.Reflection.Edition EditionDefaultValue = global::Google.Protobuf.Reflection.Edition.Unknown;
@@ -9504,6 +9825,19 @@ public FeatureSupport Clone() {
return new FeatureSupport(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ editionIntroduced_ = global::Google.Protobuf.Reflection.Edition.Unknown;
+ editionDeprecated_ = global::Google.Protobuf.Reflection.Edition.Unknown;
+ deprecationWarning_ = "";
+ editionRemoved_ = global::Google.Protobuf.Reflection.Edition.Unknown;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "edition_introduced" field.
public const int EditionIntroducedFieldNumber = 1;
private readonly static global::Google.Protobuf.Reflection.Edition EditionIntroducedDefaultValue = global::Google.Protobuf.Reflection.Edition.Unknown;
@@ -9896,6 +10230,21 @@ public OneofOptions Clone() {
return new OneofOptions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (features_ != null) {
+ features_.Clear();
+ }
+ uninterpretedOption_.Clear();
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "features" field.
public const int FeaturesFieldNumber = 1;
private global::Google.Protobuf.Reflection.FeatureSet features_;
@@ -10188,6 +10537,25 @@ public EnumOptions Clone() {
return new EnumOptions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ allowAlias_ = false;
+ deprecated_ = false;
+ deprecatedLegacyJsonFieldConflicts_ = false;
+ if (features_ != null) {
+ features_.Clear();
+ }
+ uninterpretedOption_.Clear();
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "allow_alias" field.
public const int AllowAliasFieldNumber = 2;
private readonly static bool AllowAliasDefaultValue = false;
@@ -10654,6 +11022,27 @@ public EnumValueOptions Clone() {
return new EnumValueOptions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ deprecated_ = false;
+ if (features_ != null) {
+ features_.Clear();
+ }
+ debugRedact_ = false;
+ if (featureSupport_ != null) {
+ featureSupport_.Clear();
+ }
+ uninterpretedOption_.Clear();
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "deprecated" field.
public const int DeprecatedFieldNumber = 1;
private readonly static bool DeprecatedDefaultValue = false;
@@ -11105,6 +11494,23 @@ public ServiceOptions Clone() {
return new ServiceOptions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ if (features_ != null) {
+ features_.Clear();
+ }
+ deprecated_ = false;
+ uninterpretedOption_.Clear();
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "features" field.
public const int FeaturesFieldNumber = 34;
private global::Google.Protobuf.Reflection.FeatureSet features_;
@@ -11453,6 +11859,24 @@ public MethodOptions Clone() {
return new MethodOptions(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ deprecated_ = false;
+ idempotencyLevel_ = global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel.IdempotencyUnknown;
+ if (features_ != null) {
+ features_.Clear();
+ }
+ uninterpretedOption_.Clear();
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "deprecated" field.
public const int DeprecatedFieldNumber = 33;
private readonly static bool DeprecatedDefaultValue = false;
@@ -11885,6 +12309,22 @@ public UninterpretedOption Clone() {
return new UninterpretedOption(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ name_.Clear();
+ identifierValue_ = "";
+ positiveIntValue_ = 0UL;
+ negativeIntValue_ = 0L;
+ doubleValue_ = 0D;
+ stringValue_ = pb::ByteString.Empty;
+ aggregateValue_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 2;
private static readonly pb::FieldCodec _repeated_name_codec
@@ -12392,6 +12832,17 @@ public NamePart Clone() {
return new NamePart(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ namePart_ = "";
+ isExtension_ = false;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name_part" field.
public const int NamePart_FieldNumber = 1;
private readonly static string NamePart_DefaultValue = "";
@@ -12680,6 +13131,26 @@ public FeatureSet Clone() {
return new FeatureSet(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ fieldPresence_ = global::Google.Protobuf.Reflection.FeatureSet.Types.FieldPresence.Unknown;
+ enumType_ = global::Google.Protobuf.Reflection.FeatureSet.Types.EnumType.Unknown;
+ repeatedFieldEncoding_ = global::Google.Protobuf.Reflection.FeatureSet.Types.RepeatedFieldEncoding.Unknown;
+ utf8Validation_ = global::Google.Protobuf.Reflection.FeatureSet.Types.Utf8Validation.Unknown;
+ messageEncoding_ = global::Google.Protobuf.Reflection.FeatureSet.Types.MessageEncoding.Unknown;
+ jsonFormat_ = global::Google.Protobuf.Reflection.FeatureSet.Types.JsonFormat.Unknown;
+ enforceNamingStyle_ = global::Google.Protobuf.Reflection.FeatureSet.Types.EnforceNamingStyle.Unknown;
+ defaultSymbolVisibility_ = global::Google.Protobuf.Reflection.FeatureSet.Types.VisibilityFeature.Types.DefaultSymbolVisibility.Unknown;
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "field_presence" field.
public const int FieldPresenceFieldNumber = 1;
private readonly static global::Google.Protobuf.Reflection.FeatureSet.Types.FieldPresence FieldPresenceDefaultValue = global::Google.Protobuf.Reflection.FeatureSet.Types.FieldPresence.Unknown;
@@ -13337,6 +13808,14 @@ public VisibilityFeature Clone() {
return new VisibilityFeature(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@@ -13544,6 +14023,18 @@ public FeatureSetDefaults Clone() {
return new FeatureSetDefaults(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ defaults_.Clear();
+ minimumEdition_ = global::Google.Protobuf.Reflection.Edition.Unknown;
+ maximumEdition_ = global::Google.Protobuf.Reflection.Edition.Unknown;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "defaults" field.
public const int DefaultsFieldNumber = 1;
private static readonly pb::FieldCodec _repeated_defaults_codec
@@ -13854,6 +14345,22 @@ public FeatureSetEditionDefault Clone() {
return new FeatureSetEditionDefault(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ edition_ = global::Google.Protobuf.Reflection.Edition.Unknown;
+ if (overridableFeatures_ != null) {
+ overridableFeatures_.Clear();
+ }
+ if (fixedFeatures_ != null) {
+ fixedFeatures_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "edition" field.
public const int EditionFieldNumber = 3;
private readonly static global::Google.Protobuf.Reflection.Edition EditionDefaultValue = global::Google.Protobuf.Reflection.Edition.Unknown;
@@ -14175,6 +14682,18 @@ public SourceCodeInfo Clone() {
return new SourceCodeInfo(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ location_.Clear();
+ if (_extensions != null) {
+ _extensions.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "location" field.
public const int LocationFieldNumber = 1;
private static readonly pb::FieldCodec _repeated_location_codec
@@ -14456,6 +14975,19 @@ public Location Clone() {
return new Location(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ path_.Clear();
+ span_.Clear();
+ leadingComments_ = "";
+ trailingComments_ = "";
+ leadingDetachedComments_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "path" field.
public const int PathFieldNumber = 1;
private static readonly pb::FieldCodec _repeated_path_codec
@@ -14888,6 +15420,15 @@ public GeneratedCodeInfo Clone() {
return new GeneratedCodeInfo(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ annotation_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "annotation" field.
public const int AnnotationFieldNumber = 1;
private static readonly pb::FieldCodec _repeated_annotation_codec
@@ -15088,6 +15629,20 @@ public Annotation Clone() {
return new Annotation(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ _hasBits0 = 0;
+ path_.Clear();
+ sourceFile_ = "";
+ begin_ = 0;
+ end_ = 0;
+ semantic_ = global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation.Types.Semantic.None;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "path" field.
public const int PathFieldNumber = 1;
private static readonly pb::FieldCodec _repeated_path_codec
diff --git a/csharp/src/Google.Protobuf/UnknownFieldSet.cs b/csharp/src/Google.Protobuf/UnknownFieldSet.cs
index d0963d257dc69..073fb4ecf5a42 100644
--- a/csharp/src/Google.Protobuf/UnknownFieldSet.cs
+++ b/csharp/src/Google.Protobuf/UnknownFieldSet.cs
@@ -130,6 +130,17 @@ public override int GetHashCode()
return ret;
}
+ ///
+ /// Clear this set
+ ///
+ public void Clear()
+ {
+ fields.Clear();
+
+ lastFieldNumber = 0;
+ lastField = null;
+ }
+
// Optimization: We keep around the last field that was
// modified so that we can efficiently add to it multiple times in a
// row (important when parsing an unknown repeated field).
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Any.pb.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Any.pb.cs
index 39a68e21c4c9c..9ecc68f2b68cb 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Any.pb.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Any.pb.cs
@@ -172,6 +172,16 @@ public Any Clone() {
return new Any(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ typeUrl_ = "";
+ value_ = pb::ByteString.Empty;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "type_url" field.
public const int TypeUrlFieldNumber = 1;
private string typeUrl_ = "";
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Api.pb.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Api.pb.cs
index c8f779a5ce745..fda3049c7b427 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Api.pb.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Api.pb.cs
@@ -115,6 +115,23 @@ public Api Clone() {
return new Api(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ name_ = "";
+ methods_.Clear();
+ options_.Clear();
+ version_ = "";
+ if (sourceContext_ != null) {
+ sourceContext_.Clear();
+ }
+ mixins_.Clear();
+ syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.Proto2;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private string name_ = "";
@@ -555,6 +572,21 @@ public Method Clone() {
return new Method(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ name_ = "";
+ requestTypeUrl_ = "";
+ requestStreaming_ = false;
+ responseTypeUrl_ = "";
+ responseStreaming_ = false;
+ options_.Clear();
+ syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.Proto2;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private string name_ = "";
@@ -1060,6 +1092,16 @@ public Mixin Clone() {
return new Mixin(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ name_ = "";
+ root_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private string name_ = "";
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.pb.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.pb.cs
index 9b36c449c2ce5..34835a30db46e 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.pb.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.pb.cs
@@ -146,6 +146,16 @@ public Duration Clone() {
return new Duration(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ seconds_ = 0L;
+ nanos_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "seconds" field.
public const int SecondsFieldNumber = 1;
private long seconds_;
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.pb.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.pb.cs
index 7ef348ce92aa9..2a39097330f4b 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.pb.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.pb.cs
@@ -92,6 +92,14 @@ public Empty Clone() {
return new Empty(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.pb.cs b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.pb.cs
index 7657eb26af8bb..194d78e7019b1 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.pb.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.pb.cs
@@ -284,6 +284,15 @@ public FieldMask Clone() {
return new FieldMask(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ paths_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "paths" field.
public const int PathsFieldNumber = 1;
private static readonly pb::FieldCodec _repeated_paths_codec
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.pb.cs b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.pb.cs
index 18dc152ab7e8d..cefb399fa1508 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.pb.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.pb.cs
@@ -89,6 +89,15 @@ public SourceContext Clone() {
return new SourceContext(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ fileName_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "file_name" field.
public const int FileNameFieldNumber = 1;
private string fileName_ = "";
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.pb.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.pb.cs
index 51e77721c2c6d..cf9d7088998fe 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.pb.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.pb.cs
@@ -122,6 +122,15 @@ public Struct Clone() {
return new Struct(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ fields_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "fields" field.
public const int FieldsFieldNumber = 1;
private static readonly pbc::MapField.Codec _map_fields_codec
@@ -340,6 +349,16 @@ public Value Clone() {
return new Value(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ kindCase_ = KindOneofCase.None;
+ kind_ = null;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "null_value" field.
public const int NullValueFieldNumber = 1;
///
@@ -855,6 +874,15 @@ public ListValue Clone() {
return new ListValue(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ values_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "values" field.
public const int ValuesFieldNumber = 1;
private static readonly pb::FieldCodec _repeated_values_codec
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.pb.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.pb.cs
index 11fc473e17a28..d78e693a4c800 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.pb.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.pb.cs
@@ -177,6 +177,16 @@ public Timestamp Clone() {
return new Timestamp(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ seconds_ = 0L;
+ nanos_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "seconds" field.
public const int SecondsFieldNumber = 1;
private long seconds_;
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Type.pb.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Type.pb.cs
index 6b8ef85666fc4..33d7289383390 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Type.pb.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Type.pb.cs
@@ -150,6 +150,23 @@ public Type Clone() {
return new Type(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ name_ = "";
+ fields_.Clear();
+ oneofs_.Clear();
+ options_.Clear();
+ if (sourceContext_ != null) {
+ sourceContext_.Clear();
+ }
+ syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.Proto2;
+ edition_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private string name_ = "";
@@ -573,6 +590,24 @@ public Field Clone() {
return new Field(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ kind_ = global::Google.Protobuf.WellKnownTypes.Field.Types.Kind.TypeUnknown;
+ cardinality_ = global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality.Unknown;
+ number_ = 0;
+ name_ = "";
+ typeUrl_ = "";
+ oneofIndex_ = 0;
+ packed_ = false;
+ options_.Clear();
+ jsonName_ = "";
+ defaultValue_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "kind" field.
public const int KindFieldNumber = 1;
private global::Google.Protobuf.WellKnownTypes.Field.Types.Kind kind_ = global::Google.Protobuf.WellKnownTypes.Field.Types.Kind.TypeUnknown;
@@ -1236,6 +1271,22 @@ public Enum Clone() {
return new Enum(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ name_ = "";
+ enumvalue_.Clear();
+ options_.Clear();
+ if (sourceContext_ != null) {
+ sourceContext_.Clear();
+ }
+ syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.Proto2;
+ edition_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private string name_ = "";
@@ -1624,6 +1675,17 @@ public EnumValue Clone() {
return new EnumValue(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ name_ = "";
+ number_ = 0;
+ options_.Clear();
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private string name_ = "";
@@ -1897,6 +1959,18 @@ public Option Clone() {
return new Option(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ name_ = "";
+ if (value_ != null) {
+ value_.Clear();
+ }
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "name" field.
public const int NameFieldNumber = 1;
private string name_ = "";
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.pb.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.pb.cs
index fc2e8647ba902..cf91655ebb0e3 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.pb.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.pb.cs
@@ -106,6 +106,15 @@ public DoubleValue Clone() {
return new DoubleValue(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ value_ = 0D;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "value" field.
public const int ValueFieldNumber = 1;
private double value_;
@@ -315,6 +324,15 @@ public FloatValue Clone() {
return new FloatValue(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ value_ = 0F;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "value" field.
public const int ValueFieldNumber = 1;
private float value_;
@@ -524,6 +542,15 @@ public Int64Value Clone() {
return new Int64Value(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ value_ = 0L;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "value" field.
public const int ValueFieldNumber = 1;
private long value_;
@@ -733,6 +760,15 @@ public UInt64Value Clone() {
return new UInt64Value(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ value_ = 0UL;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "value" field.
public const int ValueFieldNumber = 1;
private ulong value_;
@@ -942,6 +978,15 @@ public Int32Value Clone() {
return new Int32Value(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ value_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "value" field.
public const int ValueFieldNumber = 1;
private int value_;
@@ -1151,6 +1196,15 @@ public UInt32Value Clone() {
return new UInt32Value(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ value_ = 0;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "value" field.
public const int ValueFieldNumber = 1;
private uint value_;
@@ -1360,6 +1414,15 @@ public BoolValue Clone() {
return new BoolValue(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ value_ = false;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "value" field.
public const int ValueFieldNumber = 1;
private bool value_;
@@ -1569,6 +1632,15 @@ public StringValue Clone() {
return new StringValue(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ value_ = "";
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "value" field.
public const int ValueFieldNumber = 1;
private string value_ = "";
@@ -1778,6 +1850,15 @@ public BytesValue Clone() {
return new BytesValue(this);
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void Clear() {
+ value_ = pb::ByteString.Empty;
+ if (_unknownFields != null) {
+ _unknownFields.Clear();
+ }
+ }
+
/// Field number for the "value" field.
public const int ValueFieldNumber = 1;
private pb::ByteString value_ = pb::ByteString.Empty;
diff --git a/src/google/protobuf/compiler/csharp/csharp_field_base.h b/src/google/protobuf/compiler/csharp/csharp_field_base.h
index fd50fe32f42ea..a64160a8dc7a3 100644
--- a/src/google/protobuf/compiler/csharp/csharp_field_base.h
+++ b/src/google/protobuf/compiler/csharp/csharp_field_base.h
@@ -36,6 +36,7 @@ class FieldGeneratorBase : public SourceGeneratorBase {
FieldGeneratorBase& operator=(const FieldGeneratorBase&) = delete;
virtual void GenerateCloningCode(io::Printer* printer) = 0;
+ virtual void GenerateClearCode(io::Printer* printer) = 0;
virtual void GenerateFreezingCode(io::Printer* printer);
virtual void GenerateCodecCode(io::Printer* printer);
virtual void GenerateExtensionCode(io::Printer* printer);
diff --git a/src/google/protobuf/compiler/csharp/csharp_map_field.cc b/src/google/protobuf/compiler/csharp/csharp_map_field.cc
index 71c2857caa2fe..bb6972b485354 100644
--- a/src/google/protobuf/compiler/csharp/csharp_map_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_map_field.cc
@@ -117,6 +117,11 @@ void MapFieldGenerator::GenerateCloningCode(io::Printer* printer) {
"$name$_ = other.$name$_.Clone();\n");
}
+void MapFieldGenerator::GenerateClearCode(io::Printer* printer) {
+ printer->Print(variables_,
+ "$name$_.Clear();\n");
+}
+
void MapFieldGenerator::GenerateFreezingCode(io::Printer* printer) {
}
diff --git a/src/google/protobuf/compiler/csharp/csharp_map_field.h b/src/google/protobuf/compiler/csharp/csharp_map_field.h
index a4abefbb45ce6..123441b96f3ee 100644
--- a/src/google/protobuf/compiler/csharp/csharp_map_field.h
+++ b/src/google/protobuf/compiler/csharp/csharp_map_field.h
@@ -27,6 +27,7 @@ class MapFieldGenerator : public FieldGeneratorBase {
MapFieldGenerator& operator=(const MapFieldGenerator&) = delete;
void GenerateCloningCode(io::Printer* printer) override;
+ void GenerateClearCode(io::Printer* printer) override;
void GenerateFreezingCode(io::Printer* printer) override;
void GenerateMembers(io::Printer* printer) override;
void GenerateMergingCode(io::Printer* printer) override;
diff --git a/src/google/protobuf/compiler/csharp/csharp_message.cc b/src/google/protobuf/compiler/csharp/csharp_message.cc
index c31750afc314a..bc2f947ab07fa 100644
--- a/src/google/protobuf/compiler/csharp/csharp_message.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_message.cc
@@ -188,6 +188,7 @@ void MessageGenerator::Generate(io::Printer* printer) {
"partial void OnConstruction();\n\n");
GenerateCloningCode(printer);
+ GenerateClearCode(printer);
GenerateFreezingCode(printer);
// Fields/properties
@@ -414,6 +415,46 @@ void MessageGenerator::GenerateCloningCode(io::Printer* printer) {
"}\n\n");
}
+void MessageGenerator::GenerateClearCode(io::Printer* printer) {
+ WriteGeneratedCodeAttributes(printer);
+ printer->Print("public void Clear() {\n");
+ printer->Indent();
+ for (int i = 0; i < has_bit_field_count_; i++) {
+ printer->Print("_hasBits$i$ = 0;\n", "i", absl::StrCat(i));
+ }
+ // Clear non-oneof fields first (treating optional proto3 fields as non-oneof)
+ for (int i = 0; i < descriptor_->field_count(); i++) {
+ const FieldDescriptor* field = descriptor_->field(i);
+ if (field->real_containing_oneof()) {
+ continue;
+ }
+ std::unique_ptr generator(
+ CreateFieldGeneratorInternal(descriptor_->field(i)));
+ generator->GenerateClearCode(printer);
+ }
+ // Clear just the right field for each real oneof
+ for (int i = 0; i < descriptor_->real_oneof_decl_count(); i++) {
+ const OneofDescriptor* oneof = descriptor_->oneof_decl(i);
+ printer->Print(
+ "$name$Case_ = $property_name$OneofCase.None;\n"
+ "$name$_ = null;\n",
+ "name", UnderscoresToCamelCase(oneof->name(), false),
+ "property_name", UnderscoresToCamelCase(oneof->name(), true));
+ }
+ // Clear extensions fields
+ if (has_extension_ranges_) {
+ printer->Print("if (_extensions != null) {\n");
+ printer->Print(" _extensions.Clear();\n");
+ printer->Print("}\n");
+ }
+ // Clear unknown fields
+ printer->Print("if (_unknownFields != null) {\n");
+ printer->Print(" _unknownFields.Clear();\n");
+ printer->Print("}\n");
+ printer->Outdent();
+ printer->Print("}\n\n");
+}
+
void MessageGenerator::GenerateFreezingCode(io::Printer* printer) {}
void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) {
diff --git a/src/google/protobuf/compiler/csharp/csharp_message.h b/src/google/protobuf/compiler/csharp/csharp_message.h
index b2bb158f8c4fe..e41d74f62e313 100644
--- a/src/google/protobuf/compiler/csharp/csharp_message.h
+++ b/src/google/protobuf/compiler/csharp/csharp_message.h
@@ -31,6 +31,7 @@ class MessageGenerator : public SourceGeneratorBase {
MessageGenerator& operator=(const MessageGenerator&) = delete;
void GenerateCloningCode(io::Printer* printer);
+ void GenerateClearCode(io::Printer* printer);
void GenerateFreezingCode(io::Printer* printer);
void GenerateFrameworkMethods(io::Printer* printer);
void Generate(io::Printer* printer);
diff --git a/src/google/protobuf/compiler/csharp/csharp_message_field.cc b/src/google/protobuf/compiler/csharp/csharp_message_field.cc
index 165118b969f44..a93ae09507d99 100644
--- a/src/google/protobuf/compiler/csharp/csharp_message_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_message_field.cc
@@ -162,6 +162,13 @@ void MessageFieldGenerator::GenerateCloningCode(io::Printer* printer) {
"$name$_ = other.$has_property_check$ ? other.$name$_.Clone() : null;\n");
}
+void MessageFieldGenerator::GenerateClearCode(io::Printer* printer) {
+ printer->Print(variables_,
+ "if ($name$_ != null) {\n"
+ " $name$_.Clear();\n"
+ "}\n");
+}
+
void MessageFieldGenerator::GenerateFreezingCode(io::Printer* printer) {
}
@@ -260,6 +267,10 @@ void MessageOneofFieldGenerator::GenerateCloningCode(io::Printer* printer) {
"$property_name$ = other.$property_name$.Clone();\n");
}
+void MessageOneofFieldGenerator::GenerateClearCode(io::Printer* printer) {
+ // No-Op: Message fields in oneofs are correctly cleared by clearing the oneof
+}
+
} // namespace csharp
} // namespace compiler
} // namespace protobuf
diff --git a/src/google/protobuf/compiler/csharp/csharp_message_field.h b/src/google/protobuf/compiler/csharp/csharp_message_field.h
index 4d1c4640cddeb..565b151166c08 100644
--- a/src/google/protobuf/compiler/csharp/csharp_message_field.h
+++ b/src/google/protobuf/compiler/csharp/csharp_message_field.h
@@ -28,6 +28,7 @@ class MessageFieldGenerator : public FieldGeneratorBase {
void GenerateCodecCode(io::Printer* printer) override;
void GenerateCloningCode(io::Printer* printer) override;
+ void GenerateClearCode(io::Printer* printer) override;
void GenerateFreezingCode(io::Printer* printer) override;
void GenerateMembers(io::Printer* printer) override;
void GenerateMergingCode(io::Printer* printer) override;
@@ -53,6 +54,7 @@ class MessageOneofFieldGenerator : public MessageFieldGenerator {
delete;
void GenerateCloningCode(io::Printer* printer) override;
+ void GenerateClearCode(io::Printer* printer) override;
void GenerateMembers(io::Printer* printer) override;
void GenerateMergingCode(io::Printer* printer) override;
void WriteToString(io::Printer* printer) override;
diff --git a/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc b/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
index 6584bd1804e45..9c288b67d6fb7 100644
--- a/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
@@ -232,6 +232,11 @@ void PrimitiveFieldGenerator::GenerateCloningCode(io::Printer* printer) {
"$name$_ = other.$name$_;\n");
}
+void PrimitiveFieldGenerator::GenerateClearCode(io::Printer* printer) {
+ printer->Print(variables_,
+ "$name$_ = $default_value$;\n");
+}
+
void PrimitiveFieldGenerator::GenerateCodecCode(io::Printer* printer) {
printer->Print(
variables_,
@@ -324,6 +329,10 @@ void PrimitiveOneofFieldGenerator::GenerateCloningCode(io::Printer* printer) {
"$property_name$ = other.$property_name$;\n");
}
+void PrimitiveOneofFieldGenerator::GenerateClearCode(io::Printer* printer) {
+ // No-Op: Primitive fields in oneofs are correctly cleared by clearing the oneof
+}
+
} // namespace csharp
} // namespace compiler
} // namespace protobuf
diff --git a/src/google/protobuf/compiler/csharp/csharp_primitive_field.h b/src/google/protobuf/compiler/csharp/csharp_primitive_field.h
index e4e5b2681606d..185850fb528fd 100644
--- a/src/google/protobuf/compiler/csharp/csharp_primitive_field.h
+++ b/src/google/protobuf/compiler/csharp/csharp_primitive_field.h
@@ -30,6 +30,7 @@ class PrimitiveFieldGenerator : public FieldGeneratorBase {
void GenerateCodecCode(io::Printer* printer) override;
void GenerateCloningCode(io::Printer* printer) override;
+ void GenerateClearCode(io::Printer* printer) override;
void GenerateMembers(io::Printer* printer) override;
void GenerateMergingCode(io::Printer* printer) override;
void GenerateParsingCode(io::Printer* printer) override;
@@ -57,6 +58,7 @@ class PrimitiveOneofFieldGenerator : public PrimitiveFieldGenerator {
delete;
void GenerateCloningCode(io::Printer* printer) override;
+ void GenerateClearCode(io::Printer* printer) override;
void GenerateMembers(io::Printer* printer) override;
void GenerateMergingCode(io::Printer* printer) override;
void WriteToString(io::Printer* printer) override;
diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
index 874dfda3e2a4b..05e9595182489 100644
--- a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
@@ -106,6 +106,11 @@ void RepeatedEnumFieldGenerator::GenerateCloningCode(io::Printer* printer) {
"$name$_ = other.$name$_.Clone();\n");
}
+void RepeatedEnumFieldGenerator::GenerateClearCode(io::Printer* printer) {
+ printer->Print(variables_,
+ "$name$_.Clear();\n");
+}
+
void RepeatedEnumFieldGenerator::GenerateExtensionCode(io::Printer* printer) {
WritePropertyDocComment(printer, options(), descriptor_);
AddDeprecatedFlag(printer);
diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h
index 5058fe5f3e290..33c99125a535d 100644
--- a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h
+++ b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h
@@ -30,6 +30,7 @@ class RepeatedEnumFieldGenerator : public FieldGeneratorBase {
delete;
void GenerateCloningCode(io::Printer* printer) override;
+ void GenerateClearCode(io::Printer* printer) override;
void GenerateFreezingCode(io::Printer* printer) override;
void GenerateMembers(io::Printer* printer) override;
void GenerateMergingCode(io::Printer* printer) override;
diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
index 3025403a66ad8..936f5a78ceac1 100644
--- a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
@@ -123,6 +123,11 @@ void RepeatedMessageFieldGenerator::GenerateCloningCode(io::Printer* printer) {
"$name$_ = other.$name$_.Clone();\n");
}
+void RepeatedMessageFieldGenerator::GenerateClearCode(io::Printer* printer) {
+ printer->Print(variables_,
+ "$name$_.Clear();\n");
+}
+
void RepeatedMessageFieldGenerator::GenerateFreezingCode(io::Printer* printer) {
}
diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h
index c0ca1cf253ac4..0e009e02891f1 100644
--- a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h
+++ b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h
@@ -30,6 +30,7 @@ class RepeatedMessageFieldGenerator : public FieldGeneratorBase {
const RepeatedMessageFieldGenerator&) = delete;
void GenerateCloningCode(io::Printer* printer) override;
+ void GenerateClearCode(io::Printer* printer) override;
void GenerateFreezingCode(io::Printer* printer) override;
void GenerateMembers(io::Printer* printer) override;
void GenerateMergingCode(io::Printer* printer) override;
diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
index 0622c2ca46db3..67064a0a694cf 100644
--- a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
@@ -104,6 +104,11 @@ void RepeatedPrimitiveFieldGenerator::GenerateCloningCode(io::Printer* printer)
"$name$_ = other.$name$_.Clone();\n");
}
+void RepeatedPrimitiveFieldGenerator::GenerateClearCode(io::Printer* printer) {
+ printer->Print(variables_,
+ "$name$_.Clear();\n");
+}
+
void RepeatedPrimitiveFieldGenerator::GenerateFreezingCode(io::Printer* printer) {
}
diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h
index c4e9295c752b6..3b7ddc11be54a 100644
--- a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h
+++ b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h
@@ -26,6 +26,7 @@ class RepeatedPrimitiveFieldGenerator : public FieldGeneratorBase {
RepeatedPrimitiveFieldGenerator& operator=(const RepeatedPrimitiveFieldGenerator&) = delete;
void GenerateCloningCode(io::Printer* printer) override;
+ void GenerateClearCode(io::Printer* printer) override;
void GenerateFreezingCode(io::Printer* printer) override;
void GenerateMembers(io::Printer* printer) override;
void GenerateMergingCode(io::Printer* printer) override;
diff --git a/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc b/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
index 617887de5d8f7..86b02c4195e53 100644
--- a/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
@@ -163,6 +163,11 @@ void WrapperFieldGenerator::GenerateCloningCode(io::Printer* printer) {
"$property_name$ = other.$property_name$;\n");
}
+void WrapperFieldGenerator::GenerateClearCode(io::Printer* printer) {
+ printer->Print(variables_,
+ "$name$_ = $default_value$;\n");
+}
+
void WrapperFieldGenerator::GenerateCodecCode(io::Printer* printer) {
if (is_value_type) {
printer->Print(
diff --git a/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h b/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h
index b3223e24a7bdb..4756aab55b29d 100644
--- a/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h
+++ b/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h
@@ -30,6 +30,7 @@ class WrapperFieldGenerator : public FieldGeneratorBase {
void GenerateCodecCode(io::Printer* printer) override;
void GenerateCloningCode(io::Printer* printer) override;
+ void GenerateClearCode(io::Printer* printer) override;
void GenerateMembers(io::Printer* printer) override;
void GenerateMergingCode(io::Printer* printer) override;
void GenerateParsingCode(io::Printer* printer) override;