diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs index 1ba1275fb6fc..ca2888473b39 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs @@ -290,13 +290,13 @@ public sealed partial class TestAllTypesProto2 : pb::IExtendableMessageGets whether the optional_nested_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptionalNestedMessage { - get { return optionalNestedMessage_ != null; } - } - /// Clears the value of the optional_nested_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptionalNestedMessage() { - optionalNestedMessage_ = null; - } /// Field number for the "optional_foreign_message" field. public const int OptionalForeignMessageFieldNumber = 19; @@ -815,16 +805,6 @@ public sealed partial class TestAllTypesProto2 : pb::IExtendableMessageGets whether the optional_foreign_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptionalForeignMessage { - get { return optionalForeignMessage_ != null; } - } - /// Clears the value of the optional_foreign_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptionalForeignMessage() { - optionalForeignMessage_ = null; - } /// Field number for the "optional_nested_enum" field. public const int OptionalNestedEnumFieldNumber = 21; @@ -930,16 +910,6 @@ public sealed partial class TestAllTypesProto2 : pb::IExtendableMessageGets whether the recursive_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasRecursiveMessage { - get { return recursiveMessage_ != null; } - } - /// Clears the value of the recursive_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearRecursiveMessage() { - recursiveMessage_ = null; - } /// Field number for the "repeated_int32" field. public const int RepeatedInt32FieldNumber = 31; @@ -1660,24 +1630,12 @@ public sealed partial class TestAllTypesProto2 : pb::IExtendableMessageGets whether the "oneof_nested_message" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOneofNestedMessage { - get { return oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage; } - } - /// Clears the value of the oneof if it's currently set to "oneof_nested_message" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOneofNestedMessage() { - if (HasOneofNestedMessage) { - ClearOneofField(); - } - } /// Field number for the "oneof_string" field. public const int OneofStringFieldNumber = 113; @@ -2479,13 +2437,13 @@ public enum OneofFieldOneofCase { if (HasOptionalBool) hash ^= OptionalBool.GetHashCode(); if (HasOptionalString) hash ^= OptionalString.GetHashCode(); if (HasOptionalBytes) hash ^= OptionalBytes.GetHashCode(); - if (HasOptionalNestedMessage) hash ^= OptionalNestedMessage.GetHashCode(); - if (HasOptionalForeignMessage) hash ^= OptionalForeignMessage.GetHashCode(); + if (optionalNestedMessage_ != null) hash ^= OptionalNestedMessage.GetHashCode(); + if (optionalForeignMessage_ != null) hash ^= OptionalForeignMessage.GetHashCode(); if (HasOptionalNestedEnum) hash ^= OptionalNestedEnum.GetHashCode(); if (HasOptionalForeignEnum) hash ^= OptionalForeignEnum.GetHashCode(); if (HasOptionalStringPiece) hash ^= OptionalStringPiece.GetHashCode(); if (HasOptionalCord) hash ^= OptionalCord.GetHashCode(); - if (HasRecursiveMessage) hash ^= RecursiveMessage.GetHashCode(); + if (recursiveMessage_ != null) hash ^= RecursiveMessage.GetHashCode(); hash ^= repeatedInt32_.GetHashCode(); hash ^= repeatedInt64_.GetHashCode(); hash ^= repeatedUint32_.GetHashCode(); @@ -2555,7 +2513,7 @@ public enum OneofFieldOneofCase { hash ^= MapStringNestedEnum.GetHashCode(); hash ^= MapStringForeignEnum.GetHashCode(); if (HasOneofUint32) hash ^= OneofUint32.GetHashCode(); - if (HasOneofNestedMessage) hash ^= OneofNestedMessage.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) hash ^= OneofNestedMessage.GetHashCode(); if (HasOneofString) hash ^= OneofString.GetHashCode(); if (HasOneofBytes) hash ^= OneofBytes.GetHashCode(); if (HasOneofBool) hash ^= OneofBool.GetHashCode(); @@ -2659,11 +2617,11 @@ public enum OneofFieldOneofCase { output.WriteRawTag(122); output.WriteBytes(OptionalBytes); } - if (HasOptionalNestedMessage) { + if (optionalNestedMessage_ != null) { output.WriteRawTag(146, 1); output.WriteMessage(OptionalNestedMessage); } - if (HasOptionalForeignMessage) { + if (optionalForeignMessage_ != null) { output.WriteRawTag(154, 1); output.WriteMessage(OptionalForeignMessage); } @@ -2683,7 +2641,7 @@ public enum OneofFieldOneofCase { output.WriteRawTag(202, 1); output.WriteString(OptionalCord); } - if (HasRecursiveMessage) { + if (recursiveMessage_ != null) { output.WriteRawTag(218, 1); output.WriteMessage(RecursiveMessage); } @@ -2759,7 +2717,7 @@ public enum OneofFieldOneofCase { output.WriteRawTag(248, 6); output.WriteUInt32(OneofUint32); } - if (HasOneofNestedMessage) { + if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) { output.WriteRawTag(130, 7); output.WriteMessage(OneofNestedMessage); } @@ -2924,10 +2882,10 @@ public enum OneofFieldOneofCase { if (HasOptionalBytes) { size += 1 + pb::CodedOutputStream.ComputeBytesSize(OptionalBytes); } - if (HasOptionalNestedMessage) { + if (optionalNestedMessage_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalNestedMessage); } - if (HasOptionalForeignMessage) { + if (optionalForeignMessage_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalForeignMessage); } if (HasOptionalNestedEnum) { @@ -2942,7 +2900,7 @@ public enum OneofFieldOneofCase { if (HasOptionalCord) { size += 2 + pb::CodedOutputStream.ComputeStringSize(OptionalCord); } - if (HasRecursiveMessage) { + if (recursiveMessage_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(RecursiveMessage); } size += repeatedInt32_.CalculateSize(_repeated_repeatedInt32_codec); @@ -3016,7 +2974,7 @@ public enum OneofFieldOneofCase { if (HasOneofUint32) { size += 2 + pb::CodedOutputStream.ComputeUInt32Size(OneofUint32); } - if (HasOneofNestedMessage) { + if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(OneofNestedMessage); } if (HasOneofString) { @@ -3156,14 +3114,14 @@ public enum OneofFieldOneofCase { if (other.HasOptionalBytes) { OptionalBytes = other.OptionalBytes; } - if (other.HasOptionalNestedMessage) { - if (!HasOptionalNestedMessage) { + if (other.optionalNestedMessage_ != null) { + if (optionalNestedMessage_ == null) { OptionalNestedMessage = new global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedMessage(); } OptionalNestedMessage.MergeFrom(other.OptionalNestedMessage); } - if (other.HasOptionalForeignMessage) { - if (!HasOptionalForeignMessage) { + if (other.optionalForeignMessage_ != null) { + if (optionalForeignMessage_ == null) { OptionalForeignMessage = new global::ProtobufTestMessages.Proto2.ForeignMessageProto2(); } OptionalForeignMessage.MergeFrom(other.OptionalForeignMessage); @@ -3180,8 +3138,8 @@ public enum OneofFieldOneofCase { if (other.HasOptionalCord) { OptionalCord = other.OptionalCord; } - if (other.HasRecursiveMessage) { - if (!HasRecursiveMessage) { + if (other.recursiveMessage_ != null) { + if (recursiveMessage_ == null) { RecursiveMessage = new global::ProtobufTestMessages.Proto2.TestAllTypesProto2(); } RecursiveMessage.MergeFrom(other.RecursiveMessage); @@ -3422,14 +3380,14 @@ public enum OneofFieldOneofCase { break; } case 146: { - if (!HasOptionalNestedMessage) { + if (optionalNestedMessage_ == null) { OptionalNestedMessage = new global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedMessage(); } input.ReadMessage(OptionalNestedMessage); break; } case 154: { - if (!HasOptionalForeignMessage) { + if (optionalForeignMessage_ == null) { OptionalForeignMessage = new global::ProtobufTestMessages.Proto2.ForeignMessageProto2(); } input.ReadMessage(OptionalForeignMessage); @@ -3452,7 +3410,7 @@ public enum OneofFieldOneofCase { break; } case 218: { - if (!HasRecursiveMessage) { + if (recursiveMessage_ == null) { RecursiveMessage = new global::ProtobufTestMessages.Proto2.TestAllTypesProto2(); } input.ReadMessage(RecursiveMessage); @@ -3779,7 +3737,7 @@ public enum OneofFieldOneofCase { } case 898: { global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedMessage subBuilder = new global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedMessage(); - if (HasOneofNestedMessage) { + if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) { subBuilder.MergeFrom(OneofNestedMessage); } input.ReadMessage(subBuilder); @@ -3962,7 +3920,7 @@ public sealed partial class NestedMessage : pb::IMessage { public NestedMessage(NestedMessage other) : this() { _hasBits0 = other._hasBits0; a_ = other.a_; - corecursive_ = other.HasCorecursive ? other.corecursive_.Clone() : null; + corecursive_ = other.corecursive_ != null ? other.corecursive_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -4005,16 +3963,6 @@ public sealed partial class NestedMessage : pb::IMessage { corecursive_ = value; } } - /// Gets whether the corecursive field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasCorecursive { - get { return corecursive_ != null; } - } - /// Clears the value of the corecursive field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearCorecursive() { - corecursive_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -4038,7 +3986,7 @@ public sealed partial class NestedMessage : pb::IMessage { public override int GetHashCode() { int hash = 1; if (HasA) hash ^= A.GetHashCode(); - if (HasCorecursive) hash ^= Corecursive.GetHashCode(); + if (corecursive_ != null) hash ^= Corecursive.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -4056,7 +4004,7 @@ public sealed partial class NestedMessage : pb::IMessage { output.WriteRawTag(8); output.WriteInt32(A); } - if (HasCorecursive) { + if (corecursive_ != null) { output.WriteRawTag(18); output.WriteMessage(Corecursive); } @@ -4071,7 +4019,7 @@ public sealed partial class NestedMessage : pb::IMessage { if (HasA) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(A); } - if (HasCorecursive) { + if (corecursive_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Corecursive); } if (_unknownFields != null) { @@ -4088,8 +4036,8 @@ public sealed partial class NestedMessage : pb::IMessage { if (other.HasA) { A = other.A; } - if (other.HasCorecursive) { - if (!HasCorecursive) { + if (other.corecursive_ != null) { + if (corecursive_ == null) { Corecursive = new global::ProtobufTestMessages.Proto2.TestAllTypesProto2(); } Corecursive.MergeFrom(other.Corecursive); @@ -4110,7 +4058,7 @@ public sealed partial class NestedMessage : pb::IMessage { break; } case 18: { - if (!HasCorecursive) { + if (corecursive_ == null) { Corecursive = new global::ProtobufTestMessages.Proto2.TestAllTypesProto2(); } input.ReadMessage(Corecursive); @@ -4937,7 +4885,7 @@ public sealed partial class UnknownToTestAllTypes : pb::IMessageGets whether the nested_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasNestedMessage { - get { return nestedMessage_ != null; } - } - /// Clears the value of the nested_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearNestedMessage() { - nestedMessage_ = null; - } /// Field number for the "optionalgroup" field. public const int OptionalGroupFieldNumber = 1004; @@ -5099,7 +5037,7 @@ public sealed partial class UnknownToTestAllTypes : pb::IMessage { optionalString_ = other.optionalString_; optionalBytes_ = other.optionalBytes_; optionalGroup_ = other.HasOptionalGroup ? other.optionalGroup_.Clone() : null; - optionalNestedMessage_ = other.HasOptionalNestedMessage ? other.optionalNestedMessage_.Clone() : null; - optionalForeignMessage_ = other.HasOptionalForeignMessage ? other.optionalForeignMessage_.Clone() : null; - optionalImportMessage_ = other.HasOptionalImportMessage ? other.optionalImportMessage_.Clone() : null; + optionalNestedMessage_ = other.optionalNestedMessage_ != null ? other.optionalNestedMessage_.Clone() : null; + optionalForeignMessage_ = other.optionalForeignMessage_ != null ? other.optionalForeignMessage_.Clone() : null; + optionalImportMessage_ = other.optionalImportMessage_ != null ? other.optionalImportMessage_.Clone() : null; optionalNestedEnum_ = other.optionalNestedEnum_; optionalForeignEnum_ = other.optionalForeignEnum_; optionalImportEnum_ = other.optionalImportEnum_; optionalStringPiece_ = other.optionalStringPiece_; optionalCord_ = other.optionalCord_; - optionalPublicImportMessage_ = other.HasOptionalPublicImportMessage ? other.optionalPublicImportMessage_.Clone() : null; - optionalLazyMessage_ = other.HasOptionalLazyMessage ? other.optionalLazyMessage_.Clone() : null; + optionalPublicImportMessage_ = other.optionalPublicImportMessage_ != null ? other.optionalPublicImportMessage_.Clone() : null; + optionalLazyMessage_ = other.optionalLazyMessage_ != null ? other.optionalLazyMessage_.Clone() : null; repeatedInt32_ = other.repeatedInt32_.Clone(); repeatedInt64_ = other.repeatedInt64_.Clone(); repeatedUint32_ = other.repeatedUint32_.Clone(); @@ -1635,16 +1635,6 @@ public sealed partial class TestAllTypes : pb::IMessage { optionalNestedMessage_ = value; } } - /// Gets whether the optional_nested_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptionalNestedMessage { - get { return optionalNestedMessage_ != null; } - } - /// Clears the value of the optional_nested_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptionalNestedMessage() { - optionalNestedMessage_ = null; - } /// Field number for the "optional_foreign_message" field. public const int OptionalForeignMessageFieldNumber = 19; @@ -1656,16 +1646,6 @@ public sealed partial class TestAllTypes : pb::IMessage { optionalForeignMessage_ = value; } } - /// Gets whether the optional_foreign_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptionalForeignMessage { - get { return optionalForeignMessage_ != null; } - } - /// Clears the value of the optional_foreign_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptionalForeignMessage() { - optionalForeignMessage_ = null; - } /// Field number for the "optional_import_message" field. public const int OptionalImportMessageFieldNumber = 20; @@ -1677,16 +1657,6 @@ public sealed partial class TestAllTypes : pb::IMessage { optionalImportMessage_ = value; } } - /// Gets whether the optional_import_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptionalImportMessage { - get { return optionalImportMessage_ != null; } - } - /// Clears the value of the optional_import_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptionalImportMessage() { - optionalImportMessage_ = null; - } /// Field number for the "optional_nested_enum" field. public const int OptionalNestedEnumFieldNumber = 21; @@ -1819,16 +1789,6 @@ public sealed partial class TestAllTypes : pb::IMessage { optionalPublicImportMessage_ = value; } } - /// Gets whether the optional_public_import_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptionalPublicImportMessage { - get { return optionalPublicImportMessage_ != null; } - } - /// Clears the value of the optional_public_import_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptionalPublicImportMessage() { - optionalPublicImportMessage_ = null; - } /// Field number for the "optional_lazy_message" field. public const int OptionalLazyMessageFieldNumber = 27; @@ -1840,16 +1800,6 @@ public sealed partial class TestAllTypes : pb::IMessage { optionalLazyMessage_ = value; } } - /// Gets whether the optional_lazy_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptionalLazyMessage { - get { return optionalLazyMessage_ != null; } - } - /// Clears the value of the optional_lazy_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptionalLazyMessage() { - optionalLazyMessage_ = null; - } /// Field number for the "repeated_int32" field. public const int RepeatedInt32FieldNumber = 31; @@ -2610,24 +2560,12 @@ public sealed partial class TestAllTypes : pb::IMessage { public const int OneofNestedMessageFieldNumber = 112; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage OneofNestedMessage { - get { return HasOneofNestedMessage ? (global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage) oneofField_ : null; } + get { return oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage ? (global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage) oneofField_ : null; } set { oneofField_ = value; oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.OneofNestedMessage; } } - /// Gets whether the "oneof_nested_message" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOneofNestedMessage { - get { return oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage; } - } - /// Clears the value of the oneof if it's currently set to "oneof_nested_message" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOneofNestedMessage() { - if (HasOneofNestedMessage) { - ClearOneofField(); - } - } /// Field number for the "oneof_string" field. public const int OneofStringFieldNumber = 113; @@ -2807,16 +2745,16 @@ public enum OneofFieldOneofCase { if (HasOptionalString) hash ^= OptionalString.GetHashCode(); if (HasOptionalBytes) hash ^= OptionalBytes.GetHashCode(); if (HasOptionalGroup) hash ^= OptionalGroup.GetHashCode(); - if (HasOptionalNestedMessage) hash ^= OptionalNestedMessage.GetHashCode(); - if (HasOptionalForeignMessage) hash ^= OptionalForeignMessage.GetHashCode(); - if (HasOptionalImportMessage) hash ^= OptionalImportMessage.GetHashCode(); + if (optionalNestedMessage_ != null) hash ^= OptionalNestedMessage.GetHashCode(); + if (optionalForeignMessage_ != null) hash ^= OptionalForeignMessage.GetHashCode(); + if (optionalImportMessage_ != null) hash ^= OptionalImportMessage.GetHashCode(); if (HasOptionalNestedEnum) hash ^= OptionalNestedEnum.GetHashCode(); if (HasOptionalForeignEnum) hash ^= OptionalForeignEnum.GetHashCode(); if (HasOptionalImportEnum) hash ^= OptionalImportEnum.GetHashCode(); if (HasOptionalStringPiece) hash ^= OptionalStringPiece.GetHashCode(); if (HasOptionalCord) hash ^= OptionalCord.GetHashCode(); - if (HasOptionalPublicImportMessage) hash ^= OptionalPublicImportMessage.GetHashCode(); - if (HasOptionalLazyMessage) hash ^= OptionalLazyMessage.GetHashCode(); + if (optionalPublicImportMessage_ != null) hash ^= OptionalPublicImportMessage.GetHashCode(); + if (optionalLazyMessage_ != null) hash ^= OptionalLazyMessage.GetHashCode(); hash ^= repeatedInt32_.GetHashCode(); hash ^= repeatedInt64_.GetHashCode(); hash ^= repeatedUint32_.GetHashCode(); @@ -2863,7 +2801,7 @@ public enum OneofFieldOneofCase { if (HasDefaultStringPiece) hash ^= DefaultStringPiece.GetHashCode(); if (HasDefaultCord) hash ^= DefaultCord.GetHashCode(); if (HasOneofUint32) hash ^= OneofUint32.GetHashCode(); - if (HasOneofNestedMessage) hash ^= OneofNestedMessage.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) hash ^= OneofNestedMessage.GetHashCode(); if (HasOneofString) hash ^= OneofString.GetHashCode(); if (HasOneofBytes) hash ^= OneofBytes.GetHashCode(); hash ^= (int) oneofFieldCase_; @@ -2945,15 +2883,15 @@ public enum OneofFieldOneofCase { output.WriteGroup(OptionalGroup); output.WriteRawTag(132, 1); } - if (HasOptionalNestedMessage) { + if (optionalNestedMessage_ != null) { output.WriteRawTag(146, 1); output.WriteMessage(OptionalNestedMessage); } - if (HasOptionalForeignMessage) { + if (optionalForeignMessage_ != null) { output.WriteRawTag(154, 1); output.WriteMessage(OptionalForeignMessage); } - if (HasOptionalImportMessage) { + if (optionalImportMessage_ != null) { output.WriteRawTag(162, 1); output.WriteMessage(OptionalImportMessage); } @@ -2977,11 +2915,11 @@ public enum OneofFieldOneofCase { output.WriteRawTag(202, 1); output.WriteString(OptionalCord); } - if (HasOptionalPublicImportMessage) { + if (optionalPublicImportMessage_ != null) { output.WriteRawTag(210, 1); output.WriteMessage(OptionalPublicImportMessage); } - if (HasOptionalLazyMessage) { + if (optionalLazyMessage_ != null) { output.WriteRawTag(218, 1); output.WriteMessage(OptionalLazyMessage); } @@ -3094,7 +3032,7 @@ public enum OneofFieldOneofCase { output.WriteRawTag(248, 6); output.WriteUInt32(OneofUint32); } - if (HasOneofNestedMessage) { + if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) { output.WriteRawTag(130, 7); output.WriteMessage(OneofNestedMessage); } @@ -3162,13 +3100,13 @@ public enum OneofFieldOneofCase { if (HasOptionalGroup) { size += 4 + pb::CodedOutputStream.ComputeGroupSize(OptionalGroup); } - if (HasOptionalNestedMessage) { + if (optionalNestedMessage_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalNestedMessage); } - if (HasOptionalForeignMessage) { + if (optionalForeignMessage_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalForeignMessage); } - if (HasOptionalImportMessage) { + if (optionalImportMessage_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalImportMessage); } if (HasOptionalNestedEnum) { @@ -3186,10 +3124,10 @@ public enum OneofFieldOneofCase { if (HasOptionalCord) { size += 2 + pb::CodedOutputStream.ComputeStringSize(OptionalCord); } - if (HasOptionalPublicImportMessage) { + if (optionalPublicImportMessage_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalPublicImportMessage); } - if (HasOptionalLazyMessage) { + if (optionalLazyMessage_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalLazyMessage); } size += repeatedInt32_.CalculateSize(_repeated_repeatedInt32_codec); @@ -3280,7 +3218,7 @@ public enum OneofFieldOneofCase { if (HasOneofUint32) { size += 2 + pb::CodedOutputStream.ComputeUInt32Size(OneofUint32); } - if (HasOneofNestedMessage) { + if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(OneofNestedMessage); } if (HasOneofString) { @@ -3351,20 +3289,20 @@ public enum OneofFieldOneofCase { } OptionalGroup.MergeFrom(other.OptionalGroup); } - if (other.HasOptionalNestedMessage) { - if (!HasOptionalNestedMessage) { + if (other.optionalNestedMessage_ != null) { + if (optionalNestedMessage_ == null) { OptionalNestedMessage = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage(); } OptionalNestedMessage.MergeFrom(other.OptionalNestedMessage); } - if (other.HasOptionalForeignMessage) { - if (!HasOptionalForeignMessage) { + if (other.optionalForeignMessage_ != null) { + if (optionalForeignMessage_ == null) { OptionalForeignMessage = new global::Google.Protobuf.TestProtos.Proto2.ForeignMessage(); } OptionalForeignMessage.MergeFrom(other.OptionalForeignMessage); } - if (other.HasOptionalImportMessage) { - if (!HasOptionalImportMessage) { + if (other.optionalImportMessage_ != null) { + if (optionalImportMessage_ == null) { OptionalImportMessage = new global::Google.Protobuf.TestProtos.Proto2.ImportMessage(); } OptionalImportMessage.MergeFrom(other.OptionalImportMessage); @@ -3384,14 +3322,14 @@ public enum OneofFieldOneofCase { if (other.HasOptionalCord) { OptionalCord = other.OptionalCord; } - if (other.HasOptionalPublicImportMessage) { - if (!HasOptionalPublicImportMessage) { + if (other.optionalPublicImportMessage_ != null) { + if (optionalPublicImportMessage_ == null) { OptionalPublicImportMessage = new global::Google.Protobuf.TestProtos.Proto2.PublicImportMessage(); } OptionalPublicImportMessage.MergeFrom(other.OptionalPublicImportMessage); } - if (other.HasOptionalLazyMessage) { - if (!HasOptionalLazyMessage) { + if (other.optionalLazyMessage_ != null) { + if (optionalLazyMessage_ == null) { OptionalLazyMessage = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage(); } OptionalLazyMessage.MergeFrom(other.OptionalLazyMessage); @@ -3578,21 +3516,21 @@ public enum OneofFieldOneofCase { break; } case 146: { - if (!HasOptionalNestedMessage) { + if (optionalNestedMessage_ == null) { OptionalNestedMessage = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage(); } input.ReadMessage(OptionalNestedMessage); break; } case 154: { - if (!HasOptionalForeignMessage) { + if (optionalForeignMessage_ == null) { OptionalForeignMessage = new global::Google.Protobuf.TestProtos.Proto2.ForeignMessage(); } input.ReadMessage(OptionalForeignMessage); break; } case 162: { - if (!HasOptionalImportMessage) { + if (optionalImportMessage_ == null) { OptionalImportMessage = new global::Google.Protobuf.TestProtos.Proto2.ImportMessage(); } input.ReadMessage(OptionalImportMessage); @@ -3619,14 +3557,14 @@ public enum OneofFieldOneofCase { break; } case 210: { - if (!HasOptionalPublicImportMessage) { + if (optionalPublicImportMessage_ == null) { OptionalPublicImportMessage = new global::Google.Protobuf.TestProtos.Proto2.PublicImportMessage(); } input.ReadMessage(OptionalPublicImportMessage); break; } case 218: { - if (!HasOptionalLazyMessage) { + if (optionalLazyMessage_ == null) { OptionalLazyMessage = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage(); } input.ReadMessage(OptionalLazyMessage); @@ -3834,7 +3772,7 @@ public enum OneofFieldOneofCase { } case 898: { global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage subBuilder = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage(); - if (HasOneofNestedMessage) { + if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) { subBuilder.MergeFrom(OneofNestedMessage); } input.ReadMessage(subBuilder); @@ -4341,8 +4279,8 @@ public sealed partial class NestedTestAllTypes : pb::IMessageGets whether the child field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasChild { - get { return child_ != null; } - } - /// Clears the value of the child field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearChild() { - child_ = null; - } /// Field number for the "payload" field. public const int PayloadFieldNumber = 2; @@ -4383,16 +4311,6 @@ public sealed partial class NestedTestAllTypes : pb::IMessageGets whether the payload field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasPayload { - get { return payload_ != null; } - } - /// Clears the value of the payload field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearPayload() { - payload_ = null; - } /// Field number for the "repeated_child" field. public const int RepeatedChildFieldNumber = 3; @@ -4426,8 +4344,8 @@ public sealed partial class NestedTestAllTypes : pb::IMessageGets whether the optional_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptionalMessage { - get { return optionalMessage_ != null; } - } - /// Clears the value of the optional_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptionalMessage() { - optionalMessage_ = null; - } /// Field number for the "repeated_message" field. public const int RepeatedMessageFieldNumber = 2; @@ -7923,7 +7831,7 @@ public sealed partial class TestRequiredForeign : pb::IMessageGets whether the optional_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptionalMessage { - get { return optionalMessage_ != null; } - } - /// Clears the value of the optional_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptionalMessage() { - optionalMessage_ = null; - } /// Field number for the "repeated_message" field. public const int RepeatedMessageFieldNumber = 2; @@ -8093,16 +7991,6 @@ public sealed partial class TestRequiredMessage : pb::IMessageGets whether the required_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasRequiredMessage { - get { return requiredMessage_ != null; } - } - /// Clears the value of the required_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearRequiredMessage() { - requiredMessage_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -8126,9 +8014,9 @@ public sealed partial class TestRequiredMessage : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestForeignNested(TestForeignNested other) : this() { - foreignNested_ = other.HasForeignNested ? other.foreignNested_.Clone() : null; + foreignNested_ = other.foreignNested_ != null ? other.foreignNested_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -8272,16 +8160,6 @@ public sealed partial class TestForeignNested : pb::IMessage foreignNested_ = value; } } - /// Gets whether the foreign_nested field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasForeignNested { - get { return foreignNested_ != null; } - } - /// Clears the value of the foreign_nested field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearForeignNested() { - foreignNested_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -8303,7 +8181,7 @@ public sealed partial class TestForeignNested : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (HasForeignNested) hash ^= ForeignNested.GetHashCode(); + if (foreignNested_ != null) hash ^= ForeignNested.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -8317,7 +8195,7 @@ public sealed partial class TestForeignNested : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (HasForeignNested) { + if (foreignNested_ != null) { output.WriteRawTag(10); output.WriteMessage(ForeignNested); } @@ -8329,7 +8207,7 @@ public sealed partial class TestForeignNested : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (HasForeignNested) { + if (foreignNested_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(ForeignNested); } if (_unknownFields != null) { @@ -8343,8 +8221,8 @@ public sealed partial class TestForeignNested : pb::IMessage if (other == null) { return; } - if (other.HasForeignNested) { - if (!HasForeignNested) { + if (other.foreignNested_ != null) { + if (foreignNested_ == null) { ForeignNested = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage(); } ForeignNested.MergeFrom(other.ForeignNested); @@ -8361,7 +8239,7 @@ public sealed partial class TestForeignNested : pb::IMessage _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - if (!HasForeignNested) { + if (foreignNested_ == null) { ForeignNested = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes.Types.NestedMessage(); } input.ReadMessage(ForeignNested); @@ -8982,7 +8860,7 @@ public sealed partial class TestRecursiveMessage : pb::IMessageGets whether the a field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasA { - get { return a_ != null; } - } - /// Clears the value of the a field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearA() { - a_ = null; - } /// Field number for the "i" field. public const int IFieldNumber = 2; @@ -9058,7 +8926,7 @@ public sealed partial class TestRecursiveMessage : pb::IMessageGets whether the bb field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasBb { - get { return bb_ != null; } - } - /// Clears the value of the bb field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearBb() { - bb_ = null; - } /// Field number for the "subgroup" field. public const int SubGroupFieldNumber = 2; @@ -9244,7 +9102,7 @@ public sealed partial class TestMutualRecursionA : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SubMessage(SubMessage other) : this() { - b_ = other.HasB ? other.b_.Clone() : null; + b_ = other.b_ != null ? other.b_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -9382,16 +9240,6 @@ public sealed partial class SubMessage : pb::IMessage { b_ = value; } } - /// Gets whether the b field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasB { - get { return b_ != null; } - } - /// Clears the value of the b field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearB() { - b_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -9413,7 +9261,7 @@ public sealed partial class SubMessage : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (HasB) hash ^= B.GetHashCode(); + if (b_ != null) hash ^= B.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -9427,7 +9275,7 @@ public sealed partial class SubMessage : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (HasB) { + if (b_ != null) { output.WriteRawTag(10); output.WriteMessage(B); } @@ -9439,7 +9287,7 @@ public sealed partial class SubMessage : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (HasB) { + if (b_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(B); } if (_unknownFields != null) { @@ -9453,8 +9301,8 @@ public sealed partial class SubMessage : pb::IMessage { if (other == null) { return; } - if (other.HasB) { - if (!HasB) { + if (other.b_ != null) { + if (b_ == null) { B = new global::Google.Protobuf.TestProtos.Proto2.TestMutualRecursionB(); } B.MergeFrom(other.B); @@ -9471,7 +9319,7 @@ public sealed partial class SubMessage : pb::IMessage { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - if (!HasB) { + if (b_ == null) { B = new global::Google.Protobuf.TestProtos.Proto2.TestMutualRecursionB(); } input.ReadMessage(B); @@ -9508,8 +9356,8 @@ public sealed partial class SubGroup : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SubGroup(SubGroup other) : this() { - subMessage_ = other.HasSubMessage ? other.subMessage_.Clone() : null; - notInThisScc_ = other.HasNotInThisScc ? other.notInThisScc_.Clone() : null; + subMessage_ = other.subMessage_ != null ? other.subMessage_.Clone() : null; + notInThisScc_ = other.notInThisScc_ != null ? other.notInThisScc_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -9531,16 +9379,6 @@ public sealed partial class SubGroup : pb::IMessage { subMessage_ = value; } } - /// Gets whether the sub_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasSubMessage { - get { return subMessage_ != null; } - } - /// Clears the value of the sub_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearSubMessage() { - subMessage_ = null; - } /// Field number for the "not_in_this_scc" field. public const int NotInThisSccFieldNumber = 4; @@ -9552,16 +9390,6 @@ public sealed partial class SubGroup : pb::IMessage { notInThisScc_ = value; } } - /// Gets whether the not_in_this_scc field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasNotInThisScc { - get { return notInThisScc_ != null; } - } - /// Clears the value of the not_in_this_scc field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearNotInThisScc() { - notInThisScc_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -9584,8 +9412,8 @@ public sealed partial class SubGroup : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (HasSubMessage) hash ^= SubMessage.GetHashCode(); - if (HasNotInThisScc) hash ^= NotInThisScc.GetHashCode(); + if (subMessage_ != null) hash ^= SubMessage.GetHashCode(); + if (notInThisScc_ != null) hash ^= NotInThisScc.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -9599,11 +9427,11 @@ public sealed partial class SubGroup : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (HasSubMessage) { + if (subMessage_ != null) { output.WriteRawTag(26); output.WriteMessage(SubMessage); } - if (HasNotInThisScc) { + if (notInThisScc_ != null) { output.WriteRawTag(34); output.WriteMessage(NotInThisScc); } @@ -9615,10 +9443,10 @@ public sealed partial class SubGroup : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (HasSubMessage) { + if (subMessage_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(SubMessage); } - if (HasNotInThisScc) { + if (notInThisScc_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(NotInThisScc); } if (_unknownFields != null) { @@ -9632,14 +9460,14 @@ public sealed partial class SubGroup : pb::IMessage { if (other == null) { return; } - if (other.HasSubMessage) { - if (!HasSubMessage) { + if (other.subMessage_ != null) { + if (subMessage_ == null) { SubMessage = new global::Google.Protobuf.TestProtos.Proto2.TestMutualRecursionA.Types.SubMessage(); } SubMessage.MergeFrom(other.SubMessage); } - if (other.HasNotInThisScc) { - if (!HasNotInThisScc) { + if (other.notInThisScc_ != null) { + if (notInThisScc_ == null) { NotInThisScc = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes(); } NotInThisScc.MergeFrom(other.NotInThisScc); @@ -9658,14 +9486,14 @@ public sealed partial class SubGroup : pb::IMessage { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 26: { - if (!HasSubMessage) { + if (subMessage_ == null) { SubMessage = new global::Google.Protobuf.TestProtos.Proto2.TestMutualRecursionA.Types.SubMessage(); } input.ReadMessage(SubMessage); break; } case 34: { - if (!HasNotInThisScc) { + if (notInThisScc_ == null) { NotInThisScc = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes(); } input.ReadMessage(NotInThisScc); @@ -9709,7 +9537,7 @@ public sealed partial class TestMutualRecursionB : pb::IMessageGets whether the a field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasA { - get { return a_ != null; } - } - /// Clears the value of the a field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearA() { - a_ = null; - } /// Field number for the "optional_int32" field. public const int OptionalInt32FieldNumber = 2; @@ -9785,7 +9603,7 @@ public sealed partial class TestMutualRecursionB : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestIsInitialized(TestIsInitialized other) : this() { - subMessage_ = other.HasSubMessage ? other.subMessage_.Clone() : null; + subMessage_ = other.subMessage_ != null ? other.subMessage_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -9914,16 +9732,6 @@ public sealed partial class TestIsInitialized : pb::IMessage subMessage_ = value; } } - /// Gets whether the sub_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasSubMessage { - get { return subMessage_ != null; } - } - /// Clears the value of the sub_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearSubMessage() { - subMessage_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -9945,7 +9753,7 @@ public sealed partial class TestIsInitialized : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (HasSubMessage) hash ^= SubMessage.GetHashCode(); + if (subMessage_ != null) hash ^= SubMessage.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -9959,7 +9767,7 @@ public sealed partial class TestIsInitialized : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (HasSubMessage) { + if (subMessage_ != null) { output.WriteRawTag(10); output.WriteMessage(SubMessage); } @@ -9971,7 +9779,7 @@ public sealed partial class TestIsInitialized : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (HasSubMessage) { + if (subMessage_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(SubMessage); } if (_unknownFields != null) { @@ -9985,8 +9793,8 @@ public sealed partial class TestIsInitialized : pb::IMessage if (other == null) { return; } - if (other.HasSubMessage) { - if (!HasSubMessage) { + if (other.subMessage_ != null) { + if (subMessage_ == null) { SubMessage = new global::Google.Protobuf.TestProtos.Proto2.TestIsInitialized.Types.SubMessage(); } SubMessage.MergeFrom(other.SubMessage); @@ -10003,7 +9811,7 @@ public sealed partial class TestIsInitialized : pb::IMessage _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - if (!HasSubMessage) { + if (subMessage_ == null) { SubMessage = new global::Google.Protobuf.TestProtos.Proto2.TestIsInitialized.Types.SubMessage(); } input.ReadMessage(SubMessage); @@ -10891,7 +10699,7 @@ public sealed partial class TestEagerMessage : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestEagerMessage(TestEagerMessage other) : this() { - subMessage_ = other.HasSubMessage ? other.subMessage_.Clone() : null; + subMessage_ = other.subMessage_ != null ? other.subMessage_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -10910,16 +10718,6 @@ public sealed partial class TestEagerMessage : pb::IMessage { subMessage_ = value; } } - /// Gets whether the sub_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasSubMessage { - get { return subMessage_ != null; } - } - /// Clears the value of the sub_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearSubMessage() { - subMessage_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -10941,7 +10739,7 @@ public sealed partial class TestEagerMessage : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (HasSubMessage) hash ^= SubMessage.GetHashCode(); + if (subMessage_ != null) hash ^= SubMessage.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -10955,7 +10753,7 @@ public sealed partial class TestEagerMessage : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (HasSubMessage) { + if (subMessage_ != null) { output.WriteRawTag(10); output.WriteMessage(SubMessage); } @@ -10967,7 +10765,7 @@ public sealed partial class TestEagerMessage : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (HasSubMessage) { + if (subMessage_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(SubMessage); } if (_unknownFields != null) { @@ -10981,8 +10779,8 @@ public sealed partial class TestEagerMessage : pb::IMessage { if (other == null) { return; } - if (other.HasSubMessage) { - if (!HasSubMessage) { + if (other.subMessage_ != null) { + if (subMessage_ == null) { SubMessage = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes(); } SubMessage.MergeFrom(other.SubMessage); @@ -10999,7 +10797,7 @@ public sealed partial class TestEagerMessage : pb::IMessage { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - if (!HasSubMessage) { + if (subMessage_ == null) { SubMessage = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes(); } input.ReadMessage(SubMessage); @@ -11036,7 +10834,7 @@ public sealed partial class TestLazyMessage : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestLazyMessage(TestLazyMessage other) : this() { - subMessage_ = other.HasSubMessage ? other.subMessage_.Clone() : null; + subMessage_ = other.subMessage_ != null ? other.subMessage_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -11055,16 +10853,6 @@ public sealed partial class TestLazyMessage : pb::IMessage { subMessage_ = value; } } - /// Gets whether the sub_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasSubMessage { - get { return subMessage_ != null; } - } - /// Clears the value of the sub_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearSubMessage() { - subMessage_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -11086,7 +10874,7 @@ public sealed partial class TestLazyMessage : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (HasSubMessage) hash ^= SubMessage.GetHashCode(); + if (subMessage_ != null) hash ^= SubMessage.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -11100,7 +10888,7 @@ public sealed partial class TestLazyMessage : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (HasSubMessage) { + if (subMessage_ != null) { output.WriteRawTag(10); output.WriteMessage(SubMessage); } @@ -11112,7 +10900,7 @@ public sealed partial class TestLazyMessage : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (HasSubMessage) { + if (subMessage_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(SubMessage); } if (_unknownFields != null) { @@ -11126,8 +10914,8 @@ public sealed partial class TestLazyMessage : pb::IMessage { if (other == null) { return; } - if (other.HasSubMessage) { - if (!HasSubMessage) { + if (other.subMessage_ != null) { + if (subMessage_ == null) { SubMessage = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes(); } SubMessage.MergeFrom(other.SubMessage); @@ -11144,7 +10932,7 @@ public sealed partial class TestLazyMessage : pb::IMessage { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - if (!HasSubMessage) { + if (subMessage_ == null) { SubMessage = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes(); } input.ReadMessage(SubMessage); @@ -11184,7 +10972,7 @@ public sealed partial class TestNestedMessageHasBits : pb::IMessageGets whether the optional_nested_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptionalNestedMessage { - get { return optionalNestedMessage_ != null; } - } - /// Clears the value of the optional_nested_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptionalNestedMessage() { - optionalNestedMessage_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -11234,7 +11012,7 @@ public sealed partial class TestNestedMessageHasBits : pb::IMessageGets whether the MessageField field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasMessageField { - get { return messageField_ != null; } - } - /// Clears the value of the MessageField field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearMessageField() { - messageField_ = null; - } /// Field number for the "StringPieceField" field. public const int StringPieceFieldFieldNumber = 5; @@ -11736,7 +11504,7 @@ public sealed partial class TestCamelCaseFieldNames : pb::IMessageGets whether the optional_nested_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptionalNestedMessage { - get { return optionalNestedMessage_ != null; } - } - /// Clears the value of the optional_nested_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptionalNestedMessage() { - optionalNestedMessage_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -12095,7 +11853,7 @@ public sealed partial class TestFieldOrderings : pb::IExtendableMessage { public const int FooMessageFieldNumber = 3; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.Proto2.TestAllTypes FooMessage { - get { return HasFooMessage ? (global::Google.Protobuf.TestProtos.Proto2.TestAllTypes) foo_ : null; } + get { return fooCase_ == FooOneofCase.FooMessage ? (global::Google.Protobuf.TestProtos.Proto2.TestAllTypes) foo_ : null; } set { foo_ = value; fooCase_ = value == null ? FooOneofCase.None : FooOneofCase.FooMessage; } } - /// Gets whether the "foo_message" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasFooMessage { - get { return fooCase_ == FooOneofCase.FooMessage; } - } - /// Clears the value of the oneof if it's currently set to "foo_message" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearFooMessage() { - if (HasFooMessage) { - ClearFoo(); - } - } /// Field number for the "foogroup" field. public const int FooGroupFieldNumber = 4; @@ -15705,7 +15451,7 @@ public enum FooOneofCase { int hash = 1; if (HasFooInt) hash ^= FooInt.GetHashCode(); if (HasFooString) hash ^= FooString.GetHashCode(); - if (HasFooMessage) hash ^= FooMessage.GetHashCode(); + if (fooCase_ == FooOneofCase.FooMessage) hash ^= FooMessage.GetHashCode(); if (HasFooGroup) hash ^= FooGroup.GetHashCode(); hash ^= (int) fooCase_; if (_unknownFields != null) { @@ -15729,7 +15475,7 @@ public enum FooOneofCase { output.WriteRawTag(18); output.WriteString(FooString); } - if (HasFooMessage) { + if (fooCase_ == FooOneofCase.FooMessage) { output.WriteRawTag(26); output.WriteMessage(FooMessage); } @@ -15752,7 +15498,7 @@ public enum FooOneofCase { if (HasFooString) { size += 1 + pb::CodedOutputStream.ComputeStringSize(FooString); } - if (HasFooMessage) { + if (fooCase_ == FooOneofCase.FooMessage) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(FooMessage); } if (HasFooGroup) { @@ -15811,7 +15557,7 @@ public enum FooOneofCase { } case 26: { global::Google.Protobuf.TestProtos.Proto2.TestAllTypes subBuilder = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes(); - if (HasFooMessage) { + if (fooCase_ == FooOneofCase.FooMessage) { subBuilder.MergeFrom(FooMessage); } input.ReadMessage(subBuilder); @@ -16055,7 +15801,7 @@ public sealed partial class TestOneofBackwardsCompatible : pb::IMessageGets whether the foo_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasFooMessage { - get { return fooMessage_ != null; } - } - /// Clears the value of the foo_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearFooMessage() { - fooMessage_ = null; - } /// Field number for the "foogroup" field. public const int FooGroupFieldNumber = 4; @@ -16179,7 +15915,7 @@ public sealed partial class TestOneofBackwardsCompatible : pb::IMessage { public const int FooMessageFieldNumber = 7; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.Proto2.TestOneof2.Types.NestedMessage FooMessage { - get { return HasFooMessage ? (global::Google.Protobuf.TestProtos.Proto2.TestOneof2.Types.NestedMessage) foo_ : null; } + get { return fooCase_ == FooOneofCase.FooMessage ? (global::Google.Protobuf.TestProtos.Proto2.TestOneof2.Types.NestedMessage) foo_ : null; } set { foo_ = value; fooCase_ = value == null ? FooOneofCase.None : FooOneofCase.FooMessage; } } - /// Gets whether the "foo_message" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasFooMessage { - get { return fooCase_ == FooOneofCase.FooMessage; } - } - /// Clears the value of the oneof if it's currently set to "foo_message" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearFooMessage() { - if (HasFooMessage) { - ClearFoo(); - } - } /// Field number for the "foogroup" field. public const int FooGroupFieldNumber = 8; @@ -16768,24 +16492,12 @@ public sealed partial class TestOneof2 : pb::IMessage { public const int FooLazyMessageFieldNumber = 11; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.Proto2.TestOneof2.Types.NestedMessage FooLazyMessage { - get { return HasFooLazyMessage ? (global::Google.Protobuf.TestProtos.Proto2.TestOneof2.Types.NestedMessage) foo_ : null; } + get { return fooCase_ == FooOneofCase.FooLazyMessage ? (global::Google.Protobuf.TestProtos.Proto2.TestOneof2.Types.NestedMessage) foo_ : null; } set { foo_ = value; fooCase_ = value == null ? FooOneofCase.None : FooOneofCase.FooLazyMessage; } } - /// Gets whether the "foo_lazy_message" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasFooLazyMessage { - get { return fooCase_ == FooOneofCase.FooLazyMessage; } - } - /// Clears the value of the oneof if it's currently set to "foo_lazy_message" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearFooLazyMessage() { - if (HasFooLazyMessage) { - ClearFoo(); - } - } /// Field number for the "bar_int" field. public const int BarIntFieldNumber = 12; @@ -17065,9 +16777,9 @@ public enum BarOneofCase { if (HasFooStringPiece) hash ^= FooStringPiece.GetHashCode(); if (HasFooBytes) hash ^= FooBytes.GetHashCode(); if (HasFooEnum) hash ^= FooEnum.GetHashCode(); - if (HasFooMessage) hash ^= FooMessage.GetHashCode(); + if (fooCase_ == FooOneofCase.FooMessage) hash ^= FooMessage.GetHashCode(); if (HasFooGroup) hash ^= FooGroup.GetHashCode(); - if (HasFooLazyMessage) hash ^= FooLazyMessage.GetHashCode(); + if (fooCase_ == FooOneofCase.FooLazyMessage) hash ^= FooLazyMessage.GetHashCode(); if (HasBarInt) hash ^= BarInt.GetHashCode(); if (HasBarString) hash ^= BarString.GetHashCode(); if (HasBarCord) hash ^= BarCord.GetHashCode(); @@ -17115,7 +16827,7 @@ public enum BarOneofCase { output.WriteRawTag(48); output.WriteEnum((int) FooEnum); } - if (HasFooMessage) { + if (fooCase_ == FooOneofCase.FooMessage) { output.WriteRawTag(58); output.WriteMessage(FooMessage); } @@ -17124,7 +16836,7 @@ public enum BarOneofCase { output.WriteGroup(FooGroup); output.WriteRawTag(68); } - if (HasFooLazyMessage) { + if (fooCase_ == FooOneofCase.FooLazyMessage) { output.WriteRawTag(90); output.WriteMessage(FooLazyMessage); } @@ -17186,13 +16898,13 @@ public enum BarOneofCase { if (HasFooEnum) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) FooEnum); } - if (HasFooMessage) { + if (fooCase_ == FooOneofCase.FooMessage) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(FooMessage); } if (HasFooGroup) { size += 2 + pb::CodedOutputStream.ComputeGroupSize(FooGroup); } - if (HasFooLazyMessage) { + if (fooCase_ == FooOneofCase.FooLazyMessage) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(FooLazyMessage); } if (HasBarInt) { @@ -17334,7 +17046,7 @@ public enum BarOneofCase { } case 58: { global::Google.Protobuf.TestProtos.Proto2.TestOneof2.Types.NestedMessage subBuilder = new global::Google.Protobuf.TestProtos.Proto2.TestOneof2.Types.NestedMessage(); - if (HasFooMessage) { + if (fooCase_ == FooOneofCase.FooMessage) { subBuilder.MergeFrom(FooMessage); } input.ReadMessage(subBuilder); @@ -17352,7 +17064,7 @@ public enum BarOneofCase { } case 90: { global::Google.Protobuf.TestProtos.Proto2.TestOneof2.Types.NestedMessage subBuilder = new global::Google.Protobuf.TestProtos.Proto2.TestOneof2.Types.NestedMessage(); - if (HasFooLazyMessage) { + if (fooCase_ == FooOneofCase.FooLazyMessage) { subBuilder.MergeFrom(FooLazyMessage); } input.ReadMessage(subBuilder); @@ -17857,24 +17569,12 @@ public sealed partial class TestRequiredOneof : pb::IMessage public const int FooMessageFieldNumber = 3; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.Proto2.TestRequiredOneof.Types.NestedMessage FooMessage { - get { return HasFooMessage ? (global::Google.Protobuf.TestProtos.Proto2.TestRequiredOneof.Types.NestedMessage) foo_ : null; } + get { return fooCase_ == FooOneofCase.FooMessage ? (global::Google.Protobuf.TestProtos.Proto2.TestRequiredOneof.Types.NestedMessage) foo_ : null; } set { foo_ = value; fooCase_ = value == null ? FooOneofCase.None : FooOneofCase.FooMessage; } } - /// Gets whether the "foo_message" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasFooMessage { - get { return fooCase_ == FooOneofCase.FooMessage; } - } - /// Clears the value of the oneof if it's currently set to "foo_message" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearFooMessage() { - if (HasFooMessage) { - ClearFoo(); - } - } private object foo_; /// Enum of possible cases for the "foo" oneof. @@ -17921,7 +17621,7 @@ public enum FooOneofCase { int hash = 1; if (HasFooInt) hash ^= FooInt.GetHashCode(); if (HasFooString) hash ^= FooString.GetHashCode(); - if (HasFooMessage) hash ^= FooMessage.GetHashCode(); + if (fooCase_ == FooOneofCase.FooMessage) hash ^= FooMessage.GetHashCode(); hash ^= (int) fooCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -17944,7 +17644,7 @@ public enum FooOneofCase { output.WriteRawTag(18); output.WriteString(FooString); } - if (HasFooMessage) { + if (fooCase_ == FooOneofCase.FooMessage) { output.WriteRawTag(26); output.WriteMessage(FooMessage); } @@ -17962,7 +17662,7 @@ public enum FooOneofCase { if (HasFooString) { size += 1 + pb::CodedOutputStream.ComputeStringSize(FooString); } - if (HasFooMessage) { + if (fooCase_ == FooOneofCase.FooMessage) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(FooMessage); } if (_unknownFields != null) { @@ -18012,7 +17712,7 @@ public enum FooOneofCase { } case 26: { global::Google.Protobuf.TestProtos.Proto2.TestRequiredOneof.Types.NestedMessage subBuilder = new global::Google.Protobuf.TestProtos.Proto2.TestRequiredOneof.Types.NestedMessage(); - if (HasFooMessage) { + if (fooCase_ == FooOneofCase.FooMessage) { subBuilder.MergeFrom(FooMessage); } input.ReadMessage(subBuilder); @@ -19559,8 +19259,8 @@ public sealed partial class TestDynamicExtensions : pb::IMessageGets whether the message_extension field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasMessageExtension { - get { return messageExtension_ != null; } - } - /// Clears the value of the message_extension field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearMessageExtension() { - messageExtension_ = null; - } /// Field number for the "dynamic_message_extension" field. public const int DynamicMessageExtensionFieldNumber = 2004; @@ -19674,16 +19364,6 @@ public sealed partial class TestDynamicExtensions : pb::IMessageGets whether the dynamic_message_extension field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasDynamicMessageExtension { - get { return dynamicMessageExtension_ != null; } - } - /// Clears the value of the dynamic_message_extension field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearDynamicMessageExtension() { - dynamicMessageExtension_ = null; - } /// Field number for the "repeated_extension" field. public const int RepeatedExtensionFieldNumber = 2005; @@ -19734,8 +19414,8 @@ public sealed partial class TestDynamicExtensions : pb::IMessageGets whether the required_all_types field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasRequiredAllTypes { - get { return requiredAllTypes_ != null; } - } - /// Clears the value of the required_all_types field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearRequiredAllTypes() { - requiredAllTypes_ = null; - } /// Field number for the "optional_all_types" field. public const int OptionalAllTypesFieldNumber = 2; @@ -20358,16 +20028,6 @@ public sealed partial class TestParsingMerge : pb::IExtendableMessageGets whether the optional_all_types field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptionalAllTypes { - get { return optionalAllTypes_ != null; } - } - /// Clears the value of the optional_all_types field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptionalAllTypes() { - optionalAllTypes_ = null; - } /// Field number for the "repeated_all_types" field. public const int RepeatedAllTypesFieldNumber = 3; @@ -20437,8 +20097,8 @@ public sealed partial class TestParsingMerge : pb::IExtendableMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Group1(Group1 other) : this() { - field1_ = other.HasField1 ? other.field1_.Clone() : null; + field1_ = other.field1_ != null ? other.field1_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -20896,16 +20556,6 @@ public sealed partial class Group1 : pb::IMessage { field1_ = value; } } - /// Gets whether the field1 field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasField1 { - get { return field1_ != null; } - } - /// Clears the value of the field1 field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearField1() { - field1_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -20927,7 +20577,7 @@ public sealed partial class Group1 : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (HasField1) hash ^= Field1.GetHashCode(); + if (field1_ != null) hash ^= Field1.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -20941,7 +20591,7 @@ public sealed partial class Group1 : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (HasField1) { + if (field1_ != null) { output.WriteRawTag(90); output.WriteMessage(Field1); } @@ -20953,7 +20603,7 @@ public sealed partial class Group1 : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (HasField1) { + if (field1_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Field1); } if (_unknownFields != null) { @@ -20967,8 +20617,8 @@ public sealed partial class Group1 : pb::IMessage { if (other == null) { return; } - if (other.HasField1) { - if (!HasField1) { + if (other.field1_ != null) { + if (field1_ == null) { Field1 = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes(); } Field1.MergeFrom(other.Field1); @@ -20987,7 +20637,7 @@ public sealed partial class Group1 : pb::IMessage { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 90: { - if (!HasField1) { + if (field1_ == null) { Field1 = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes(); } input.ReadMessage(Field1); @@ -21024,7 +20674,7 @@ public sealed partial class Group2 : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Group2(Group2 other) : this() { - field1_ = other.HasField1 ? other.field1_.Clone() : null; + field1_ = other.field1_ != null ? other.field1_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -21043,16 +20693,6 @@ public sealed partial class Group2 : pb::IMessage { field1_ = value; } } - /// Gets whether the field1 field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasField1 { - get { return field1_ != null; } - } - /// Clears the value of the field1 field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearField1() { - field1_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -21074,7 +20714,7 @@ public sealed partial class Group2 : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (HasField1) hash ^= Field1.GetHashCode(); + if (field1_ != null) hash ^= Field1.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -21088,7 +20728,7 @@ public sealed partial class Group2 : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (HasField1) { + if (field1_ != null) { output.WriteRawTag(170, 1); output.WriteMessage(Field1); } @@ -21100,7 +20740,7 @@ public sealed partial class Group2 : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (HasField1) { + if (field1_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(Field1); } if (_unknownFields != null) { @@ -21114,8 +20754,8 @@ public sealed partial class Group2 : pb::IMessage { if (other == null) { return; } - if (other.HasField1) { - if (!HasField1) { + if (other.field1_ != null) { + if (field1_ == null) { Field1 = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes(); } Field1.MergeFrom(other.Field1); @@ -21134,7 +20774,7 @@ public sealed partial class Group2 : pb::IMessage { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 170: { - if (!HasField1) { + if (field1_ == null) { Field1 = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes(); } input.ReadMessage(Field1); @@ -21176,7 +20816,7 @@ public sealed partial class OptionalGroup : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OptionalGroup(OptionalGroup other) : this() { - optionalGroupAllTypes_ = other.HasOptionalGroupAllTypes ? other.optionalGroupAllTypes_.Clone() : null; + optionalGroupAllTypes_ = other.optionalGroupAllTypes_ != null ? other.optionalGroupAllTypes_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -21195,16 +20835,6 @@ public sealed partial class OptionalGroup : pb::IMessage { optionalGroupAllTypes_ = value; } } - /// Gets whether the optional_group_all_types field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptionalGroupAllTypes { - get { return optionalGroupAllTypes_ != null; } - } - /// Clears the value of the optional_group_all_types field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptionalGroupAllTypes() { - optionalGroupAllTypes_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -21226,7 +20856,7 @@ public sealed partial class OptionalGroup : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (HasOptionalGroupAllTypes) hash ^= OptionalGroupAllTypes.GetHashCode(); + if (optionalGroupAllTypes_ != null) hash ^= OptionalGroupAllTypes.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -21240,7 +20870,7 @@ public sealed partial class OptionalGroup : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (HasOptionalGroupAllTypes) { + if (optionalGroupAllTypes_ != null) { output.WriteRawTag(90); output.WriteMessage(OptionalGroupAllTypes); } @@ -21252,7 +20882,7 @@ public sealed partial class OptionalGroup : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (HasOptionalGroupAllTypes) { + if (optionalGroupAllTypes_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(OptionalGroupAllTypes); } if (_unknownFields != null) { @@ -21266,8 +20896,8 @@ public sealed partial class OptionalGroup : pb::IMessage { if (other == null) { return; } - if (other.HasOptionalGroupAllTypes) { - if (!HasOptionalGroupAllTypes) { + if (other.optionalGroupAllTypes_ != null) { + if (optionalGroupAllTypes_ == null) { OptionalGroupAllTypes = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes(); } OptionalGroupAllTypes.MergeFrom(other.OptionalGroupAllTypes); @@ -21286,7 +20916,7 @@ public sealed partial class OptionalGroup : pb::IMessage { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 90: { - if (!HasOptionalGroupAllTypes) { + if (optionalGroupAllTypes_ == null) { OptionalGroupAllTypes = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes(); } input.ReadMessage(OptionalGroupAllTypes); @@ -21323,7 +20953,7 @@ public sealed partial class RepeatedGroup : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public RepeatedGroup(RepeatedGroup other) : this() { - repeatedGroupAllTypes_ = other.HasRepeatedGroupAllTypes ? other.repeatedGroupAllTypes_.Clone() : null; + repeatedGroupAllTypes_ = other.repeatedGroupAllTypes_ != null ? other.repeatedGroupAllTypes_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -21342,16 +20972,6 @@ public sealed partial class RepeatedGroup : pb::IMessage { repeatedGroupAllTypes_ = value; } } - /// Gets whether the repeated_group_all_types field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasRepeatedGroupAllTypes { - get { return repeatedGroupAllTypes_ != null; } - } - /// Clears the value of the repeated_group_all_types field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearRepeatedGroupAllTypes() { - repeatedGroupAllTypes_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -21373,7 +20993,7 @@ public sealed partial class RepeatedGroup : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (HasRepeatedGroupAllTypes) hash ^= RepeatedGroupAllTypes.GetHashCode(); + if (repeatedGroupAllTypes_ != null) hash ^= RepeatedGroupAllTypes.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -21387,7 +21007,7 @@ public sealed partial class RepeatedGroup : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (HasRepeatedGroupAllTypes) { + if (repeatedGroupAllTypes_ != null) { output.WriteRawTag(170, 1); output.WriteMessage(RepeatedGroupAllTypes); } @@ -21399,7 +21019,7 @@ public sealed partial class RepeatedGroup : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (HasRepeatedGroupAllTypes) { + if (repeatedGroupAllTypes_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(RepeatedGroupAllTypes); } if (_unknownFields != null) { @@ -21413,8 +21033,8 @@ public sealed partial class RepeatedGroup : pb::IMessage { if (other == null) { return; } - if (other.HasRepeatedGroupAllTypes) { - if (!HasRepeatedGroupAllTypes) { + if (other.repeatedGroupAllTypes_ != null) { + if (repeatedGroupAllTypes_ == null) { RepeatedGroupAllTypes = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes(); } RepeatedGroupAllTypes.MergeFrom(other.RepeatedGroupAllTypes); @@ -21433,7 +21053,7 @@ public sealed partial class RepeatedGroup : pb::IMessage { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 170: { - if (!HasRepeatedGroupAllTypes) { + if (repeatedGroupAllTypes_ == null) { RepeatedGroupAllTypes = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes(); } input.ReadMessage(RepeatedGroupAllTypes); @@ -22599,7 +22219,7 @@ public sealed partial class TestHugeFieldNumbers : pb::IExtendableMessageGets whether the optional_message field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptionalMessage { - get { return optionalMessage_ != null; } - } - /// Clears the value of the optional_message field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptionalMessage() { - optionalMessage_ = null; - } /// Field number for the "optionalgroup" field. public const int OptionalGroupFieldNumber = 536870008; @@ -22843,24 +22453,12 @@ public sealed partial class TestHugeFieldNumbers : pb::IExtendableMessageGets whether the "oneof_test_all_types" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOneofTestAllTypes { - get { return oneofFieldCase_ == OneofFieldOneofCase.OneofTestAllTypes; } - } - /// Clears the value of the oneof if it's currently set to "oneof_test_all_types" - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOneofTestAllTypes() { - if (HasOneofTestAllTypes) { - ClearOneofField(); - } - } /// Field number for the "oneof_string" field. public const int OneofStringFieldNumber = 536870013; @@ -22973,11 +22571,11 @@ public enum OneofFieldOneofCase { if (HasOptionalEnum) hash ^= OptionalEnum.GetHashCode(); if (HasOptionalString) hash ^= OptionalString.GetHashCode(); if (HasOptionalBytes) hash ^= OptionalBytes.GetHashCode(); - if (HasOptionalMessage) hash ^= OptionalMessage.GetHashCode(); + if (optionalMessage_ != null) hash ^= OptionalMessage.GetHashCode(); if (HasOptionalGroup) hash ^= OptionalGroup.GetHashCode(); hash ^= StringStringMap.GetHashCode(); if (HasOneofUint32) hash ^= OneofUint32.GetHashCode(); - if (HasOneofTestAllTypes) hash ^= OneofTestAllTypes.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofTestAllTypes) hash ^= OneofTestAllTypes.GetHashCode(); if (HasOneofString) hash ^= OneofString.GetHashCode(); if (HasOneofBytes) hash ^= OneofBytes.GetHashCode(); hash ^= (int) oneofFieldCase_; @@ -23019,7 +22617,7 @@ public enum OneofFieldOneofCase { output.WriteRawTag(178, 199, 255, 255, 15); output.WriteBytes(OptionalBytes); } - if (HasOptionalMessage) { + if (optionalMessage_ != null) { output.WriteRawTag(186, 199, 255, 255, 15); output.WriteMessage(OptionalMessage); } @@ -23033,7 +22631,7 @@ public enum OneofFieldOneofCase { output.WriteRawTag(216, 199, 255, 255, 15); output.WriteUInt32(OneofUint32); } - if (HasOneofTestAllTypes) { + if (oneofFieldCase_ == OneofFieldOneofCase.OneofTestAllTypes) { output.WriteRawTag(226, 199, 255, 255, 15); output.WriteMessage(OneofTestAllTypes); } @@ -23073,7 +22671,7 @@ public enum OneofFieldOneofCase { if (HasOptionalBytes) { size += 5 + pb::CodedOutputStream.ComputeBytesSize(OptionalBytes); } - if (HasOptionalMessage) { + if (optionalMessage_ != null) { size += 5 + pb::CodedOutputStream.ComputeMessageSize(OptionalMessage); } if (HasOptionalGroup) { @@ -23083,7 +22681,7 @@ public enum OneofFieldOneofCase { if (HasOneofUint32) { size += 5 + pb::CodedOutputStream.ComputeUInt32Size(OneofUint32); } - if (HasOneofTestAllTypes) { + if (oneofFieldCase_ == OneofFieldOneofCase.OneofTestAllTypes) { size += 5 + pb::CodedOutputStream.ComputeMessageSize(OneofTestAllTypes); } if (HasOneofString) { @@ -23123,8 +22721,8 @@ public enum OneofFieldOneofCase { if (other.HasOptionalBytes) { OptionalBytes = other.OptionalBytes; } - if (other.HasOptionalMessage) { - if (!HasOptionalMessage) { + if (other.optionalMessage_ != null) { + if (optionalMessage_ == null) { OptionalMessage = new global::Google.Protobuf.TestProtos.Proto2.ForeignMessage(); } OptionalMessage.MergeFrom(other.OptionalMessage); @@ -23199,7 +22797,7 @@ public enum OneofFieldOneofCase { break; } case 4294960058: { - if (!HasOptionalMessage) { + if (optionalMessage_ == null) { OptionalMessage = new global::Google.Protobuf.TestProtos.Proto2.ForeignMessage(); } input.ReadMessage(OptionalMessage); @@ -23222,7 +22820,7 @@ public enum OneofFieldOneofCase { } case 4294960098: { global::Google.Protobuf.TestProtos.Proto2.TestAllTypes subBuilder = new global::Google.Protobuf.TestProtos.Proto2.TestAllTypes(); - if (HasOneofTestAllTypes) { + if (oneofFieldCase_ == OneofFieldOneofCase.OneofTestAllTypes) { subBuilder.MergeFrom(OneofTestAllTypes); } input.ReadMessage(subBuilder); diff --git a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs index c9ba6328b9fb..1fa232b1148f 100644 --- a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs @@ -352,8 +352,8 @@ public sealed partial class FileDescriptorProto : pb::IMessageGets whether the options field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptions { - get { return options_ != null; } - } - /// Clears the value of the options field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptions() { - options_ = null; - } /// Field number for the "source_code_info" field. public const int SourceCodeInfoFieldNumber = 9; @@ -535,16 +525,6 @@ public sealed partial class FileDescriptorProto : pb::IMessageGets whether the source_code_info field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasSourceCodeInfo { - get { return sourceCodeInfo_ != null; } - } - /// Clears the value of the source_code_info field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearSourceCodeInfo() { - sourceCodeInfo_ = null; - } /// Field number for the "syntax" field. public const int SyntaxFieldNumber = 12; @@ -613,8 +593,8 @@ public sealed partial class FileDescriptorProto : pb::IMessage { enumType_ = other.enumType_.Clone(); extensionRange_ = other.extensionRange_.Clone(); oneofDecl_ = other.oneofDecl_.Clone(); - options_ = other.HasOptions ? other.options_.Clone() : null; + options_ = other.options_ != null ? other.options_.Clone() : null; reservedRange_ = other.reservedRange_.Clone(); reservedName_ = other.reservedName_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); @@ -937,16 +917,6 @@ public sealed partial class DescriptorProto : pb::IMessage { options_ = value; } } - /// Gets whether the options field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptions { - get { return options_ != null; } - } - /// Clears the value of the options field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptions() { - options_ = null; - } /// Field number for the "reserved_range" field. public const int ReservedRangeFieldNumber = 9; @@ -1008,7 +978,7 @@ public sealed partial class DescriptorProto : pb::IMessage { hash ^= enumType_.GetHashCode(); hash ^= extensionRange_.GetHashCode(); hash ^= oneofDecl_.GetHashCode(); - if (HasOptions) hash ^= Options.GetHashCode(); + if (options_ != null) hash ^= Options.GetHashCode(); hash ^= reservedRange_.GetHashCode(); hash ^= reservedName_.GetHashCode(); if (_unknownFields != null) { @@ -1033,7 +1003,7 @@ public sealed partial class DescriptorProto : pb::IMessage { enumType_.WriteTo(output, _repeated_enumType_codec); extensionRange_.WriteTo(output, _repeated_extensionRange_codec); extension_.WriteTo(output, _repeated_extension_codec); - if (HasOptions) { + if (options_ != null) { output.WriteRawTag(58); output.WriteMessage(Options); } @@ -1057,7 +1027,7 @@ public sealed partial class DescriptorProto : pb::IMessage { size += enumType_.CalculateSize(_repeated_enumType_codec); size += extensionRange_.CalculateSize(_repeated_extensionRange_codec); size += oneofDecl_.CalculateSize(_repeated_oneofDecl_codec); - if (HasOptions) { + if (options_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } size += reservedRange_.CalculateSize(_repeated_reservedRange_codec); @@ -1082,8 +1052,8 @@ public sealed partial class DescriptorProto : pb::IMessage { enumType_.Add(other.enumType_); extensionRange_.Add(other.extensionRange_); oneofDecl_.Add(other.oneofDecl_); - if (other.HasOptions) { - if (!HasOptions) { + if (other.options_ != null) { + if (options_ == null) { Options = new global::Google.Protobuf.Reflection.MessageOptions(); } Options.MergeFrom(other.Options); @@ -1126,7 +1096,7 @@ public sealed partial class DescriptorProto : pb::IMessage { break; } case 58: { - if (!HasOptions) { + if (options_ == null) { Options = new global::Google.Protobuf.Reflection.MessageOptions(); } input.ReadMessage(Options); @@ -1181,7 +1151,7 @@ public sealed partial class ExtensionRange : pb::IMessage { _hasBits0 = other._hasBits0; start_ = other.start_; end_ = other.end_; - options_ = other.HasOptions ? other.options_.Clone() : null; + options_ = other.options_ != null ? other.options_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -1254,16 +1224,6 @@ public sealed partial class ExtensionRange : pb::IMessage { options_ = value; } } - /// Gets whether the options field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptions { - get { return options_ != null; } - } - /// Clears the value of the options field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptions() { - options_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -1289,7 +1249,7 @@ public sealed partial class ExtensionRange : pb::IMessage { int hash = 1; if (HasStart) hash ^= Start.GetHashCode(); if (HasEnd) hash ^= End.GetHashCode(); - if (HasOptions) hash ^= Options.GetHashCode(); + if (options_ != null) hash ^= Options.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1311,7 +1271,7 @@ public sealed partial class ExtensionRange : pb::IMessage { output.WriteRawTag(16); output.WriteInt32(End); } - if (HasOptions) { + if (options_ != null) { output.WriteRawTag(26); output.WriteMessage(Options); } @@ -1329,7 +1289,7 @@ public sealed partial class ExtensionRange : pb::IMessage { if (HasEnd) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(End); } - if (HasOptions) { + if (options_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); } if (_unknownFields != null) { @@ -1349,8 +1309,8 @@ public sealed partial class ExtensionRange : pb::IMessage { if (other.HasEnd) { End = other.End; } - if (other.HasOptions) { - if (!HasOptions) { + if (other.options_ != null) { + if (options_ == null) { Options = new global::Google.Protobuf.Reflection.ExtensionRangeOptions(); } Options.MergeFrom(other.Options); @@ -1375,7 +1335,7 @@ public sealed partial class ExtensionRange : pb::IMessage { break; } case 26: { - if (!HasOptions) { + if (options_ == null) { Options = new global::Google.Protobuf.Reflection.ExtensionRangeOptions(); } input.ReadMessage(Options); @@ -1791,7 +1751,7 @@ public sealed partial class FieldDescriptorProto : pb::IMessageGets whether the options field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptions { - get { return options_ != null; } - } - /// Clears the value of the options field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptions() { - options_ = null; - } /// Field number for the "proto3_optional" field. public const int Proto3OptionalFieldNumber = 17; @@ -2151,7 +2101,7 @@ public sealed partial class FieldDescriptorProto : pb::IMessageGets whether the options field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptions { - get { return options_ != null; } - } - /// Clears the value of the options field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptions() { - options_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -2533,7 +2473,7 @@ public sealed partial class OneofDescriptorProto : pb::IMessageGets whether the options field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptions { - get { return options_ != null; } - } - /// Clears the value of the options field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptions() { - options_ = null; - } /// Field number for the "reserved_range" field. public const int ReservedRangeFieldNumber = 4; @@ -2767,7 +2697,7 @@ public sealed partial class EnumDescriptorProto : pb::IMessageGets whether the options field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptions { - get { return options_ != null; } - } - /// Clears the value of the options field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptions() { - options_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -3213,7 +3133,7 @@ public sealed partial class EnumValueDescriptorProto : pb::IMessageGets whether the options field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptions { - get { return options_ != null; } - } - /// Clears the value of the options field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptions() { - options_ = null; - } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { @@ -3428,7 +3338,7 @@ public sealed partial class ServiceDescriptorProto : pb::IMessageGets whether the options field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptions { - get { return options_ != null; } - } - /// Clears the value of the options field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptions() { - options_ = null; - } /// Field number for the "client_streaming" field. public const int ClientStreamingFieldNumber = 5; @@ -3739,7 +3639,7 @@ public sealed partial class MethodDescriptorProto : pb::IMessageis_singular_with_presence() as C# has slightly - // different behavior to other languages. - - if (IsProto2(descriptor->file())) { - // We generate Has/Clear for oneof fields in C#, as well as for messages. - // It's possible that we shouldn't, but stopping doing so would be a - // breaking change for proto2. Fortunately the decision is moot for - // onoeof in proto3: you can't use "optional" inside a oneof. - // Proto2: every singular field has presence. (Even fields in oneofs.) - return !descriptor->is_repeated(); - } else { - // Proto3: only for explictly-optional fields that aren't messages. - // (Repeated fields can never be explicitly optional, so we don't need - // to check for that.) Currently we can't get at proto3_optional directly, - // but we can use has_optional_keyword() as a surrogate check. - return descriptor->has_optional_keyword() && - descriptor->type() != FieldDescriptor::TYPE_MESSAGE; + // Unlike most languages, we don't generate Has/Clear members for message + // types, because they can always be set to null in C#. They're not really + // needed for oneof fields in proto2 either, as everything can be done via + // oneof case, but we follow the convention from other languages. Proto3 + // oneof fields never have Has/Clear members - but will also never have + // the explicit optional keyword either. + // + // None of the built-in helpers (descriptor->has_presence() etc) describe + // quite the behavior we want, so the rules are explicit below. + + if (descriptor->is_repeated() || + descriptor->type() == FieldDescriptor::TYPE_MESSAGE) { + return false; } + // has_optional_keyword() has more complex rules for proto2, but that + // doesn't matter given the first part of this condition. + return IsProto2(descriptor->file()) || descriptor->has_optional_keyword(); } inline bool RequiresPresenceBit(const FieldDescriptor* descriptor) {