From c2d2c1adaf447bbc80194d8bce6c4e0442a7f47a Mon Sep 17 00:00:00 2001 From: csharptest Date: Thu, 8 Sep 2011 20:02:11 -0500 Subject: [PATCH 01/31] first pass at adding required changes --- src/AddressBook/AddressBookProtos.cs | 20 +- src/AddressBook/Properties/AssemblyInfo.cs | 6 +- src/ProtoBench/Properties/AssemblyInfo.cs | 6 +- src/ProtoDump/Properties/AssemblyInfo.cs | 6 +- src/ProtoGen.Test/Properties/AssemblyInfo.cs | 6 +- src/ProtoGen/Properties/AssemblyInfo.cs | 6 +- src/ProtoMunge/Properties/AssemblyInfo.cs | 6 +- .../AbstractReader.cs | 10 + .../AbstractWriter.cs | 20 ++ .../DictionaryReader.cs | 15 ++ .../DictionaryWriter.cs | 13 ++ .../Http/MessageFormatFactory.cs | 168 ++++++++++++++++ .../Http/MessageFormatOptions.cs | 82 ++++++++ .../Http/ServiceExtensions.cs | 32 +++ .../JsonFormatReader.cs | 25 ++- .../JsonFormatWriter.cs | 20 +- .../Properties/AssemblyInfo.cs | 6 +- .../ProtocolBuffers.Serialization.csproj | 3 + .../XmlFormatReader.cs | 35 ++++ .../XmlFormatWriter.cs | 39 +++- .../Properties/AssemblyInfo.cs | 8 +- .../UnitTestCSharpOptionsProtoFile.cs | 8 +- .../UnitTestCustomOptionsProtoFile.cs | 86 ++++---- .../UnitTestEmbedOptimizeForProtoFile.cs | 8 +- .../TestProtos/UnitTestEmptyProtoFile.cs | 4 +- .../UnitTestExtrasIssuesProtoFile.cs | 20 +- .../TestProtos/UnitTestGenericServices.cs | 12 +- .../TestProtos/UnitTestGoogleSizeProtoFile.cs | 26 +-- .../UnitTestGoogleSpeedProtoFile.cs | 26 +-- .../TestProtos/UnitTestImportLiteProtoFile.cs | 10 +- .../TestProtos/UnitTestImportProtoFile.cs | 10 +- .../TestProtos/UnitTestMessageSetProtoFile.cs | 30 +-- .../UnitTestNoGenericServicesProtoFile.cs | 10 +- .../UnitTestOptimizeForProtoFile.cs | 16 +- .../TestProtos/UnitTestProtoFile.cs | 186 +++++++++--------- .../TestProtos/UnitTestRpcInterop.cs | 30 +-- .../UnitTestXmlSerializerTestProtoFile.cs | 32 +-- .../TestWriterFormatJson.cs | 64 ++++++ .../TestWriterFormatXml.cs | 72 +++++++ .../DescriptorProtos/CSharpOptions.cs | 22 +-- .../DescriptorProtos/DescriptorProtoFile.cs | 94 ++++----- .../Properties/AssemblyInfo.cs | 6 +- .../TestProtos/UnitTestExtrasFullProtoFile.cs | 44 ++--- .../TestProtos/UnitTestExtrasLiteProtoFile.cs | 30 +-- .../TestProtos/UnitTestImportLiteProtoFile.cs | 10 +- .../TestProtos/UnitTestImportProtoFile.cs | 10 +- .../UnitTestLiteImportNonLiteProtoFile.cs | 8 +- .../TestProtos/UnitTestLiteProtoFile.cs | 66 +++---- .../TestProtos/UnitTestProtoFile.cs | 186 +++++++++--------- 49 files changed, 1117 insertions(+), 541 deletions(-) create mode 100644 src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs create mode 100644 src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs create mode 100644 src/ProtocolBuffers.Serialization/Http/ServiceExtensions.cs diff --git a/src/AddressBook/AddressBookProtos.cs b/src/AddressBook/AddressBookProtos.cs index 4d391f0fe1..7f3504a6e5 100644 --- a/src/AddressBook/AddressBookProtos.cs +++ b/src/AddressBook/AddressBookProtos.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class AddressBookProtos { #region Extension registration @@ -66,7 +66,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Person : pb::GeneratedMessage { private static readonly Person defaultInstance = new Builder().BuildPartial(); private static readonly string[] _personFieldNames = new string[] { "email", "id", "name", "phone" }; @@ -94,10 +94,10 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum PhoneType { MOBILE = 0, HOME = 1, @@ -106,7 +106,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class PhoneNumber : pb::GeneratedMessage { private static readonly PhoneNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _phoneNumberFieldNames = new string[] { "number", "type" }; @@ -228,7 +228,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -532,7 +532,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -764,7 +764,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class AddressBook : pb::GeneratedMessage { private static readonly AddressBook defaultInstance = new Builder().BuildPartial(); private static readonly string[] _addressBookFieldNames = new string[] { "person" }; @@ -874,7 +874,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/AddressBook/Properties/AssemblyInfo.cs b/src/AddressBook/Properties/AssemblyInfo.cs index 614e1b4839..34b9e47ffe 100644 --- a/src/AddressBook/Properties/AssemblyInfo.cs +++ b/src/AddressBook/Properties/AssemblyInfo.cs @@ -33,7 +33,7 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.277")] +// [assembly: AssemblyVersion("2.3.0.369")] -[assembly: AssemblyVersion("2.3.0.277")] -[assembly: AssemblyFileVersion("2.3.0.277")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.0.369")] +[assembly: AssemblyFileVersion("2.3.0.369")] \ No newline at end of file diff --git a/src/ProtoBench/Properties/AssemblyInfo.cs b/src/ProtoBench/Properties/AssemblyInfo.cs index a5779209df..498f8dcfb9 100644 --- a/src/ProtoBench/Properties/AssemblyInfo.cs +++ b/src/ProtoBench/Properties/AssemblyInfo.cs @@ -36,7 +36,7 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.277")] +// [assembly: AssemblyVersion("2.3.0.369")] -[assembly: AssemblyVersion("2.3.0.277")] -[assembly: AssemblyFileVersion("2.3.0.277")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.0.369")] +[assembly: AssemblyFileVersion("2.3.0.369")] \ No newline at end of file diff --git a/src/ProtoDump/Properties/AssemblyInfo.cs b/src/ProtoDump/Properties/AssemblyInfo.cs index 816d6f98c1..e71f55407b 100644 --- a/src/ProtoDump/Properties/AssemblyInfo.cs +++ b/src/ProtoDump/Properties/AssemblyInfo.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.277")] +// [assembly: AssemblyVersion("2.3.0.369")] -[assembly: AssemblyVersion("2.3.0.277")] -[assembly: AssemblyFileVersion("2.3.0.277")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.0.369")] +[assembly: AssemblyFileVersion("2.3.0.369")] \ No newline at end of file diff --git a/src/ProtoGen.Test/Properties/AssemblyInfo.cs b/src/ProtoGen.Test/Properties/AssemblyInfo.cs index 8a64bf4bbc..98ab392a4b 100644 --- a/src/ProtoGen.Test/Properties/AssemblyInfo.cs +++ b/src/ProtoGen.Test/Properties/AssemblyInfo.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.277")] +// [assembly: AssemblyVersion("2.3.0.369")] -[assembly: AssemblyVersion("2.3.0.277")] -[assembly: AssemblyFileVersion("2.3.0.277")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.0.369")] +[assembly: AssemblyFileVersion("2.3.0.369")] \ No newline at end of file diff --git a/src/ProtoGen/Properties/AssemblyInfo.cs b/src/ProtoGen/Properties/AssemblyInfo.cs index 1d8cc31290..2e2fdae92b 100644 --- a/src/ProtoGen/Properties/AssemblyInfo.cs +++ b/src/ProtoGen/Properties/AssemblyInfo.cs @@ -33,7 +33,7 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.277")] +// [assembly: AssemblyVersion("2.3.0.369")] -[assembly: AssemblyVersion("2.3.0.277")] -[assembly: AssemblyFileVersion("2.3.0.277")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.0.369")] +[assembly: AssemblyFileVersion("2.3.0.369")] \ No newline at end of file diff --git a/src/ProtoMunge/Properties/AssemblyInfo.cs b/src/ProtoMunge/Properties/AssemblyInfo.cs index 5e62c84872..eaadf7afcc 100644 --- a/src/ProtoMunge/Properties/AssemblyInfo.cs +++ b/src/ProtoMunge/Properties/AssemblyInfo.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.277")] +// [assembly: AssemblyVersion("2.3.0.369")] -[assembly: AssemblyVersion("2.3.0.277")] -[assembly: AssemblyFileVersion("2.3.0.277")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.0.369")] +[assembly: AssemblyFileVersion("2.3.0.369")] \ No newline at end of file diff --git a/src/ProtocolBuffers.Serialization/AbstractReader.cs b/src/ProtocolBuffers.Serialization/AbstractReader.cs index f54c270713..538af38f79 100644 --- a/src/ProtocolBuffers.Serialization/AbstractReader.cs +++ b/src/ProtocolBuffers.Serialization/AbstractReader.cs @@ -112,6 +112,16 @@ namespace Google.ProtocolBuffers.Serialization /// Merges the input stream into the provided IBuilderLite /// protected abstract bool ReadMessage(IBuilderLite builder, ExtensionRegistry registry); + + /// + /// Reads the root-message preamble specific to this formatter + /// + public abstract AbstractReader ReadStartMessage(); + + /// + /// Reads the root-message close specific to this formatter + /// + public abstract void ReadEndMessage(); /// /// Merges the input stream into the provided IBuilderLite diff --git a/src/ProtocolBuffers.Serialization/AbstractWriter.cs b/src/ProtocolBuffers.Serialization/AbstractWriter.cs index 6592c1dde1..50dfe67187 100644 --- a/src/ProtocolBuffers.Serialization/AbstractWriter.cs +++ b/src/ProtocolBuffers.Serialization/AbstractWriter.cs @@ -43,6 +43,26 @@ namespace Google.ProtocolBuffers.Serialization /// public abstract void WriteMessage(IMessageLite message); + /// + /// Used to write any nessary root-message preamble. After this call you can call + /// IMessageLite.MergeTo(...) and complete the message with a call to EndMessage(). + /// These three calls are identical to just calling WriteMessage(message); + /// + /// + /// AbstractWriter writer; + /// writer.StartMessage(); + /// message.WriteTo(writer); + /// writer.EndMessage(); + /// // ... or, but not both ... + /// writer.WriteMessage(message); + /// + public abstract void StartMessage(); + + /// + /// Used to complete a root-message previously started with a call to StartMessage() + /// + public abstract void EndMessage(); + /// /// Writes a Boolean value /// diff --git a/src/ProtocolBuffers.Serialization/DictionaryReader.cs b/src/ProtocolBuffers.Serialization/DictionaryReader.cs index cc5c680cb3..f606bc9bdb 100644 --- a/src/ProtocolBuffers.Serialization/DictionaryReader.cs +++ b/src/ProtocolBuffers.Serialization/DictionaryReader.cs @@ -22,6 +22,21 @@ namespace Google.ProtocolBuffers.Serialization _ready = _input.MoveNext(); } + /// + /// No-op + /// + public override AbstractReader ReadStartMessage() + { + return this; + } + + /// + /// No-op + /// + public override void ReadEndMessage() + { + } + /// /// Merges the contents of stream into the provided message builder /// diff --git a/src/ProtocolBuffers.Serialization/DictionaryWriter.cs b/src/ProtocolBuffers.Serialization/DictionaryWriter.cs index 96175a7e57..4c3b01167f 100644 --- a/src/ProtocolBuffers.Serialization/DictionaryWriter.cs +++ b/src/ProtocolBuffers.Serialization/DictionaryWriter.cs @@ -53,6 +53,19 @@ namespace Google.ProtocolBuffers.Serialization message.WriteTo(this); } + + /// + /// No-op + /// + public override void StartMessage() + { } + + /// + /// No-op + /// + public override void EndMessage() + { } + /// /// Writes a Boolean value /// diff --git a/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs b/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs new file mode 100644 index 0000000000..7173d478c0 --- /dev/null +++ b/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs @@ -0,0 +1,168 @@ +using System; +using System.IO; +using System.Xml; +using System.Text; + +namespace Google.ProtocolBuffers.Serialization +{ + /// + /// Extensions and helpers to abstract the reading/writing of messages by a client-specified content type. + /// + public static class MessageFormatFactory + { + /// + /// Constructs an ICodedInputStream from the input stream based on the contentType provided + /// + /// Options specific to reading this message and/or content type + /// The mime type of the input stream content + /// The stream to read the message from + /// The ICodedInputStream that can be given to the IBuilder.MergeFrom(...) method + public static ICodedInputStream CreateInputStream(MessageFormatOptions options, string contentType, Stream input) + { + FormatType inputType = ContentTypeToFormat(contentType, options.DefaultContentType); + + ICodedInputStream codedInput; + if (inputType == FormatType.ProtoBuffer) + { + codedInput = CodedInputStream.CreateInstance(input); + } + else if (inputType == FormatType.Json) + { + JsonFormatReader reader = JsonFormatReader.CreateInstance(input); + codedInput = reader.ReadStartMessage(); + } + else if (inputType == FormatType.Xml) + { + XmlFormatReader reader = XmlFormatReader.CreateInstance(input); + reader.RootElementName = options.XmlReaderRootElementName; + reader.Options = options.XmlReaderOptions; + codedInput = reader.ReadStartMessage(); + } + else + throw new NotSupportedException(); + + return codedInput; + } + + /// + /// Merges the message from the input stream based on the contentType provided + /// + /// A type derived from IBuilderLite + /// An instance of a message builder + /// Options specific to reading this message and/or content type + /// The mime type of the input stream content + /// The stream to read the message from + /// The same builder instance that was supplied in the builder parameter + public static TBuilder MergeFrom(this TBuilder builder, MessageFormatOptions options, string contentType, Stream input) where TBuilder : IBuilderLite + { + ICodedInputStream codedInput = CreateInputStream(options, contentType, input); + return (TBuilder)builder.WeakMergeFrom(codedInput, options.ExtensionRegistry); + } + + /// + /// Writes the message instance to the stream using the content type provided + /// + /// An instance of a message + /// Options specific to writing this message and/or content type + /// The mime type of the content to be written + /// The stream to write the message to + public static void WriteTo(this IMessageLite message, MessageFormatOptions options, string contentType, Stream output) + { + FormatType outputType = ContentTypeToFormat(contentType, options.DefaultContentType); + + ICodedOutputStream codedOutput; + if (outputType == FormatType.ProtoBuffer) + { + codedOutput = CodedOutputStream.CreateInstance(output); + } + else if (outputType == FormatType.Json) + { + JsonFormatWriter writer = JsonFormatWriter.CreateInstance(output); + if (options.FormattedOutput) + { + writer.Formatted(); + } + writer.StartMessage(); + codedOutput = writer; + } + else if (outputType == FormatType.Xml) + { + XmlFormatWriter writer; + if (options.FormattedOutput) + { + writer = XmlFormatWriter.CreateInstance(output); + } + else + { + XmlWriterSettings settings = new XmlWriterSettings() + { + CheckCharacters = false, + NewLineHandling = NewLineHandling.Entitize, + OmitXmlDeclaration = true, + Encoding = Encoding.UTF8, + Indent = true, + IndentChars = " ", + NewLineChars = Environment.NewLine, + }; + writer = XmlFormatWriter.CreateInstance(XmlWriter.Create(output, settings)); + } + writer.RootElementName = options.XmlWriterRootElementName; + writer.Options = options.XmlWriterOptions; + writer.StartMessage(); + codedOutput = writer; + } + else + throw new NotSupportedException(); + + message.WriteTo(codedOutput); + + if (codedOutput is AbstractWriter) + ((AbstractWriter) codedOutput).EndMessage(); + + codedOutput.Flush(); + } + + + enum FormatType { ProtoBuffer, Json, Xml }; + + private static FormatType ContentTypeToFormat(string contentType, string defaultType) + { + switch ((contentType ?? String.Empty).Split(';')[0].Trim().ToLower()) + { + case "application/json": + case "application/x-json": + case "application/x-javascript": + case "text/javascript": + case "text/x-javascript": + case "text/x-json": + case "text/json": + { + return FormatType.Json; + } + + case "text/xml": + case "application/xml": + { + return FormatType.Xml; + } + + case "application/binary": + case "application/x-protobuf": + case "application/vnd.google.protobuf": + { + return FormatType.ProtoBuffer; + } + + case "": + case null: + if (!String.IsNullOrEmpty(defaultType)) + { + return ContentTypeToFormat(defaultType, null); + } + break; + } + + throw new ArgumentOutOfRangeException("contentType"); + } + } +} \ No newline at end of file diff --git a/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs b/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs new file mode 100644 index 0000000000..5b88ac9415 --- /dev/null +++ b/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs @@ -0,0 +1,82 @@ +using System; + +namespace Google.ProtocolBuffers.Serialization +{ + /// + /// Defines control information for the various formatting used with HTTP services + /// + public struct MessageFormatOptions + { + /// The mime type for xml content + /// Other valid xml mime types include: application/binary, application/x-protobuf + public const string ContentTypeProtoBuffer = "application/vnd.google.protobuf"; + + /// The mime type for xml content + /// Other valid xml mime types include: text/xml + public const string ContentTypeXml = "application/xml"; + + /// The mime type for json content + /// + /// Other valid json mime types include: application/json, application/x-json, + /// application/x-javascript, text/javascript, text/x-javascript, text/x-json, text/json + /// + public const string ContentTypeJson = "application/json"; + + private string _defaultContentType; + private string _xmlReaderRootElementName; + private string _xmlWriterRootElementName; + private ExtensionRegistry _extensionRegistry; + + /// + /// The default content type to use if the input type is null or empty. If this + /// value is not supplied an ArgumentOutOfRangeException exception will be raised. + /// + public string DefaultContentType + { + get { return _defaultContentType ?? String.Empty; } + set { _defaultContentType = value; } + } + + /// + /// The extension registry to use when reading messages + /// + public ExtensionRegistry ExtensionRegistry + { + get { return _extensionRegistry ?? ExtensionRegistry.Empty; } + set { _extensionRegistry = value; } + } + + /// + /// The name of the xml root element when reading messages + /// + public string XmlReaderRootElementName + { + get { return _xmlReaderRootElementName ?? XmlFormatReader.DefaultRootElementName; } + set { _xmlReaderRootElementName = value; } + } + + /// + /// Xml reader options + /// + public XmlReaderOptions XmlReaderOptions { get; set; } + + /// + /// True to use formatted output including new-lines and default indentation + /// + public bool FormattedOutput { get; set; } + + /// + /// The name of the xml root element when writing messages + /// + public string XmlWriterRootElementName + { + get { return _xmlWriterRootElementName ?? XmlFormatWriter.DefaultRootElementName; } + set { _xmlWriterRootElementName = value; } + } + + /// + /// Xml writer options + /// + public XmlWriterOptions XmlWriterOptions { get; set; } + } +} \ No newline at end of file diff --git a/src/ProtocolBuffers.Serialization/Http/ServiceExtensions.cs b/src/ProtocolBuffers.Serialization/Http/ServiceExtensions.cs new file mode 100644 index 0000000000..3ca9964a75 --- /dev/null +++ b/src/ProtocolBuffers.Serialization/Http/ServiceExtensions.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using System.Text; +using Google.ProtocolBuffers; +using System.IO; + +namespace Google.ProtocolBuffers.Serialization +{ + /// + /// Extensions for the IRpcServerStub + /// + public static class ServiceExtensions + { + /// + /// Used to implement a service endpoint on an HTTP server. This works with services generated with the + /// service_generator_type option set to IRPCDISPATCH. + /// + /// The service execution stub + /// The name of the method being invoked + /// optional arguments for the format reader/writer + /// The mime type for the input stream + /// The input stream + /// The mime type for the output stream + /// The output stream + public static void HttpCallMethod(this IRpcServerStub stub, string methodName, MessageFormatOptions options, + string contentType, Stream input, string responseType, Stream output) + { + ICodedInputStream codedInput = MessageFormatFactory.CreateInputStream(options, contentType, input); + IMessageLite response = stub.CallMethod(methodName, codedInput, options.ExtensionRegistry); + response.WriteTo(options, responseType, output); + } + } +} diff --git a/src/ProtocolBuffers.Serialization/JsonFormatReader.cs b/src/ProtocolBuffers.Serialization/JsonFormatReader.cs index d4505d709d..403367876e 100644 --- a/src/ProtocolBuffers.Serialization/JsonFormatReader.cs +++ b/src/ProtocolBuffers.Serialization/JsonFormatReader.cs @@ -101,17 +101,34 @@ namespace Google.ProtocolBuffers.Serialization } /// - /// Merges the contents of stream into the provided message builder + /// Reads the root-message preamble specific to this formatter /// - public override TBuilder Merge(TBuilder builder, ExtensionRegistry registry) + public override AbstractReader ReadStartMessage() { _input.Consume('{'); _stopChar.Push('}'); _state = ReaderState.BeginObject; - builder.WeakMergeFrom(this, registry); - _input.Consume((char) _stopChar.Pop()); + return this; + } + + /// + /// Reads the root-message close specific to this formatter + /// + public override void ReadEndMessage() + { + _input.Consume((char)_stopChar.Pop()); _state = ReaderState.EndValue; + } + + /// + /// Merges the contents of stream into the provided message builder + /// + public override TBuilder Merge(TBuilder builder, ExtensionRegistry registry) + { + AbstractReader rdr = ReadStartMessage(); + builder.WeakMergeFrom(rdr, registry); + rdr.ReadEndMessage(); return builder; } diff --git a/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs b/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs index d54507cc42..12d180d84b 100644 --- a/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs +++ b/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs @@ -444,6 +444,18 @@ namespace Google.ProtocolBuffers.Serialization /// Writes the message to the the formatted stream. /// public override void WriteMessage(IMessageLite message) + { + StartMessage(); + message.WriteTo(this); + EndMessage(); + } + + /// + /// Used to write the root-message preamble, in json this is the left-curly brace '{'. + /// After this call you can call IMessageLite.MergeTo(...) and complete the message with + /// a call to EndMessage(). + /// + public override void StartMessage() { if (_isArray) { @@ -451,7 +463,13 @@ namespace Google.ProtocolBuffers.Serialization } WriteToOutput("{"); _counter.Add(0); - message.WriteTo(this); + } + + /// + /// Used to complete a root-message previously started with a call to StartMessage() + /// + public override void EndMessage() + { _counter.RemoveAt(_counter.Count - 1); WriteLine("}"); Flush(); diff --git a/src/ProtocolBuffers.Serialization/Properties/AssemblyInfo.cs b/src/ProtocolBuffers.Serialization/Properties/AssemblyInfo.cs index fdae52b878..b6581aa4c5 100644 --- a/src/ProtocolBuffers.Serialization/Properties/AssemblyInfo.cs +++ b/src/ProtocolBuffers.Serialization/Properties/AssemblyInfo.cs @@ -65,12 +65,12 @@ using System.Runtime.CompilerServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.277")] +// [assembly: AssemblyVersion("2.3.0.369")] -[assembly: AssemblyVersion("2.3.0.277")] +[assembly: AssemblyVersion("2.3.0.369")] #if !COMPACT_FRAMEWORK_35 -[assembly: AssemblyFileVersion("2.3.0.277")] +[assembly: AssemblyFileVersion("2.3.0.369")] #endif [assembly: CLSCompliant(true)] \ No newline at end of file diff --git a/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.csproj b/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.csproj index 0c53577c38..fdbbe50326 100644 --- a/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.csproj +++ b/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.csproj @@ -98,6 +98,9 @@ + + + diff --git a/src/ProtocolBuffers.Serialization/XmlFormatReader.cs b/src/ProtocolBuffers.Serialization/XmlFormatReader.cs index cb2cb2ea70..0d3bca67f6 100644 --- a/src/ProtocolBuffers.Serialization/XmlFormatReader.cs +++ b/src/ProtocolBuffers.Serialization/XmlFormatReader.cs @@ -135,6 +135,41 @@ namespace Google.ProtocolBuffers.Serialization } } + /// + /// Reads the root-message preamble specific to this formatter + /// + public override AbstractReader ReadStartMessage() + { + return ReadStartMessage(_rootElementName); + } + + public AbstractReader ReadStartMessage(string element) + { + string field; + Assert(PeekNext(out field) && field == element); + + XmlReader child = _input.ReadSubtree(); + while (!child.IsStartElement() && child.Read()) + { + continue; + } + child.Read(); + return CloneWith(child); + } + + /// + /// Reads the root-message close specific to this formatter, MUST be called + /// on the reader obtained from ReadStartMessage(string element). + /// + public override void ReadEndMessage() + { + Assert(0 == _input.Depth); + if(_input.NodeType == XmlNodeType.EndElement) + { + _input.Read(); + } + } + /// /// Merge the provided builder as an element named in the current context /// diff --git a/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs b/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs index fd36c1de01..97fc6b2c37 100644 --- a/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs +++ b/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs @@ -112,17 +112,21 @@ namespace Google.ProtocolBuffers.Serialization } /// - /// Writes a message as an element using the name defined in + /// Used to write the root-message preamble, in xml this is open element for RootElementName, + /// by default "<root>". After this call you can call IMessageLite.MergeTo(...) and + /// complete the message with a call to EndMessage(). /// - public override void WriteMessage(IMessageLite message) + public override void StartMessage() { - WriteMessage(_rootElementName, message); + StartMessage(_rootElementName); } /// - /// Writes a message as an element with the given name + /// Used to write the root-message preamble, in xml this is open element for elementName. + /// After this call you can call IMessageLite.MergeTo(...) and complete the message with + /// a call to EndMessage(). /// - public void WriteMessage(string elementName, IMessageLite message) + public void StartMessage(string elementName) { if (TestOption(XmlWriterOptions.OutputJsonTypes)) { @@ -133,12 +137,35 @@ namespace Google.ProtocolBuffers.Serialization { _output.WriteStartElement(elementName); } + } - message.WriteTo(this); + /// + /// Used to complete a root-message previously started with a call to StartMessage() + /// + public override void EndMessage() + { _output.WriteEndElement(); _output.Flush(); } + /// + /// Writes a message as an element using the name defined in + /// + public override void WriteMessage(IMessageLite message) + { + WriteMessage(_rootElementName, message); + } + + /// + /// Writes a message as an element with the given name + /// + public void WriteMessage(string elementName, IMessageLite message) + { + StartMessage(elementName); + message.WriteTo(this); + EndMessage(); + } + /// /// Writes a message /// diff --git a/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs b/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs index 9c51aca609..a324c105e9 100644 --- a/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs +++ b/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs @@ -12,7 +12,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ProtocolBuffers.Test")] -[assembly: AssemblyCopyright("Copyright © 2008")] +[assembly: AssemblyCopyright("Copyright � 2008")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -35,10 +35,10 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.277")] +// [assembly: AssemblyVersion("2.3.0.369")] -[assembly: AssemblyVersion("2.3.0.277")] -[assembly: AssemblyFileVersion("2.3.0.277")] +[assembly: AssemblyVersion("2.3.0.369")] +[assembly: AssemblyFileVersion("2.3.0.369")] // We don't really need CLSCompliance, but if the assembly builds with no warnings, // that means the generator is okay. diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs index ff726d65de..076de4ffbd 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestCSharpOptionsProtoFile { #region Extension registration @@ -58,7 +58,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class OptionsMessage : pb::GeneratedMessage { private static readonly OptionsMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionsMessageFieldNames = new string[] { "customized", "normal", "options_message" }; @@ -195,7 +195,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs index 0b1be422a6..427b1ade85 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestCustomOptionsProtoFile { #region Extension registration @@ -387,7 +387,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum MethodOpt1 { METHODOPT1_VAL1 = 1, METHODOPT1_VAL2 = 2, @@ -398,7 +398,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestMessageWithCustomOptions : pb::GeneratedMessage { private static readonly TestMessageWithCustomOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageWithCustomOptionsFieldNames = new string[] { "field1" }; @@ -426,10 +426,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum AnEnum { ANENUM_VAL1 = 1, ANENUM_VAL2 = 2, @@ -518,7 +518,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -653,7 +653,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class CustomOptionFooRequest : pb::GeneratedMessage { private static readonly CustomOptionFooRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _customOptionFooRequestFieldNames = new string[] { }; @@ -742,7 +742,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -851,7 +851,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class CustomOptionFooResponse : pb::GeneratedMessage { private static readonly CustomOptionFooResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _customOptionFooResponseFieldNames = new string[] { }; @@ -940,7 +940,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1049,7 +1049,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class DummyMessageContainingEnum : pb::GeneratedMessage { private static readonly DummyMessageContainingEnum defaultInstance = new Builder().BuildPartial(); private static readonly string[] _dummyMessageContainingEnumFieldNames = new string[] { }; @@ -1077,10 +1077,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum TestEnumType { TEST_OPTION_ENUM_TYPE1 = 22, TEST_OPTION_ENUM_TYPE2 = -23, @@ -1153,7 +1153,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1262,7 +1262,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class DummyMessageInvalidAsOptionType : pb::GeneratedMessage { private static readonly DummyMessageInvalidAsOptionType defaultInstance = new Builder().BuildPartial(); private static readonly string[] _dummyMessageInvalidAsOptionTypeFieldNames = new string[] { }; @@ -1351,7 +1351,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1460,7 +1460,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class CustomOptionMinIntegerValues : pb::GeneratedMessage { private static readonly CustomOptionMinIntegerValues defaultInstance = new Builder().BuildPartial(); private static readonly string[] _customOptionMinIntegerValuesFieldNames = new string[] { }; @@ -1549,7 +1549,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1658,7 +1658,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class CustomOptionMaxIntegerValues : pb::GeneratedMessage { private static readonly CustomOptionMaxIntegerValues defaultInstance = new Builder().BuildPartial(); private static readonly string[] _customOptionMaxIntegerValuesFieldNames = new string[] { }; @@ -1747,7 +1747,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1856,7 +1856,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class CustomOptionOtherValues : pb::GeneratedMessage { private static readonly CustomOptionOtherValues defaultInstance = new Builder().BuildPartial(); private static readonly string[] _customOptionOtherValuesFieldNames = new string[] { }; @@ -1945,7 +1945,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -2054,7 +2054,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class SettingRealsFromPositiveInts : pb::GeneratedMessage { private static readonly SettingRealsFromPositiveInts defaultInstance = new Builder().BuildPartial(); private static readonly string[] _settingRealsFromPositiveIntsFieldNames = new string[] { }; @@ -2143,7 +2143,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -2252,7 +2252,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class SettingRealsFromNegativeInts : pb::GeneratedMessage { private static readonly SettingRealsFromNegativeInts defaultInstance = new Builder().BuildPartial(); private static readonly string[] _settingRealsFromNegativeIntsFieldNames = new string[] { }; @@ -2341,7 +2341,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -2450,7 +2450,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class ComplexOptionType1 : pb::ExtendableMessage { private static readonly ComplexOptionType1 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOptionType1FieldNames = new string[] { "foo", "foo2", "foo3" }; @@ -2591,7 +2591,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -2776,7 +2776,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class ComplexOptionType2 : pb::ExtendableMessage { private static readonly ComplexOptionType2 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOptionType2FieldNames = new string[] { "bar", "baz", "fred" }; @@ -2804,11 +2804,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class ComplexOptionType4 : pb::GeneratedMessage { private static readonly ComplexOptionType4 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOptionType4FieldNames = new string[] { "waldo" }; @@ -2915,7 +2915,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3169,7 +3169,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3400,7 +3400,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class ComplexOptionType3 : pb::GeneratedMessage { private static readonly ComplexOptionType3 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOptionType3FieldNames = new string[] { "complexoptiontype5", "qux" }; @@ -3428,11 +3428,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class ComplexOptionType5 : pb::GeneratedMessage { private static readonly ComplexOptionType5 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOptionType5FieldNames = new string[] { "plugh" }; @@ -3537,7 +3537,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3768,7 +3768,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3950,7 +3950,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class ComplexOpt6 : pb::GeneratedMessage { private static readonly ComplexOpt6 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOpt6FieldNames = new string[] { "xyzzy" }; @@ -4055,7 +4055,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -4189,7 +4189,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class VariousComplexOptions : pb::GeneratedMessage { private static readonly VariousComplexOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _variousComplexOptionsFieldNames = new string[] { }; @@ -4278,7 +4278,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs index 09ecdd63d4..53f5a2b573 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestEmbedOptimizeForProtoFile { #region Extension registration @@ -62,7 +62,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestEmbedOptimizedForSize : pb::GeneratedMessage { private static readonly TestEmbedOptimizedForSize defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testEmbedOptimizedForSizeFieldNames = new string[] { "optional_message", "repeated_message" }; @@ -191,7 +191,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmptyProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmptyProtoFile.cs index eb6c6c74aa..c3544f21a3 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmptyProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmptyProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestEmptyProtoFile { #region Extension registration diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs index db56e8b919..0f66e5d666 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestExtrasIssuesProtoFile { #region Extension registration @@ -75,7 +75,7 @@ namespace UnitTest.Issues.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class A : pb::GeneratedMessage { private static readonly A defaultInstance = new Builder().BuildPartial(); private static readonly string[] _aFieldNames = new string[] { "_A" }; @@ -180,7 +180,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -314,7 +314,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class B : pb::GeneratedMessage { private static readonly B defaultInstance = new Builder().BuildPartial(); private static readonly string[] _bFieldNames = new string[] { "B_" }; @@ -419,7 +419,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -553,7 +553,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class AB : pb::GeneratedMessage { private static readonly AB defaultInstance = new Builder().BuildPartial(); private static readonly string[] _aBFieldNames = new string[] { "a_b" }; @@ -658,7 +658,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -792,7 +792,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class NumberField : pb::GeneratedMessage { private static readonly NumberField defaultInstance = new Builder().BuildPartial(); private static readonly string[] _numberFieldFieldNames = new string[] { "_01" }; @@ -899,7 +899,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs index 9227c7cc40..f21475ad43 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestGenericServices { #region Extension registration @@ -62,7 +62,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Services [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public abstract class TestGenericService : pb::IService { public abstract void Foo( pb::IRpcController controller, @@ -141,7 +141,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public class Stub : global::Google.ProtocolBuffers.TestProtos.TestGenericService { internal Stub(pb::IRpcChannel channel) { this.channel = channel; @@ -174,7 +174,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public abstract class TestGenericServiceWithCustomOptions : pb::IService { public abstract void Foo( pb::IRpcController controller, @@ -240,7 +240,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public class Stub : global::Google.ProtocolBuffers.TestProtos.TestGenericServiceWithCustomOptions { internal Stub(pb::IRpcChannel channel) { this.channel = channel; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs index 77635f2132..83250c1eb8 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestGoogleSizeProtoFile { #region Extension registration @@ -135,7 +135,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class SizeMessage1 : pb::GeneratedMessage { private static readonly SizeMessage1 defaultInstance = new Builder().BuildPartial(); public static SizeMessage1 DefaultInstance { @@ -611,7 +611,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1436,7 +1436,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class SizeMessage1SubMessage : pb::GeneratedMessage { private static readonly SizeMessage1SubMessage defaultInstance = new Builder().BuildPartial(); public static SizeMessage1SubMessage DefaultInstance { @@ -1702,7 +1702,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -2119,7 +2119,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class SizeMessage2 : pb::GeneratedMessage { private static readonly SizeMessage2 defaultInstance = new Builder().BuildPartial(); public static SizeMessage2 DefaultInstance { @@ -2145,11 +2145,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Group1 : pb::GeneratedMessage { private static readonly Group1 defaultInstance = new Builder().BuildPartial(); public static Group1 DefaultInstance { @@ -2378,7 +2378,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3118,7 +3118,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3760,7 +3760,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class SizeMessage2GroupedMessage : pb::GeneratedMessage { private static readonly SizeMessage2GroupedMessage defaultInstance = new Builder().BuildPartial(); public static SizeMessage2GroupedMessage DefaultInstance { @@ -3932,7 +3932,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs index 918be643ec..15a3aa49e0 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestGoogleSpeedProtoFile { #region Extension registration @@ -135,7 +135,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class SpeedMessage1 : pb::GeneratedMessage { private static readonly SpeedMessage1 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _speedMessage1FieldNames = new string[] { "field1", "field100", "field101", "field102", "field103", "field104", "field12", "field128", "field129", "field13", "field130", "field131", "field14", "field15", "field150", "field16", "field17", "field18", "field2", "field22", "field23", "field24", "field25", "field271", "field272", "field280", "field29", "field3", "field30", "field4", "field5", "field59", "field6", "field60", "field67", "field68", "field7", "field78", "field80", "field81", "field9" }; @@ -890,7 +890,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -2070,7 +2070,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class SpeedMessage1SubMessage : pb::GeneratedMessage { private static readonly SpeedMessage1SubMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _speedMessage1SubMessageFieldNames = new string[] { "field1", "field12", "field13", "field14", "field15", "field16", "field19", "field2", "field20", "field203", "field204", "field205", "field206", "field207", "field21", "field22", "field23", "field28", "field3", "field300" }; @@ -2483,7 +2483,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3102,7 +3102,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class SpeedMessage2 : pb::GeneratedMessage { private static readonly SpeedMessage2 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _speedMessage2FieldNames = new string[] { "field1", "field109", "field127", "field128", "field129", "field130", "field131", "field2", "field205", "field206", "field21", "field210", "field211", "field212", "field213", "field216", "field217", "field218", "field220", "field221", "field222", "field25", "field3", "field30", "field4", "field6", "field63", "field71", "field75", "group1" }; @@ -3130,11 +3130,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Group1 : pb::GeneratedMessage { private static readonly Group1 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _group1FieldNames = new string[] { "field11", "field12", "field13", "field14", "field15", "field16", "field20", "field22", "field24", "field26", "field27", "field28", "field29", "field31", "field5", "field73" }; @@ -3503,7 +3503,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -4643,7 +4643,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5558,7 +5558,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class SpeedMessage2GroupedMessage : pb::GeneratedMessage { private static readonly SpeedMessage2GroupedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _speedMessage2GroupedMessageFieldNames = new string[] { "field1", "field10", "field11", "field2", "field3", "field4", "field5", "field6", "field7", "field8", "field9" }; @@ -5823,7 +5823,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs index a96833bef0..4702794028 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestImportLiteProtoFile { #region Extension registration @@ -29,7 +29,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum ImportEnumLite { IMPORT_LITE_FOO = 7, IMPORT_LITE_BAR = 8, @@ -41,7 +41,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class ImportMessageLite : pb::GeneratedMessageLite { private static readonly ImportMessageLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _importMessageLiteFieldNames = new string[] { "d" }; @@ -155,7 +155,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs index 5749c97f88..ac745a7fbd 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestImportProtoFile { #region Extension registration @@ -57,7 +57,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum ImportEnum { IMPORT_FOO = 7, IMPORT_BAR = 8, @@ -69,7 +69,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class ImportMessage : pb::GeneratedMessage { private static readonly ImportMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _importMessageFieldNames = new string[] { "d" }; @@ -174,7 +174,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs index 8a6bb58929..9302d5ac07 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestMessageSetProtoFile { #region Extension registration @@ -101,7 +101,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestMessageSet : pb::ExtendableMessage { private static readonly TestMessageSet defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageSetFieldNames = new string[] { }; @@ -194,7 +194,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -304,7 +304,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestMessageSetContainer : pb::GeneratedMessage { private static readonly TestMessageSetContainer defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageSetContainerFieldNames = new string[] { "message_set" }; @@ -409,7 +409,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -566,7 +566,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestMessageSetExtension1 : pb::GeneratedMessage { private static readonly TestMessageSetExtension1 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageSetExtension1FieldNames = new string[] { "i" }; @@ -673,7 +673,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -807,7 +807,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestMessageSetExtension2 : pb::GeneratedMessage { private static readonly TestMessageSetExtension2 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageSetExtension2FieldNames = new string[] { "str" }; @@ -914,7 +914,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1049,7 +1049,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class RawMessageSet : pb::GeneratedMessage { private static readonly RawMessageSet defaultInstance = new Builder().BuildPartial(); private static readonly string[] _rawMessageSetFieldNames = new string[] { "item" }; @@ -1077,11 +1077,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Item : pb::GeneratedMessage { private static readonly Item defaultInstance = new Builder().BuildPartial(); private static readonly string[] _itemFieldNames = new string[] { "message", "type_id" }; @@ -1204,7 +1204,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1447,7 +1447,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs index 74d6af60eb..6b6aa7e2a4 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestNoGenericServicesProtoFile { #region Extension registration @@ -69,7 +69,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum TestEnum { FOO = 1, } @@ -79,7 +79,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestMessage : pb::ExtendableMessage { private static readonly TestMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageFieldNames = new string[] { "a" }; @@ -188,7 +188,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs index c7153abc4c..c1ab93ff8c 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestOptimizeForProtoFile { #region Extension registration @@ -83,7 +83,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestOptimizedForSize : pb::ExtendableMessage { private static readonly TestOptimizedForSize defaultInstance = new Builder().BuildPartial(); public static TestOptimizedForSize DefaultInstance { @@ -169,7 +169,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -270,7 +270,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestRequiredOptimizedForSize : pb::GeneratedMessage { private static readonly TestRequiredOptimizedForSize defaultInstance = new Builder().BuildPartial(); public static TestRequiredOptimizedForSize DefaultInstance { @@ -342,7 +342,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -407,7 +407,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestOptionalOptimizedForSize : pb::GeneratedMessage { private static readonly TestOptionalOptimizedForSize defaultInstance = new Builder().BuildPartial(); public static TestOptionalOptimizedForSize DefaultInstance { @@ -479,7 +479,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs index d8824d49a4..f46ec30148 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestProtoFile { #region Extension registration @@ -1086,7 +1086,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum ForeignEnum { FOREIGN_FOO = 4, FOREIGN_BAR = 5, @@ -1094,7 +1094,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum TestEnumWithDupValue { FOO1 = 1, BAR1 = 2, @@ -1104,7 +1104,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum TestSparseEnum { SPARSE_A = 123, SPARSE_B = 62374, @@ -1120,7 +1120,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestAllTypes : pb::GeneratedMessage { private static readonly TestAllTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllTypesFieldNames = new string[] { "default_bool", "default_bytes", "default_cord", "default_double", "default_fixed32", "default_fixed64", "default_float", "default_foreign_enum", "default_import_enum", "default_int32", "default_int64", "default_nested_enum", "default_sfixed32", "default_sfixed64", "default_sint32", "default_sint64", "default_string", "default_string_piece", "default_uint32", "default_uint64", "optional_bool", "optional_bytes", "optional_cord", "optional_double", "optional_fixed32", "optional_fixed64", "optional_float", "optional_foreign_enum", "optional_foreign_message", "optional_import_enum", "optional_import_message", "optional_int32", "optional_int64", "optional_nested_enum", "optional_nested_message", "optional_sfixed32", "optional_sfixed64", "optional_sint32", "optional_sint64", "optional_string", "optional_string_piece", "optional_uint32", "optional_uint64", "optionalgroup", "repeated_bool", "repeated_bytes", "repeated_cord", "repeated_double", "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_foreign_enum", "repeated_foreign_message", "repeated_import_enum", "repeated_import_message", "repeated_int32", "repeated_int64", "repeated_nested_enum", "repeated_nested_message", "repeated_sfixed32", "repeated_sfixed64", "repeated_sint32", "repeated_sint64", "repeated_string", "repeated_string_piece", "repeated_uint32", "repeated_uint64", "repeatedgroup" }; @@ -1148,10 +1148,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum NestedEnum { FOO = 1, BAR = 2, @@ -1160,7 +1160,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class NestedMessage : pb::GeneratedMessage { private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _nestedMessageFieldNames = new string[] { "bb" }; @@ -1265,7 +1265,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1399,7 +1399,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class OptionalGroup : pb::GeneratedMessage { private static readonly OptionalGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupFieldNames = new string[] { "a" }; @@ -1504,7 +1504,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1638,7 +1638,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class RepeatedGroup : pb::GeneratedMessage { private static readonly RepeatedGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupFieldNames = new string[] { "a" }; @@ -1743,7 +1743,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3186,7 +3186,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5494,7 +5494,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestDeprecatedFields : pb::GeneratedMessage { private static readonly TestDeprecatedFields defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDeprecatedFieldsFieldNames = new string[] { "deprecated_int32" }; @@ -5599,7 +5599,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5733,7 +5733,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class ForeignMessage : pb::GeneratedMessage { private static readonly ForeignMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _foreignMessageFieldNames = new string[] { "c" }; @@ -5838,7 +5838,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5972,7 +5972,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestAllExtensions : pb::ExtendableMessage { private static readonly TestAllExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllExtensionsFieldNames = new string[] { }; @@ -6065,7 +6065,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6175,7 +6175,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class OptionalGroup_extension : pb::GeneratedMessage { private static readonly OptionalGroup_extension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupExtensionFieldNames = new string[] { "a" }; @@ -6280,7 +6280,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6414,7 +6414,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class RepeatedGroup_extension : pb::GeneratedMessage { private static readonly RepeatedGroup_extension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupExtensionFieldNames = new string[] { "a" }; @@ -6519,7 +6519,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6653,7 +6653,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestNestedExtension : pb::GeneratedMessage { private static readonly TestNestedExtension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testNestedExtensionFieldNames = new string[] { }; @@ -6744,7 +6744,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6853,7 +6853,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestRequired : pb::GeneratedMessage { private static readonly TestRequired defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRequiredFieldNames = new string[] { "a", "b", "c", "dummy10", "dummy11", "dummy12", "dummy13", "dummy14", "dummy15", "dummy16", "dummy17", "dummy18", "dummy19", "dummy2", "dummy20", "dummy21", "dummy22", "dummy23", "dummy24", "dummy25", "dummy26", "dummy27", "dummy28", "dummy29", "dummy30", "dummy31", "dummy32", "dummy4", "dummy5", "dummy6", "dummy7", "dummy8", "dummy9" }; @@ -7477,7 +7477,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -8411,7 +8411,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestRequiredForeign : pb::GeneratedMessage { private static readonly TestRequiredForeign defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRequiredForeignFieldNames = new string[] { "dummy", "optional_message", "repeated_message" }; @@ -8556,7 +8556,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -8784,7 +8784,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestForeignNested : pb::GeneratedMessage { private static readonly TestForeignNested defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testForeignNestedFieldNames = new string[] { "foreign_nested" }; @@ -8889,7 +8889,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9046,7 +9046,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestEmptyMessage : pb::GeneratedMessage { private static readonly TestEmptyMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testEmptyMessageFieldNames = new string[] { }; @@ -9135,7 +9135,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9244,7 +9244,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestEmptyMessageWithExtensions : pb::ExtendableMessage { private static readonly TestEmptyMessageWithExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testEmptyMessageWithExtensionsFieldNames = new string[] { }; @@ -9337,7 +9337,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9447,7 +9447,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestMultipleExtensionRanges : pb::ExtendableMessage { private static readonly TestMultipleExtensionRanges defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMultipleExtensionRangesFieldNames = new string[] { }; @@ -9542,7 +9542,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9652,7 +9652,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestReallyLargeTagNumber : pb::GeneratedMessage { private static readonly TestReallyLargeTagNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testReallyLargeTagNumberFieldNames = new string[] { "a", "bb" }; @@ -9773,7 +9773,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9932,7 +9932,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestRecursiveMessage : pb::GeneratedMessage { private static readonly TestRecursiveMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRecursiveMessageFieldNames = new string[] { "a", "i" }; @@ -10053,7 +10053,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -10235,7 +10235,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestMutualRecursionA : pb::GeneratedMessage { private static readonly TestMutualRecursionA defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMutualRecursionAFieldNames = new string[] { "bb" }; @@ -10340,7 +10340,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -10497,7 +10497,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestMutualRecursionB : pb::GeneratedMessage { private static readonly TestMutualRecursionB defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMutualRecursionBFieldNames = new string[] { "a", "optional_int32" }; @@ -10618,7 +10618,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -10800,7 +10800,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestDupFieldNumber : pb::GeneratedMessage { private static readonly TestDupFieldNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDupFieldNumberFieldNames = new string[] { "a", "bar", "foo" }; @@ -10828,11 +10828,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Foo : pb::GeneratedMessage { private static readonly Foo defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooFieldNames = new string[] { "a" }; @@ -10937,7 +10937,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -11071,7 +11071,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Bar : pb::GeneratedMessage { private static readonly Bar defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barFieldNames = new string[] { "a" }; @@ -11176,7 +11176,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -11423,7 +11423,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -11653,7 +11653,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestNestedMessageHasBits : pb::GeneratedMessage { private static readonly TestNestedMessageHasBits defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testNestedMessageHasBitsFieldNames = new string[] { "optional_nested_message" }; @@ -11681,11 +11681,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class NestedMessage : pb::GeneratedMessage { private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _nestedMessageFieldNames = new string[] { "nestedmessage_repeated_foreignmessage", "nestedmessage_repeated_int32" }; @@ -11815,7 +11815,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -12086,7 +12086,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -12243,7 +12243,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestCamelCaseFieldNames : pb::GeneratedMessage { private static readonly TestCamelCaseFieldNames defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testCamelCaseFieldNamesFieldNames = new string[] { "CordField", "EnumField", "MessageField", "PrimitiveField", "RepeatedCordField", "RepeatedEnumField", "RepeatedMessageField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedStringPieceField", "StringField", "StringPieceField" }; @@ -12563,7 +12563,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -13089,7 +13089,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestFieldOrderings : pb::ExtendableMessage { private static readonly TestFieldOrderings defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testFieldOrderingsFieldNames = new string[] { "my_float", "my_int", "my_string" }; @@ -13231,7 +13231,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -13417,7 +13417,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestExtremeDefaultValues : pb::GeneratedMessage { private static readonly TestExtremeDefaultValues defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testExtremeDefaultValuesFieldNames = new string[] { "escaped_bytes", "inf_double", "inf_float", "large_float", "large_uint32", "large_uint64", "nan_double", "nan_float", "neg_inf_double", "neg_inf_float", "negative_float", "negative_one_float", "one_float", "small_float", "small_int32", "small_int64", "small_negative_float", "utf8_string", "zero_float" }; @@ -13812,7 +13812,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -14402,7 +14402,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class OneString : pb::GeneratedMessage { private static readonly OneString defaultInstance = new Builder().BuildPartial(); private static readonly string[] _oneStringFieldNames = new string[] { "data" }; @@ -14507,7 +14507,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -14642,7 +14642,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class OneBytes : pb::GeneratedMessage { private static readonly OneBytes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _oneBytesFieldNames = new string[] { "data" }; @@ -14747,7 +14747,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -14882,7 +14882,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestPackedTypes : pb::GeneratedMessage { private static readonly TestPackedTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedTypesFieldNames = new string[] { "packed_bool", "packed_double", "packed_enum", "packed_fixed32", "packed_fixed64", "packed_float", "packed_int32", "packed_int64", "packed_sfixed32", "packed_sfixed64", "packed_sint32", "packed_sint64", "packed_uint32", "packed_uint64" }; @@ -15344,7 +15344,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -15972,7 +15972,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestUnpackedTypes : pb::GeneratedMessage { private static readonly TestUnpackedTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedTypesFieldNames = new string[] { "unpacked_bool", "unpacked_double", "unpacked_enum", "unpacked_fixed32", "unpacked_fixed64", "unpacked_float", "unpacked_int32", "unpacked_int64", "unpacked_sfixed32", "unpacked_sfixed64", "unpacked_sint32", "unpacked_sint64", "unpacked_uint32", "unpacked_uint64" }; @@ -16379,7 +16379,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -17007,7 +17007,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestPackedExtensions : pb::ExtendableMessage { private static readonly TestPackedExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedExtensionsFieldNames = new string[] { }; @@ -17100,7 +17100,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -17210,7 +17210,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestUnpackedExtensions : pb::ExtendableMessage { private static readonly TestUnpackedExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedExtensionsFieldNames = new string[] { }; @@ -17303,7 +17303,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -17413,7 +17413,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestDynamicExtensions : pb::GeneratedMessage { private static readonly TestDynamicExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDynamicExtensionsFieldNames = new string[] { "dynamic_enum_extension", "dynamic_message_extension", "enum_extension", "message_extension", "packed_extension", "repeated_extension", "scalar_extension" }; @@ -17441,10 +17441,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum DynamicEnumType { DYNAMIC_FOO = 2200, DYNAMIC_BAR = 2201, @@ -17453,7 +17453,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class DynamicMessageType : pb::GeneratedMessage { private static readonly DynamicMessageType defaultInstance = new Builder().BuildPartial(); private static readonly string[] _dynamicMessageTypeFieldNames = new string[] { "dynamic_field" }; @@ -17558,7 +17558,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -17888,7 +17888,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -18257,7 +18257,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::GeneratedMessage { private static readonly TestRepeatedScalarDifferentTagSizes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRepeatedScalarDifferentTagSizesFieldNames = new string[] { "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_int32", "repeated_int64", "repeated_uint64" }; @@ -18484,7 +18484,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -18818,7 +18818,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class FooRequest : pb::GeneratedMessage { private static readonly FooRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooRequestFieldNames = new string[] { }; @@ -18907,7 +18907,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -19016,7 +19016,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class FooResponse : pb::GeneratedMessage { private static readonly FooResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooResponseFieldNames = new string[] { }; @@ -19105,7 +19105,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -19214,7 +19214,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class BarRequest : pb::GeneratedMessage { private static readonly BarRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barRequestFieldNames = new string[] { }; @@ -19303,7 +19303,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -19412,7 +19412,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class BarResponse : pb::GeneratedMessage { private static readonly BarResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barResponseFieldNames = new string[] { }; @@ -19501,7 +19501,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs index ae309fa706..55d1fdacb0 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestRpcInterop { #region Extension registration @@ -81,7 +81,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class SearchRequest : pb::GeneratedMessage { private static readonly SearchRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _searchRequestFieldNames = new string[] { "Criteria" }; @@ -193,7 +193,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -338,7 +338,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class SearchResponse : pb::GeneratedMessage { private static readonly SearchResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _searchResponseFieldNames = new string[] { "results" }; @@ -366,11 +366,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class ResultItem : pb::GeneratedMessage { private static readonly ResultItem defaultInstance = new Builder().BuildPartial(); private static readonly string[] _resultItemFieldNames = new string[] { "name", "url" }; @@ -492,7 +492,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -739,7 +739,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -894,7 +894,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class RefineSearchRequest : pb::GeneratedMessage { private static readonly RefineSearchRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _refineSearchRequestFieldNames = new string[] { "Criteria", "previous_results" }; @@ -1024,7 +1024,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1220,7 +1220,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Services [global::System.Runtime.InteropServices.GuidAttribute("a65f0925-fd11-4f94-b166-89ac4f027205")] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public partial interface ISearchService { [global::System.Runtime.InteropServices.DispId(5)] global::Google.ProtocolBuffers.TestProtos.SearchResponse Search(global::Google.ProtocolBuffers.TestProtos.SearchRequest searchRequest); @@ -1230,7 +1230,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.CLSCompliant(false)] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public partial class SearchService : ISearchService, pb::IRpcDispatch, global::System.IDisposable { private readonly bool dispose; private readonly pb::IRpcDispatch dispatch; @@ -1260,7 +1260,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.CLSCompliant(false)] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public partial class Dispatch : pb::IRpcDispatch, global::System.IDisposable { private readonly bool dispose; private readonly ISearchService implementation; @@ -1288,7 +1288,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.CLSCompliant(false)] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public partial class ServerStub : pb::IRpcServerStub, global::System.IDisposable { private readonly bool dispose; private readonly pb::IRpcDispatch implementation; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs index 3d818a6082..c9f5ebdfeb 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestXmlSerializerTestProtoFile { #region Extension registration @@ -124,7 +124,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum EnumOptions { ONE = 0, TWO = 1, @@ -136,7 +136,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestXmlChild : pb::GeneratedMessage { private static readonly TestXmlChild defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testXmlChildFieldNames = new string[] { "binary", "options" }; @@ -266,7 +266,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -445,7 +445,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestXmlNoFields : pb::GeneratedMessage { private static readonly TestXmlNoFields defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testXmlNoFieldsFieldNames = new string[] { }; @@ -534,7 +534,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -643,7 +643,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestXmlRescursive : pb::GeneratedMessage { private static readonly TestXmlRescursive defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testXmlRescursiveFieldNames = new string[] { "child" }; @@ -748,7 +748,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -905,7 +905,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestXmlMessage : pb::ExtendableMessage { private static readonly TestXmlMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testXmlMessageFieldNames = new string[] { "child", "children", "number", "numbers", "text", "textlines", "valid" }; @@ -933,11 +933,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Children : pb::GeneratedMessage { private static readonly Children defaultInstance = new Builder().BuildPartial(); private static readonly string[] _childrenFieldNames = new string[] { "binary", "options" }; @@ -1067,7 +1067,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1443,7 +1443,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1794,7 +1794,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestXmlExtension : pb::GeneratedMessage { private static readonly TestXmlExtension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testXmlExtensionFieldNames = new string[] { "number" }; @@ -1900,7 +1900,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestWriterFormatJson.cs b/src/ProtocolBuffers.Test/TestWriterFormatJson.cs index 3f534fc036..341f0b3ceb 100644 --- a/src/ProtocolBuffers.Test/TestWriterFormatJson.cs +++ b/src/ProtocolBuffers.Test/TestWriterFormatJson.cs @@ -10,6 +10,70 @@ namespace Google.ProtocolBuffers [TestFixture] public class TestWriterFormatJson { + [Test] + public void Example_FromJson() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + + builder.MergeFromJson(@"{""valid"":true}"); + + TestXmlMessage message = builder.Build(); + Assert.AreEqual(true, message.Valid); + } + + [Test] + public void Example_ToJson() + { + TestXmlMessage message = + TestXmlMessage.CreateBuilder() + .SetValid(true) + .Build(); + + string json = message.ToJson(); + + Assert.AreEqual(@"{""valid"":true}", json); + } + + [Test] + public void Example_WriteJsonUsingICodedOutputStream() + { + TestXmlMessage message = + TestXmlMessage.CreateBuilder() + .SetValid(true) + .Build(); + + using (TextWriter output = new StringWriter()) + using (AbstractWriter writer = JsonFormatWriter.CreateInstance(output)) + { + writer.StartMessage(); //manually begin the message, output is '{' + + writer.Flush(); + Assert.AreEqual("{", output.ToString()); + + ICodedOutputStream stream = writer; + message.WriteTo(stream); //write the message normally + + writer.Flush(); + Assert.AreEqual(@"{""valid"":true", output.ToString()); + + writer.EndMessage(); //manually write the end message '}' + Assert.AreEqual(@"{""valid"":true}", output.ToString()); + } + } + + [Test] + public void Example_ReadJsonUsingICodedInputStream() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + AbstractReader reader = JsonFormatReader.CreateInstance(@"{""valid"":true}"); + + AbstractReader stream = reader.ReadStartMessage(); //manually read the begin the message '{' + + builder.MergeFrom(stream); //write the message normally + + stream.ReadEndMessage(); //manually read the end message '}' + } + protected string Content; [System.Diagnostics.DebuggerNonUserCode] protected void FormatterAssert(TMessage message, params string[] expecting) where TMessage : IMessageLite diff --git a/src/ProtocolBuffers.Test/TestWriterFormatXml.cs b/src/ProtocolBuffers.Test/TestWriterFormatXml.cs index 2ffca9fbde..d56cc52525 100644 --- a/src/ProtocolBuffers.Test/TestWriterFormatXml.cs +++ b/src/ProtocolBuffers.Test/TestWriterFormatXml.cs @@ -12,6 +12,65 @@ namespace Google.ProtocolBuffers [TestFixture] public class TestWriterFormatXml { + [Test] + public void Example_FromXml() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + + XmlReader rdr = XmlReader.Create(new StringReader(@"true")); + builder.MergeFromXml(rdr); + + TestXmlMessage message = builder.Build(); + Assert.AreEqual(true, message.Valid); + } + + [Test] + public void Example_ToXml() + { + TestXmlMessage message = + TestXmlMessage.CreateBuilder() + .SetValid(true) + .Build(); + + string Xml = message.ToXml(); + + Assert.AreEqual(@"true", Xml); + } + + [Test] + public void Example_WriteXmlUsingICodedOutputStream() + { + TestXmlMessage message = + TestXmlMessage.CreateBuilder() + .SetValid(true) + .Build(); + + using (TextWriter output = new StringWriter()) + using (AbstractWriter writer = XmlFormatWriter.CreateInstance(output)) + { + writer.StartMessage(); //manually begin the message, output is '{' + + ICodedOutputStream stream = writer; + message.WriteTo(stream); //write the message normally + + writer.EndMessage(); //manually write the end message '}' + Assert.AreEqual(@"true", output.ToString()); + } + } + + [Test] + public void Example_ReadXmlUsingICodedInputStream() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + AbstractReader reader = XmlFormatReader.CreateInstance(@"true"); + + AbstractReader stream = reader.ReadStartMessage(); //manually read the begin the message '{' + + builder.MergeFrom(stream); //write the message normally + + stream.ReadEndMessage(); //manually read the end message '}' + } + [Test] public void TestToXmlParseFromXml() { @@ -324,6 +383,19 @@ namespace Google.ProtocolBuffers TestXmlMessage copy = rdr.Merge(TestXmlMessage.CreateBuilder(), registry).Build(); Assert.AreEqual(message, copy); } + [Test] + public void TestXmlReadEmptyRoot() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + AbstractReader reader = XmlFormatReader.CreateInstance(@""); + + AbstractReader stream = reader.ReadStartMessage(); //manually read the begin the message '{' + + builder.MergeFrom(stream); //write the message normally + + stream.ReadEndMessage(); //manually read the end message '}' + } + [Test, ExpectedException(typeof(RecursionLimitExceededException))] public void TestRecursiveLimit() { diff --git a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs index 853b0e7d09..98fb3dfe91 100644 --- a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs +++ b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class CSharpOptions { #region Extension registration @@ -110,7 +110,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum CSharpServiceType { NONE = 0, GENERIC = 1, @@ -123,7 +123,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class CSharpFileOptions : pb::GeneratedMessage { private static readonly CSharpFileOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _cSharpFileOptionsFieldNames = new string[] { "cls_compliance", "code_contracts", "expand_namespace_directories", "file_extension", "ignore_google_protobuf", "multiple_files", "namespace", "nest_classes", "output_directory", "public_classes", "service_generator_type", "umbrella_classname", "umbrella_namespace" }; @@ -420,7 +420,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -867,7 +867,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class CSharpFieldOptions : pb::GeneratedMessage { private static readonly CSharpFieldOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _cSharpFieldOptionsFieldNames = new string[] { "property_name" }; @@ -972,7 +972,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1107,7 +1107,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class CSharpServiceOptions : pb::GeneratedMessage { private static readonly CSharpServiceOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _cSharpServiceOptionsFieldNames = new string[] { "interface_id" }; @@ -1212,7 +1212,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1347,7 +1347,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class CSharpMethodOptions : pb::GeneratedMessage { private static readonly CSharpMethodOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _cSharpMethodOptionsFieldNames = new string[] { "dispatch_id" }; @@ -1452,7 +1452,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs index 5b48cde198..78c37ead33 100644 --- a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs +++ b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class DescriptorProtoFile { #region Extension registration @@ -231,7 +231,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class FileDescriptorSet : pb::GeneratedMessage { private static readonly FileDescriptorSet defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fileDescriptorSetFieldNames = new string[] { "file" }; @@ -341,7 +341,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -496,7 +496,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class FileDescriptorProto : pb::GeneratedMessage { private static readonly FileDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fileDescriptorProtoFieldNames = new string[] { "dependency", "enum_type", "extension", "message_type", "name", "options", "package", "service" }; @@ -743,7 +743,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1172,7 +1172,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class DescriptorProto : pb::GeneratedMessage { private static readonly DescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _descriptorProtoFieldNames = new string[] { "enum_type", "extension", "extension_range", "field", "name", "nested_type", "options" }; @@ -1200,11 +1200,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class ExtensionRange : pb::GeneratedMessage { private static readonly ExtensionRange defaultInstance = new Builder().BuildPartial(); private static readonly string[] _extensionRangeFieldNames = new string[] { "end", "start" }; @@ -1325,7 +1325,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1686,7 +1686,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -2099,7 +2099,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class FieldDescriptorProto : pb::GeneratedMessage { private static readonly FieldDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fieldDescriptorProtoFieldNames = new string[] { "default_value", "extendee", "label", "name", "number", "options", "type", "type_name" }; @@ -2127,10 +2127,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum Type { TYPE_DOUBLE = 1, TYPE_FLOAT = 2, @@ -2153,7 +2153,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum Label { LABEL_OPTIONAL = 1, LABEL_REQUIRED = 2, @@ -2358,7 +2358,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -2710,7 +2710,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class EnumDescriptorProto : pb::GeneratedMessage { private static readonly EnumDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _enumDescriptorProtoFieldNames = new string[] { "name", "options", "value" }; @@ -2855,7 +2855,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3084,7 +3084,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class EnumValueDescriptorProto : pb::GeneratedMessage { private static readonly EnumValueDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _enumValueDescriptorProtoFieldNames = new string[] { "name", "number", "options" }; @@ -3224,7 +3224,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3432,7 +3432,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class ServiceDescriptorProto : pb::GeneratedMessage { private static readonly ServiceDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _serviceDescriptorProtoFieldNames = new string[] { "method", "name", "options" }; @@ -3577,7 +3577,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3806,7 +3806,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class MethodDescriptorProto : pb::GeneratedMessage { private static readonly MethodDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _methodDescriptorProtoFieldNames = new string[] { "input_type", "name", "options", "output_type" }; @@ -3962,7 +3962,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -4197,7 +4197,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class FileOptions : pb::ExtendableMessage { private static readonly FileOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fileOptionsFieldNames = new string[] { "cc_generic_services", "java_generic_services", "java_multiple_files", "java_outer_classname", "java_package", "optimize_for", "py_generic_services", "uninterpreted_option" }; @@ -4225,10 +4225,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum OptimizeMode { SPEED = 1, CODE_SIZE = 2, @@ -4439,7 +4439,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -4780,7 +4780,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class MessageOptions : pb::ExtendableMessage { private static readonly MessageOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _messageOptionsFieldNames = new string[] { "message_set_wire_format", "no_standard_descriptor_accessor", "uninterpreted_option" }; @@ -4926,7 +4926,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5132,7 +5132,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class FieldOptions : pb::ExtendableMessage { private static readonly FieldOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fieldOptionsFieldNames = new string[] { "ctype", "deprecated", "experimental_map_key", "packed", "uninterpreted_option" }; @@ -5160,10 +5160,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum CType { STRING = 0, CORD = 1, @@ -5326,7 +5326,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5591,7 +5591,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class EnumOptions : pb::ExtendableMessage { private static readonly EnumOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _enumOptionsFieldNames = new string[] { "uninterpreted_option" }; @@ -5705,7 +5705,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5861,7 +5861,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class EnumValueOptions : pb::ExtendableMessage { private static readonly EnumValueOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _enumValueOptionsFieldNames = new string[] { "uninterpreted_option" }; @@ -5975,7 +5975,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6131,7 +6131,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class ServiceOptions : pb::ExtendableMessage { private static readonly ServiceOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _serviceOptionsFieldNames = new string[] { "uninterpreted_option" }; @@ -6245,7 +6245,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6401,7 +6401,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class MethodOptions : pb::ExtendableMessage { private static readonly MethodOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _methodOptionsFieldNames = new string[] { "uninterpreted_option" }; @@ -6515,7 +6515,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6671,7 +6671,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class UninterpretedOption : pb::GeneratedMessage { private static readonly UninterpretedOption defaultInstance = new Builder().BuildPartial(); private static readonly string[] _uninterpretedOptionFieldNames = new string[] { "double_value", "identifier_value", "name", "negative_int_value", "positive_int_value", "string_value" }; @@ -6699,11 +6699,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class NamePart : pb::GeneratedMessage { private static readonly NamePart defaultInstance = new Builder().BuildPartial(); private static readonly string[] _namePartFieldNames = new string[] { "is_extension", "name_part" }; @@ -6826,7 +6826,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -7153,7 +7153,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers/Properties/AssemblyInfo.cs b/src/ProtocolBuffers/Properties/AssemblyInfo.cs index fdae52b878..b6581aa4c5 100644 --- a/src/ProtocolBuffers/Properties/AssemblyInfo.cs +++ b/src/ProtocolBuffers/Properties/AssemblyInfo.cs @@ -65,12 +65,12 @@ using System.Runtime.CompilerServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.277")] +// [assembly: AssemblyVersion("2.3.0.369")] -[assembly: AssemblyVersion("2.3.0.277")] +[assembly: AssemblyVersion("2.3.0.369")] #if !COMPACT_FRAMEWORK_35 -[assembly: AssemblyFileVersion("2.3.0.277")] +[assembly: AssemblyFileVersion("2.3.0.369")] #endif [assembly: CLSCompliant(true)] \ No newline at end of file diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs index a9ee77724b..523ad93730 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestExtrasFullProtoFile { #region Extension registration @@ -126,7 +126,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestInteropPerson : pb::ExtendableMessage { private static readonly TestInteropPerson defaultInstance = new Builder().BuildPartial(); public static TestInteropPerson DefaultInstance { @@ -152,10 +152,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum PhoneType { MOBILE = 0, HOME = 1, @@ -164,7 +164,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class PhoneNumber : pb::GeneratedMessage { private static readonly PhoneNumber defaultInstance = new Builder().BuildPartial(); public static PhoneNumber DefaultInstance { @@ -246,7 +246,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -330,7 +330,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Addresses : pb::GeneratedMessage { private static readonly Addresses defaultInstance = new Builder().BuildPartial(); public static Addresses DefaultInstance { @@ -443,7 +443,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -692,7 +692,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -900,7 +900,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestInteropEmployeeId : pb::GeneratedMessage { private static readonly TestInteropEmployeeId defaultInstance = new Builder().BuildPartial(); public static TestInteropEmployeeId DefaultInstance { @@ -972,7 +972,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1038,7 +1038,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestMissingFieldsA : pb::GeneratedMessage { private static readonly TestMissingFieldsA defaultInstance = new Builder().BuildPartial(); public static TestMissingFieldsA DefaultInstance { @@ -1064,11 +1064,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class SubA : pb::GeneratedMessage { private static readonly SubA defaultInstance = new Builder().BuildPartial(); public static SubA DefaultInstance { @@ -1152,7 +1152,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1326,7 +1326,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1465,7 +1465,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestMissingFieldsB : pb::GeneratedMessage { private static readonly TestMissingFieldsB defaultInstance = new Builder().BuildPartial(); public static TestMissingFieldsB DefaultInstance { @@ -1491,11 +1491,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class SubB : pb::GeneratedMessage { private static readonly SubB defaultInstance = new Builder().BuildPartial(); public static SubB DefaultInstance { @@ -1569,7 +1569,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1725,7 +1725,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs index bc214e2565..d268954b16 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestExtrasLiteProtoFile { #region Extension registration @@ -44,7 +44,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum ExtraEnum { DEFAULT = 10, EXLITE_FOO = 7, @@ -57,7 +57,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestRequiredLite : pb::GeneratedMessageLite { private static readonly TestRequiredLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRequiredLiteFieldNames = new string[] { "d", "en" }; @@ -192,7 +192,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -337,7 +337,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestInteropPersonLite : pb::ExtendableMessageLite { private static readonly TestInteropPersonLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testInteropPersonLiteFieldNames = new string[] { "addresses", "codes", "email", "id", "name", "phone" }; @@ -357,10 +357,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum PhoneType { MOBILE = 0, HOME = 1, @@ -369,7 +369,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class PhoneNumber : pb::GeneratedMessageLite { private static readonly PhoneNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _phoneNumberFieldNames = new string[] { "number", "type" }; @@ -503,7 +503,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -649,7 +649,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Addresses : pb::GeneratedMessageLite { private static readonly Addresses defaultInstance = new Builder().BuildPartial(); private static readonly string[] _addressesFieldNames = new string[] { "address", "address2", "city", "state", "zip" }; @@ -844,7 +844,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -1295,7 +1295,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -1591,7 +1591,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestInteropEmployeeIdLite : pb::GeneratedMessageLite { private static readonly TestInteropEmployeeIdLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testInteropEmployeeIdLiteFieldNames = new string[] { "number" }; @@ -1706,7 +1706,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs index a96833bef0..4702794028 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestImportLiteProtoFile { #region Extension registration @@ -29,7 +29,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum ImportEnumLite { IMPORT_LITE_FOO = 7, IMPORT_LITE_BAR = 8, @@ -41,7 +41,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class ImportMessageLite : pb::GeneratedMessageLite { private static readonly ImportMessageLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _importMessageLiteFieldNames = new string[] { "d" }; @@ -155,7 +155,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs index 5749c97f88..ac745a7fbd 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestImportProtoFile { #region Extension registration @@ -57,7 +57,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum ImportEnum { IMPORT_FOO = 7, IMPORT_BAR = 8, @@ -69,7 +69,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class ImportMessage : pb::GeneratedMessage { private static readonly ImportMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _importMessageFieldNames = new string[] { "d" }; @@ -174,7 +174,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs index 7c2836cdb3..f20647ee7c 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestLiteImportNonLiteProtoFile { #region Extension registration @@ -30,7 +30,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestLiteImportsNonlite : pb::GeneratedMessageLite { private static readonly TestLiteImportsNonlite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testLiteImportsNonliteFieldNames = new string[] { "message" }; @@ -144,7 +144,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs index 78bed7e204..cd09860072 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestLiteProtoFile { #region Extension registration @@ -1214,7 +1214,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum ForeignEnumLite { FOREIGN_LITE_FOO = 4, FOREIGN_LITE_BAR = 5, @@ -1226,7 +1226,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestAllTypesLite : pb::GeneratedMessageLite { private static readonly TestAllTypesLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllTypesLiteFieldNames = new string[] { "default_bool", "default_bytes", "default_cord", "default_double", "default_fixed32", "default_fixed64", "default_float", "default_foreign_enum", "default_import_enum", "default_int32", "default_int64", "default_nested_enum", "default_sfixed32", "default_sfixed64", "default_sint32", "default_sint64", "default_string", "default_string_piece", "default_uint32", "default_uint64", "optional_bool", "optional_bytes", "optional_cord", "optional_double", "optional_fixed32", "optional_fixed64", "optional_float", "optional_foreign_enum", "optional_foreign_message", "optional_import_enum", "optional_import_message", "optional_int32", "optional_int64", "optional_nested_enum", "optional_nested_message", "optional_sfixed32", "optional_sfixed64", "optional_sint32", "optional_sint64", "optional_string", "optional_string_piece", "optional_uint32", "optional_uint64", "optionalgroup", "repeated_bool", "repeated_bytes", "repeated_cord", "repeated_double", "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_foreign_enum", "repeated_foreign_message", "repeated_import_enum", "repeated_import_message", "repeated_int32", "repeated_int64", "repeated_nested_enum", "repeated_nested_message", "repeated_sfixed32", "repeated_sfixed64", "repeated_sint32", "repeated_sint64", "repeated_string", "repeated_string_piece", "repeated_uint32", "repeated_uint64", "repeatedgroup" }; @@ -1246,10 +1246,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum NestedEnum { FOO = 1, BAR = 2, @@ -1258,7 +1258,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class NestedMessage : pb::GeneratedMessageLite { private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _nestedMessageFieldNames = new string[] { "bb" }; @@ -1372,7 +1372,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -1488,7 +1488,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class OptionalGroup : pb::GeneratedMessageLite { private static readonly OptionalGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupFieldNames = new string[] { "a" }; @@ -1602,7 +1602,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -1718,7 +1718,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class RepeatedGroup : pb::GeneratedMessageLite { private static readonly RepeatedGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupFieldNames = new string[] { "a" }; @@ -1832,7 +1832,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -3547,7 +3547,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -5789,7 +5789,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class ForeignMessageLite : pb::GeneratedMessageLite { private static readonly ForeignMessageLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _foreignMessageLiteFieldNames = new string[] { "c" }; @@ -5903,7 +5903,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -6019,7 +6019,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestPackedTypesLite : pb::GeneratedMessageLite { private static readonly TestPackedTypesLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedTypesLiteFieldNames = new string[] { "packed_bool", "packed_double", "packed_enum", "packed_fixed32", "packed_fixed64", "packed_float", "packed_int32", "packed_int64", "packed_sfixed32", "packed_sfixed64", "packed_sint32", "packed_sint64", "packed_uint32", "packed_uint64" }; @@ -6571,7 +6571,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -7173,7 +7173,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestUnpackedTypesLite : pb::GeneratedMessageLite { private static readonly TestUnpackedTypesLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedTypesLiteFieldNames = new string[] { "unpacked_bool", "unpacked_double", "unpacked_enum", "unpacked_fixed32", "unpacked_fixed64", "unpacked_float", "unpacked_int32", "unpacked_int64", "unpacked_sfixed32", "unpacked_sfixed64", "unpacked_sint32", "unpacked_sint64", "unpacked_uint32", "unpacked_uint64" }; @@ -7670,7 +7670,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -8272,7 +8272,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestAllExtensionsLite : pb::ExtendableMessageLite { private static readonly TestAllExtensionsLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllExtensionsLiteFieldNames = new string[] { }; @@ -8374,7 +8374,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -8466,7 +8466,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class OptionalGroup_extension_lite : pb::GeneratedMessageLite { private static readonly OptionalGroup_extension_lite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupExtensionLiteFieldNames = new string[] { "a" }; @@ -8580,7 +8580,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -8696,7 +8696,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class RepeatedGroup_extension_lite : pb::GeneratedMessageLite { private static readonly RepeatedGroup_extension_lite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupExtensionLiteFieldNames = new string[] { "a" }; @@ -8810,7 +8810,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -8926,7 +8926,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestPackedExtensionsLite : pb::ExtendableMessageLite { private static readonly TestPackedExtensionsLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedExtensionsLiteFieldNames = new string[] { }; @@ -9028,7 +9028,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -9120,7 +9120,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestUnpackedExtensionsLite : pb::ExtendableMessageLite { private static readonly TestUnpackedExtensionsLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedExtensionsLiteFieldNames = new string[] { }; @@ -9222,7 +9222,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -9314,7 +9314,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestNestedExtensionLite : pb::GeneratedMessageLite { private static readonly TestNestedExtensionLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testNestedExtensionLiteFieldNames = new string[] { }; @@ -9411,7 +9411,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -9502,7 +9502,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestDeprecatedLite : pb::GeneratedMessageLite { private static readonly TestDeprecatedLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDeprecatedLiteFieldNames = new string[] { "deprecated_field" }; @@ -9616,7 +9616,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs index d8824d49a4..f46ec30148 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static partial class UnitTestProtoFile { #region Extension registration @@ -1086,7 +1086,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum ForeignEnum { FOREIGN_FOO = 4, FOREIGN_BAR = 5, @@ -1094,7 +1094,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum TestEnumWithDupValue { FOO1 = 1, BAR1 = 2, @@ -1104,7 +1104,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum TestSparseEnum { SPARSE_A = 123, SPARSE_B = 62374, @@ -1120,7 +1120,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestAllTypes : pb::GeneratedMessage { private static readonly TestAllTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllTypesFieldNames = new string[] { "default_bool", "default_bytes", "default_cord", "default_double", "default_fixed32", "default_fixed64", "default_float", "default_foreign_enum", "default_import_enum", "default_int32", "default_int64", "default_nested_enum", "default_sfixed32", "default_sfixed64", "default_sint32", "default_sint64", "default_string", "default_string_piece", "default_uint32", "default_uint64", "optional_bool", "optional_bytes", "optional_cord", "optional_double", "optional_fixed32", "optional_fixed64", "optional_float", "optional_foreign_enum", "optional_foreign_message", "optional_import_enum", "optional_import_message", "optional_int32", "optional_int64", "optional_nested_enum", "optional_nested_message", "optional_sfixed32", "optional_sfixed64", "optional_sint32", "optional_sint64", "optional_string", "optional_string_piece", "optional_uint32", "optional_uint64", "optionalgroup", "repeated_bool", "repeated_bytes", "repeated_cord", "repeated_double", "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_foreign_enum", "repeated_foreign_message", "repeated_import_enum", "repeated_import_message", "repeated_int32", "repeated_int64", "repeated_nested_enum", "repeated_nested_message", "repeated_sfixed32", "repeated_sfixed64", "repeated_sint32", "repeated_sint64", "repeated_string", "repeated_string_piece", "repeated_uint32", "repeated_uint64", "repeatedgroup" }; @@ -1148,10 +1148,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum NestedEnum { FOO = 1, BAR = 2, @@ -1160,7 +1160,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class NestedMessage : pb::GeneratedMessage { private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _nestedMessageFieldNames = new string[] { "bb" }; @@ -1265,7 +1265,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1399,7 +1399,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class OptionalGroup : pb::GeneratedMessage { private static readonly OptionalGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupFieldNames = new string[] { "a" }; @@ -1504,7 +1504,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1638,7 +1638,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class RepeatedGroup : pb::GeneratedMessage { private static readonly RepeatedGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupFieldNames = new string[] { "a" }; @@ -1743,7 +1743,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3186,7 +3186,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5494,7 +5494,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestDeprecatedFields : pb::GeneratedMessage { private static readonly TestDeprecatedFields defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDeprecatedFieldsFieldNames = new string[] { "deprecated_int32" }; @@ -5599,7 +5599,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5733,7 +5733,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class ForeignMessage : pb::GeneratedMessage { private static readonly ForeignMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _foreignMessageFieldNames = new string[] { "c" }; @@ -5838,7 +5838,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5972,7 +5972,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestAllExtensions : pb::ExtendableMessage { private static readonly TestAllExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllExtensionsFieldNames = new string[] { }; @@ -6065,7 +6065,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6175,7 +6175,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class OptionalGroup_extension : pb::GeneratedMessage { private static readonly OptionalGroup_extension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupExtensionFieldNames = new string[] { "a" }; @@ -6280,7 +6280,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6414,7 +6414,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class RepeatedGroup_extension : pb::GeneratedMessage { private static readonly RepeatedGroup_extension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupExtensionFieldNames = new string[] { "a" }; @@ -6519,7 +6519,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6653,7 +6653,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestNestedExtension : pb::GeneratedMessage { private static readonly TestNestedExtension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testNestedExtensionFieldNames = new string[] { }; @@ -6744,7 +6744,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6853,7 +6853,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestRequired : pb::GeneratedMessage { private static readonly TestRequired defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRequiredFieldNames = new string[] { "a", "b", "c", "dummy10", "dummy11", "dummy12", "dummy13", "dummy14", "dummy15", "dummy16", "dummy17", "dummy18", "dummy19", "dummy2", "dummy20", "dummy21", "dummy22", "dummy23", "dummy24", "dummy25", "dummy26", "dummy27", "dummy28", "dummy29", "dummy30", "dummy31", "dummy32", "dummy4", "dummy5", "dummy6", "dummy7", "dummy8", "dummy9" }; @@ -7477,7 +7477,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -8411,7 +8411,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestRequiredForeign : pb::GeneratedMessage { private static readonly TestRequiredForeign defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRequiredForeignFieldNames = new string[] { "dummy", "optional_message", "repeated_message" }; @@ -8556,7 +8556,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -8784,7 +8784,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestForeignNested : pb::GeneratedMessage { private static readonly TestForeignNested defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testForeignNestedFieldNames = new string[] { "foreign_nested" }; @@ -8889,7 +8889,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9046,7 +9046,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestEmptyMessage : pb::GeneratedMessage { private static readonly TestEmptyMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testEmptyMessageFieldNames = new string[] { }; @@ -9135,7 +9135,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9244,7 +9244,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestEmptyMessageWithExtensions : pb::ExtendableMessage { private static readonly TestEmptyMessageWithExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testEmptyMessageWithExtensionsFieldNames = new string[] { }; @@ -9337,7 +9337,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9447,7 +9447,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestMultipleExtensionRanges : pb::ExtendableMessage { private static readonly TestMultipleExtensionRanges defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMultipleExtensionRangesFieldNames = new string[] { }; @@ -9542,7 +9542,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9652,7 +9652,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestReallyLargeTagNumber : pb::GeneratedMessage { private static readonly TestReallyLargeTagNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testReallyLargeTagNumberFieldNames = new string[] { "a", "bb" }; @@ -9773,7 +9773,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9932,7 +9932,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestRecursiveMessage : pb::GeneratedMessage { private static readonly TestRecursiveMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRecursiveMessageFieldNames = new string[] { "a", "i" }; @@ -10053,7 +10053,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -10235,7 +10235,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestMutualRecursionA : pb::GeneratedMessage { private static readonly TestMutualRecursionA defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMutualRecursionAFieldNames = new string[] { "bb" }; @@ -10340,7 +10340,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -10497,7 +10497,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestMutualRecursionB : pb::GeneratedMessage { private static readonly TestMutualRecursionB defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMutualRecursionBFieldNames = new string[] { "a", "optional_int32" }; @@ -10618,7 +10618,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -10800,7 +10800,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestDupFieldNumber : pb::GeneratedMessage { private static readonly TestDupFieldNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDupFieldNumberFieldNames = new string[] { "a", "bar", "foo" }; @@ -10828,11 +10828,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Foo : pb::GeneratedMessage { private static readonly Foo defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooFieldNames = new string[] { "a" }; @@ -10937,7 +10937,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -11071,7 +11071,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Bar : pb::GeneratedMessage { private static readonly Bar defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barFieldNames = new string[] { "a" }; @@ -11176,7 +11176,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -11423,7 +11423,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -11653,7 +11653,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestNestedMessageHasBits : pb::GeneratedMessage { private static readonly TestNestedMessageHasBits defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testNestedMessageHasBitsFieldNames = new string[] { "optional_nested_message" }; @@ -11681,11 +11681,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class NestedMessage : pb::GeneratedMessage { private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _nestedMessageFieldNames = new string[] { "nestedmessage_repeated_foreignmessage", "nestedmessage_repeated_int32" }; @@ -11815,7 +11815,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -12086,7 +12086,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -12243,7 +12243,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestCamelCaseFieldNames : pb::GeneratedMessage { private static readonly TestCamelCaseFieldNames defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testCamelCaseFieldNamesFieldNames = new string[] { "CordField", "EnumField", "MessageField", "PrimitiveField", "RepeatedCordField", "RepeatedEnumField", "RepeatedMessageField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedStringPieceField", "StringField", "StringPieceField" }; @@ -12563,7 +12563,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -13089,7 +13089,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestFieldOrderings : pb::ExtendableMessage { private static readonly TestFieldOrderings defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testFieldOrderingsFieldNames = new string[] { "my_float", "my_int", "my_string" }; @@ -13231,7 +13231,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -13417,7 +13417,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestExtremeDefaultValues : pb::GeneratedMessage { private static readonly TestExtremeDefaultValues defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testExtremeDefaultValuesFieldNames = new string[] { "escaped_bytes", "inf_double", "inf_float", "large_float", "large_uint32", "large_uint64", "nan_double", "nan_float", "neg_inf_double", "neg_inf_float", "negative_float", "negative_one_float", "one_float", "small_float", "small_int32", "small_int64", "small_negative_float", "utf8_string", "zero_float" }; @@ -13812,7 +13812,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -14402,7 +14402,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class OneString : pb::GeneratedMessage { private static readonly OneString defaultInstance = new Builder().BuildPartial(); private static readonly string[] _oneStringFieldNames = new string[] { "data" }; @@ -14507,7 +14507,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -14642,7 +14642,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class OneBytes : pb::GeneratedMessage { private static readonly OneBytes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _oneBytesFieldNames = new string[] { "data" }; @@ -14747,7 +14747,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -14882,7 +14882,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestPackedTypes : pb::GeneratedMessage { private static readonly TestPackedTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedTypesFieldNames = new string[] { "packed_bool", "packed_double", "packed_enum", "packed_fixed32", "packed_fixed64", "packed_float", "packed_int32", "packed_int64", "packed_sfixed32", "packed_sfixed64", "packed_sint32", "packed_sint64", "packed_uint32", "packed_uint64" }; @@ -15344,7 +15344,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -15972,7 +15972,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestUnpackedTypes : pb::GeneratedMessage { private static readonly TestUnpackedTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedTypesFieldNames = new string[] { "unpacked_bool", "unpacked_double", "unpacked_enum", "unpacked_fixed32", "unpacked_fixed64", "unpacked_float", "unpacked_int32", "unpacked_int64", "unpacked_sfixed32", "unpacked_sfixed64", "unpacked_sint32", "unpacked_sint64", "unpacked_uint32", "unpacked_uint64" }; @@ -16379,7 +16379,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -17007,7 +17007,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestPackedExtensions : pb::ExtendableMessage { private static readonly TestPackedExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedExtensionsFieldNames = new string[] { }; @@ -17100,7 +17100,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -17210,7 +17210,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestUnpackedExtensions : pb::ExtendableMessage { private static readonly TestUnpackedExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedExtensionsFieldNames = new string[] { }; @@ -17303,7 +17303,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -17413,7 +17413,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestDynamicExtensions : pb::GeneratedMessage { private static readonly TestDynamicExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDynamicExtensionsFieldNames = new string[] { "dynamic_enum_extension", "dynamic_message_extension", "enum_extension", "message_extension", "packed_extension", "repeated_extension", "scalar_extension" }; @@ -17441,10 +17441,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public enum DynamicEnumType { DYNAMIC_FOO = 2200, DYNAMIC_BAR = 2201, @@ -17453,7 +17453,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class DynamicMessageType : pb::GeneratedMessage { private static readonly DynamicMessageType defaultInstance = new Builder().BuildPartial(); private static readonly string[] _dynamicMessageTypeFieldNames = new string[] { "dynamic_field" }; @@ -17558,7 +17558,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -17888,7 +17888,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -18257,7 +18257,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::GeneratedMessage { private static readonly TestRepeatedScalarDifferentTagSizes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRepeatedScalarDifferentTagSizesFieldNames = new string[] { "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_int32", "repeated_int64", "repeated_uint64" }; @@ -18484,7 +18484,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -18818,7 +18818,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class FooRequest : pb::GeneratedMessage { private static readonly FooRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooRequestFieldNames = new string[] { }; @@ -18907,7 +18907,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -19016,7 +19016,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class FooResponse : pb::GeneratedMessage { private static readonly FooResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooResponseFieldNames = new string[] { }; @@ -19105,7 +19105,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -19214,7 +19214,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class BarRequest : pb::GeneratedMessage { private static readonly BarRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barRequestFieldNames = new string[] { }; @@ -19303,7 +19303,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -19412,7 +19412,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class BarResponse : pb::GeneratedMessage { private static readonly BarResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barResponseFieldNames = new string[] { }; @@ -19501,7 +19501,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } From 819b7154d162f3ef4f187f19b020f999c02fcf03 Mon Sep 17 00:00:00 2001 From: csharptest Date: Thu, 8 Sep 2011 20:28:22 -0500 Subject: [PATCH 02/31] Added IDisposable to ICodedOutputStream --- .../Http/MessageFormatFactory.cs | 49 +++++++++++++------ .../JsonFormatWriter.cs | 13 +++++ .../XmlFormatWriter.cs | 14 ++++++ src/ProtocolBuffers/CodedOutputStream.cs | 12 ++++- src/ProtocolBuffers/ICodedOutputStream.cs | 2 +- 5 files changed, 72 insertions(+), 18 deletions(-) diff --git a/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs b/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs index 7173d478c0..8a19a8b7be 100644 --- a/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs +++ b/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs @@ -58,15 +58,15 @@ namespace Google.ProtocolBuffers.Serialization ICodedInputStream codedInput = CreateInputStream(options, contentType, input); return (TBuilder)builder.WeakMergeFrom(codedInput, options.ExtensionRegistry); } - + /// /// Writes the message instance to the stream using the content type provided /// - /// An instance of a message /// Options specific to writing this message and/or content type /// The mime type of the content to be written /// The stream to write the message to - public static void WriteTo(this IMessageLite message, MessageFormatOptions options, string contentType, Stream output) + /// If you do not dispose of ICodedOutputStream some formats may yield incomplete output + public static ICodedOutputStream CreateOutputStream(MessageFormatOptions options, string contentType, Stream output) { FormatType outputType = ContentTypeToFormat(contentType, options.DefaultContentType); @@ -95,15 +95,15 @@ namespace Google.ProtocolBuffers.Serialization else { XmlWriterSettings settings = new XmlWriterSettings() - { - CheckCharacters = false, - NewLineHandling = NewLineHandling.Entitize, - OmitXmlDeclaration = true, - Encoding = Encoding.UTF8, - Indent = true, - IndentChars = " ", - NewLineChars = Environment.NewLine, - }; + { + CheckCharacters = false, + NewLineHandling = NewLineHandling.Entitize, + OmitXmlDeclaration = true, + Encoding = Encoding.UTF8, + Indent = true, + IndentChars = " ", + NewLineChars = Environment.NewLine, + }; writer = XmlFormatWriter.CreateInstance(XmlWriter.Create(output, settings)); } writer.RootElementName = options.XmlWriterRootElementName; @@ -114,12 +114,29 @@ namespace Google.ProtocolBuffers.Serialization else throw new NotSupportedException(); - message.WriteTo(codedOutput); + return codedOutput; + } + + /// + /// Writes the message instance to the stream using the content type provided + /// + /// An instance of a message + /// Options specific to writing this message and/or content type + /// The mime type of the content to be written + /// The stream to write the message to + public static void WriteTo(this IMessageLite message, MessageFormatOptions options, string contentType, Stream output) + { + using (ICodedOutputStream codedOutput = CreateOutputStream(options, contentType, output)) + { + message.WriteTo(codedOutput); - if (codedOutput is AbstractWriter) - ((AbstractWriter) codedOutput).EndMessage(); + // This is effectivly done by Dispose(); however, if you need to finalize a message + // without disposing the underlying stream, this is the only way to do it. + if (codedOutput is AbstractWriter) + ((AbstractWriter)codedOutput).EndMessage(); - codedOutput.Flush(); + codedOutput.Flush(); + } } diff --git a/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs b/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs index 12d180d84b..5f396ae58f 100644 --- a/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs +++ b/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs @@ -239,6 +239,19 @@ namespace Google.ProtocolBuffers.Serialization /// Gets or sets the whitespace to use to separate the text, default = empty public string Whitespace { get; set; } + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + protected override void Dispose(bool disposing) + { + if (disposing && _counter.Count == 1) + { + EndMessage(); + } + + base.Dispose(disposing); + } + private void Seperator() { if (_counter.Count == 0) diff --git a/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs b/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs index 97fc6b2c37..a9cfcc1e2d 100644 --- a/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs +++ b/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs @@ -75,8 +75,13 @@ namespace Google.ProtocolBuffers.Serialization { if (disposing) { + if (_output.WriteState != WriteState.Closed && _output.WriteState != WriteState.Start) + _output.WriteEndDocument(); + _output.Close(); } + + base.Dispose(disposing); } /// @@ -111,6 +116,15 @@ namespace Google.ProtocolBuffers.Serialization return (Options & option) != 0; } + /// + /// Completes any pending write operations + /// + public override void Flush() + { + _output.Flush(); + base.Flush(); + } + /// /// Used to write the root-message preamble, in xml this is open element for RootElementName, /// by default "<root>". After this call you can call IMessageLite.MergeTo(...) and diff --git a/src/ProtocolBuffers/CodedOutputStream.cs b/src/ProtocolBuffers/CodedOutputStream.cs index c14f5e0d44..bb133a7741 100644 --- a/src/ProtocolBuffers/CodedOutputStream.cs +++ b/src/ProtocolBuffers/CodedOutputStream.cs @@ -57,7 +57,7 @@ namespace Google.ProtocolBuffers /// methods are taken from the protocol buffer type names, not .NET types. /// (Hence WriteFloat instead of WriteSingle, and WriteBool instead of WriteBoolean.) /// - public sealed partial class CodedOutputStream : ICodedOutputStream + public sealed partial class CodedOutputStream : ICodedOutputStream, IDisposable { /// /// The buffer size used by CreateInstance(Stream). @@ -125,6 +125,16 @@ namespace Google.ProtocolBuffers } #endregion + + public void Dispose() + { + if (output != null) + { + if (position > 0) + Flush(); + output.Dispose(); + } + } #region Writing of unknown fields diff --git a/src/ProtocolBuffers/ICodedOutputStream.cs b/src/ProtocolBuffers/ICodedOutputStream.cs index 861d3fece6..2c324792b5 100644 --- a/src/ProtocolBuffers/ICodedOutputStream.cs +++ b/src/ProtocolBuffers/ICodedOutputStream.cs @@ -49,7 +49,7 @@ namespace Google.ProtocolBuffers /// in their binary form by creating a instance via the CodedOutputStream.CreateInstance /// static factory. /// - public interface ICodedOutputStream + public interface ICodedOutputStream : IDisposable { /// /// Indicates that all temporary buffers be written to the final output. From 60fd773d300cd0390ba08812590690ab2d28c837 Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 9 Sep 2011 12:18:16 -0500 Subject: [PATCH 03/31] Completed work and testing for manually reading/writing start/end message --- .../AbstractReader.cs | 10 +- .../AbstractTextReader.cs | 4 - .../AbstractWriter.cs | 12 +- .../DictionaryReader.cs | 13 +- .../DictionaryWriter.cs | 6 +- .../Http/MessageFormatFactory.cs | 33 ++- .../Http/MessageFormatOptions.cs | 2 +- .../Http/ServiceExtensions.cs | 3 +- .../JsonFormatReader.cs | 13 +- .../JsonFormatWriter.cs | 21 +- .../XmlFormatReader.cs | 142 ++++++----- .../XmlFormatWriter.cs | 28 ++- .../ProtocolBuffers.Test.csproj | 1 + .../TestMimeMessageFormats.cs | 225 ++++++++++++++++++ .../TestWriterFormatJson.cs | 34 ++- .../TestWriterFormatXml.cs | 63 ++++- src/ProtocolBuffers/CodedInputStream.cs | 3 + src/ProtocolBuffers/CodedOutputStream.cs | 3 + src/ProtocolBuffers/ICodedInputStream.cs | 18 ++ src/ProtocolBuffers/ICodedOutputStream.cs | 18 ++ 20 files changed, 486 insertions(+), 166 deletions(-) create mode 100644 src/ProtocolBuffers.Test/TestMimeMessageFormats.cs diff --git a/src/ProtocolBuffers.Serialization/AbstractReader.cs b/src/ProtocolBuffers.Serialization/AbstractReader.cs index 538af38f79..f3e6fd6f4d 100644 --- a/src/ProtocolBuffers.Serialization/AbstractReader.cs +++ b/src/ProtocolBuffers.Serialization/AbstractReader.cs @@ -17,12 +17,6 @@ namespace Google.ProtocolBuffers.Serialization /// Constructs a new reader protected AbstractReader() { MaxDepth = DefaultMaxDepth; } - /// Constructs a new child reader - protected AbstractReader(AbstractReader copyFrom) - { - _depth = copyFrom._depth + 1; - MaxDepth = copyFrom.MaxDepth; - } /// Gets or sets the maximum recursion depth allowed public int MaxDepth { get; set; } @@ -116,12 +110,12 @@ namespace Google.ProtocolBuffers.Serialization /// /// Reads the root-message preamble specific to this formatter /// - public abstract AbstractReader ReadStartMessage(); + public abstract void ReadMessageStart(); /// /// Reads the root-message close specific to this formatter /// - public abstract void ReadEndMessage(); + public abstract void ReadMessageEnd(); /// /// Merges the input stream into the provided IBuilderLite diff --git a/src/ProtocolBuffers.Serialization/AbstractTextReader.cs b/src/ProtocolBuffers.Serialization/AbstractTextReader.cs index 59b9057bee..ddfa643643 100644 --- a/src/ProtocolBuffers.Serialization/AbstractTextReader.cs +++ b/src/ProtocolBuffers.Serialization/AbstractTextReader.cs @@ -11,10 +11,6 @@ namespace Google.ProtocolBuffers.Serialization { /// Constructs a new reader protected AbstractTextReader() { } - /// Constructs a new child reader - protected AbstractTextReader(AbstractTextReader copyFrom) - : base(copyFrom) - { } /// /// Reads a typed field as a string diff --git a/src/ProtocolBuffers.Serialization/AbstractWriter.cs b/src/ProtocolBuffers.Serialization/AbstractWriter.cs index 50dfe67187..7ae268646f 100644 --- a/src/ProtocolBuffers.Serialization/AbstractWriter.cs +++ b/src/ProtocolBuffers.Serialization/AbstractWriter.cs @@ -45,23 +45,23 @@ namespace Google.ProtocolBuffers.Serialization /// /// Used to write any nessary root-message preamble. After this call you can call - /// IMessageLite.MergeTo(...) and complete the message with a call to EndMessage(). + /// IMessageLite.MergeTo(...) and complete the message with a call to WriteMessageEnd(). /// These three calls are identical to just calling WriteMessage(message); /// /// /// AbstractWriter writer; - /// writer.StartMessage(); + /// writer.WriteMessageStart(); /// message.WriteTo(writer); - /// writer.EndMessage(); + /// writer.WriteMessageEnd(); /// // ... or, but not both ... /// writer.WriteMessage(message); /// - public abstract void StartMessage(); + public abstract void WriteMessageStart(); /// - /// Used to complete a root-message previously started with a call to StartMessage() + /// Used to complete a root-message previously started with a call to WriteMessageStart() /// - public abstract void EndMessage(); + public abstract void WriteMessageEnd(); /// /// Writes a Boolean value diff --git a/src/ProtocolBuffers.Serialization/DictionaryReader.cs b/src/ProtocolBuffers.Serialization/DictionaryReader.cs index f606bc9bdb..bb83ef9c75 100644 --- a/src/ProtocolBuffers.Serialization/DictionaryReader.cs +++ b/src/ProtocolBuffers.Serialization/DictionaryReader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using Google.ProtocolBuffers.Descriptors; @@ -25,17 +25,14 @@ namespace Google.ProtocolBuffers.Serialization /// /// No-op /// - public override AbstractReader ReadStartMessage() - { - return this; - } + public override void ReadMessageStart() + { } /// /// No-op /// - public override void ReadEndMessage() - { - } + public override void ReadMessageEnd() + { } /// /// Merges the contents of stream into the provided message builder diff --git a/src/ProtocolBuffers.Serialization/DictionaryWriter.cs b/src/ProtocolBuffers.Serialization/DictionaryWriter.cs index 4c3b01167f..6d823301a2 100644 --- a/src/ProtocolBuffers.Serialization/DictionaryWriter.cs +++ b/src/ProtocolBuffers.Serialization/DictionaryWriter.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using System.Collections.Generic; using Google.ProtocolBuffers.Descriptors; @@ -57,13 +57,13 @@ namespace Google.ProtocolBuffers.Serialization /// /// No-op /// - public override void StartMessage() + public override void WriteMessageStart() { } /// /// No-op /// - public override void EndMessage() + public override void WriteMessageEnd() { } /// diff --git a/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs b/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs index 8a19a8b7be..2ee7eb4de4 100644 --- a/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs +++ b/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs @@ -3,7 +3,7 @@ using System.IO; using System.Xml; using System.Text; -namespace Google.ProtocolBuffers.Serialization +namespace Google.ProtocolBuffers.Serialization.Http { /// /// Extensions and helpers to abstract the reading/writing of messages by a client-specified content type. @@ -29,14 +29,14 @@ namespace Google.ProtocolBuffers.Serialization else if (inputType == FormatType.Json) { JsonFormatReader reader = JsonFormatReader.CreateInstance(input); - codedInput = reader.ReadStartMessage(); + codedInput = reader; } else if (inputType == FormatType.Xml) { XmlFormatReader reader = XmlFormatReader.CreateInstance(input); reader.RootElementName = options.XmlReaderRootElementName; reader.Options = options.XmlReaderOptions; - codedInput = reader.ReadStartMessage(); + codedInput = reader; } else throw new NotSupportedException(); @@ -56,6 +56,7 @@ namespace Google.ProtocolBuffers.Serialization public static TBuilder MergeFrom(this TBuilder builder, MessageFormatOptions options, string contentType, Stream input) where TBuilder : IBuilderLite { ICodedInputStream codedInput = CreateInputStream(options, contentType, input); + codedInput.ReadMessageStart(); return (TBuilder)builder.WeakMergeFrom(codedInput, options.ExtensionRegistry); } @@ -82,13 +83,12 @@ namespace Google.ProtocolBuffers.Serialization { writer.Formatted(); } - writer.StartMessage(); codedOutput = writer; } else if (outputType == FormatType.Xml) { XmlFormatWriter writer; - if (options.FormattedOutput) + if (!options.FormattedOutput) { writer = XmlFormatWriter.CreateInstance(output); } @@ -99,16 +99,15 @@ namespace Google.ProtocolBuffers.Serialization CheckCharacters = false, NewLineHandling = NewLineHandling.Entitize, OmitXmlDeclaration = true, - Encoding = Encoding.UTF8, + Encoding = new UTF8Encoding(false), Indent = true, - IndentChars = " ", + IndentChars = " ", NewLineChars = Environment.NewLine, }; writer = XmlFormatWriter.CreateInstance(XmlWriter.Create(output, settings)); } writer.RootElementName = options.XmlWriterRootElementName; writer.Options = options.XmlWriterOptions; - writer.StartMessage(); codedOutput = writer; } else @@ -126,19 +125,17 @@ namespace Google.ProtocolBuffers.Serialization /// The stream to write the message to public static void WriteTo(this IMessageLite message, MessageFormatOptions options, string contentType, Stream output) { - using (ICodedOutputStream codedOutput = CreateOutputStream(options, contentType, output)) - { - message.WriteTo(codedOutput); + ICodedOutputStream codedOutput = CreateOutputStream(options, contentType, output); - // This is effectivly done by Dispose(); however, if you need to finalize a message - // without disposing the underlying stream, this is the only way to do it. - if (codedOutput is AbstractWriter) - ((AbstractWriter)codedOutput).EndMessage(); + // Output the appropriate message preamble + codedOutput.WriteMessageStart(); - codedOutput.Flush(); - } - } + // Write the message content to the output + message.WriteTo(codedOutput); + // Write the closing message fragment + codedOutput.WriteMessageEnd(); + } enum FormatType { ProtoBuffer, Json, Xml }; diff --git a/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs b/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs index 5b88ac9415..02f2ea4656 100644 --- a/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs +++ b/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs @@ -1,6 +1,6 @@ using System; -namespace Google.ProtocolBuffers.Serialization +namespace Google.ProtocolBuffers.Serialization.Http { /// /// Defines control information for the various formatting used with HTTP services diff --git a/src/ProtocolBuffers.Serialization/Http/ServiceExtensions.cs b/src/ProtocolBuffers.Serialization/Http/ServiceExtensions.cs index 3ca9964a75..022cfb6a4c 100644 --- a/src/ProtocolBuffers.Serialization/Http/ServiceExtensions.cs +++ b/src/ProtocolBuffers.Serialization/Http/ServiceExtensions.cs @@ -3,7 +3,7 @@ using System.Text; using Google.ProtocolBuffers; using System.IO; -namespace Google.ProtocolBuffers.Serialization +namespace Google.ProtocolBuffers.Serialization.Http { /// /// Extensions for the IRpcServerStub @@ -25,6 +25,7 @@ namespace Google.ProtocolBuffers.Serialization string contentType, Stream input, string responseType, Stream output) { ICodedInputStream codedInput = MessageFormatFactory.CreateInputStream(options, contentType, input); + codedInput.ReadMessageStart(); IMessageLite response = stub.CallMethod(methodName, codedInput, options.ExtensionRegistry); response.WriteTo(options, responseType, output); } diff --git a/src/ProtocolBuffers.Serialization/JsonFormatReader.cs b/src/ProtocolBuffers.Serialization/JsonFormatReader.cs index 403367876e..240ce625bc 100644 --- a/src/ProtocolBuffers.Serialization/JsonFormatReader.cs +++ b/src/ProtocolBuffers.Serialization/JsonFormatReader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Xml; @@ -103,19 +103,18 @@ namespace Google.ProtocolBuffers.Serialization /// /// Reads the root-message preamble specific to this formatter /// - public override AbstractReader ReadStartMessage() + public override void ReadMessageStart() { _input.Consume('{'); _stopChar.Push('}'); _state = ReaderState.BeginObject; - return this; } /// /// Reads the root-message close specific to this formatter /// - public override void ReadEndMessage() + public override void ReadMessageEnd() { _input.Consume((char)_stopChar.Pop()); _state = ReaderState.EndValue; @@ -126,9 +125,9 @@ namespace Google.ProtocolBuffers.Serialization /// public override TBuilder Merge(TBuilder builder, ExtensionRegistry registry) { - AbstractReader rdr = ReadStartMessage(); - builder.WeakMergeFrom(rdr, registry); - rdr.ReadEndMessage(); + ReadMessageStart(); + builder.WeakMergeFrom(this, registry); + ReadMessageEnd(); return builder; } diff --git a/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs b/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs index 5f396ae58f..f387f39d16 100644 --- a/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs +++ b/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using System.Collections.Generic; using System.IO; @@ -101,7 +101,7 @@ namespace Google.ProtocolBuffers.Serialization private class JsonStreamWriter : JsonFormatWriter { #if SILVERLIGHT2 || COMPACT_FRAMEWORK_35 - static readonly Encoding Encoding = Encoding.UTF8; + static readonly Encoding Encoding = new UTF8Encoding(false); #else private static readonly Encoding Encoding = Encoding.ASCII; #endif @@ -244,9 +244,10 @@ namespace Google.ProtocolBuffers.Serialization /// protected override void Dispose(bool disposing) { - if (disposing && _counter.Count == 1) + if (disposing) { - EndMessage(); + while(_counter.Count > 1) + WriteMessageEnd(); } base.Dispose(disposing); @@ -458,17 +459,17 @@ namespace Google.ProtocolBuffers.Serialization /// public override void WriteMessage(IMessageLite message) { - StartMessage(); + WriteMessageStart(); message.WriteTo(this); - EndMessage(); + WriteMessageEnd(); } /// /// Used to write the root-message preamble, in json this is the left-curly brace '{'. /// After this call you can call IMessageLite.MergeTo(...) and complete the message with - /// a call to EndMessage(). + /// a call to WriteMessageEnd(). /// - public override void StartMessage() + public override void WriteMessageStart() { if (_isArray) { @@ -479,9 +480,9 @@ namespace Google.ProtocolBuffers.Serialization } /// - /// Used to complete a root-message previously started with a call to StartMessage() + /// Used to complete a root-message previously started with a call to WriteMessageStart() /// - public override void EndMessage() + public override void WriteMessageEnd() { _counter.RemoveAt(_counter.Count - 1); WriteLine("}"); diff --git a/src/ProtocolBuffers.Serialization/XmlFormatReader.cs b/src/ProtocolBuffers.Serialization/XmlFormatReader.cs index 0d3bca67f6..98b6977678 100644 --- a/src/ProtocolBuffers.Serialization/XmlFormatReader.cs +++ b/src/ProtocolBuffers.Serialization/XmlFormatReader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Xml; @@ -14,8 +14,23 @@ namespace Google.ProtocolBuffers.Serialization { public const string DefaultRootElementName = XmlFormatWriter.DefaultRootElementName; private readonly XmlReader _input; + private readonly Stack _elements; private string _rootElementName; + private struct ElementStack + { + public readonly string LocalName; + public readonly int Depth; + public readonly bool IsEmpty; + + public ElementStack(string localName, int depth, bool isEmpty) : this() + { + LocalName = localName; + IsEmpty = isEmpty; + Depth = depth; + } + } + private static XmlReaderSettings DefaultSettings { get @@ -72,20 +87,10 @@ namespace Google.ProtocolBuffers.Serialization { _input = input; _rootElementName = DefaultRootElementName; + _elements = new Stack(); Options = XmlReaderOptions.None; } - /// - /// Constructs the XmlFormatReader with the XmlReader and options - /// - protected XmlFormatReader(XmlFormatReader copyFrom, XmlReader input) - : base(copyFrom) - { - _input = input; - _rootElementName = copyFrom._rootElementName; - Options = copyFrom.Options; - } - /// /// Gets or sets the options to use when reading the xml /// @@ -113,20 +118,6 @@ namespace Google.ProtocolBuffers.Serialization } } - private XmlFormatReader CloneWith(XmlReader rdr) - { - XmlFormatReader copy = new XmlFormatReader(this, rdr); - return copy; - } - - private void NextElement() - { - while (!_input.IsStartElement() && _input.Read()) - { - continue; - } - } - private static void Assert(bool cond) { if (!cond) @@ -138,36 +129,49 @@ namespace Google.ProtocolBuffers.Serialization /// /// Reads the root-message preamble specific to this formatter /// - public override AbstractReader ReadStartMessage() + public override void ReadMessageStart() { - return ReadStartMessage(_rootElementName); + ReadMessageStart(_rootElementName); } - public AbstractReader ReadStartMessage(string element) + /// + /// Reads the root-message preamble specific to this formatter + /// + public void ReadMessageStart(string element) { - string field; - Assert(PeekNext(out field) && field == element); - - XmlReader child = _input.ReadSubtree(); - while (!child.IsStartElement() && child.Read()) + while (!_input.IsStartElement() && _input.Read()) { continue; } - child.Read(); - return CloneWith(child); + Assert(_input.IsStartElement() && _input.LocalName == element); + _elements.Push(new ElementStack(element, _input.Depth, _input.IsEmptyElement)); + _input.Read(); } /// /// Reads the root-message close specific to this formatter, MUST be called - /// on the reader obtained from ReadStartMessage(string element). + /// on the reader obtained from ReadMessageStart(string element). /// - public override void ReadEndMessage() + public override void ReadMessageEnd() { - Assert(0 == _input.Depth); - if(_input.NodeType == XmlNodeType.EndElement) + Assert(_elements.Count > 0); + + ElementStack stop = _elements.Peek(); + while (_input.NodeType != XmlNodeType.EndElement && _input.NodeType != XmlNodeType.Element + && _input.Depth > stop.Depth && _input.Read()) { + continue; + } + + if (!stop.IsEmpty) + { + Assert(_input.NodeType == XmlNodeType.EndElement + && _input.LocalName == stop.LocalName + && _input.Depth == stop.Depth); + _input.Read(); } + _elements.Pop(); } /// @@ -192,9 +196,9 @@ namespace Google.ProtocolBuffers.Serialization public TBuilder Merge(string element, TBuilder builder, ExtensionRegistry registry) where TBuilder : IBuilderLite { - string field; - Assert(PeekNext(out field) && field == element); - ReadMessage(builder, registry); + ReadMessageStart(element); + builder.WeakMergeFrom(this, registry); + ReadMessageEnd(); return builder; } @@ -207,7 +211,21 @@ namespace Google.ProtocolBuffers.Serialization /// protected override bool PeekNext(out string field) { - NextElement(); + ElementStack stopNode; + if (_elements.Count == 0) + { + stopNode = new ElementStack(null, _input.Depth - 1, false); + } + else + { + stopNode = _elements.Peek(); + } + + while (!_input.IsStartElement() && _input.Depth > stopNode.Depth && _input.Read()) + { + continue; + } + if (_input.IsStartElement()) { field = _input.LocalName; @@ -270,20 +288,9 @@ namespace Google.ProtocolBuffers.Serialization protected override bool ReadMessage(IBuilderLite builder, ExtensionRegistry registry) { Assert(_input.IsStartElement()); - - if (!_input.IsEmptyElement) - { - int depth = _input.Depth; - XmlReader child = _input.ReadSubtree(); - while (!child.IsStartElement() && child.Read()) - { - continue; - } - child.Read(); - builder.WeakMergeFrom(CloneWith(child), registry); - Assert(depth == _input.Depth && _input.NodeType == XmlNodeType.EndElement); - } - _input.Read(); + ReadMessageStart(_input.LocalName); + builder.WeakMergeFrom(this, registry); + ReadMessageEnd(); return true; } @@ -305,27 +312,16 @@ namespace Google.ProtocolBuffers.Serialization { yield return item; } - yield break; } - if (!_input.IsEmptyElement) + else { - int depth = _input.Depth; - XmlReader child = _input.ReadSubtree(); - - while (!child.IsStartElement() && child.Read()) - { - continue; - } - child.Read(); - - foreach (string item in CloneWith(child).NonNestedArrayItems("item")) + ReadMessageStart(field); + foreach (string item in NonNestedArrayItems("item")) { yield return item; } - Assert(depth == _input.Depth && _input.NodeType == XmlNodeType.EndElement); + ReadMessageEnd(); } - _input.Read(); - yield break; } } } \ No newline at end of file diff --git a/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs b/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs index a9cfcc1e2d..79f403dfad 100644 --- a/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs +++ b/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using System.IO; using System.Text; @@ -14,10 +14,12 @@ namespace Google.ProtocolBuffers.Serialization /// public class XmlFormatWriter : AbstractTextWriter { + private static readonly Encoding DefaultEncoding = new UTF8Encoding(false); public const string DefaultRootElementName = "root"; private const int NestedArrayFlag = 0x0001; private readonly XmlWriter _output; private string _rootElementName; + private int _messageOpenCount; private static XmlWriterSettings DefaultSettings(Encoding encoding) { @@ -43,7 +45,7 @@ namespace Google.ProtocolBuffers.Serialization /// public static XmlFormatWriter CreateInstance(Stream output) { - return new XmlFormatWriter(XmlWriter.Create(output, DefaultSettings(Encoding.UTF8))); + return new XmlFormatWriter(XmlWriter.Create(output, DefaultSettings(DefaultEncoding))); } /// @@ -65,6 +67,7 @@ namespace Google.ProtocolBuffers.Serialization protected XmlFormatWriter(XmlWriter output) { _output = output; + _messageOpenCount = 0; _rootElementName = DefaultRootElementName; } @@ -75,8 +78,8 @@ namespace Google.ProtocolBuffers.Serialization { if (disposing) { - if (_output.WriteState != WriteState.Closed && _output.WriteState != WriteState.Start) - _output.WriteEndDocument(); + while(_messageOpenCount > 0) + WriteMessageEnd(); _output.Close(); } @@ -128,9 +131,9 @@ namespace Google.ProtocolBuffers.Serialization /// /// Used to write the root-message preamble, in xml this is open element for RootElementName, /// by default "<root>". After this call you can call IMessageLite.MergeTo(...) and - /// complete the message with a call to EndMessage(). + /// complete the message with a call to WriteMessageEnd(). /// - public override void StartMessage() + public override void WriteMessageStart() { StartMessage(_rootElementName); } @@ -138,7 +141,7 @@ namespace Google.ProtocolBuffers.Serialization /// /// Used to write the root-message preamble, in xml this is open element for elementName. /// After this call you can call IMessageLite.MergeTo(...) and complete the message with - /// a call to EndMessage(). + /// a call to WriteMessageEnd(). /// public void StartMessage(string elementName) { @@ -151,15 +154,20 @@ namespace Google.ProtocolBuffers.Serialization { _output.WriteStartElement(elementName); } + _messageOpenCount++; } /// - /// Used to complete a root-message previously started with a call to StartMessage() + /// Used to complete a root-message previously started with a call to WriteMessageStart() /// - public override void EndMessage() + public override void WriteMessageEnd() { + if (_messageOpenCount <= 0) + throw new InvalidOperationException(); + _output.WriteEndElement(); _output.Flush(); + _messageOpenCount--; } /// @@ -177,7 +185,7 @@ namespace Google.ProtocolBuffers.Serialization { StartMessage(elementName); message.WriteTo(this); - EndMessage(); + WriteMessageEnd(); } /// diff --git a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj index 95ab0b9c63..549fe88c4f 100644 --- a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj +++ b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj @@ -106,6 +106,7 @@ + diff --git a/src/ProtocolBuffers.Test/TestMimeMessageFormats.cs b/src/ProtocolBuffers.Test/TestMimeMessageFormats.cs new file mode 100644 index 0000000000..6f4b7e0f3d --- /dev/null +++ b/src/ProtocolBuffers.Test/TestMimeMessageFormats.cs @@ -0,0 +1,225 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Google.ProtocolBuffers.Serialization; +using Google.ProtocolBuffers.Serialization.Http; +using Google.ProtocolBuffers.TestProtos; +using NUnit.Framework; + +namespace Google.ProtocolBuffers +{ + [TestFixture] + public class TestMimeMessageFormats + { + // There is a whole host of various json mime types in use around the net, this is the set we accept... + readonly IEnumerable JsonTypes = new string[] { "application/json", "application/x-json", "application/x-javascript", "text/javascript", "text/x-javascript", "text/x-json", "text/json" }; + readonly IEnumerable XmlTypes = new string[] { "text/xml", "application/xml" }; + readonly IEnumerable ProtobufTypes = new string[] { "application/binary", "application/x-protobuf", "application/vnd.google.protobuf" }; + + [Test] + public void TestReadJsonMimeTypes() + { + foreach (string type in JsonTypes) + { + Assert.IsTrue( + MessageFormatFactory.CreateInputStream(new MessageFormatOptions(), type, Stream.Null) + is JsonFormatReader); + } + Assert.IsTrue( + MessageFormatFactory.CreateInputStream(new MessageFormatOptions() { DefaultContentType = "application/json" }, null, Stream.Null) + is JsonFormatReader); + } + [Test] + public void TestWriteJsonMimeTypes() + { + foreach (string type in JsonTypes) + { + Assert.IsTrue( + MessageFormatFactory.CreateOutputStream(new MessageFormatOptions(), type, Stream.Null) + is JsonFormatWriter); + } + Assert.IsTrue( + MessageFormatFactory.CreateOutputStream(new MessageFormatOptions() { DefaultContentType = "application/json" }, null, Stream.Null) + is JsonFormatWriter); + } + [Test] + public void TestReadXmlMimeTypes() + { + foreach (string type in XmlTypes) + { + Assert.IsTrue( + MessageFormatFactory.CreateInputStream(new MessageFormatOptions(), type, Stream.Null) + is XmlFormatReader); + } + Assert.IsTrue( + MessageFormatFactory.CreateInputStream(new MessageFormatOptions() { DefaultContentType = "application/xml" }, null, Stream.Null) + is XmlFormatReader); + } + [Test] + public void TestWriteXmlMimeTypes() + { + foreach (string type in XmlTypes) + { + Assert.IsTrue( + MessageFormatFactory.CreateOutputStream(new MessageFormatOptions(), type, Stream.Null) + is XmlFormatWriter); + } + Assert.IsTrue( + MessageFormatFactory.CreateOutputStream(new MessageFormatOptions() { DefaultContentType = "application/xml" }, null, Stream.Null) + is XmlFormatWriter); + } + [Test] + public void TestReadProtoMimeTypes() + { + foreach (string type in ProtobufTypes) + { + Assert.IsTrue( + MessageFormatFactory.CreateInputStream(new MessageFormatOptions(), type, Stream.Null) + is CodedInputStream); + } + Assert.IsTrue( + MessageFormatFactory.CreateInputStream(new MessageFormatOptions() { DefaultContentType = "application/vnd.google.protobuf" }, null, Stream.Null) + is CodedInputStream); + } + [Test] + public void TestWriteProtoMimeTypes() + { + foreach (string type in ProtobufTypes) + { + Assert.IsTrue( + MessageFormatFactory.CreateOutputStream(new MessageFormatOptions(), type, Stream.Null) + is CodedOutputStream); + } + Assert.IsTrue( + MessageFormatFactory.CreateOutputStream(new MessageFormatOptions() { DefaultContentType = "application/vnd.google.protobuf" }, null, Stream.Null) + is CodedOutputStream); + } + [Test] + public void TestMergeFromJsonType() + { + TestXmlMessage msg = new TestXmlMessage.Builder().MergeFrom( + new MessageFormatOptions(), "application/json", new MemoryStream(Encoding.ASCII.GetBytes( + TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build().ToJson() + ))) + .Build(); + Assert.AreEqual("a", msg.Text); + Assert.AreEqual(1, msg.Number); + } + [Test] + public void TestMergeFromXmlType() + { + TestXmlMessage msg = new TestXmlMessage.Builder().MergeFrom( + new MessageFormatOptions(), "application/xml", new MemoryStream(Encoding.ASCII.GetBytes( + TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build().ToXml() + ))) + .Build(); + Assert.AreEqual("a", msg.Text); + Assert.AreEqual(1, msg.Number); + } + [Test] + public void TestMergeFromProtoType() + { + TestXmlMessage msg = new TestXmlMessage.Builder().MergeFrom( + new MessageFormatOptions(), "application/vnd.google.protobuf", new MemoryStream( + TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build().ToByteArray() + )) + .Build(); + Assert.AreEqual("a", msg.Text); + Assert.AreEqual(1, msg.Number); + } + [Test] + public void TestWriteToJsonType() + { + MemoryStream ms = new MemoryStream(); + TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build() + .WriteTo(new MessageFormatOptions(), "application/json", ms); + + Assert.AreEqual(@"{""text"":""a"",""number"":1}", Encoding.UTF8.GetString(ms.ToArray())); + } + [Test] + public void TestWriteToXmlType() + { + MemoryStream ms = new MemoryStream(); + TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build() + .WriteTo(new MessageFormatOptions(), "application/xml", ms); + + Assert.AreEqual("a1", Encoding.UTF8.GetString(ms.ToArray())); + } + [Test] + public void TestWriteToProtoType() + { + MemoryStream ms = new MemoryStream(); + TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build() + .WriteTo(new MessageFormatOptions(), "application/vnd.google.protobuf", ms); + + byte[] bytes = TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build().ToByteArray(); + Assert.AreEqual(bytes, ms.ToArray()); + } + [Test] + public void TestXmlReaderOptions() + { + MemoryStream ms = new MemoryStream(); + XmlFormatWriter.CreateInstance(ms) + .SetOptions(XmlWriterOptions.OutputNestedArrays) + .WriteMessage("my-root-node", TestXmlMessage.CreateBuilder().SetText("a").AddNumbers(1).AddNumbers(2).Build()); + ms.Position = 0; + + MessageFormatOptions options = new MessageFormatOptions() + { + XmlReaderOptions = XmlReaderOptions.ReadNestedArrays, + XmlReaderRootElementName = "my-root-node" + }; + + TestXmlMessage msg = new TestXmlMessage.Builder().MergeFrom( + options, "application/xml", ms) + .Build(); + + Assert.AreEqual("a", msg.Text); + Assert.AreEqual(1, msg.NumbersList[0]); + Assert.AreEqual(2, msg.NumbersList[1]); + + } + [Test] + public void TestXmlWriterOptions() + { + TestXmlMessage message = TestXmlMessage.CreateBuilder().SetText("a").AddNumbers(1).AddNumbers(2).Build(); + MessageFormatOptions options = new MessageFormatOptions() + { + XmlWriterOptions = XmlWriterOptions.OutputNestedArrays, + XmlWriterRootElementName = "root-node" + }; + + MemoryStream ms = new MemoryStream(); + message.WriteTo(options, "application/xml", ms); + ms.Position = 0; + + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + XmlFormatReader.CreateInstance(ms) + .SetOptions(XmlReaderOptions.ReadNestedArrays) + .Merge("root-node", builder); + + Assert.AreEqual("a", builder.Text); + Assert.AreEqual(1, builder.NumbersList[0]); + Assert.AreEqual(2, builder.NumbersList[1]); + } + [Test] + public void TestJsonFormatted() + { + MemoryStream ms = new MemoryStream(); + TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build() + .WriteTo(new MessageFormatOptions() { FormattedOutput = true }, "application/json", ms); + + Assert.AreEqual("{\r\n \"text\": \"a\",\r\n \"number\": 1\r\n}", Encoding.UTF8.GetString(ms.ToArray())); + } + [Test] + public void TestXmlFormatted() + { + MemoryStream ms = new MemoryStream(); + TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build() + .WriteTo(new MessageFormatOptions() { FormattedOutput = true }, "application/xml", ms); + + Assert.AreEqual("\r\n a\r\n 1\r\n", Encoding.UTF8.GetString(ms.ToArray())); + } + } +} \ No newline at end of file diff --git a/src/ProtocolBuffers.Test/TestWriterFormatJson.cs b/src/ProtocolBuffers.Test/TestWriterFormatJson.cs index 341f0b3ceb..1958df0de3 100644 --- a/src/ProtocolBuffers.Test/TestWriterFormatJson.cs +++ b/src/ProtocolBuffers.Test/TestWriterFormatJson.cs @@ -45,7 +45,7 @@ namespace Google.ProtocolBuffers using (TextWriter output = new StringWriter()) using (AbstractWriter writer = JsonFormatWriter.CreateInstance(output)) { - writer.StartMessage(); //manually begin the message, output is '{' + writer.WriteMessageStart(); //manually begin the message, output is '{' writer.Flush(); Assert.AreEqual("{", output.ToString()); @@ -56,7 +56,7 @@ namespace Google.ProtocolBuffers writer.Flush(); Assert.AreEqual(@"{""valid"":true", output.ToString()); - writer.EndMessage(); //manually write the end message '}' + writer.WriteMessageEnd(); //manually write the end message '}' Assert.AreEqual(@"{""valid"":true}", output.ToString()); } } @@ -65,13 +65,13 @@ namespace Google.ProtocolBuffers public void Example_ReadJsonUsingICodedInputStream() { TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); - AbstractReader reader = JsonFormatReader.CreateInstance(@"{""valid"":true}"); + ICodedInputStream reader = JsonFormatReader.CreateInstance(@"{""valid"":true}"); - AbstractReader stream = reader.ReadStartMessage(); //manually read the begin the message '{' + reader.ReadMessageStart(); //manually read the begin the message '{' - builder.MergeFrom(stream); //write the message normally + builder.MergeFrom(reader); //write the message normally - stream.ReadEndMessage(); //manually read the end message '}' + reader.ReadMessageEnd(); //manually read the end message '}' } protected string Content; @@ -401,6 +401,28 @@ namespace Google.ProtocolBuffers Assert.AreEqual(3, ordinal); Assert.AreEqual(3, builder.TextlinesCount); } + [Test] + public void TestReadWriteJsonWithoutRoot() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + TestXmlMessage message = builder.SetText("abc").SetNumber(123).Build(); + + string Json; + using (StringWriter sw = new StringWriter()) + { + ICodedOutputStream output = JsonFormatWriter.CreateInstance(sw); + + message.WriteTo(output); + output.Flush(); + Json = sw.ToString(); + } + Assert.AreEqual(@"""text"":""abc"",""number"":123", Json); + + ICodedInputStream input = JsonFormatReader.CreateInstance(Json); + TestXmlMessage copy = TestXmlMessage.CreateBuilder().MergeFrom(input).Build(); + + Assert.AreEqual(message, copy); + } [Test,ExpectedException(typeof(RecursionLimitExceededException))] public void TestRecursiveLimit() { diff --git a/src/ProtocolBuffers.Test/TestWriterFormatXml.cs b/src/ProtocolBuffers.Test/TestWriterFormatXml.cs index d56cc52525..f401481eec 100644 --- a/src/ProtocolBuffers.Test/TestWriterFormatXml.cs +++ b/src/ProtocolBuffers.Test/TestWriterFormatXml.cs @@ -48,12 +48,12 @@ namespace Google.ProtocolBuffers using (TextWriter output = new StringWriter()) using (AbstractWriter writer = XmlFormatWriter.CreateInstance(output)) { - writer.StartMessage(); //manually begin the message, output is '{' + writer.WriteMessageStart(); //manually begin the message, output is '{' ICodedOutputStream stream = writer; - message.WriteTo(stream); //write the message normally + message.WriteTo(stream); //write the message normally - writer.EndMessage(); //manually write the end message '}' + writer.WriteMessageEnd(); //manually write the end message '}' Assert.AreEqual(@"true", output.ToString()); } } @@ -62,13 +62,13 @@ namespace Google.ProtocolBuffers public void Example_ReadXmlUsingICodedInputStream() { TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); - AbstractReader reader = XmlFormatReader.CreateInstance(@"true"); + ICodedInputStream reader = XmlFormatReader.CreateInstance(@"true"); - AbstractReader stream = reader.ReadStartMessage(); //manually read the begin the message '{' + reader.ReadMessageStart(); //manually read the begin the message '{' - builder.MergeFrom(stream); //write the message normally + builder.MergeFrom(reader); //read the message normally - stream.ReadEndMessage(); //manually read the end message '}' + reader.ReadMessageEnd(); //manually read the end message '}' } [Test] @@ -387,13 +387,54 @@ namespace Google.ProtocolBuffers public void TestXmlReadEmptyRoot() { TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); - AbstractReader reader = XmlFormatReader.CreateInstance(@""); + ICodedInputStream reader = XmlFormatReader.CreateInstance(@""); - AbstractReader stream = reader.ReadStartMessage(); //manually read the begin the message '{' + reader.ReadMessageStart(); //manually read the begin the message '{' - builder.MergeFrom(stream); //write the message normally + builder.MergeFrom(reader); //write the message normally - stream.ReadEndMessage(); //manually read the end message '}' + reader.ReadMessageEnd(); //manually read the end message '}' + } + + [Test] + public void TestXmlReadEmptyChild() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + ICodedInputStream reader = XmlFormatReader.CreateInstance(@""); + + reader.ReadMessageStart(); //manually read the begin the message '{' + + builder.MergeFrom(reader); //write the message normally + Assert.IsTrue(builder.HasText); + Assert.AreEqual(String.Empty, builder.Text); + } + + [Test] + public void TestXmlReadWriteWithoutRoot() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + TestXmlMessage message = builder.SetText("abc").SetNumber(123).Build(); + + string xml; + using (StringWriter sw = new StringWriter()) + { + ICodedOutputStream output = XmlFormatWriter.CreateInstance( + XmlWriter.Create(sw, new XmlWriterSettings() { ConformanceLevel = ConformanceLevel.Fragment })); + + message.WriteTo(output); + output.Flush(); + xml = sw.ToString(); + } + Assert.AreEqual("abc123", xml); + + TestXmlMessage copy; + using (XmlReader xr = XmlReader.Create(new StringReader(xml), new XmlReaderSettings() { ConformanceLevel = ConformanceLevel.Fragment })) + { + ICodedInputStream input = XmlFormatReader.CreateInstance(xr); + copy = TestXmlMessage.CreateBuilder().MergeFrom(input).Build(); + } + + Assert.AreEqual(message, copy); } [Test, ExpectedException(typeof(RecursionLimitExceededException))] diff --git a/src/ProtocolBuffers/CodedInputStream.cs b/src/ProtocolBuffers/CodedInputStream.cs index 509b416453..35ebba92ae 100644 --- a/src/ProtocolBuffers/CodedInputStream.cs +++ b/src/ProtocolBuffers/CodedInputStream.cs @@ -144,6 +144,9 @@ namespace Google.ProtocolBuffers #endregion + void ICodedInputStream.ReadMessageStart() { } + void ICodedInputStream.ReadMessageEnd() { } + #region Validation /// diff --git a/src/ProtocolBuffers/CodedOutputStream.cs b/src/ProtocolBuffers/CodedOutputStream.cs index bb133a7741..560719afa3 100644 --- a/src/ProtocolBuffers/CodedOutputStream.cs +++ b/src/ProtocolBuffers/CodedOutputStream.cs @@ -136,6 +136,9 @@ namespace Google.ProtocolBuffers } } + void ICodedOutputStream.WriteMessageStart() { } + void ICodedOutputStream.WriteMessageEnd() { Flush(); } + #region Writing of unknown fields [Obsolete] diff --git a/src/ProtocolBuffers/ICodedInputStream.cs b/src/ProtocolBuffers/ICodedInputStream.cs index 1d9d26e3a7..a3c0f30b57 100644 --- a/src/ProtocolBuffers/ICodedInputStream.cs +++ b/src/ProtocolBuffers/ICodedInputStream.cs @@ -45,6 +45,24 @@ namespace Google.ProtocolBuffers { public interface ICodedInputStream { + /// + /// Reads any message initialization data expected from the input stream + /// + /// + /// This is primarily used by text formats and unnecessary for protobuffers' own + /// binary format. The API for MessageStart/End was added for consistent handling + /// of output streams regardless of the actual writer implementation. + /// + void ReadMessageStart(); + /// + /// Reads any message finalization data expected from the input stream + /// + /// + /// This is primarily used by text formats and unnecessary for protobuffers' own + /// binary format. The API for MessageStart/End was added for consistent handling + /// of output streams regardless of the actual writer implementation. + /// + void ReadMessageEnd(); /// /// Attempt to read a field tag, returning false if we have reached the end /// of the input data. diff --git a/src/ProtocolBuffers/ICodedOutputStream.cs b/src/ProtocolBuffers/ICodedOutputStream.cs index 2c324792b5..a686fed178 100644 --- a/src/ProtocolBuffers/ICodedOutputStream.cs +++ b/src/ProtocolBuffers/ICodedOutputStream.cs @@ -51,6 +51,24 @@ namespace Google.ProtocolBuffers /// public interface ICodedOutputStream : IDisposable { + /// + /// Writes any message initialization data needed to the output stream + /// + /// + /// This is primarily used by text formats and unnecessary for protobuffers' own + /// binary format. The API for MessageStart/End was added for consistent handling + /// of output streams regardless of the actual writer implementation. + /// + void WriteMessageStart(); + /// + /// Writes any message finalization data needed to the output stream + /// + /// + /// This is primarily used by text formats and unnecessary for protobuffers' own + /// binary format. The API for MessageStart/End was added for consistent handling + /// of output streams regardless of the actual writer implementation. + /// + void WriteMessageEnd(); /// /// Indicates that all temporary buffers be written to the final output. /// From f9102a61e1d87238e9ac7aff3ee090b8b31ed4ab Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 9 Sep 2011 12:29:09 -0500 Subject: [PATCH 04/31] Fix for issue 6 --- src/ProtocolBuffers/IRpcController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ProtocolBuffers/IRpcController.cs b/src/ProtocolBuffers/IRpcController.cs index f6220e3768..b155bec557 100644 --- a/src/ProtocolBuffers/IRpcController.cs +++ b/src/ProtocolBuffers/IRpcController.cs @@ -105,7 +105,7 @@ namespace Google.ProtocolBuffers /// well give up on replying to it. This method must be called on the server /// side only. The server should still call the final "done" callback. /// - bool isCanceled(); + bool IsCanceled(); /// /// Requests that the given callback be called when the RPC is canceled. From a105eac521b6a810b9c40db2febba412e316d0b2 Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 9 Sep 2011 13:39:54 -0500 Subject: [PATCH 05/31] Added support for negative enum values and tests --- protos/extest/unittest_issues.proto | 14 + .../CodedInputStreamTest.cs | 73 +++ .../CodedOutputStreamTest.cs | 79 ++++ .../ProtocolBuffers.Test.csproj | 1 + src/ProtocolBuffers.Test/TestCornerCases.cs | 38 ++ .../UnitTestExtrasIssuesProtoFile.cs | 416 +++++++++++++++++- .../CodedOutputStream.ComputeSize.cs | 4 +- src/ProtocolBuffers/CodedOutputStream.cs | 4 +- 8 files changed, 622 insertions(+), 7 deletions(-) create mode 100644 src/ProtocolBuffers.Test/TestCornerCases.cs diff --git a/protos/extest/unittest_issues.proto b/protos/extest/unittest_issues.proto index 459e58f865..0816e1e215 100644 --- a/protos/extest/unittest_issues.proto +++ b/protos/extest/unittest_issues.proto @@ -86,3 +86,17 @@ message NumberField { optional int32 _01 = 1; } + +// issue 19 - negative enum values + +enum NegativeEnum { + FiveBelow = -5; + MinusOne = -1; + Zero = 0; +} + +message NegativeEnumMessage { + optional NegativeEnum value = 1; + repeated NegativeEnum values = 2; + repeated NegativeEnum packed_values = 3 [packed=true]; +} \ No newline at end of file diff --git a/src/ProtocolBuffers.Test/CodedInputStreamTest.cs b/src/ProtocolBuffers.Test/CodedInputStreamTest.cs index c3ca0a10ff..64656b196f 100644 --- a/src/ProtocolBuffers.Test/CodedInputStreamTest.cs +++ b/src/ProtocolBuffers.Test/CodedInputStreamTest.cs @@ -35,6 +35,7 @@ #endregion using System; +using System.Collections.Generic; using System.IO; using Google.ProtocolBuffers.TestProtos; using NUnit.Framework; @@ -532,5 +533,77 @@ namespace Google.ProtocolBuffers return base.Read(buffer, offset, Math.Min(count, blockSize)); } } + + enum TestNegEnum { None = 0, Value = -2 } + + [Test] + public void TestNegativeEnum() + { + byte[] bytes = new byte[10] { 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01 }; + CodedInputStream input = CodedInputStream.CreateInstance(bytes); + object unk; + TestNegEnum val = TestNegEnum.None; + + Assert.IsTrue(input.ReadEnum(ref val, out unk)); + Assert.IsTrue(input.IsAtEnd); + Assert.AreEqual(TestNegEnum.Value, val); + } + + [Test] + public void TestNegativeEnumPackedArray() + { + int arraySize = 1 + (10 * 5); + int msgSize = 1 + 1 + arraySize; + byte[] bytes = new byte[msgSize]; + CodedOutputStream output = CodedOutputStream.CreateInstance(bytes); + output.WritePackedInt32Array(8, "", arraySize, new int[] { 0, -1, -2, -3, -4, -5 }); + + Assert.AreEqual(0, output.SpaceLeft); + + CodedInputStream input = CodedInputStream.CreateInstance(bytes); + uint tag; + string name; + Assert.IsTrue(input.ReadTag(out tag, out name)); + + List values = new List(); + ICollection unk; + input.ReadEnumArray(tag, name, values, out unk); + + Assert.AreEqual(2, values.Count); + Assert.AreEqual(TestNegEnum.None, values[0]); + Assert.AreEqual(TestNegEnum.Value, values[1]); + + Assert.IsNotNull(unk); + Assert.AreEqual(4, unk.Count); + } + + [Test] + public void TestNegativeEnumArray() + { + int arraySize = 1 + 1 + (11 * 5); + int msgSize = arraySize; + byte[] bytes = new byte[msgSize]; + CodedOutputStream output = CodedOutputStream.CreateInstance(bytes); + output.WriteInt32Array(8, "", new int[] { 0, -1, -2, -3, -4, -5 }); + + Assert.AreEqual(0, output.SpaceLeft); + + CodedInputStream input = CodedInputStream.CreateInstance(bytes); + uint tag; + string name; + Assert.IsTrue(input.ReadTag(out tag, out name)); + + List values = new List(); + ICollection unk; + input.ReadEnumArray(tag, name, values, out unk); + + Assert.AreEqual(2, values.Count); + Assert.AreEqual(TestNegEnum.None, values[0]); + Assert.AreEqual(TestNegEnum.Value, values[1]); + + Assert.IsNotNull(unk); + Assert.AreEqual(4, unk.Count); + } + } } \ No newline at end of file diff --git a/src/ProtocolBuffers.Test/CodedOutputStreamTest.cs b/src/ProtocolBuffers.Test/CodedOutputStreamTest.cs index 3dd2e0c3dd..d041d3f0dd 100644 --- a/src/ProtocolBuffers.Test/CodedOutputStreamTest.cs +++ b/src/ProtocolBuffers.Test/CodedOutputStreamTest.cs @@ -34,6 +34,8 @@ #endregion +using System; +using System.Collections.Generic; using System.IO; using Google.ProtocolBuffers.TestProtos; using NUnit.Framework; @@ -288,5 +290,82 @@ namespace Google.ProtocolBuffers Assert.AreEqual(-75123905439571256L, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-75123905439571256L))); } + + [Test] + public void TestNegativeEnumNoTag() + { + Assert.AreEqual(10, CodedOutputStream.ComputeInt32SizeNoTag(-2)); + Assert.AreEqual(10, CodedOutputStream.ComputeEnumSizeNoTag(-2)); + + byte[] bytes = new byte[10]; + CodedOutputStream output = CodedOutputStream.CreateInstance(bytes); + output.WriteEnumNoTag(-2); + + Assert.AreEqual(0, output.SpaceLeft); + Assert.AreEqual("FE-FF-FF-FF-FF-FF-FF-FF-FF-01", BitConverter.ToString(bytes)); + } + + [Test] + public void TestNegativeEnumWithTag() + { + Assert.AreEqual(11, CodedOutputStream.ComputeInt32Size(8, -2)); + Assert.AreEqual(11, CodedOutputStream.ComputeEnumSize(8, -2)); + + byte[] bytes = new byte[11]; + CodedOutputStream output = CodedOutputStream.CreateInstance(bytes); + output.WriteEnum(8, "", -2, -2); + + Assert.AreEqual(0, output.SpaceLeft); + //fyi, 0x40 == 0x08 << 3 + 0, field num + wire format shift + Assert.AreEqual("40-FE-FF-FF-FF-FF-FF-FF-FF-FF-01", BitConverter.ToString(bytes)); + } + + [Test] + public void TestNegativeEnumArrayPacked() + { + int arraySize = 1 + (10 * 5); + int msgSize = 1 + 1 + arraySize; + byte[] bytes = new byte[msgSize]; + CodedOutputStream output = CodedOutputStream.CreateInstance(bytes); + output.WritePackedEnumArray(8, "", arraySize, new int[] { 0, -1, -2, -3, -4, -5 }); + + Assert.AreEqual(0, output.SpaceLeft); + + CodedInputStream input = CodedInputStream.CreateInstance(bytes); + uint tag; + string name; + Assert.IsTrue(input.ReadTag(out tag, out name)); + + List values = new List(); + input.ReadInt32Array(tag, name, values); + + Assert.AreEqual(6, values.Count); + for (int i = 0; i > -6; i--) + Assert.AreEqual(i, values[Math.Abs(i)]); + } + + [Test] + public void TestNegativeEnumArray() + { + int arraySize = 1 + 1 + (11 * 5); + int msgSize = arraySize; + byte[] bytes = new byte[msgSize]; + CodedOutputStream output = CodedOutputStream.CreateInstance(bytes); + output.WriteEnumArray(8, "", new int[] { 0, -1, -2, -3, -4, -5 }); + + Assert.AreEqual(0, output.SpaceLeft); + + CodedInputStream input = CodedInputStream.CreateInstance(bytes); + uint tag; + string name; + Assert.IsTrue(input.ReadTag(out tag, out name)); + + List values = new List(); + input.ReadInt32Array(tag, name, values); + + Assert.AreEqual(6, values.Count); + for (int i = 0; i > -6; i--) + Assert.AreEqual(i, values[Math.Abs(i)]); + } } } \ No newline at end of file diff --git a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj index 95ab0b9c63..5083817282 100644 --- a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj +++ b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj @@ -106,6 +106,7 @@ + diff --git a/src/ProtocolBuffers.Test/TestCornerCases.cs b/src/ProtocolBuffers.Test/TestCornerCases.cs new file mode 100644 index 0000000000..8a3fe051d6 --- /dev/null +++ b/src/ProtocolBuffers.Test/TestCornerCases.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Text; +using NUnit.Framework; +using UnitTest.Issues.TestProtos; + +namespace Google.ProtocolBuffers +{ + [TestFixture] + public class TestCornerCases + { + [Test] + public void TestRoundTripNegativeEnums() + { + NegativeEnumMessage msg = NegativeEnumMessage.CreateBuilder() + .SetValue(NegativeEnum.MinusOne) //11 + .AddValues(NegativeEnum.Zero) //2 + .AddValues(NegativeEnum.MinusOne) //11 + .AddValues(NegativeEnum.FiveBelow) //11 + //2 + .AddPackedValues(NegativeEnum.Zero) //1 + .AddPackedValues(NegativeEnum.MinusOne) //10 + .AddPackedValues(NegativeEnum.FiveBelow) //10 + .Build(); + + Assert.AreEqual(58, msg.SerializedSize); + + byte[] bytes = new byte[58]; + CodedOutputStream output = CodedOutputStream.CreateInstance(bytes); + + msg.WriteTo(output); + Assert.AreEqual(0, output.SpaceLeft); + + NegativeEnumMessage copy = NegativeEnumMessage.ParseFrom(bytes); + Assert.AreEqual(msg, copy); + } + } +} diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs index db56e8b919..3ea55b8828 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs @@ -26,6 +26,8 @@ namespace UnitTest.Issues.TestProtos { internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_AB__FieldAccessorTable; internal static pbd::MessageDescriptor internal__static_unittest_issues_NumberField__Descriptor; internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_NumberField__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_issues_NegativeEnumMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_NegativeEnumMessage__FieldAccessorTable; #endregion #region Descriptor public static pbd::FileDescriptor Descriptor { @@ -38,9 +40,14 @@ namespace UnitTest.Issues.TestProtos { "ChxleHRlc3QvdW5pdHRlc3RfaXNzdWVzLnByb3RvEg91bml0dGVzdF9pc3N1" + "ZXMaJGdvb2dsZS9wcm90b2J1Zi9jc2hhcnBfb3B0aW9ucy5wcm90byIPCgFB" + "EgoKAl9BGAEgASgFIg8KAUISCgoCQl8YASABKAUiEQoCQUISCwoDYV9iGAEg" + - "ASgFIhoKC051bWJlckZpZWxkEgsKA18wMRgBIAEoBUJASAHCPjsKGlVuaXRU" + - "ZXN0Lklzc3Vlcy5UZXN0UHJvdG9zEh1Vbml0VGVzdEV4dHJhc0lzc3Vlc1By" + - "b3RvRmlsZQ=="); + "ASgFIhoKC051bWJlckZpZWxkEgsKA18wMRgBIAEoBSKsAQoTTmVnYXRpdmVF" + + "bnVtTWVzc2FnZRIsCgV2YWx1ZRgBIAEoDjIdLnVuaXR0ZXN0X2lzc3Vlcy5O" + + "ZWdhdGl2ZUVudW0SLQoGdmFsdWVzGAIgAygOMh0udW5pdHRlc3RfaXNzdWVz" + + "Lk5lZ2F0aXZlRW51bRI4Cg1wYWNrZWRfdmFsdWVzGAMgAygOMh0udW5pdHRl" + + "c3RfaXNzdWVzLk5lZ2F0aXZlRW51bUICEAEqRwoMTmVnYXRpdmVFbnVtEhYK" + + "CUZpdmVCZWxvdxD7//////////8BEhUKCE1pbnVzT25lEP///////////wES" + + "CAoEWmVybxAAQkBIAcI+OwoaVW5pdFRlc3QuSXNzdWVzLlRlc3RQcm90b3MS" + + "HVVuaXRUZXN0RXh0cmFzSXNzdWVzUHJvdG9GaWxl"); pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { descriptor = root; internal__static_unittest_issues_A__Descriptor = Descriptor.MessageTypes[0]; @@ -59,6 +66,10 @@ namespace UnitTest.Issues.TestProtos { internal__static_unittest_issues_NumberField__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_NumberField__Descriptor, new string[] { "_01", }); + internal__static_unittest_issues_NegativeEnumMessage__Descriptor = Descriptor.MessageTypes[4]; + internal__static_unittest_issues_NegativeEnumMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_NegativeEnumMessage__Descriptor, + new string[] { "Value", "Values", "PackedValues", }); pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); RegisterAllExtensions(registry); global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); @@ -72,6 +83,17 @@ namespace UnitTest.Issues.TestProtos { #endregion } + #region Enums + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + public enum NegativeEnum { + FiveBelow = -5, + MinusOne = -1, + Zero = 0, + } + + #endregion + #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] @@ -1033,6 +1055,394 @@ namespace UnitTest.Issues.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + public sealed partial class NegativeEnumMessage : pb::GeneratedMessage { + private static readonly NegativeEnumMessage defaultInstance = new Builder().BuildPartial(); + private static readonly string[] _negativeEnumMessageFieldNames = new string[] { "packed_values", "value", "values" }; + private static readonly uint[] _negativeEnumMessageFieldTags = new uint[] { 26, 8, 16 }; + public static NegativeEnumMessage DefaultInstance { + get { return defaultInstance; } + } + + public override NegativeEnumMessage DefaultInstanceForType { + get { return defaultInstance; } + } + + protected override NegativeEnumMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_NegativeEnumMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_NegativeEnumMessage__FieldAccessorTable; } + } + + public const int ValueFieldNumber = 1; + private bool hasValue; + private global::UnitTest.Issues.TestProtos.NegativeEnum value_ = global::UnitTest.Issues.TestProtos.NegativeEnum.FiveBelow; + public bool HasValue { + get { return hasValue; } + } + public global::UnitTest.Issues.TestProtos.NegativeEnum Value { + get { return value_; } + } + + public const int ValuesFieldNumber = 2; + private pbc::PopsicleList values_ = new pbc::PopsicleList(); + public scg::IList ValuesList { + get { return pbc::Lists.AsReadOnly(values_); } + } + public int ValuesCount { + get { return values_.Count; } + } + public global::UnitTest.Issues.TestProtos.NegativeEnum GetValues(int index) { + return values_[index]; + } + + public const int PackedValuesFieldNumber = 3; + private int packedValuesMemoizedSerializedSize; + private pbc::PopsicleList packedValues_ = new pbc::PopsicleList(); + public scg::IList PackedValuesList { + get { return pbc::Lists.AsReadOnly(packedValues_); } + } + public int PackedValuesCount { + get { return packedValues_.Count; } + } + public global::UnitTest.Issues.TestProtos.NegativeEnum GetPackedValues(int index) { + return packedValues_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + int size = SerializedSize; + string[] field_names = _negativeEnumMessageFieldNames; + if (hasValue) { + output.WriteEnum(1, field_names[1], (int) Value, Value); + } + if (values_.Count > 0) { + output.WriteEnumArray(2, field_names[2], values_); + } + if (packedValues_.Count > 0) { + output.WritePackedEnumArray(3, field_names[0], packedValuesMemoizedSerializedSize, packedValues_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasValue) { + size += pb::CodedOutputStream.ComputeEnumSize(1, (int) Value); + } + { + int dataSize = 0; + if (values_.Count > 0) { + foreach (global::UnitTest.Issues.TestProtos.NegativeEnum element in values_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 1 * values_.Count; + } + } + { + int dataSize = 0; + if (packedValues_.Count > 0) { + foreach (global::UnitTest.Issues.TestProtos.NegativeEnum element in packedValues_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 1; + size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + } + packedValuesMemoizedSerializedSize = dataSize; + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static NegativeEnumMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NegativeEnumMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NegativeEnumMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NegativeEnumMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NegativeEnumMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NegativeEnumMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static NegativeEnumMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static NegativeEnumMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static NegativeEnumMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NegativeEnumMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(NegativeEnumMessage prototype) { + return (Builder) new Builder().MergeFrom(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() {} + + NegativeEnumMessage result = new NegativeEnumMessage(); + + protected override NegativeEnumMessage MessageBeingBuilt { + get { return result; } + } + + public override Builder Clear() { + result = new NegativeEnumMessage(); + return this; + } + + public override Builder Clone() { + return new Builder().MergeFrom(result); + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::UnitTest.Issues.TestProtos.NegativeEnumMessage.Descriptor; } + } + + public override NegativeEnumMessage DefaultInstanceForType { + get { return global::UnitTest.Issues.TestProtos.NegativeEnumMessage.DefaultInstance; } + } + + public override NegativeEnumMessage BuildPartial() { + if (result == null) { + throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + } + result.values_.MakeReadOnly(); + result.packedValues_.MakeReadOnly(); + NegativeEnumMessage returnMe = result; + result = null; + return returnMe; + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is NegativeEnumMessage) { + return MergeFrom((NegativeEnumMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(NegativeEnumMessage other) { + if (other == global::UnitTest.Issues.TestProtos.NegativeEnumMessage.DefaultInstance) return this; + if (other.HasValue) { + Value = other.Value; + } + if (other.values_.Count != 0) { + base.AddRange(other.values_, result.values_); + } + if (other.packedValues_.Count != 0) { + base.AddRange(other.packedValues_, result.packedValues_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_negativeEnumMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _negativeEnumMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + object unknown; + if(input.ReadEnum(ref result.value_, out unknown)) { + result.hasValue = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(1, (ulong)(int)unknown); + } + break; + } + case 18: + case 16: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.values_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(2, (ulong)(int)rawValue); + } + break; + } + case 26: + case 24: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.packedValues_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(3, (ulong)(int)rawValue); + } + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasValue { + get { return result.hasValue; } + } + public global::UnitTest.Issues.TestProtos.NegativeEnum Value { + get { return result.Value; } + set { SetValue(value); } + } + public Builder SetValue(global::UnitTest.Issues.TestProtos.NegativeEnum value) { + result.hasValue = true; + result.value_ = value; + return this; + } + public Builder ClearValue() { + result.hasValue = false; + result.value_ = global::UnitTest.Issues.TestProtos.NegativeEnum.FiveBelow; + return this; + } + + public pbc::IPopsicleList ValuesList { + get { return result.values_; } + } + public int ValuesCount { + get { return result.ValuesCount; } + } + public global::UnitTest.Issues.TestProtos.NegativeEnum GetValues(int index) { + return result.GetValues(index); + } + public Builder SetValues(int index, global::UnitTest.Issues.TestProtos.NegativeEnum value) { + result.values_[index] = value; + return this; + } + public Builder AddValues(global::UnitTest.Issues.TestProtos.NegativeEnum value) { + result.values_.Add(value); + return this; + } + public Builder AddRangeValues(scg::IEnumerable values) { + base.AddRange(values, result.values_); + return this; + } + public Builder ClearValues() { + result.values_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedValuesList { + get { return result.packedValues_; } + } + public int PackedValuesCount { + get { return result.PackedValuesCount; } + } + public global::UnitTest.Issues.TestProtos.NegativeEnum GetPackedValues(int index) { + return result.GetPackedValues(index); + } + public Builder SetPackedValues(int index, global::UnitTest.Issues.TestProtos.NegativeEnum value) { + result.packedValues_[index] = value; + return this; + } + public Builder AddPackedValues(global::UnitTest.Issues.TestProtos.NegativeEnum value) { + result.packedValues_.Add(value); + return this; + } + public Builder AddRangePackedValues(scg::IEnumerable values) { + base.AddRange(values, result.packedValues_); + return this; + } + public Builder ClearPackedValues() { + result.packedValues_.Clear(); + return this; + } + } + static NegativeEnumMessage() { + object.ReferenceEquals(global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.Descriptor, null); + } + } + #endregion } diff --git a/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs b/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs index 50bf28d23e..2da0080ec9 100644 --- a/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs +++ b/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs @@ -202,7 +202,7 @@ namespace Google.ProtocolBuffers /// public static int ComputeEnumSize(int fieldNumber, int value) { - return ComputeTagSize(fieldNumber) + ComputeRawVarint32Size((uint) value); + return ComputeTagSize(fieldNumber) + ComputeEnumSizeNoTag(value); } /// @@ -391,7 +391,7 @@ namespace Google.ProtocolBuffers /// public static int ComputeEnumSizeNoTag(int value) { - return ComputeRawVarint32Size((uint) value); + return ComputeInt32SizeNoTag(value); } /// diff --git a/src/ProtocolBuffers/CodedOutputStream.cs b/src/ProtocolBuffers/CodedOutputStream.cs index c14f5e0d44..09099ee3d8 100644 --- a/src/ProtocolBuffers/CodedOutputStream.cs +++ b/src/ProtocolBuffers/CodedOutputStream.cs @@ -373,7 +373,7 @@ namespace Google.ProtocolBuffers public void WriteEnum(int fieldNumber, string fieldName, int value, object rawValue) { WriteTag(fieldNumber, WireFormat.WireType.Varint); - WriteRawVarint32((uint) value); + WriteInt32NoTag(value); } public void WriteSFixed32(int fieldNumber, string fieldName, int value) @@ -648,7 +648,7 @@ namespace Google.ProtocolBuffers public void WriteEnumNoTag(int value) { - WriteRawVarint32((uint) value); + WriteInt32NoTag(value); } public void WriteSFixed32NoTag(int value) From 4a594cac938258c6fc5150a7b99530bed9df483e Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 9 Sep 2011 15:53:10 -0500 Subject: [PATCH 06/31] Implemented [Obsolete] attribute for deprecated fields --- protos/extest/unittest_issues.proto | 20 + src/AddressBook/AddressBookProtos.cs | 2 +- src/ProtoGen/EnumFieldGenerator.cs | 9 +- src/ProtoGen/FieldGeneratorBase.cs | 19 + src/ProtoGen/MessageFieldGenerator.cs | 8 + src/ProtoGen/PrimitiveFieldGenerator.cs | 9 +- src/ProtoGen/RepeatedEnumFieldGenerator.cs | 10 + src/ProtoGen/RepeatedMessageFieldGenerator.cs | 12 + .../RepeatedPrimitiveFieldGenerator.cs | 17 +- src/ProtoGen/UmbrellaClassGenerator.cs | 4 +- .../DeprecatedMemberTest.cs | 102 +++ .../ProtocolBuffers.Test.csproj | 1 + .../UnitTestCSharpOptionsProtoFile.cs | 2 +- .../UnitTestCustomOptionsProtoFile.cs | 2 +- .../UnitTestEmbedOptimizeForProtoFile.cs | 2 +- .../TestProtos/UnitTestEmptyProtoFile.cs | 2 +- .../UnitTestExtrasIssuesProtoFile.cs | 830 +++++++++++++++++- .../TestProtos/UnitTestGenericServices.cs | 2 +- .../TestProtos/UnitTestGoogleSizeProtoFile.cs | 2 +- .../UnitTestGoogleSpeedProtoFile.cs | 2 +- .../TestProtos/UnitTestImportLiteProtoFile.cs | 2 +- .../TestProtos/UnitTestImportProtoFile.cs | 2 +- .../TestProtos/UnitTestMessageSetProtoFile.cs | 2 +- .../UnitTestNoGenericServicesProtoFile.cs | 2 +- .../UnitTestOptimizeForProtoFile.cs | 2 +- .../TestProtos/UnitTestProtoFile.cs | 8 +- .../TestProtos/UnitTestRpcInterop.cs | 2 +- .../UnitTestXmlSerializerTestProtoFile.cs | 2 +- .../DescriptorProtos/CSharpOptions.cs | 2 +- .../DescriptorProtos/DescriptorProtoFile.cs | 2 +- .../TestProtos/UnitTestExtrasFullProtoFile.cs | 2 +- .../TestProtos/UnitTestExtrasLiteProtoFile.cs | 2 +- .../TestProtos/UnitTestImportLiteProtoFile.cs | 2 +- .../TestProtos/UnitTestImportProtoFile.cs | 2 +- .../UnitTestLiteImportNonLiteProtoFile.cs | 2 +- .../TestProtos/UnitTestLiteProtoFile.cs | 8 +- .../TestProtos/UnitTestProtoFile.cs | 8 +- 37 files changed, 1065 insertions(+), 44 deletions(-) create mode 100644 src/ProtocolBuffers.Test/DeprecatedMemberTest.cs diff --git a/protos/extest/unittest_issues.proto b/protos/extest/unittest_issues.proto index 459e58f865..ce5b7972e8 100644 --- a/protos/extest/unittest_issues.proto +++ b/protos/extest/unittest_issues.proto @@ -86,3 +86,23 @@ message NumberField { optional int32 _01 = 1; } +// Issue 21: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=21 +// Decorate fields with [deprecated=true] as [System.Obsolete] + +message DeprecatedChild { +} + +enum DeprecatedEnum { + one = 1; +} + +message DeprecatedFieldsMessage { + optional int32 PrimitiveValue = 1 [deprecated = true]; + repeated int32 PrimitiveArray = 2 [deprecated = true]; + + optional DeprecatedChild MessageValue = 3 [deprecated = true]; + repeated DeprecatedChild MessageArray = 4 [deprecated = true]; + + optional DeprecatedEnum EnumValue = 5 [deprecated = true]; + repeated DeprecatedEnum EnumArray = 6 [deprecated = true]; +} diff --git a/src/AddressBook/AddressBookProtos.cs b/src/AddressBook/AddressBookProtos.cs index 4d391f0fe1..dba3bdf4ce 100644 --- a/src/AddressBook/AddressBookProtos.cs +++ b/src/AddressBook/AddressBookProtos.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtoGen/EnumFieldGenerator.cs b/src/ProtoGen/EnumFieldGenerator.cs index 8b56b9e96b..78384fdd76 100644 --- a/src/ProtoGen/EnumFieldGenerator.cs +++ b/src/ProtoGen/EnumFieldGenerator.cs @@ -49,10 +49,11 @@ namespace Google.ProtocolBuffers.ProtoGen { writer.WriteLine("private bool has{0};", PropertyName); writer.WriteLine("private {0} {1}_ = {2};", TypeName, Name, DefaultValue); + AddDeprecatedFlag(writer); writer.WriteLine("public bool Has{0} {{", PropertyName); writer.WriteLine(" get {{ return has{0}; }}", PropertyName); writer.WriteLine("}"); - AddClsComplianceCheck(writer); + AddPublicMemberAttributes(writer); writer.WriteLine("public {0} {1} {{", TypeName, PropertyName); writer.WriteLine(" get {{ return {0}_; }}", Name); writer.WriteLine("}"); @@ -60,20 +61,22 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateBuilderMembers(TextGenerator writer) { + AddDeprecatedFlag(writer); writer.WriteLine("public bool Has{0} {{", PropertyName); writer.WriteLine(" get {{ return result.has{0}; }}", PropertyName); writer.WriteLine("}"); - AddClsComplianceCheck(writer); + AddPublicMemberAttributes(writer); writer.WriteLine("public {0} {1} {{", TypeName, PropertyName); writer.WriteLine(" get {{ return result.{0}; }}", PropertyName); writer.WriteLine(" set {{ Set{0}(value); }}", PropertyName); writer.WriteLine("}"); - AddClsComplianceCheck(writer); + AddPublicMemberAttributes(writer); writer.WriteLine("public Builder Set{0}({1} value) {{", PropertyName, TypeName); writer.WriteLine(" result.has{0} = true;", PropertyName); writer.WriteLine(" result.{0}_ = value;", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public Builder Clear{0}() {{", PropertyName); writer.WriteLine(" result.has{0} = false;", PropertyName); writer.WriteLine(" result.{0}_ = {1};", Name, DefaultValue); diff --git a/src/ProtoGen/FieldGeneratorBase.cs b/src/ProtoGen/FieldGeneratorBase.cs index 54294196cd..93aee6cad9 100644 --- a/src/ProtoGen/FieldGeneratorBase.cs +++ b/src/ProtoGen/FieldGeneratorBase.cs @@ -251,6 +251,12 @@ namespace Google.ProtocolBuffers.ProtoGen } } + protected void AddPublicMemberAttributes(TextGenerator writer) + { + AddDeprecatedFlag(writer); + AddClsComplianceCheck(writer); + } + protected void AddClsComplianceCheck(TextGenerator writer) { if (!Descriptor.IsCLSCompliant && Descriptor.File.CSharpOptions.ClsCompliance) @@ -259,6 +265,19 @@ namespace Google.ProtocolBuffers.ProtoGen } } + protected bool IsObsolete { get { return Descriptor.Options.Deprecated; } } + + /// + /// Writes [global::System.ObsoleteAttribute()] if the member is obsolete + /// + protected void AddDeprecatedFlag(TextGenerator writer) + { + if (IsObsolete) + { + writer.WriteLine("[global::System.ObsoleteAttribute()]"); + } + } + /// /// For encodings with fixed sizes, returns that size in bytes. Otherwise /// returns -1. TODO(jonskeet): Make this less ugly. diff --git a/src/ProtoGen/MessageFieldGenerator.cs b/src/ProtoGen/MessageFieldGenerator.cs index b86f2c9adf..8e4bef5bc1 100644 --- a/src/ProtoGen/MessageFieldGenerator.cs +++ b/src/ProtoGen/MessageFieldGenerator.cs @@ -49,9 +49,11 @@ namespace Google.ProtocolBuffers.ProtoGen { writer.WriteLine("private bool has{0};", PropertyName); writer.WriteLine("private {0} {1}_ = {2};", TypeName, Name, DefaultValue); + AddDeprecatedFlag(writer); writer.WriteLine("public bool Has{0} {{", PropertyName); writer.WriteLine(" get {{ return has{0}; }}", PropertyName); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public {0} {1} {{", TypeName, PropertyName); writer.WriteLine(" get {{ return {0}_; }}", Name); writer.WriteLine("}"); @@ -59,25 +61,30 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateBuilderMembers(TextGenerator writer) { + AddDeprecatedFlag(writer); writer.WriteLine("public bool Has{0} {{", PropertyName); writer.WriteLine(" get {{ return result.has{0}; }}", PropertyName); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public {0} {1} {{", TypeName, PropertyName); writer.WriteLine(" get {{ return result.{0}; }}", PropertyName); writer.WriteLine(" set {{ Set{0}(value); }}", PropertyName); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public Builder Set{0}({1} value) {{", PropertyName, TypeName); AddNullCheck(writer); writer.WriteLine(" result.has{0} = true;", PropertyName); writer.WriteLine(" result.{0}_ = value;", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public Builder Set{0}({1}.Builder builderForValue) {{", PropertyName, TypeName); AddNullCheck(writer, "builderForValue"); writer.WriteLine(" result.has{0} = true;", PropertyName); writer.WriteLine(" result.{0}_ = builderForValue.Build();", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public Builder Merge{0}({1} value) {{", PropertyName, TypeName); AddNullCheck(writer); writer.WriteLine(" if (result.has{0} &&", PropertyName); @@ -90,6 +97,7 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine(" result.has{0} = true;", PropertyName); writer.WriteLine(" return this;"); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public Builder Clear{0}() {{", PropertyName); writer.WriteLine(" result.has{0} = false;", PropertyName); writer.WriteLine(" result.{0}_ = {1};", Name, DefaultValue); diff --git a/src/ProtoGen/PrimitiveFieldGenerator.cs b/src/ProtoGen/PrimitiveFieldGenerator.cs index e945bf877f..0904ce22c7 100644 --- a/src/ProtoGen/PrimitiveFieldGenerator.cs +++ b/src/ProtoGen/PrimitiveFieldGenerator.cs @@ -50,10 +50,11 @@ namespace Google.ProtocolBuffers.ProtoGen { writer.WriteLine("private bool has{0};", PropertyName); writer.WriteLine("private {0} {1}_{2};", TypeName, Name, HasDefaultValue ? " = " + DefaultValue : ""); + AddDeprecatedFlag(writer); writer.WriteLine("public bool Has{0} {{", PropertyName); writer.WriteLine(" get {{ return has{0}; }}", PropertyName); writer.WriteLine("}"); - AddClsComplianceCheck(writer); + AddPublicMemberAttributes(writer); writer.WriteLine("public {0} {1} {{", TypeName, PropertyName); writer.WriteLine(" get {{ return {0}_; }}", Name); writer.WriteLine("}"); @@ -61,21 +62,23 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateBuilderMembers(TextGenerator writer) { + AddDeprecatedFlag(writer); writer.WriteLine("public bool Has{0} {{", PropertyName); writer.WriteLine(" get {{ return result.has{0}; }}", PropertyName); writer.WriteLine("}"); - AddClsComplianceCheck(writer); + AddPublicMemberAttributes(writer); writer.WriteLine("public {0} {1} {{", TypeName, PropertyName); writer.WriteLine(" get {{ return result.{0}; }}", PropertyName); writer.WriteLine(" set {{ Set{0}(value); }}", PropertyName); writer.WriteLine("}"); - AddClsComplianceCheck(writer); + AddPublicMemberAttributes(writer); writer.WriteLine("public Builder Set{0}({1} value) {{", PropertyName, TypeName); AddNullCheck(writer); writer.WriteLine(" result.has{0} = true;", PropertyName); writer.WriteLine(" result.{0}_ = value;", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public Builder Clear{0}() {{", PropertyName); writer.WriteLine(" result.has{0} = false;", PropertyName); writer.WriteLine(" result.{0}_ = {1};", Name, DefaultValue); diff --git a/src/ProtoGen/RepeatedEnumFieldGenerator.cs b/src/ProtoGen/RepeatedEnumFieldGenerator.cs index 5880390b99..de3fe5e184 100644 --- a/src/ProtoGen/RepeatedEnumFieldGenerator.cs +++ b/src/ProtoGen/RepeatedEnumFieldGenerator.cs @@ -52,15 +52,18 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine("private int {0}MemoizedSerializedSize;", Name); } writer.WriteLine("private pbc::PopsicleList<{0}> {1}_ = new pbc::PopsicleList<{0}>();", TypeName, Name); + AddDeprecatedFlag(writer); writer.WriteLine("public scg::IList<{0}> {1}List {{", TypeName, PropertyName); writer.WriteLine(" get {{ return pbc::Lists.AsReadOnly({0}_); }}", Name); writer.WriteLine("}"); // TODO(jonskeet): Redundant API calls? Possibly - include for portability though. Maybe create an option. + AddDeprecatedFlag(writer); writer.WriteLine("public int {0}Count {{", PropertyName); writer.WriteLine(" get {{ return {0}_.Count; }}", Name); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName); writer.WriteLine(" return {0}_[index];", Name); writer.WriteLine("}"); @@ -70,27 +73,34 @@ namespace Google.ProtocolBuffers.ProtoGen { // Note: We can return the original list here, because we make it unmodifiable when we build // We return it via IPopsicleList so that collection initializers work more pleasantly. + AddDeprecatedFlag(writer); writer.WriteLine("public pbc::IPopsicleList<{0}> {1}List {{", TypeName, PropertyName); writer.WriteLine(" get {{ return result.{0}_; }}", Name); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public int {0}Count {{", PropertyName); writer.WriteLine(" get {{ return result.{0}Count; }}", PropertyName); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName); writer.WriteLine(" return result.Get{0}(index);", PropertyName); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", PropertyName, TypeName); writer.WriteLine(" result.{0}_[index] = value;", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public Builder Add{0}({1} value) {{", PropertyName, TypeName); writer.WriteLine(" result.{0}_.Add(value);", Name, TypeName); writer.WriteLine(" return this;"); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName); writer.WriteLine(" base.AddRange(values, result.{0}_);", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public Builder Clear{0}() {{", PropertyName); writer.WriteLine(" result.{0}_.Clear();", Name); writer.WriteLine(" return this;"); diff --git a/src/ProtoGen/RepeatedMessageFieldGenerator.cs b/src/ProtoGen/RepeatedMessageFieldGenerator.cs index bfa0763f6f..61b6b6b56f 100644 --- a/src/ProtoGen/RepeatedMessageFieldGenerator.cs +++ b/src/ProtoGen/RepeatedMessageFieldGenerator.cs @@ -48,15 +48,18 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateMembers(TextGenerator writer) { writer.WriteLine("private pbc::PopsicleList<{0}> {1}_ = new pbc::PopsicleList<{0}>();", TypeName, Name); + AddDeprecatedFlag(writer); writer.WriteLine("public scg::IList<{0}> {1}List {{", TypeName, PropertyName); writer.WriteLine(" get {{ return {0}_; }}", Name); writer.WriteLine("}"); // TODO(jonskeet): Redundant API calls? Possibly - include for portability though. Maybe create an option. + AddDeprecatedFlag(writer); writer.WriteLine("public int {0}Count {{", PropertyName); writer.WriteLine(" get {{ return {0}_.Count; }}", Name); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName); writer.WriteLine(" return {0}_[index];", Name); writer.WriteLine("}"); @@ -66,41 +69,50 @@ namespace Google.ProtocolBuffers.ProtoGen { // Note: We can return the original list here, because we make it unmodifiable when we build // We return it via IPopsicleList so that collection initializers work more pleasantly. + AddDeprecatedFlag(writer); writer.WriteLine("public pbc::IPopsicleList<{0}> {1}List {{", TypeName, PropertyName); writer.WriteLine(" get {{ return result.{0}_; }}", Name); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public int {0}Count {{", PropertyName); writer.WriteLine(" get {{ return result.{0}Count; }}", PropertyName); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName); writer.WriteLine(" return result.Get{0}(index);", PropertyName); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", PropertyName, TypeName); AddNullCheck(writer); writer.WriteLine(" result.{0}_[index] = value;", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); // Extra overload for builder (just on messages) + AddDeprecatedFlag(writer); writer.WriteLine("public Builder Set{0}(int index, {1}.Builder builderForValue) {{", PropertyName, TypeName); AddNullCheck(writer, "builderForValue"); writer.WriteLine(" result.{0}_[index] = builderForValue.Build();", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public Builder Add{0}({1} value) {{", PropertyName, TypeName); AddNullCheck(writer); writer.WriteLine(" result.{0}_.Add(value);", Name, TypeName); writer.WriteLine(" return this;"); writer.WriteLine("}"); // Extra overload for builder (just on messages) + AddDeprecatedFlag(writer); writer.WriteLine("public Builder Add{0}({1}.Builder builderForValue) {{", PropertyName, TypeName); AddNullCheck(writer, "builderForValue"); writer.WriteLine(" result.{0}_.Add(builderForValue.Build());", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName); writer.WriteLine(" base.AddRange(values, result.{0}_);", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public Builder Clear{0}() {{", PropertyName); writer.WriteLine(" result.{0}_.Clear();", Name); writer.WriteLine(" return this;"); diff --git a/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs b/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs index 9e7f5f641f..d499011cb4 100644 --- a/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs +++ b/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs @@ -52,17 +52,18 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine("private int {0}MemoizedSerializedSize;", Name); } writer.WriteLine("private pbc::PopsicleList<{0}> {1}_ = new pbc::PopsicleList<{0}>();", TypeName, Name); - AddClsComplianceCheck(writer); + AddPublicMemberAttributes(writer); writer.WriteLine("public scg::IList<{0}> {1}List {{", TypeName, PropertyName); writer.WriteLine(" get {{ return pbc::Lists.AsReadOnly({0}_); }}", Name); writer.WriteLine("}"); // TODO(jonskeet): Redundant API calls? Possibly - include for portability though. Maybe create an option. + AddDeprecatedFlag(writer); writer.WriteLine("public int {0}Count {{", PropertyName); writer.WriteLine(" get {{ return {0}_.Count; }}", Name); writer.WriteLine("}"); - AddClsComplianceCheck(writer); + AddPublicMemberAttributes(writer); writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName); writer.WriteLine(" return {0}_[index];", Name); writer.WriteLine("}"); @@ -72,34 +73,36 @@ namespace Google.ProtocolBuffers.ProtoGen { // Note: We can return the original list here, because we make it unmodifiable when we build // We return it via IPopsicleList so that collection initializers work more pleasantly. - AddClsComplianceCheck(writer); + AddPublicMemberAttributes(writer); writer.WriteLine("public pbc::IPopsicleList<{0}> {1}List {{", TypeName, PropertyName); writer.WriteLine(" get {{ return result.{0}_; }}", Name); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public int {0}Count {{", PropertyName); writer.WriteLine(" get {{ return result.{0}Count; }}", PropertyName); writer.WriteLine("}"); - AddClsComplianceCheck(writer); + AddPublicMemberAttributes(writer); writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName); writer.WriteLine(" return result.Get{0}(index);", PropertyName); writer.WriteLine("}"); - AddClsComplianceCheck(writer); + AddPublicMemberAttributes(writer); writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", PropertyName, TypeName); AddNullCheck(writer); writer.WriteLine(" result.{0}_[index] = value;", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); - AddClsComplianceCheck(writer); + AddPublicMemberAttributes(writer); writer.WriteLine("public Builder Add{0}({1} value) {{", PropertyName, TypeName); AddNullCheck(writer); writer.WriteLine(" result.{0}_.Add(value);", Name, TypeName); writer.WriteLine(" return this;"); writer.WriteLine("}"); - AddClsComplianceCheck(writer); + AddPublicMemberAttributes(writer); writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName); writer.WriteLine(" base.AddRange(values, result.{0}_);", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); + AddDeprecatedFlag(writer); writer.WriteLine("public Builder Clear{0}() {{", PropertyName); writer.WriteLine(" result.{0}_.Clear();", Name); writer.WriteLine(" return this;"); diff --git a/src/ProtoGen/UmbrellaClassGenerator.cs b/src/ProtoGen/UmbrellaClassGenerator.cs index 57a7844b69..e425045876 100644 --- a/src/ProtoGen/UmbrellaClassGenerator.cs +++ b/src/ProtoGen/UmbrellaClassGenerator.cs @@ -138,8 +138,8 @@ namespace Google.ProtocolBuffers.ProtoGen private void WriteIntroduction(TextGenerator writer) { - writer.WriteLine("// Generated by {0}. DO NOT EDIT!", this.GetType().Assembly.FullName); - writer.WriteLine("#pragma warning disable 1591"); + writer.WriteLine("// Generated by {0}. DO NOT EDIT!", this.GetType().Assembly.FullName); + writer.WriteLine("#pragma warning disable 1591, 0612"); writer.WriteLine("#region Designer generated code"); writer.WriteLine(); diff --git a/src/ProtocolBuffers.Test/DeprecatedMemberTest.cs b/src/ProtocolBuffers.Test/DeprecatedMemberTest.cs new file mode 100644 index 0000000000..44e7914f12 --- /dev/null +++ b/src/ProtocolBuffers.Test/DeprecatedMemberTest.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using NUnit.Framework; +using UnitTest.Issues.TestProtos; + +namespace Google.ProtocolBuffers +{ + [TestFixture] + public class DeprecatedMemberTest + { + private static void AssertIsDeprecated(ICustomAttributeProvider member) + { + Assert.IsNotNull(member); + Assert.IsTrue(member.IsDefined(typeof(ObsoleteAttribute), false), "Member not obsolete: " + member); + } + + [Test] + public void TestDepreatedPrimitiveValue() + { + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("HasPrimitiveValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("PrimitiveValue")); + + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("HasPrimitiveValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("PrimitiveValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearPrimitiveValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetPrimitiveValue")); + } + [Test] + public void TestDepreatedPrimitiveArray() + { + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("PrimitiveArrayList")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("PrimitiveArrayCount")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetMethod("GetPrimitiveArray")); + + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("PrimitiveArrayList")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("PrimitiveArrayCount")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("GetPrimitiveArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetPrimitiveArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddPrimitiveArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddRangePrimitiveArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearPrimitiveArray")); + } + [Test] + public void TestDepreatedMessageValue() + { + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("HasMessageValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("MessageValue")); + + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("HasMessageValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("MessageValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("MergeMessageValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearMessageValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetMessageValue", new[] { typeof(DeprecatedChild) })); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetMessageValue", new[] { typeof(DeprecatedChild.Builder) })); + } + [Test] + public void TestDepreatedMessageArray() + { + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("MessageArrayList")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("MessageArrayCount")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetMethod("GetMessageArray")); + + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("MessageArrayList")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("MessageArrayCount")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("GetMessageArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetMessageArray", new[] { typeof(int), typeof(DeprecatedChild) })); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetMessageArray", new[] { typeof(int), typeof(DeprecatedChild.Builder) })); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddMessageArray", new[] { typeof(DeprecatedChild) })); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddMessageArray", new[] { typeof(DeprecatedChild.Builder) })); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddRangeMessageArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearMessageArray")); + } + [Test] + public void TestDepreatedEnumValue() + { + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("HasEnumValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("EnumValue")); + + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("HasEnumValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("EnumValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearEnumValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetEnumValue")); + } + [Test] + public void TestDepreatedEnumArray() + { + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("EnumArrayList")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("EnumArrayCount")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetMethod("GetEnumArray")); + + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("EnumArrayList")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("EnumArrayCount")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("GetEnumArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetEnumArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddEnumArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddRangeEnumArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearEnumArray")); + } + } +} diff --git a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj index 95ab0b9c63..66fcccbfb4 100644 --- a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj +++ b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj @@ -93,6 +93,7 @@ + diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs index ff726d65de..01a536d7fa 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs index 0b1be422a6..9c8abc447d 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs index 09ecdd63d4..c4e71a997a 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmptyProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmptyProtoFile.cs index eb6c6c74aa..6c5cf369ff 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmptyProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmptyProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs index db56e8b919..43ed54b75c 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; @@ -26,6 +26,10 @@ namespace UnitTest.Issues.TestProtos { internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_AB__FieldAccessorTable; internal static pbd::MessageDescriptor internal__static_unittest_issues_NumberField__Descriptor; internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_NumberField__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_issues_DeprecatedChild__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_DeprecatedChild__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_issues_DeprecatedFieldsMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_DeprecatedFieldsMessage__FieldAccessorTable; #endregion #region Descriptor public static pbd::FileDescriptor Descriptor { @@ -38,9 +42,17 @@ namespace UnitTest.Issues.TestProtos { "ChxleHRlc3QvdW5pdHRlc3RfaXNzdWVzLnByb3RvEg91bml0dGVzdF9pc3N1" + "ZXMaJGdvb2dsZS9wcm90b2J1Zi9jc2hhcnBfb3B0aW9ucy5wcm90byIPCgFB" + "EgoKAl9BGAEgASgFIg8KAUISCgoCQl8YASABKAUiEQoCQUISCwoDYV9iGAEg" + - "ASgFIhoKC051bWJlckZpZWxkEgsKA18wMRgBIAEoBUJASAHCPjsKGlVuaXRU" + - "ZXN0Lklzc3Vlcy5UZXN0UHJvdG9zEh1Vbml0VGVzdEV4dHJhc0lzc3Vlc1By" + - "b3RvRmlsZQ=="); + "ASgFIhoKC051bWJlckZpZWxkEgsKA18wMRgBIAEoBSIRCg9EZXByZWNhdGVk" + + "Q2hpbGQiuQIKF0RlcHJlY2F0ZWRGaWVsZHNNZXNzYWdlEhoKDlByaW1pdGl2" + + "ZVZhbHVlGAEgASgFQgIYARIaCg5QcmltaXRpdmVBcnJheRgCIAMoBUICGAES" + + "OgoMTWVzc2FnZVZhbHVlGAMgASgLMiAudW5pdHRlc3RfaXNzdWVzLkRlcHJl" + + "Y2F0ZWRDaGlsZEICGAESOgoMTWVzc2FnZUFycmF5GAQgAygLMiAudW5pdHRl" + + "c3RfaXNzdWVzLkRlcHJlY2F0ZWRDaGlsZEICGAESNgoJRW51bVZhbHVlGAUg" + + "ASgOMh8udW5pdHRlc3RfaXNzdWVzLkRlcHJlY2F0ZWRFbnVtQgIYARI2CglF" + + "bnVtQXJyYXkYBiADKA4yHy51bml0dGVzdF9pc3N1ZXMuRGVwcmVjYXRlZEVu" + + "dW1CAhgBKhkKDkRlcHJlY2F0ZWRFbnVtEgcKA29uZRABQkBIAcI+OwoaVW5p" + + "dFRlc3QuSXNzdWVzLlRlc3RQcm90b3MSHVVuaXRUZXN0RXh0cmFzSXNzdWVz" + + "UHJvdG9GaWxl"); pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { descriptor = root; internal__static_unittest_issues_A__Descriptor = Descriptor.MessageTypes[0]; @@ -59,6 +71,14 @@ namespace UnitTest.Issues.TestProtos { internal__static_unittest_issues_NumberField__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_NumberField__Descriptor, new string[] { "_01", }); + internal__static_unittest_issues_DeprecatedChild__Descriptor = Descriptor.MessageTypes[4]; + internal__static_unittest_issues_DeprecatedChild__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_DeprecatedChild__Descriptor, + new string[] { }); + internal__static_unittest_issues_DeprecatedFieldsMessage__Descriptor = Descriptor.MessageTypes[5]; + internal__static_unittest_issues_DeprecatedFieldsMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_DeprecatedFieldsMessage__Descriptor, + new string[] { "PrimitiveValue", "PrimitiveArray", "MessageValue", "MessageArray", "EnumValue", "EnumArray", }); pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); RegisterAllExtensions(registry); global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); @@ -72,6 +92,15 @@ namespace UnitTest.Issues.TestProtos { #endregion } + #region Enums + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + public enum DeprecatedEnum { + one = 1, + } + + #endregion + #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] @@ -1033,6 +1062,799 @@ namespace UnitTest.Issues.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + public sealed partial class DeprecatedChild : pb::GeneratedMessage { + private static readonly DeprecatedChild defaultInstance = new Builder().BuildPartial(); + private static readonly string[] _deprecatedChildFieldNames = new string[] { }; + private static readonly uint[] _deprecatedChildFieldTags = new uint[] { }; + public static DeprecatedChild DefaultInstance { + get { return defaultInstance; } + } + + public override DeprecatedChild DefaultInstanceForType { + get { return defaultInstance; } + } + + protected override DeprecatedChild ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_DeprecatedChild__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_DeprecatedChild__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + int size = SerializedSize; + string[] field_names = _deprecatedChildFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static DeprecatedChild ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DeprecatedChild ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DeprecatedChild ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DeprecatedChild ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DeprecatedChild ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DeprecatedChild ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static DeprecatedChild ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static DeprecatedChild ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static DeprecatedChild ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DeprecatedChild ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(DeprecatedChild prototype) { + return (Builder) new Builder().MergeFrom(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() {} + + DeprecatedChild result = new DeprecatedChild(); + + protected override DeprecatedChild MessageBeingBuilt { + get { return result; } + } + + public override Builder Clear() { + result = new DeprecatedChild(); + return this; + } + + public override Builder Clone() { + return new Builder().MergeFrom(result); + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::UnitTest.Issues.TestProtos.DeprecatedChild.Descriptor; } + } + + public override DeprecatedChild DefaultInstanceForType { + get { return global::UnitTest.Issues.TestProtos.DeprecatedChild.DefaultInstance; } + } + + public override DeprecatedChild BuildPartial() { + if (result == null) { + throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + } + DeprecatedChild returnMe = result; + result = null; + return returnMe; + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is DeprecatedChild) { + return MergeFrom((DeprecatedChild) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(DeprecatedChild other) { + if (other == global::UnitTest.Issues.TestProtos.DeprecatedChild.DefaultInstance) return this; + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_deprecatedChildFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _deprecatedChildFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static DeprecatedChild() { + object.ReferenceEquals(global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + public sealed partial class DeprecatedFieldsMessage : pb::GeneratedMessage { + private static readonly DeprecatedFieldsMessage defaultInstance = new Builder().BuildPartial(); + private static readonly string[] _deprecatedFieldsMessageFieldNames = new string[] { "EnumArray", "EnumValue", "MessageArray", "MessageValue", "PrimitiveArray", "PrimitiveValue" }; + private static readonly uint[] _deprecatedFieldsMessageFieldTags = new uint[] { 48, 40, 34, 26, 16, 8 }; + public static DeprecatedFieldsMessage DefaultInstance { + get { return defaultInstance; } + } + + public override DeprecatedFieldsMessage DefaultInstanceForType { + get { return defaultInstance; } + } + + protected override DeprecatedFieldsMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_DeprecatedFieldsMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_DeprecatedFieldsMessage__FieldAccessorTable; } + } + + public const int PrimitiveValueFieldNumber = 1; + private bool hasPrimitiveValue; + private int primitiveValue_; + [global::System.ObsoleteAttribute()] + public bool HasPrimitiveValue { + get { return hasPrimitiveValue; } + } + [global::System.ObsoleteAttribute()] + public int PrimitiveValue { + get { return primitiveValue_; } + } + + public const int PrimitiveArrayFieldNumber = 2; + private pbc::PopsicleList primitiveArray_ = new pbc::PopsicleList(); + [global::System.ObsoleteAttribute()] + public scg::IList PrimitiveArrayList { + get { return pbc::Lists.AsReadOnly(primitiveArray_); } + } + [global::System.ObsoleteAttribute()] + public int PrimitiveArrayCount { + get { return primitiveArray_.Count; } + } + [global::System.ObsoleteAttribute()] + public int GetPrimitiveArray(int index) { + return primitiveArray_[index]; + } + + public const int MessageValueFieldNumber = 3; + private bool hasMessageValue; + private global::UnitTest.Issues.TestProtos.DeprecatedChild messageValue_ = global::UnitTest.Issues.TestProtos.DeprecatedChild.DefaultInstance; + [global::System.ObsoleteAttribute()] + public bool HasMessageValue { + get { return hasMessageValue; } + } + [global::System.ObsoleteAttribute()] + public global::UnitTest.Issues.TestProtos.DeprecatedChild MessageValue { + get { return messageValue_; } + } + + public const int MessageArrayFieldNumber = 4; + private pbc::PopsicleList messageArray_ = new pbc::PopsicleList(); + [global::System.ObsoleteAttribute()] + public scg::IList MessageArrayList { + get { return messageArray_; } + } + [global::System.ObsoleteAttribute()] + public int MessageArrayCount { + get { return messageArray_.Count; } + } + [global::System.ObsoleteAttribute()] + public global::UnitTest.Issues.TestProtos.DeprecatedChild GetMessageArray(int index) { + return messageArray_[index]; + } + + public const int EnumValueFieldNumber = 5; + private bool hasEnumValue; + private global::UnitTest.Issues.TestProtos.DeprecatedEnum enumValue_ = global::UnitTest.Issues.TestProtos.DeprecatedEnum.one; + [global::System.ObsoleteAttribute()] + public bool HasEnumValue { + get { return hasEnumValue; } + } + [global::System.ObsoleteAttribute()] + public global::UnitTest.Issues.TestProtos.DeprecatedEnum EnumValue { + get { return enumValue_; } + } + + public const int EnumArrayFieldNumber = 6; + private pbc::PopsicleList enumArray_ = new pbc::PopsicleList(); + [global::System.ObsoleteAttribute()] + public scg::IList EnumArrayList { + get { return pbc::Lists.AsReadOnly(enumArray_); } + } + [global::System.ObsoleteAttribute()] + public int EnumArrayCount { + get { return enumArray_.Count; } + } + [global::System.ObsoleteAttribute()] + public global::UnitTest.Issues.TestProtos.DeprecatedEnum GetEnumArray(int index) { + return enumArray_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + int size = SerializedSize; + string[] field_names = _deprecatedFieldsMessageFieldNames; + if (hasPrimitiveValue) { + output.WriteInt32(1, field_names[5], PrimitiveValue); + } + if (primitiveArray_.Count > 0) { + output.WriteInt32Array(2, field_names[4], primitiveArray_); + } + if (hasMessageValue) { + output.WriteMessage(3, field_names[3], MessageValue); + } + if (messageArray_.Count > 0) { + output.WriteMessageArray(4, field_names[2], messageArray_); + } + if (hasEnumValue) { + output.WriteEnum(5, field_names[1], (int) EnumValue, EnumValue); + } + if (enumArray_.Count > 0) { + output.WriteEnumArray(6, field_names[0], enumArray_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasPrimitiveValue) { + size += pb::CodedOutputStream.ComputeInt32Size(1, PrimitiveValue); + } + { + int dataSize = 0; + foreach (int element in PrimitiveArrayList) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 1 * primitiveArray_.Count; + } + if (hasMessageValue) { + size += pb::CodedOutputStream.ComputeMessageSize(3, MessageValue); + } + foreach (global::UnitTest.Issues.TestProtos.DeprecatedChild element in MessageArrayList) { + size += pb::CodedOutputStream.ComputeMessageSize(4, element); + } + if (hasEnumValue) { + size += pb::CodedOutputStream.ComputeEnumSize(5, (int) EnumValue); + } + { + int dataSize = 0; + if (enumArray_.Count > 0) { + foreach (global::UnitTest.Issues.TestProtos.DeprecatedEnum element in enumArray_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 1 * enumArray_.Count; + } + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static DeprecatedFieldsMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(DeprecatedFieldsMessage prototype) { + return (Builder) new Builder().MergeFrom(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() {} + + DeprecatedFieldsMessage result = new DeprecatedFieldsMessage(); + + protected override DeprecatedFieldsMessage MessageBeingBuilt { + get { return result; } + } + + public override Builder Clear() { + result = new DeprecatedFieldsMessage(); + return this; + } + + public override Builder Clone() { + return new Builder().MergeFrom(result); + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage.Descriptor; } + } + + public override DeprecatedFieldsMessage DefaultInstanceForType { + get { return global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage.DefaultInstance; } + } + + public override DeprecatedFieldsMessage BuildPartial() { + if (result == null) { + throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + } + result.primitiveArray_.MakeReadOnly(); + result.messageArray_.MakeReadOnly(); + result.enumArray_.MakeReadOnly(); + DeprecatedFieldsMessage returnMe = result; + result = null; + return returnMe; + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is DeprecatedFieldsMessage) { + return MergeFrom((DeprecatedFieldsMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(DeprecatedFieldsMessage other) { + if (other == global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage.DefaultInstance) return this; + if (other.HasPrimitiveValue) { + PrimitiveValue = other.PrimitiveValue; + } + if (other.primitiveArray_.Count != 0) { + base.AddRange(other.primitiveArray_, result.primitiveArray_); + } + if (other.HasMessageValue) { + MergeMessageValue(other.MessageValue); + } + if (other.messageArray_.Count != 0) { + base.AddRange(other.messageArray_, result.messageArray_); + } + if (other.HasEnumValue) { + EnumValue = other.EnumValue; + } + if (other.enumArray_.Count != 0) { + base.AddRange(other.enumArray_, result.enumArray_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_deprecatedFieldsMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _deprecatedFieldsMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasPrimitiveValue = input.ReadInt32(ref result.primitiveValue_); + break; + } + case 18: + case 16: { + input.ReadInt32Array(tag, field_name, result.primitiveArray_); + break; + } + case 26: { + global::UnitTest.Issues.TestProtos.DeprecatedChild.Builder subBuilder = global::UnitTest.Issues.TestProtos.DeprecatedChild.CreateBuilder(); + if (result.hasMessageValue) { + subBuilder.MergeFrom(MessageValue); + } + input.ReadMessage(subBuilder, extensionRegistry); + MessageValue = subBuilder.BuildPartial(); + break; + } + case 34: { + input.ReadMessageArray(tag, field_name, result.messageArray_, global::UnitTest.Issues.TestProtos.DeprecatedChild.DefaultInstance, extensionRegistry); + break; + } + case 40: { + object unknown; + if(input.ReadEnum(ref result.enumValue_, out unknown)) { + result.hasEnumValue = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(5, (ulong)(int)unknown); + } + break; + } + case 50: + case 48: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.enumArray_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(6, (ulong)(int)rawValue); + } + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + [global::System.ObsoleteAttribute()] + public bool HasPrimitiveValue { + get { return result.hasPrimitiveValue; } + } + [global::System.ObsoleteAttribute()] + public int PrimitiveValue { + get { return result.PrimitiveValue; } + set { SetPrimitiveValue(value); } + } + [global::System.ObsoleteAttribute()] + public Builder SetPrimitiveValue(int value) { + result.hasPrimitiveValue = true; + result.primitiveValue_ = value; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder ClearPrimitiveValue() { + result.hasPrimitiveValue = false; + result.primitiveValue_ = 0; + return this; + } + + [global::System.ObsoleteAttribute()] + public pbc::IPopsicleList PrimitiveArrayList { + get { return result.primitiveArray_; } + } + [global::System.ObsoleteAttribute()] + public int PrimitiveArrayCount { + get { return result.PrimitiveArrayCount; } + } + [global::System.ObsoleteAttribute()] + public int GetPrimitiveArray(int index) { + return result.GetPrimitiveArray(index); + } + [global::System.ObsoleteAttribute()] + public Builder SetPrimitiveArray(int index, int value) { + result.primitiveArray_[index] = value; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder AddPrimitiveArray(int value) { + result.primitiveArray_.Add(value); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder AddRangePrimitiveArray(scg::IEnumerable values) { + base.AddRange(values, result.primitiveArray_); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder ClearPrimitiveArray() { + result.primitiveArray_.Clear(); + return this; + } + + [global::System.ObsoleteAttribute()] + public bool HasMessageValue { + get { return result.hasMessageValue; } + } + [global::System.ObsoleteAttribute()] + public global::UnitTest.Issues.TestProtos.DeprecatedChild MessageValue { + get { return result.MessageValue; } + set { SetMessageValue(value); } + } + [global::System.ObsoleteAttribute()] + public Builder SetMessageValue(global::UnitTest.Issues.TestProtos.DeprecatedChild value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + result.hasMessageValue = true; + result.messageValue_ = value; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder SetMessageValue(global::UnitTest.Issues.TestProtos.DeprecatedChild.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + result.hasMessageValue = true; + result.messageValue_ = builderForValue.Build(); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder MergeMessageValue(global::UnitTest.Issues.TestProtos.DeprecatedChild value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + if (result.hasMessageValue && + result.messageValue_ != global::UnitTest.Issues.TestProtos.DeprecatedChild.DefaultInstance) { + result.messageValue_ = global::UnitTest.Issues.TestProtos.DeprecatedChild.CreateBuilder(result.messageValue_).MergeFrom(value).BuildPartial(); + } else { + result.messageValue_ = value; + } + result.hasMessageValue = true; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder ClearMessageValue() { + result.hasMessageValue = false; + result.messageValue_ = global::UnitTest.Issues.TestProtos.DeprecatedChild.DefaultInstance; + return this; + } + + [global::System.ObsoleteAttribute()] + public pbc::IPopsicleList MessageArrayList { + get { return result.messageArray_; } + } + [global::System.ObsoleteAttribute()] + public int MessageArrayCount { + get { return result.MessageArrayCount; } + } + [global::System.ObsoleteAttribute()] + public global::UnitTest.Issues.TestProtos.DeprecatedChild GetMessageArray(int index) { + return result.GetMessageArray(index); + } + [global::System.ObsoleteAttribute()] + public Builder SetMessageArray(int index, global::UnitTest.Issues.TestProtos.DeprecatedChild value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + result.messageArray_[index] = value; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder SetMessageArray(int index, global::UnitTest.Issues.TestProtos.DeprecatedChild.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + result.messageArray_[index] = builderForValue.Build(); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder AddMessageArray(global::UnitTest.Issues.TestProtos.DeprecatedChild value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + result.messageArray_.Add(value); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder AddMessageArray(global::UnitTest.Issues.TestProtos.DeprecatedChild.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + result.messageArray_.Add(builderForValue.Build()); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder AddRangeMessageArray(scg::IEnumerable values) { + base.AddRange(values, result.messageArray_); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder ClearMessageArray() { + result.messageArray_.Clear(); + return this; + } + + [global::System.ObsoleteAttribute()] + public bool HasEnumValue { + get { return result.hasEnumValue; } + } + [global::System.ObsoleteAttribute()] + public global::UnitTest.Issues.TestProtos.DeprecatedEnum EnumValue { + get { return result.EnumValue; } + set { SetEnumValue(value); } + } + [global::System.ObsoleteAttribute()] + public Builder SetEnumValue(global::UnitTest.Issues.TestProtos.DeprecatedEnum value) { + result.hasEnumValue = true; + result.enumValue_ = value; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder ClearEnumValue() { + result.hasEnumValue = false; + result.enumValue_ = global::UnitTest.Issues.TestProtos.DeprecatedEnum.one; + return this; + } + + [global::System.ObsoleteAttribute()] + public pbc::IPopsicleList EnumArrayList { + get { return result.enumArray_; } + } + [global::System.ObsoleteAttribute()] + public int EnumArrayCount { + get { return result.EnumArrayCount; } + } + [global::System.ObsoleteAttribute()] + public global::UnitTest.Issues.TestProtos.DeprecatedEnum GetEnumArray(int index) { + return result.GetEnumArray(index); + } + [global::System.ObsoleteAttribute()] + public Builder SetEnumArray(int index, global::UnitTest.Issues.TestProtos.DeprecatedEnum value) { + result.enumArray_[index] = value; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder AddEnumArray(global::UnitTest.Issues.TestProtos.DeprecatedEnum value) { + result.enumArray_.Add(value); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder AddRangeEnumArray(scg::IEnumerable values) { + base.AddRange(values, result.enumArray_); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder ClearEnumArray() { + result.enumArray_.Clear(); + return this; + } + } + static DeprecatedFieldsMessage() { + object.ReferenceEquals(global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.Descriptor, null); + } + } + #endregion } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs index 9227c7cc40..d1fa863337 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs index 77635f2132..0ade582fbd 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs index 918be643ec..453a5416fb 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs index a96833bef0..239eaa480f 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs index 5749c97f88..f1fff865ce 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs index 8a6bb58929..c1754e88e3 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs index 74d6af60eb..89a5c30eff 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs index c7153abc4c..1f6e6ff45d 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs index d8824d49a4..ad12efb322 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; @@ -5522,9 +5522,11 @@ namespace Google.ProtocolBuffers.TestProtos { public const int DeprecatedInt32FieldNumber = 1; private bool hasDeprecatedInt32; private int deprecatedInt32_; + [global::System.ObsoleteAttribute()] public bool HasDeprecatedInt32 { get { return hasDeprecatedInt32; } } + [global::System.ObsoleteAttribute()] public int DeprecatedInt32 { get { return deprecatedInt32_; } } @@ -5708,18 +5710,22 @@ namespace Google.ProtocolBuffers.TestProtos { } + [global::System.ObsoleteAttribute()] public bool HasDeprecatedInt32 { get { return result.hasDeprecatedInt32; } } + [global::System.ObsoleteAttribute()] public int DeprecatedInt32 { get { return result.DeprecatedInt32; } set { SetDeprecatedInt32(value); } } + [global::System.ObsoleteAttribute()] public Builder SetDeprecatedInt32(int value) { result.hasDeprecatedInt32 = true; result.deprecatedInt32_ = value; return this; } + [global::System.ObsoleteAttribute()] public Builder ClearDeprecatedInt32() { result.hasDeprecatedInt32 = false; result.deprecatedInt32_ = 0; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs index ae309fa706..3697a7959b 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs index 3d818a6082..ff95996ade 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs index 853b0e7d09..2419616043 100644 --- a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs +++ b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs index 5b48cde198..35384852e8 100644 --- a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs +++ b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs index a9ee77724b..2c438b124f 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs index bc214e2565..c4b048211e 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs index a96833bef0..239eaa480f 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs index 5749c97f88..f1fff865ce 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs index 7c2836cdb3..bb53b646c8 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs index 78bed7e204..b991b3f9a0 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; @@ -9522,9 +9522,11 @@ namespace Google.ProtocolBuffers.TestProtos { public const int DeprecatedFieldFieldNumber = 1; private bool hasDeprecatedField; private int deprecatedField_; + [global::System.ObsoleteAttribute()] public bool HasDeprecatedField { get { return hasDeprecatedField; } } + [global::System.ObsoleteAttribute()] public int DeprecatedField { get { return deprecatedField_; } } @@ -9707,18 +9709,22 @@ namespace Google.ProtocolBuffers.TestProtos { } + [global::System.ObsoleteAttribute()] public bool HasDeprecatedField { get { return result.hasDeprecatedField; } } + [global::System.ObsoleteAttribute()] public int DeprecatedField { get { return result.DeprecatedField; } set { SetDeprecatedField(value); } } + [global::System.ObsoleteAttribute()] public Builder SetDeprecatedField(int value) { result.hasDeprecatedField = true; result.deprecatedField_ = value; return this; } + [global::System.ObsoleteAttribute()] public Builder ClearDeprecatedField() { result.hasDeprecatedField = false; result.deprecatedField_ = 0; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs index d8824d49a4..ad12efb322 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs @@ -1,5 +1,5 @@ // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! -#pragma warning disable 1591 +#pragma warning disable 1591, 0612 #region Designer generated code using pb = global::Google.ProtocolBuffers; @@ -5522,9 +5522,11 @@ namespace Google.ProtocolBuffers.TestProtos { public const int DeprecatedInt32FieldNumber = 1; private bool hasDeprecatedInt32; private int deprecatedInt32_; + [global::System.ObsoleteAttribute()] public bool HasDeprecatedInt32 { get { return hasDeprecatedInt32; } } + [global::System.ObsoleteAttribute()] public int DeprecatedInt32 { get { return deprecatedInt32_; } } @@ -5708,18 +5710,22 @@ namespace Google.ProtocolBuffers.TestProtos { } + [global::System.ObsoleteAttribute()] public bool HasDeprecatedInt32 { get { return result.hasDeprecatedInt32; } } + [global::System.ObsoleteAttribute()] public int DeprecatedInt32 { get { return result.DeprecatedInt32; } set { SetDeprecatedInt32(value); } } + [global::System.ObsoleteAttribute()] public Builder SetDeprecatedInt32(int value) { result.hasDeprecatedInt32 = true; result.deprecatedInt32_ = value; return this; } + [global::System.ObsoleteAttribute()] public Builder ClearDeprecatedInt32() { result.hasDeprecatedInt32 = false; result.deprecatedInt32_ = 0; From 1a0764ab27ae7189ae4b2b8a1d9f7a0599568282 Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 9 Sep 2011 21:05:29 -0500 Subject: [PATCH 07/31] First pass at implementation and testing of reusable builders. --- src/AddressBook/AddressBookProtos.cs | 176 +- src/ProtoGen/EnumFieldGenerator.cs | 2 + src/ProtoGen/MessageFieldGenerator.cs | 4 + src/ProtoGen/MessageGenerator.cs | 55 +- src/ProtoGen/PrimitiveFieldGenerator.cs | 2 + src/ProtoGen/RepeatedEnumFieldGenerator.cs | 6 +- src/ProtoGen/RepeatedMessageFieldGenerator.cs | 8 +- .../RepeatedPrimitiveFieldGenerator.cs | 6 +- .../GeneratedMessageTest.cs | 16 - .../ProtocolBuffers.Test.csproj | 1 + .../ReusableBuilderTest.cs | 117 + .../UnitTestCSharpOptionsProtoFile.cs | 56 +- .../UnitTestCustomOptionsProtoFile.cs | 880 ++++-- .../UnitTestEmbedOptimizeForProtoFile.cs | 62 +- .../UnitTestExtrasIssuesProtoFile.cs | 208 +- .../TestProtos/UnitTestGoogleSizeProtoFile.cs | 514 ++- .../UnitTestGoogleSpeedProtoFile.cs | 524 +++- .../TestProtos/UnitTestImportLiteProtoFile.cs | 52 +- .../TestProtos/UnitTestImportProtoFile.cs | 52 +- .../TestProtos/UnitTestMessageSetProtoFile.cs | 320 +- .../UnitTestNoGenericServicesProtoFile.cs | 52 +- .../UnitTestOptimizeForProtoFile.cs | 156 +- .../TestProtos/UnitTestProtoFile.cs | 2780 ++++++++++++++--- .../TestProtos/UnitTestRpcInterop.cs | 228 +- .../UnitTestXmlSerializerTestProtoFile.cs | 352 ++- .../DescriptorProtos/CSharpOptions.cs | 232 +- .../DescriptorProtos/DescriptorProtoFile.cs | 1172 +++++-- src/ProtocolBuffers/GeneratedBuilder.cs | 11 +- src/ProtocolBuffers/GeneratedBuilderLite.cs | 7 +- .../TestProtos/UnitTestExtrasFullProtoFile.cs | 462 ++- .../TestProtos/UnitTestExtrasLiteProtoFile.cs | 298 +- .../TestProtos/UnitTestImportLiteProtoFile.cs | 52 +- .../TestProtos/UnitTestImportProtoFile.cs | 52 +- .../UnitTestLiteImportNonLiteProtoFile.cs | 54 +- .../TestProtos/UnitTestLiteProtoFile.cs | 1130 +++++-- .../TestProtos/UnitTestProtoFile.cs | 2780 ++++++++++++++--- 36 files changed, 10475 insertions(+), 2404 deletions(-) create mode 100644 src/ProtocolBuffers.Test/ReusableBuilderTest.cs diff --git a/src/AddressBook/AddressBookProtos.cs b/src/AddressBook/AddressBookProtos.cs index 4d391f0fe1..8bb19df6c3 100644 --- a/src/AddressBook/AddressBookProtos.cs +++ b/src/AddressBook/AddressBookProtos.cs @@ -223,7 +223,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(PhoneNumber prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -233,21 +233,48 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new PhoneNumber(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(PhoneNumber cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - PhoneNumber result = new PhoneNumber(); + bool builderIsReadOnly; + PhoneNumber result; + + private PhoneNumber PrepareBuilder() { + if (builderIsReadOnly) { + PhoneNumber original = result; + result = new PhoneNumber(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override PhoneNumber MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new PhoneNumber(); + result = DefaultInstance ?? new PhoneNumber(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -259,12 +286,11 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public override PhoneNumber BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - PhoneNumber returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -278,6 +304,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { public override Builder MergeFrom(PhoneNumber other) { if (other == global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.DefaultInstance) return this; + PrepareBuilder(); if (other.HasNumber) { Number = other.Number; } @@ -293,6 +320,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -361,11 +389,13 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public Builder SetNumber(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasNumber = true; result.number_ = value; return this; } public Builder ClearNumber() { + PrepareBuilder(); result.hasNumber = false; result.number_ = ""; return this; @@ -379,11 +409,13 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { set { SetType(value); } } public Builder SetType(global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType value) { + PrepareBuilder(); result.hasType = true; result.type_ = value; return this; } public Builder ClearType() { + PrepareBuilder(); result.hasType = false; result.type_ = global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME; return this; @@ -527,7 +559,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(Person prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -537,21 +569,48 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new Person(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(Person cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - Person result = new Person(); + bool builderIsReadOnly; + Person result; + + private Person PrepareBuilder() { + if (builderIsReadOnly) { + Person original = result; + result = new Person(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override Person MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new Person(); + result = DefaultInstance ?? new Person(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -563,13 +622,12 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public override Person BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.phone_.MakeReadOnly(); - Person returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -583,6 +641,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { public override Builder MergeFrom(Person other) { if (other == global::Google.ProtocolBuffers.Examples.AddressBook.Person.DefaultInstance) return this; + PrepareBuilder(); if (other.HasName) { Name = other.Name; } @@ -604,6 +663,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -672,11 +732,13 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public Builder SetName(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasName = true; result.name_ = value; return this; } public Builder ClearName() { + PrepareBuilder(); result.hasName = false; result.name_ = ""; return this; @@ -690,11 +752,13 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { set { SetId(value); } } public Builder SetId(int value) { + PrepareBuilder(); result.hasId = true; result.id_ = value; return this; } public Builder ClearId() { + PrepareBuilder(); result.hasId = false; result.id_ = 0; return this; @@ -709,18 +773,20 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public Builder SetEmail(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasEmail = true; result.email_ = value; return this; } public Builder ClearEmail() { + PrepareBuilder(); result.hasEmail = false; result.email_ = ""; return this; } public pbc::IPopsicleList PhoneList { - get { return result.phone_; } + get { return PrepareBuilder().phone_; } } public int PhoneCount { get { return result.PhoneCount; } @@ -730,29 +796,35 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public Builder SetPhone(int index, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.phone_[index] = value; return this; } public Builder SetPhone(int index, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.phone_[index] = builderForValue.Build(); return this; } public Builder AddPhone(global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.phone_.Add(value); return this; } public Builder AddPhone(global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.phone_.Add(builderForValue.Build()); return this; } public Builder AddRangePhone(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.phone_); return this; } public Builder ClearPhone() { + PrepareBuilder(); result.phone_.Clear(); return this; } @@ -869,7 +941,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(AddressBook prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -879,21 +951,48 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new AddressBook(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(AddressBook cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - AddressBook result = new AddressBook(); + bool builderIsReadOnly; + AddressBook result; + + private AddressBook PrepareBuilder() { + if (builderIsReadOnly) { + AddressBook original = result; + result = new AddressBook(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override AddressBook MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new AddressBook(); + result = DefaultInstance ?? new AddressBook(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -905,13 +1004,12 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public override AddressBook BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.person_.MakeReadOnly(); - AddressBook returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -925,6 +1023,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { public override Builder MergeFrom(AddressBook other) { if (other == global::Google.ProtocolBuffers.Examples.AddressBook.AddressBook.DefaultInstance) return this; + PrepareBuilder(); if (other.person_.Count != 0) { base.AddRange(other.person_, result.person_); } @@ -937,6 +1036,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -985,7 +1085,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { public pbc::IPopsicleList PersonList { - get { return result.person_; } + get { return PrepareBuilder().person_; } } public int PersonCount { get { return result.PersonCount; } @@ -995,29 +1095,35 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public Builder SetPerson(int index, global::Google.ProtocolBuffers.Examples.AddressBook.Person value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.person_[index] = value; return this; } public Builder SetPerson(int index, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.person_[index] = builderForValue.Build(); return this; } public Builder AddPerson(global::Google.ProtocolBuffers.Examples.AddressBook.Person value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.person_.Add(value); return this; } public Builder AddPerson(global::Google.ProtocolBuffers.Examples.AddressBook.Person.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.person_.Add(builderForValue.Build()); return this; } public Builder AddRangePerson(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.person_); return this; } public Builder ClearPerson() { + PrepareBuilder(); result.person_.Clear(); return this; } diff --git a/src/ProtoGen/EnumFieldGenerator.cs b/src/ProtoGen/EnumFieldGenerator.cs index 8b56b9e96b..84e677ed0d 100644 --- a/src/ProtoGen/EnumFieldGenerator.cs +++ b/src/ProtoGen/EnumFieldGenerator.cs @@ -70,11 +70,13 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine("}"); AddClsComplianceCheck(writer); writer.WriteLine("public Builder Set{0}({1} value) {{", PropertyName, TypeName); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.has{0} = true;", PropertyName); writer.WriteLine(" result.{0}_ = value;", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine("public Builder Clear{0}() {{", PropertyName); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.has{0} = false;", PropertyName); writer.WriteLine(" result.{0}_ = {1};", Name, DefaultValue); writer.WriteLine(" return this;"); diff --git a/src/ProtoGen/MessageFieldGenerator.cs b/src/ProtoGen/MessageFieldGenerator.cs index b86f2c9adf..fab0f29e49 100644 --- a/src/ProtoGen/MessageFieldGenerator.cs +++ b/src/ProtoGen/MessageFieldGenerator.cs @@ -68,18 +68,21 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine("}"); writer.WriteLine("public Builder Set{0}({1} value) {{", PropertyName, TypeName); AddNullCheck(writer); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.has{0} = true;", PropertyName); writer.WriteLine(" result.{0}_ = value;", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine("public Builder Set{0}({1}.Builder builderForValue) {{", PropertyName, TypeName); AddNullCheck(writer, "builderForValue"); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.has{0} = true;", PropertyName); writer.WriteLine(" result.{0}_ = builderForValue.Build();", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine("public Builder Merge{0}({1} value) {{", PropertyName, TypeName); AddNullCheck(writer); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" if (result.has{0} &&", PropertyName); writer.WriteLine(" result.{0}_ != {1}) {{", Name, DefaultValue); writer.WriteLine(" result.{0}_ = {1}.CreateBuilder(result.{0}_).MergeFrom(value).BuildPartial();", Name, @@ -91,6 +94,7 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine("public Builder Clear{0}() {{", PropertyName); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.has{0} = false;", PropertyName); writer.WriteLine(" result.{0}_ = {1};", Name, DefaultValue); writer.WriteLine(" return this;"); diff --git a/src/ProtoGen/MessageGenerator.cs b/src/ProtoGen/MessageGenerator.cs index 01d47ce216..f191da4fff 100644 --- a/src/ProtoGen/MessageGenerator.cs +++ b/src/ProtoGen/MessageGenerator.cs @@ -551,7 +551,7 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine("public override Builder ToBuilder() { return CreateBuilder(this); }"); writer.WriteLine("public override Builder CreateBuilderForType() { return new Builder(); }"); writer.WriteLine("public static Builder CreateBuilder({0} prototype) {{", ClassName); - writer.WriteLine(" return (Builder) new Builder().MergeFrom(prototype);"); + writer.WriteLine(" return new Builder(prototype);"); writer.WriteLine("}"); writer.WriteLine(); writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); @@ -582,21 +582,52 @@ namespace Google.ProtocolBuffers.ProtoGen private void GenerateCommonBuilderMethods(TextGenerator writer) { - writer.WriteLine("public Builder() {{}}", ClassAccessLevel); + //default constructor + writer.WriteLine("public Builder() {"); + //Durring static initialization of message, DefaultInstance is expected to return null. + writer.WriteLine(" result = DefaultInstance ?? new {0}();", ClassName); + writer.WriteLine(" builderIsReadOnly = result == DefaultInstance;"); + writer.WriteLine("}"); + //clone constructor + writer.WriteLine("internal Builder({0} cloneFrom) {{", ClassName); + writer.WriteLine(" result = cloneFrom;"); + writer.WriteLine(" builderIsReadOnly = true;"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("bool builderIsReadOnly;"); + writer.WriteLine("{0} result;", ClassName); + writer.WriteLine(); + writer.WriteLine("private {0} PrepareBuilder() {{", ClassName); + writer.WriteLine(" if (builderIsReadOnly) {"); + writer.WriteLine(" {0} original = result;", ClassName); + writer.WriteLine(" result = new {0}();", ClassName); + writer.WriteLine(" builderIsReadOnly = false;"); + writer.WriteLine(" MergeFrom(original);"); + writer.WriteLine(" }"); + writer.WriteLine(" return result;"); + writer.WriteLine("}"); writer.WriteLine(); - writer.WriteLine("{0} result = new {0}();", ClassName); + writer.WriteLine("public override bool IsInitialized {"); + writer.WriteLine(" get { return result.IsInitialized; }"); + writer.WriteLine("}"); writer.WriteLine(); writer.WriteLine("protected override {0} MessageBeingBuilt {{", ClassName); - writer.WriteLine(" get { return result; }"); + writer.WriteLine(" get { return PrepareBuilder(); }"); writer.WriteLine("}"); writer.WriteLine(); + //Not actually expecting that DefaultInstance would ever be null here; however, we will ensure it does not break writer.WriteLine("public override Builder Clear() {"); - writer.WriteLine(" result = new {0}();", ClassName); + writer.WriteLine(" result = DefaultInstance ?? new {0}();", ClassName); + writer.WriteLine(" builderIsReadOnly = true;"); writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine(); writer.WriteLine("public override Builder Clone() {"); - writer.WriteLine(" return new Builder().MergeFrom(result);"); + writer.WriteLine(" if (builderIsReadOnly) {"); + writer.WriteLine(" return new Builder(result);"); + writer.WriteLine(" } else {"); + writer.WriteLine(" return new Builder().MergeFrom(result);"); + writer.WriteLine(" }"); writer.WriteLine("}"); writer.WriteLine(); if (!UseLiteRuntime) @@ -613,17 +644,15 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine("public override {0} BuildPartial() {{", ClassName); writer.Indent(); - writer.WriteLine("if (result == null) {"); - writer.WriteLine( - " throw new global::System.InvalidOperationException(\"build() has already been called on this Builder\");"); + writer.WriteLine("if (builderIsReadOnly) {"); + writer.WriteLine(" return result;"); writer.WriteLine("}"); foreach (FieldDescriptor field in Descriptor.Fields) { CreateFieldGenerator(field).GenerateBuildingCode(writer); } - writer.WriteLine("{0} returnMe = result;", ClassName); - writer.WriteLine("result = null;"); - writer.WriteLine("return returnMe;"); + writer.WriteLine("builderIsReadOnly = true;"); + writer.WriteLine("return result;"); writer.Outdent(); writer.WriteLine("}"); writer.WriteLine(); @@ -644,6 +673,7 @@ namespace Google.ProtocolBuffers.ProtoGen // fields are set so we can skip the merge. writer.Indent(); writer.WriteLine("if (other == {0}.DefaultInstance) return this;", FullClassName); + writer.WriteLine("PrepareBuilder();"); foreach (FieldDescriptor field in Descriptor.Fields) { CreateFieldGenerator(field).GenerateMergingCode(writer); @@ -676,6 +706,7 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine( "public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {"); writer.Indent(); + writer.WriteLine("PrepareBuilder();"); if (!UseLiteRuntime) { writer.WriteLine("pb::UnknownFieldSet.Builder unknownFields = null;"); diff --git a/src/ProtoGen/PrimitiveFieldGenerator.cs b/src/ProtoGen/PrimitiveFieldGenerator.cs index e945bf877f..b9aee8651d 100644 --- a/src/ProtoGen/PrimitiveFieldGenerator.cs +++ b/src/ProtoGen/PrimitiveFieldGenerator.cs @@ -72,11 +72,13 @@ namespace Google.ProtocolBuffers.ProtoGen AddClsComplianceCheck(writer); writer.WriteLine("public Builder Set{0}({1} value) {{", PropertyName, TypeName); AddNullCheck(writer); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.has{0} = true;", PropertyName); writer.WriteLine(" result.{0}_ = value;", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine("public Builder Clear{0}() {{", PropertyName); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.has{0} = false;", PropertyName); writer.WriteLine(" result.{0}_ = {1};", Name, DefaultValue); writer.WriteLine(" return this;"); diff --git a/src/ProtoGen/RepeatedEnumFieldGenerator.cs b/src/ProtoGen/RepeatedEnumFieldGenerator.cs index 5880390b99..ae1ed2408f 100644 --- a/src/ProtoGen/RepeatedEnumFieldGenerator.cs +++ b/src/ProtoGen/RepeatedEnumFieldGenerator.cs @@ -71,7 +71,7 @@ namespace Google.ProtocolBuffers.ProtoGen // Note: We can return the original list here, because we make it unmodifiable when we build // We return it via IPopsicleList so that collection initializers work more pleasantly. writer.WriteLine("public pbc::IPopsicleList<{0}> {1}List {{", TypeName, PropertyName); - writer.WriteLine(" get {{ return result.{0}_; }}", Name); + writer.WriteLine(" get {{ return PrepareBuilder().{0}_; }}", Name); writer.WriteLine("}"); writer.WriteLine("public int {0}Count {{", PropertyName); writer.WriteLine(" get {{ return result.{0}Count; }}", PropertyName); @@ -80,18 +80,22 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine(" return result.Get{0}(index);", PropertyName); writer.WriteLine("}"); writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", PropertyName, TypeName); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.{0}_[index] = value;", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine("public Builder Add{0}({1} value) {{", PropertyName, TypeName); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.{0}_.Add(value);", Name, TypeName); writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" base.AddRange(values, result.{0}_);", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine("public Builder Clear{0}() {{", PropertyName); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.{0}_.Clear();", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); diff --git a/src/ProtoGen/RepeatedMessageFieldGenerator.cs b/src/ProtoGen/RepeatedMessageFieldGenerator.cs index bfa0763f6f..c184b34554 100644 --- a/src/ProtoGen/RepeatedMessageFieldGenerator.cs +++ b/src/ProtoGen/RepeatedMessageFieldGenerator.cs @@ -67,7 +67,7 @@ namespace Google.ProtocolBuffers.ProtoGen // Note: We can return the original list here, because we make it unmodifiable when we build // We return it via IPopsicleList so that collection initializers work more pleasantly. writer.WriteLine("public pbc::IPopsicleList<{0}> {1}List {{", TypeName, PropertyName); - writer.WriteLine(" get {{ return result.{0}_; }}", Name); + writer.WriteLine(" get {{ return PrepareBuilder().{0}_; }}", Name); writer.WriteLine("}"); writer.WriteLine("public int {0}Count {{", PropertyName); writer.WriteLine(" get {{ return result.{0}Count; }}", PropertyName); @@ -77,31 +77,37 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine("}"); writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", PropertyName, TypeName); AddNullCheck(writer); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.{0}_[index] = value;", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); // Extra overload for builder (just on messages) writer.WriteLine("public Builder Set{0}(int index, {1}.Builder builderForValue) {{", PropertyName, TypeName); AddNullCheck(writer, "builderForValue"); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.{0}_[index] = builderForValue.Build();", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine("public Builder Add{0}({1} value) {{", PropertyName, TypeName); AddNullCheck(writer); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.{0}_.Add(value);", Name, TypeName); writer.WriteLine(" return this;"); writer.WriteLine("}"); // Extra overload for builder (just on messages) writer.WriteLine("public Builder Add{0}({1}.Builder builderForValue) {{", PropertyName, TypeName); AddNullCheck(writer, "builderForValue"); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.{0}_.Add(builderForValue.Build());", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" base.AddRange(values, result.{0}_);", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine("public Builder Clear{0}() {{", PropertyName); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.{0}_.Clear();", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); diff --git a/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs b/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs index 9e7f5f641f..3bbcff52bf 100644 --- a/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs +++ b/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs @@ -74,7 +74,7 @@ namespace Google.ProtocolBuffers.ProtoGen // We return it via IPopsicleList so that collection initializers work more pleasantly. AddClsComplianceCheck(writer); writer.WriteLine("public pbc::IPopsicleList<{0}> {1}List {{", TypeName, PropertyName); - writer.WriteLine(" get {{ return result.{0}_; }}", Name); + writer.WriteLine(" get {{ return PrepareBuilder().{0}_; }}", Name); writer.WriteLine("}"); writer.WriteLine("public int {0}Count {{", PropertyName); writer.WriteLine(" get {{ return result.{0}Count; }}", PropertyName); @@ -86,21 +86,25 @@ namespace Google.ProtocolBuffers.ProtoGen AddClsComplianceCheck(writer); writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", PropertyName, TypeName); AddNullCheck(writer); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.{0}_[index] = value;", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); AddClsComplianceCheck(writer); writer.WriteLine("public Builder Add{0}({1} value) {{", PropertyName, TypeName); AddNullCheck(writer); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.{0}_.Add(value);", Name, TypeName); writer.WriteLine(" return this;"); writer.WriteLine("}"); AddClsComplianceCheck(writer); writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" base.AddRange(values, result.{0}_);", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine("public Builder Clear{0}() {{", PropertyName); + writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.{0}_.Clear();", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); diff --git a/src/ProtocolBuffers.Test/GeneratedMessageTest.cs b/src/ProtocolBuffers.Test/GeneratedMessageTest.cs index 410452d327..12224e9b32 100644 --- a/src/ProtocolBuffers.Test/GeneratedMessageTest.cs +++ b/src/ProtocolBuffers.Test/GeneratedMessageTest.cs @@ -111,22 +111,6 @@ namespace Google.ProtocolBuffers } } - [Test] - public void DoubleBuildError() - { - TestAllTypes.Builder builder = new TestAllTypes.Builder(); - builder.Build(); - try - { - builder.Build(); - Assert.Fail("Should have thrown exception."); - } - catch (InvalidOperationException) - { - // Success. - } - } - [Test] public void DefaultInstance() { diff --git a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj index 95ab0b9c63..b1a7e55977 100644 --- a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj +++ b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj @@ -105,6 +105,7 @@ + diff --git a/src/ProtocolBuffers.Test/ReusableBuilderTest.cs b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs new file mode 100644 index 0000000000..4184971f08 --- /dev/null +++ b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections.Generic; +using System.Text; +using NUnit.Framework; +using Google.ProtocolBuffers.TestProtos; + +namespace Google.ProtocolBuffers +{ + [TestFixture] + public class ReusableBuilderTest + { + [Test] + public void TestUnmodifiedDefaultInstance() + { + //Simply calling ToBuilder().Build() no longer creates a copy of the message + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + [Test] + public void BuildMultipleWithoutChange() + { + //Calling Build() or BuildPartial() does not require a copy of the message + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + builder.SetDefaultBool(true); + + TestAllTypes first = builder.BuildPartial(); + //Still the same instance? + Assert.IsTrue(ReferenceEquals(first, builder.Build())); + //Still the same instance? + Assert.IsTrue(ReferenceEquals(first, builder.BuildPartial().ToBuilder().Build())); + } + + [Test] + public void MergeFromDefaultInstance() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + builder.MergeFrom(TestAllTypes.DefaultInstance); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + [Test] + public void BuildNewBuilderIsDefaultInstance() + { + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, new TestAllTypes.Builder().Build())); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, TestAllTypes.CreateBuilder().Build())); + //last test, if you clear a builder it reverts to default instance + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, + TestAllTypes.CreateBuilder().SetOptionalBool(true).Build().ToBuilder().Clear().Build())); + } + + [Test] + public void CloneOnChangePrimitive() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + builder.SetDefaultBool(true); + Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + [Test] + public void CloneOnAddRepeatedBool() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + builder.AddRepeatedBool(true); + Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + [Test] + public void CloneOnChangeMessage() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + builder.SetOptionalForeignMessage(new ForeignMessage.Builder()); + Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + [Test] + public void CloneOnClearMessage() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + builder.ClearOptionalForeignMessage(); + Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + [Test] + public void CloneOnAddRepeatedForeignMessage() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + builder.AddRepeatedForeignMessage(ForeignMessage.DefaultInstance); + Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + [Test] + public void CloneOnChangeEnumValue() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + builder.SetOptionalForeignEnum(ForeignEnum.FOREIGN_BAR); + Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + [Test] + public void CloneOnAddRepeatedForeignEnum() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + builder.AddRepeatedForeignEnum(ForeignEnum.FOREIGN_BAR); + Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + } +} diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs index ff726d65de..215b9b4fd2 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs @@ -190,7 +190,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(OptionsMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -200,21 +200,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new OptionsMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(OptionsMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + OptionsMessage result; - OptionsMessage result = new OptionsMessage(); + private OptionsMessage PrepareBuilder() { + if (builderIsReadOnly) { + OptionsMessage original = result; + result = new OptionsMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override OptionsMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new OptionsMessage(); + result = DefaultInstance ?? new OptionsMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -226,12 +253,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionsMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - OptionsMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -245,6 +271,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(OptionsMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.OptionsMessage.DefaultInstance) return this; + PrepareBuilder(); if (other.HasNormal) { Normal = other.Normal; } @@ -263,6 +290,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -327,11 +355,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetNormal(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasNormal = true; result.normal_ = value; return this; } public Builder ClearNormal() { + PrepareBuilder(); result.hasNormal = false; result.normal_ = ""; return this; @@ -346,11 +376,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionsMessage_(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionsMessage_ = true; result.optionsMessage_ = value; return this; } public Builder ClearOptionsMessage_() { + PrepareBuilder(); result.hasOptionsMessage_ = false; result.optionsMessage_ = ""; return this; @@ -365,11 +397,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetCustomName(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasCustomName = true; result.customized_ = value; return this; } public Builder ClearCustomName() { + PrepareBuilder(); result.hasCustomName = false; result.customized_ = ""; return this; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs index 0b1be422a6..bc29da2640 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs @@ -513,7 +513,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestMessageWithCustomOptions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -523,21 +523,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestMessageWithCustomOptions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestMessageWithCustomOptions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestMessageWithCustomOptions result; + + private TestMessageWithCustomOptions PrepareBuilder() { + if (builderIsReadOnly) { + TestMessageWithCustomOptions original = result; + result = new TestMessageWithCustomOptions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestMessageWithCustomOptions result = new TestMessageWithCustomOptions(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestMessageWithCustomOptions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestMessageWithCustomOptions(); + result = DefaultInstance ?? new TestMessageWithCustomOptions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -549,12 +576,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMessageWithCustomOptions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestMessageWithCustomOptions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -568,6 +594,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestMessageWithCustomOptions other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestMessageWithCustomOptions.DefaultInstance) return this; + PrepareBuilder(); if (other.HasField1) { Field1 = other.Field1; } @@ -580,6 +607,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -636,11 +664,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField1(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField1 = true; result.field1_ = value; return this; } public Builder ClearField1() { + PrepareBuilder(); result.hasField1 = false; result.field1_ = ""; return this; @@ -737,7 +767,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(CustomOptionFooRequest prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -747,21 +777,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new CustomOptionFooRequest(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(CustomOptionFooRequest cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + CustomOptionFooRequest result; + + private CustomOptionFooRequest PrepareBuilder() { + if (builderIsReadOnly) { + CustomOptionFooRequest original = result; + result = new CustomOptionFooRequest(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - CustomOptionFooRequest result = new CustomOptionFooRequest(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override CustomOptionFooRequest MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new CustomOptionFooRequest(); + result = DefaultInstance ?? new CustomOptionFooRequest(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -773,12 +830,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override CustomOptionFooRequest BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - CustomOptionFooRequest returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -792,6 +848,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(CustomOptionFooRequest other) { if (other == global::Google.ProtocolBuffers.TestProtos.CustomOptionFooRequest.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -801,6 +858,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -935,7 +993,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(CustomOptionFooResponse prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -945,21 +1003,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new CustomOptionFooResponse(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(CustomOptionFooResponse cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - CustomOptionFooResponse result = new CustomOptionFooResponse(); + bool builderIsReadOnly; + CustomOptionFooResponse result; + + private CustomOptionFooResponse PrepareBuilder() { + if (builderIsReadOnly) { + CustomOptionFooResponse original = result; + result = new CustomOptionFooResponse(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override CustomOptionFooResponse MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new CustomOptionFooResponse(); + result = DefaultInstance ?? new CustomOptionFooResponse(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -971,12 +1056,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override CustomOptionFooResponse BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - CustomOptionFooResponse returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -990,6 +1074,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(CustomOptionFooResponse other) { if (other == global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -999,6 +1084,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1148,7 +1234,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(DummyMessageContainingEnum prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1158,21 +1244,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new DummyMessageContainingEnum(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(DummyMessageContainingEnum cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - DummyMessageContainingEnum result = new DummyMessageContainingEnum(); + bool builderIsReadOnly; + DummyMessageContainingEnum result; + + private DummyMessageContainingEnum PrepareBuilder() { + if (builderIsReadOnly) { + DummyMessageContainingEnum original = result; + result = new DummyMessageContainingEnum(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override DummyMessageContainingEnum MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new DummyMessageContainingEnum(); + result = DefaultInstance ?? new DummyMessageContainingEnum(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1184,12 +1297,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override DummyMessageContainingEnum BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - DummyMessageContainingEnum returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1203,6 +1315,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(DummyMessageContainingEnum other) { if (other == global::Google.ProtocolBuffers.TestProtos.DummyMessageContainingEnum.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -1212,6 +1325,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1346,7 +1460,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(DummyMessageInvalidAsOptionType prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1356,21 +1470,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new DummyMessageInvalidAsOptionType(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(DummyMessageInvalidAsOptionType cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - DummyMessageInvalidAsOptionType result = new DummyMessageInvalidAsOptionType(); + bool builderIsReadOnly; + DummyMessageInvalidAsOptionType result; + + private DummyMessageInvalidAsOptionType PrepareBuilder() { + if (builderIsReadOnly) { + DummyMessageInvalidAsOptionType original = result; + result = new DummyMessageInvalidAsOptionType(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override DummyMessageInvalidAsOptionType MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new DummyMessageInvalidAsOptionType(); + result = DefaultInstance ?? new DummyMessageInvalidAsOptionType(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1382,12 +1523,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override DummyMessageInvalidAsOptionType BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - DummyMessageInvalidAsOptionType returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1401,6 +1541,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(DummyMessageInvalidAsOptionType other) { if (other == global::Google.ProtocolBuffers.TestProtos.DummyMessageInvalidAsOptionType.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -1410,6 +1551,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1544,7 +1686,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(CustomOptionMinIntegerValues prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1554,21 +1696,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new CustomOptionMinIntegerValues(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(CustomOptionMinIntegerValues cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - CustomOptionMinIntegerValues result = new CustomOptionMinIntegerValues(); + bool builderIsReadOnly; + CustomOptionMinIntegerValues result; + + private CustomOptionMinIntegerValues PrepareBuilder() { + if (builderIsReadOnly) { + CustomOptionMinIntegerValues original = result; + result = new CustomOptionMinIntegerValues(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override CustomOptionMinIntegerValues MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new CustomOptionMinIntegerValues(); + result = DefaultInstance ?? new CustomOptionMinIntegerValues(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1580,12 +1749,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override CustomOptionMinIntegerValues BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - CustomOptionMinIntegerValues returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1599,6 +1767,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(CustomOptionMinIntegerValues other) { if (other == global::Google.ProtocolBuffers.TestProtos.CustomOptionMinIntegerValues.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -1608,6 +1777,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1742,7 +1912,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(CustomOptionMaxIntegerValues prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1752,21 +1922,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new CustomOptionMaxIntegerValues(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(CustomOptionMaxIntegerValues cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + CustomOptionMaxIntegerValues result; + + private CustomOptionMaxIntegerValues PrepareBuilder() { + if (builderIsReadOnly) { + CustomOptionMaxIntegerValues original = result; + result = new CustomOptionMaxIntegerValues(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - CustomOptionMaxIntegerValues result = new CustomOptionMaxIntegerValues(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override CustomOptionMaxIntegerValues MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new CustomOptionMaxIntegerValues(); + result = DefaultInstance ?? new CustomOptionMaxIntegerValues(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1778,12 +1975,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override CustomOptionMaxIntegerValues BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - CustomOptionMaxIntegerValues returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1797,6 +1993,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(CustomOptionMaxIntegerValues other) { if (other == global::Google.ProtocolBuffers.TestProtos.CustomOptionMaxIntegerValues.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -1806,6 +2003,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1940,7 +2138,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(CustomOptionOtherValues prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1950,21 +2148,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new CustomOptionOtherValues(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(CustomOptionOtherValues cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + CustomOptionOtherValues result; - CustomOptionOtherValues result = new CustomOptionOtherValues(); + private CustomOptionOtherValues PrepareBuilder() { + if (builderIsReadOnly) { + CustomOptionOtherValues original = result; + result = new CustomOptionOtherValues(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override CustomOptionOtherValues MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new CustomOptionOtherValues(); + result = DefaultInstance ?? new CustomOptionOtherValues(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1976,12 +2201,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override CustomOptionOtherValues BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - CustomOptionOtherValues returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1995,6 +2219,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(CustomOptionOtherValues other) { if (other == global::Google.ProtocolBuffers.TestProtos.CustomOptionOtherValues.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -2004,6 +2229,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -2138,7 +2364,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(SettingRealsFromPositiveInts prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -2148,21 +2374,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new SettingRealsFromPositiveInts(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(SettingRealsFromPositiveInts cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + SettingRealsFromPositiveInts result; - SettingRealsFromPositiveInts result = new SettingRealsFromPositiveInts(); + private SettingRealsFromPositiveInts PrepareBuilder() { + if (builderIsReadOnly) { + SettingRealsFromPositiveInts original = result; + result = new SettingRealsFromPositiveInts(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override SettingRealsFromPositiveInts MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new SettingRealsFromPositiveInts(); + result = DefaultInstance ?? new SettingRealsFromPositiveInts(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -2174,12 +2427,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SettingRealsFromPositiveInts BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - SettingRealsFromPositiveInts returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -2193,6 +2445,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(SettingRealsFromPositiveInts other) { if (other == global::Google.ProtocolBuffers.TestProtos.SettingRealsFromPositiveInts.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -2202,6 +2455,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -2336,7 +2590,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(SettingRealsFromNegativeInts prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -2346,21 +2600,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new SettingRealsFromNegativeInts(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(SettingRealsFromNegativeInts cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - SettingRealsFromNegativeInts result = new SettingRealsFromNegativeInts(); + bool builderIsReadOnly; + SettingRealsFromNegativeInts result; + + private SettingRealsFromNegativeInts PrepareBuilder() { + if (builderIsReadOnly) { + SettingRealsFromNegativeInts original = result; + result = new SettingRealsFromNegativeInts(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override SettingRealsFromNegativeInts MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new SettingRealsFromNegativeInts(); + result = DefaultInstance ?? new SettingRealsFromNegativeInts(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -2372,12 +2653,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SettingRealsFromNegativeInts BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - SettingRealsFromNegativeInts returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -2391,6 +2671,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(SettingRealsFromNegativeInts other) { if (other == global::Google.ProtocolBuffers.TestProtos.SettingRealsFromNegativeInts.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -2400,6 +2681,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -2586,7 +2868,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ComplexOptionType1 prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -2596,21 +2878,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new ComplexOptionType1(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(ComplexOptionType1 cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + ComplexOptionType1 result; + + private ComplexOptionType1 PrepareBuilder() { + if (builderIsReadOnly) { + ComplexOptionType1 original = result; + result = new ComplexOptionType1(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - ComplexOptionType1 result = new ComplexOptionType1(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override ComplexOptionType1 MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new ComplexOptionType1(); + result = DefaultInstance ?? new ComplexOptionType1(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -2622,12 +2931,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOptionType1 BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - ComplexOptionType1 returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -2641,6 +2949,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(ComplexOptionType1 other) { if (other == global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.DefaultInstance) return this; + PrepareBuilder(); if (other.HasFoo) { Foo = other.Foo; } @@ -2660,6 +2969,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -2723,11 +3033,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetFoo(value); } } public Builder SetFoo(int value) { + PrepareBuilder(); result.hasFoo = true; result.foo_ = value; return this; } public Builder ClearFoo() { + PrepareBuilder(); result.hasFoo = false; result.foo_ = 0; return this; @@ -2741,11 +3053,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetFoo2(value); } } public Builder SetFoo2(int value) { + PrepareBuilder(); result.hasFoo2 = true; result.foo2_ = value; return this; } public Builder ClearFoo2() { + PrepareBuilder(); result.hasFoo2 = false; result.foo2_ = 0; return this; @@ -2759,11 +3073,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetFoo3(value); } } public Builder SetFoo3(int value) { + PrepareBuilder(); result.hasFoo3 = true; result.foo3_ = value; return this; } public Builder ClearFoo3() { + PrepareBuilder(); result.hasFoo3 = false; result.foo3_ = 0; return this; @@ -2910,7 +3226,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ComplexOptionType4 prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -2920,21 +3236,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new ComplexOptionType4(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(ComplexOptionType4 cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - ComplexOptionType4 result = new ComplexOptionType4(); + bool builderIsReadOnly; + ComplexOptionType4 result; + + private ComplexOptionType4 PrepareBuilder() { + if (builderIsReadOnly) { + ComplexOptionType4 original = result; + result = new ComplexOptionType4(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override ComplexOptionType4 MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new ComplexOptionType4(); + result = DefaultInstance ?? new ComplexOptionType4(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -2946,12 +3289,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOptionType4 BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - ComplexOptionType4 returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -2965,6 +3307,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(ComplexOptionType4 other) { if (other == global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.DefaultInstance) return this; + PrepareBuilder(); if (other.HasWaldo) { Waldo = other.Waldo; } @@ -2977,6 +3320,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -3032,11 +3376,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetWaldo(value); } } public Builder SetWaldo(int value) { + PrepareBuilder(); result.hasWaldo = true; result.waldo_ = value; return this; } public Builder ClearWaldo() { + PrepareBuilder(); result.hasWaldo = false; result.waldo_ = 0; return this; @@ -3164,7 +3510,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ComplexOptionType2 prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -3174,21 +3520,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new ComplexOptionType2(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(ComplexOptionType2 cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + ComplexOptionType2 result; - ComplexOptionType2 result = new ComplexOptionType2(); + private ComplexOptionType2 PrepareBuilder() { + if (builderIsReadOnly) { + ComplexOptionType2 original = result; + result = new ComplexOptionType2(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override ComplexOptionType2 MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new ComplexOptionType2(); + result = DefaultInstance ?? new ComplexOptionType2(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -3200,12 +3573,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOptionType2 BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - ComplexOptionType2 returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -3219,6 +3591,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(ComplexOptionType2 other) { if (other == global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.DefaultInstance) return this; + PrepareBuilder(); if (other.HasBar) { MergeBar(other.Bar); } @@ -3238,6 +3611,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -3312,18 +3686,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetBar(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1 value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasBar = true; result.bar_ = value; return this; } public Builder SetBar(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasBar = true; result.bar_ = builderForValue.Build(); return this; } public Builder MergeBar(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1 value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasBar && result.bar_ != global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.DefaultInstance) { result.bar_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.CreateBuilder(result.bar_).MergeFrom(value).BuildPartial(); @@ -3334,6 +3711,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearBar() { + PrepareBuilder(); result.hasBar = false; result.bar_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.DefaultInstance; return this; @@ -3347,11 +3725,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetBaz(value); } } public Builder SetBaz(int value) { + PrepareBuilder(); result.hasBaz = true; result.baz_ = value; return this; } public Builder ClearBaz() { + PrepareBuilder(); result.hasBaz = false; result.baz_ = 0; return this; @@ -3366,18 +3746,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetFred(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4 value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasFred = true; result.fred_ = value; return this; } public Builder SetFred(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasFred = true; result.fred_ = builderForValue.Build(); return this; } public Builder MergeFred(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4 value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasFred && result.fred_ != global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.DefaultInstance) { result.fred_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.CreateBuilder(result.fred_).MergeFrom(value).BuildPartial(); @@ -3388,6 +3771,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearFred() { + PrepareBuilder(); result.hasFred = false; result.fred_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.DefaultInstance; return this; @@ -3532,7 +3916,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ComplexOptionType5 prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -3542,21 +3926,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new ComplexOptionType5(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(ComplexOptionType5 cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + ComplexOptionType5 result; + + private ComplexOptionType5 PrepareBuilder() { + if (builderIsReadOnly) { + ComplexOptionType5 original = result; + result = new ComplexOptionType5(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - ComplexOptionType5 result = new ComplexOptionType5(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override ComplexOptionType5 MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new ComplexOptionType5(); + result = DefaultInstance ?? new ComplexOptionType5(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -3568,12 +3979,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOptionType5 BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - ComplexOptionType5 returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -3587,6 +3997,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(ComplexOptionType5 other) { if (other == global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.DefaultInstance) return this; + PrepareBuilder(); if (other.HasPlugh) { Plugh = other.Plugh; } @@ -3599,6 +4010,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -3654,11 +4066,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetPlugh(value); } } public Builder SetPlugh(int value) { + PrepareBuilder(); result.hasPlugh = true; result.plugh_ = value; return this; } public Builder ClearPlugh() { + PrepareBuilder(); result.hasPlugh = false; result.plugh_ = 0; return this; @@ -3763,7 +4177,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ComplexOptionType3 prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -3773,21 +4187,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new ComplexOptionType3(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(ComplexOptionType3 cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - ComplexOptionType3 result = new ComplexOptionType3(); + bool builderIsReadOnly; + ComplexOptionType3 result; + + private ComplexOptionType3 PrepareBuilder() { + if (builderIsReadOnly) { + ComplexOptionType3 original = result; + result = new ComplexOptionType3(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override ComplexOptionType3 MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new ComplexOptionType3(); + result = DefaultInstance ?? new ComplexOptionType3(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -3799,12 +4240,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOptionType3 BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - ComplexOptionType3 returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -3818,6 +4258,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(ComplexOptionType3 other) { if (other == global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.DefaultInstance) return this; + PrepareBuilder(); if (other.HasQux) { Qux = other.Qux; } @@ -3833,6 +4274,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -3897,11 +4339,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetQux(value); } } public Builder SetQux(int value) { + PrepareBuilder(); result.hasQux = true; result.qux_ = value; return this; } public Builder ClearQux() { + PrepareBuilder(); result.hasQux = false; result.qux_ = 0; return this; @@ -3916,18 +4360,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetComplexOptionType5(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5 value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasComplexOptionType5 = true; result.complexOptionType5_ = value; return this; } public Builder SetComplexOptionType5(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasComplexOptionType5 = true; result.complexOptionType5_ = builderForValue.Build(); return this; } public Builder MergeComplexOptionType5(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5 value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasComplexOptionType5 && result.complexOptionType5_ != global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.DefaultInstance) { result.complexOptionType5_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.CreateBuilder(result.complexOptionType5_).MergeFrom(value).BuildPartial(); @@ -3938,6 +4385,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearComplexOptionType5() { + PrepareBuilder(); result.hasComplexOptionType5 = false; result.complexOptionType5_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.DefaultInstance; return this; @@ -4050,7 +4498,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ComplexOpt6 prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -4060,21 +4508,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new ComplexOpt6(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(ComplexOpt6 cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + ComplexOpt6 result; + + private ComplexOpt6 PrepareBuilder() { + if (builderIsReadOnly) { + ComplexOpt6 original = result; + result = new ComplexOpt6(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - ComplexOpt6 result = new ComplexOpt6(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override ComplexOpt6 MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new ComplexOpt6(); + result = DefaultInstance ?? new ComplexOpt6(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -4086,12 +4561,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOpt6 BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - ComplexOpt6 returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -4105,6 +4579,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(ComplexOpt6 other) { if (other == global::Google.ProtocolBuffers.TestProtos.ComplexOpt6.DefaultInstance) return this; + PrepareBuilder(); if (other.HasXyzzy) { Xyzzy = other.Xyzzy; } @@ -4117,6 +4592,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -4172,11 +4648,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetXyzzy(value); } } public Builder SetXyzzy(int value) { + PrepareBuilder(); result.hasXyzzy = true; result.xyzzy_ = value; return this; } public Builder ClearXyzzy() { + PrepareBuilder(); result.hasXyzzy = false; result.xyzzy_ = 0; return this; @@ -4273,7 +4751,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(VariousComplexOptions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -4283,21 +4761,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new VariousComplexOptions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(VariousComplexOptions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + VariousComplexOptions result; - VariousComplexOptions result = new VariousComplexOptions(); + private VariousComplexOptions PrepareBuilder() { + if (builderIsReadOnly) { + VariousComplexOptions original = result; + result = new VariousComplexOptions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override VariousComplexOptions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new VariousComplexOptions(); + result = DefaultInstance ?? new VariousComplexOptions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -4309,12 +4814,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override VariousComplexOptions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - VariousComplexOptions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -4328,6 +4832,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(VariousComplexOptions other) { if (other == global::Google.ProtocolBuffers.TestProtos.VariousComplexOptions.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -4337,6 +4842,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs index 09ecdd63d4..466cce7327 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs @@ -186,7 +186,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestEmbedOptimizedForSize prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -196,21 +196,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestEmbedOptimizedForSize(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestEmbedOptimizedForSize cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestEmbedOptimizedForSize result; - TestEmbedOptimizedForSize result = new TestEmbedOptimizedForSize(); + private TestEmbedOptimizedForSize PrepareBuilder() { + if (builderIsReadOnly) { + TestEmbedOptimizedForSize original = result; + result = new TestEmbedOptimizedForSize(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestEmbedOptimizedForSize MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestEmbedOptimizedForSize(); + result = DefaultInstance ?? new TestEmbedOptimizedForSize(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -222,13 +249,12 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestEmbedOptimizedForSize BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.repeatedMessage_.MakeReadOnly(); - TestEmbedOptimizedForSize returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -242,6 +268,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestEmbedOptimizedForSize other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize.DefaultInstance) return this; + PrepareBuilder(); if (other.HasOptionalMessage) { MergeOptionalMessage(other.OptionalMessage); } @@ -257,6 +284,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -322,18 +350,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalMessage = true; result.optionalMessage_ = value; return this; } public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptionalMessage = true; result.optionalMessage_ = builderForValue.Build(); return this; } public Builder MergeOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptionalMessage && result.optionalMessage_ != global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance) { result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.CreateBuilder(result.optionalMessage_).MergeFrom(value).BuildPartial(); @@ -344,13 +375,14 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearOptionalMessage() { + PrepareBuilder(); result.hasOptionalMessage = false; result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance; return this; } public pbc::IPopsicleList RepeatedMessageList { - get { return result.repeatedMessage_; } + get { return PrepareBuilder().repeatedMessage_; } } public int RepeatedMessageCount { get { return result.RepeatedMessageCount; } @@ -360,29 +392,35 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedMessage_[index] = value; return this; } public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedMessage_[index] = builderForValue.Build(); return this; } public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedMessage_.Add(value); return this; } public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedMessage_.Add(builderForValue.Build()); return this; } public Builder AddRangeRepeatedMessage(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedMessage_); return this; } public Builder ClearRepeatedMessage() { + PrepareBuilder(); result.repeatedMessage_.Clear(); return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs index db56e8b919..7791759a2a 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs @@ -175,7 +175,7 @@ namespace UnitTest.Issues.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(A prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -185,21 +185,48 @@ namespace UnitTest.Issues.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new A(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(A cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + A result; - A result = new A(); + private A PrepareBuilder() { + if (builderIsReadOnly) { + A original = result; + result = new A(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override A MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new A(); + result = DefaultInstance ?? new A(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -211,12 +238,11 @@ namespace UnitTest.Issues.TestProtos { } public override A BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - A returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -230,6 +256,7 @@ namespace UnitTest.Issues.TestProtos { public override Builder MergeFrom(A other) { if (other == global::UnitTest.Issues.TestProtos.A.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA_) { A_ = other.A_; } @@ -242,6 +269,7 @@ namespace UnitTest.Issues.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -297,11 +325,13 @@ namespace UnitTest.Issues.TestProtos { set { SetA_(value); } } public Builder SetA_(int value) { + PrepareBuilder(); result.hasA_ = true; result.a_ = value; return this; } public Builder ClearA_() { + PrepareBuilder(); result.hasA_ = false; result.a_ = 0; return this; @@ -414,7 +444,7 @@ namespace UnitTest.Issues.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(B prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -424,21 +454,48 @@ namespace UnitTest.Issues.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new B(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(B cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + B result; - B result = new B(); + private B PrepareBuilder() { + if (builderIsReadOnly) { + B original = result; + result = new B(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override B MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new B(); + result = DefaultInstance ?? new B(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -450,12 +507,11 @@ namespace UnitTest.Issues.TestProtos { } public override B BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - B returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -469,6 +525,7 @@ namespace UnitTest.Issues.TestProtos { public override Builder MergeFrom(B other) { if (other == global::UnitTest.Issues.TestProtos.B.DefaultInstance) return this; + PrepareBuilder(); if (other.HasB_) { B_ = other.B_; } @@ -481,6 +538,7 @@ namespace UnitTest.Issues.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -536,11 +594,13 @@ namespace UnitTest.Issues.TestProtos { set { SetB_(value); } } public Builder SetB_(int value) { + PrepareBuilder(); result.hasB_ = true; result.b_ = value; return this; } public Builder ClearB_() { + PrepareBuilder(); result.hasB_ = false; result.b_ = 0; return this; @@ -653,7 +713,7 @@ namespace UnitTest.Issues.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(AB prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -663,21 +723,48 @@ namespace UnitTest.Issues.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new AB(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(AB cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + AB result; - AB result = new AB(); + private AB PrepareBuilder() { + if (builderIsReadOnly) { + AB original = result; + result = new AB(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override AB MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new AB(); + result = DefaultInstance ?? new AB(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -689,12 +776,11 @@ namespace UnitTest.Issues.TestProtos { } public override AB BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - AB returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -708,6 +794,7 @@ namespace UnitTest.Issues.TestProtos { public override Builder MergeFrom(AB other) { if (other == global::UnitTest.Issues.TestProtos.AB.DefaultInstance) return this; + PrepareBuilder(); if (other.HasAB_) { AB_ = other.AB_; } @@ -720,6 +807,7 @@ namespace UnitTest.Issues.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -775,11 +863,13 @@ namespace UnitTest.Issues.TestProtos { set { SetAB_(value); } } public Builder SetAB_(int value) { + PrepareBuilder(); result.hasAB_ = true; result.aB_ = value; return this; } public Builder ClearAB_() { + PrepareBuilder(); result.hasAB_ = false; result.aB_ = 0; return this; @@ -894,7 +984,7 @@ namespace UnitTest.Issues.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(NumberField prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -904,21 +994,48 @@ namespace UnitTest.Issues.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new NumberField(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(NumberField cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + NumberField result; - NumberField result = new NumberField(); + private NumberField PrepareBuilder() { + if (builderIsReadOnly) { + NumberField original = result; + result = new NumberField(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override NumberField MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new NumberField(); + result = DefaultInstance ?? new NumberField(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -930,12 +1047,11 @@ namespace UnitTest.Issues.TestProtos { } public override NumberField BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - NumberField returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -949,6 +1065,7 @@ namespace UnitTest.Issues.TestProtos { public override Builder MergeFrom(NumberField other) { if (other == global::UnitTest.Issues.TestProtos.NumberField.DefaultInstance) return this; + PrepareBuilder(); if (other.Has_01) { _01 = other._01; } @@ -961,6 +1078,7 @@ namespace UnitTest.Issues.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1018,11 +1136,13 @@ namespace UnitTest.Issues.TestProtos { } [global::System.CLSCompliant(false)] public Builder Set_01(int value) { + PrepareBuilder(); result.has_01 = true; result._01_ = value; return this; } public Builder Clear_01() { + PrepareBuilder(); result.has_01 = false; result._01_ = 0; return this; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs index 77635f2132..64046eebf5 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs @@ -606,7 +606,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(SizeMessage1 prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -616,21 +616,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new SizeMessage1(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(SizeMessage1 cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + SizeMessage1 result; + + private SizeMessage1 PrepareBuilder() { + if (builderIsReadOnly) { + SizeMessage1 original = result; + result = new SizeMessage1(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - SizeMessage1 result = new SizeMessage1(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override SizeMessage1 MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new SizeMessage1(); + result = DefaultInstance ?? new SizeMessage1(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -642,13 +669,12 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SizeMessage1 BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.field5_.MakeReadOnly(); - SizeMessage1 returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } @@ -661,11 +687,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField1(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField1 = true; result.field1_ = value; return this; } public Builder ClearField1() { + PrepareBuilder(); result.hasField1 = false; result.field1_ = ""; return this; @@ -680,11 +708,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField9(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField9 = true; result.field9_ = value; return this; } public Builder ClearField9() { + PrepareBuilder(); result.hasField9 = false; result.field9_ = ""; return this; @@ -699,11 +729,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField18(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField18 = true; result.field18_ = value; return this; } public Builder ClearField18() { + PrepareBuilder(); result.hasField18 = false; result.field18_ = ""; return this; @@ -717,11 +749,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField80(value); } } public Builder SetField80(bool value) { + PrepareBuilder(); result.hasField80 = true; result.field80_ = value; return this; } public Builder ClearField80() { + PrepareBuilder(); result.hasField80 = false; result.field80_ = false; return this; @@ -735,11 +769,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField81(value); } } public Builder SetField81(bool value) { + PrepareBuilder(); result.hasField81 = true; result.field81_ = value; return this; } public Builder ClearField81() { + PrepareBuilder(); result.hasField81 = false; result.field81_ = true; return this; @@ -753,11 +789,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField2(value); } } public Builder SetField2(int value) { + PrepareBuilder(); result.hasField2 = true; result.field2_ = value; return this; } public Builder ClearField2() { + PrepareBuilder(); result.hasField2 = false; result.field2_ = 0; return this; @@ -771,11 +809,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField3(value); } } public Builder SetField3(int value) { + PrepareBuilder(); result.hasField3 = true; result.field3_ = value; return this; } public Builder ClearField3() { + PrepareBuilder(); result.hasField3 = false; result.field3_ = 0; return this; @@ -789,11 +829,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField280(value); } } public Builder SetField280(int value) { + PrepareBuilder(); result.hasField280 = true; result.field280_ = value; return this; } public Builder ClearField280() { + PrepareBuilder(); result.hasField280 = false; result.field280_ = 0; return this; @@ -807,11 +849,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField6(value); } } public Builder SetField6(int value) { + PrepareBuilder(); result.hasField6 = true; result.field6_ = value; return this; } public Builder ClearField6() { + PrepareBuilder(); result.hasField6 = false; result.field6_ = 0; return this; @@ -825,11 +869,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField22(value); } } public Builder SetField22(long value) { + PrepareBuilder(); result.hasField22 = true; result.field22_ = value; return this; } public Builder ClearField22() { + PrepareBuilder(); result.hasField22 = false; result.field22_ = 0L; return this; @@ -844,11 +890,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField4(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField4 = true; result.field4_ = value; return this; } public Builder ClearField4() { + PrepareBuilder(); result.hasField4 = false; result.field4_ = ""; return this; @@ -856,7 +904,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.CLSCompliant(false)] public pbc::IPopsicleList Field5List { - get { return result.field5_; } + get { return PrepareBuilder().field5_; } } public int Field5Count { get { return result.Field5Count; } @@ -867,20 +915,24 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetField5(int index, ulong value) { + PrepareBuilder(); result.field5_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddField5(ulong value) { + PrepareBuilder(); result.field5_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeField5(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.field5_); return this; } public Builder ClearField5() { + PrepareBuilder(); result.field5_.Clear(); return this; } @@ -893,11 +945,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField59(value); } } public Builder SetField59(bool value) { + PrepareBuilder(); result.hasField59 = true; result.field59_ = value; return this; } public Builder ClearField59() { + PrepareBuilder(); result.hasField59 = false; result.field59_ = false; return this; @@ -912,11 +966,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField7(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField7 = true; result.field7_ = value; return this; } public Builder ClearField7() { + PrepareBuilder(); result.hasField7 = false; result.field7_ = ""; return this; @@ -930,11 +986,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField16(value); } } public Builder SetField16(int value) { + PrepareBuilder(); result.hasField16 = true; result.field16_ = value; return this; } public Builder ClearField16() { + PrepareBuilder(); result.hasField16 = false; result.field16_ = 0; return this; @@ -948,11 +1006,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField130(value); } } public Builder SetField130(int value) { + PrepareBuilder(); result.hasField130 = true; result.field130_ = value; return this; } public Builder ClearField130() { + PrepareBuilder(); result.hasField130 = false; result.field130_ = 0; return this; @@ -966,11 +1026,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField12(value); } } public Builder SetField12(bool value) { + PrepareBuilder(); result.hasField12 = true; result.field12_ = value; return this; } public Builder ClearField12() { + PrepareBuilder(); result.hasField12 = false; result.field12_ = true; return this; @@ -984,11 +1046,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField17(value); } } public Builder SetField17(bool value) { + PrepareBuilder(); result.hasField17 = true; result.field17_ = value; return this; } public Builder ClearField17() { + PrepareBuilder(); result.hasField17 = false; result.field17_ = true; return this; @@ -1002,11 +1066,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField13(value); } } public Builder SetField13(bool value) { + PrepareBuilder(); result.hasField13 = true; result.field13_ = value; return this; } public Builder ClearField13() { + PrepareBuilder(); result.hasField13 = false; result.field13_ = true; return this; @@ -1020,11 +1086,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField14(value); } } public Builder SetField14(bool value) { + PrepareBuilder(); result.hasField14 = true; result.field14_ = value; return this; } public Builder ClearField14() { + PrepareBuilder(); result.hasField14 = false; result.field14_ = true; return this; @@ -1038,11 +1106,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField104(value); } } public Builder SetField104(int value) { + PrepareBuilder(); result.hasField104 = true; result.field104_ = value; return this; } public Builder ClearField104() { + PrepareBuilder(); result.hasField104 = false; result.field104_ = 0; return this; @@ -1056,11 +1126,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField100(value); } } public Builder SetField100(int value) { + PrepareBuilder(); result.hasField100 = true; result.field100_ = value; return this; } public Builder ClearField100() { + PrepareBuilder(); result.hasField100 = false; result.field100_ = 0; return this; @@ -1074,11 +1146,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField101(value); } } public Builder SetField101(int value) { + PrepareBuilder(); result.hasField101 = true; result.field101_ = value; return this; } public Builder ClearField101() { + PrepareBuilder(); result.hasField101 = false; result.field101_ = 0; return this; @@ -1093,11 +1167,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField102(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField102 = true; result.field102_ = value; return this; } public Builder ClearField102() { + PrepareBuilder(); result.hasField102 = false; result.field102_ = ""; return this; @@ -1112,11 +1188,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField103(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField103 = true; result.field103_ = value; return this; } public Builder ClearField103() { + PrepareBuilder(); result.hasField103 = false; result.field103_ = ""; return this; @@ -1130,11 +1208,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField29(value); } } public Builder SetField29(int value) { + PrepareBuilder(); result.hasField29 = true; result.field29_ = value; return this; } public Builder ClearField29() { + PrepareBuilder(); result.hasField29 = false; result.field29_ = 0; return this; @@ -1148,11 +1228,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField30(value); } } public Builder SetField30(bool value) { + PrepareBuilder(); result.hasField30 = true; result.field30_ = value; return this; } public Builder ClearField30() { + PrepareBuilder(); result.hasField30 = false; result.field30_ = false; return this; @@ -1166,11 +1248,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField60(value); } } public Builder SetField60(int value) { + PrepareBuilder(); result.hasField60 = true; result.field60_ = value; return this; } public Builder ClearField60() { + PrepareBuilder(); result.hasField60 = false; result.field60_ = -1; return this; @@ -1184,11 +1268,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField271(value); } } public Builder SetField271(int value) { + PrepareBuilder(); result.hasField271 = true; result.field271_ = value; return this; } public Builder ClearField271() { + PrepareBuilder(); result.hasField271 = false; result.field271_ = -1; return this; @@ -1202,11 +1288,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField272(value); } } public Builder SetField272(int value) { + PrepareBuilder(); result.hasField272 = true; result.field272_ = value; return this; } public Builder ClearField272() { + PrepareBuilder(); result.hasField272 = false; result.field272_ = -1; return this; @@ -1220,11 +1308,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField150(value); } } public Builder SetField150(int value) { + PrepareBuilder(); result.hasField150 = true; result.field150_ = value; return this; } public Builder ClearField150() { + PrepareBuilder(); result.hasField150 = false; result.field150_ = 0; return this; @@ -1238,11 +1328,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField23(value); } } public Builder SetField23(int value) { + PrepareBuilder(); result.hasField23 = true; result.field23_ = value; return this; } public Builder ClearField23() { + PrepareBuilder(); result.hasField23 = false; result.field23_ = 0; return this; @@ -1256,11 +1348,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField24(value); } } public Builder SetField24(bool value) { + PrepareBuilder(); result.hasField24 = true; result.field24_ = value; return this; } public Builder ClearField24() { + PrepareBuilder(); result.hasField24 = false; result.field24_ = false; return this; @@ -1274,11 +1368,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField25(value); } } public Builder SetField25(int value) { + PrepareBuilder(); result.hasField25 = true; result.field25_ = value; return this; } public Builder ClearField25() { + PrepareBuilder(); result.hasField25 = false; result.field25_ = 0; return this; @@ -1293,18 +1389,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField15(global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField15 = true; result.field15_ = value; return this; } public Builder SetField15(global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasField15 = true; result.field15_ = builderForValue.Build(); return this; } public Builder MergeField15(global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasField15 && result.field15_ != global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage.DefaultInstance) { result.field15_ = global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage.CreateBuilder(result.field15_).MergeFrom(value).BuildPartial(); @@ -1315,6 +1414,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearField15() { + PrepareBuilder(); result.hasField15 = false; result.field15_ = global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage.DefaultInstance; return this; @@ -1328,11 +1428,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField78(value); } } public Builder SetField78(bool value) { + PrepareBuilder(); result.hasField78 = true; result.field78_ = value; return this; } public Builder ClearField78() { + PrepareBuilder(); result.hasField78 = false; result.field78_ = false; return this; @@ -1346,11 +1448,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField67(value); } } public Builder SetField67(int value) { + PrepareBuilder(); result.hasField67 = true; result.field67_ = value; return this; } public Builder ClearField67() { + PrepareBuilder(); result.hasField67 = false; result.field67_ = 0; return this; @@ -1364,11 +1468,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField68(value); } } public Builder SetField68(int value) { + PrepareBuilder(); result.hasField68 = true; result.field68_ = value; return this; } public Builder ClearField68() { + PrepareBuilder(); result.hasField68 = false; result.field68_ = 0; return this; @@ -1382,11 +1488,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField128(value); } } public Builder SetField128(int value) { + PrepareBuilder(); result.hasField128 = true; result.field128_ = value; return this; } public Builder ClearField128() { + PrepareBuilder(); result.hasField128 = false; result.field128_ = 0; return this; @@ -1401,11 +1509,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField129(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField129 = true; result.field129_ = value; return this; } public Builder ClearField129() { + PrepareBuilder(); result.hasField129 = false; result.field129_ = "xxxxxxxxxxxxxxxxxxxxx"; return this; @@ -1419,11 +1529,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField131(value); } } public Builder SetField131(int value) { + PrepareBuilder(); result.hasField131 = true; result.field131_ = value; return this; } public Builder ClearField131() { + PrepareBuilder(); result.hasField131 = false; result.field131_ = 0; return this; @@ -1697,7 +1809,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(SizeMessage1SubMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1707,21 +1819,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new SizeMessage1SubMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(SizeMessage1SubMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - SizeMessage1SubMessage result = new SizeMessage1SubMessage(); + bool builderIsReadOnly; + SizeMessage1SubMessage result; + + private SizeMessage1SubMessage PrepareBuilder() { + if (builderIsReadOnly) { + SizeMessage1SubMessage original = result; + result = new SizeMessage1SubMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override SizeMessage1SubMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new SizeMessage1SubMessage(); + result = DefaultInstance ?? new SizeMessage1SubMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1733,12 +1872,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SizeMessage1SubMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - SizeMessage1SubMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } @@ -1750,11 +1888,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField1(value); } } public Builder SetField1(int value) { + PrepareBuilder(); result.hasField1 = true; result.field1_ = value; return this; } public Builder ClearField1() { + PrepareBuilder(); result.hasField1 = false; result.field1_ = 0; return this; @@ -1768,11 +1908,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField2(value); } } public Builder SetField2(int value) { + PrepareBuilder(); result.hasField2 = true; result.field2_ = value; return this; } public Builder ClearField2() { + PrepareBuilder(); result.hasField2 = false; result.field2_ = 0; return this; @@ -1786,11 +1928,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField3(value); } } public Builder SetField3(int value) { + PrepareBuilder(); result.hasField3 = true; result.field3_ = value; return this; } public Builder ClearField3() { + PrepareBuilder(); result.hasField3 = false; result.field3_ = 0; return this; @@ -1805,11 +1949,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField15(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField15 = true; result.field15_ = value; return this; } public Builder ClearField15() { + PrepareBuilder(); result.hasField15 = false; result.field15_ = ""; return this; @@ -1823,11 +1969,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField12(value); } } public Builder SetField12(bool value) { + PrepareBuilder(); result.hasField12 = true; result.field12_ = value; return this; } public Builder ClearField12() { + PrepareBuilder(); result.hasField12 = false; result.field12_ = true; return this; @@ -1841,11 +1989,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField13(value); } } public Builder SetField13(long value) { + PrepareBuilder(); result.hasField13 = true; result.field13_ = value; return this; } public Builder ClearField13() { + PrepareBuilder(); result.hasField13 = false; result.field13_ = 0L; return this; @@ -1859,11 +2009,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField14(value); } } public Builder SetField14(long value) { + PrepareBuilder(); result.hasField14 = true; result.field14_ = value; return this; } public Builder ClearField14() { + PrepareBuilder(); result.hasField14 = false; result.field14_ = 0L; return this; @@ -1877,11 +2029,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField16(value); } } public Builder SetField16(int value) { + PrepareBuilder(); result.hasField16 = true; result.field16_ = value; return this; } public Builder ClearField16() { + PrepareBuilder(); result.hasField16 = false; result.field16_ = 0; return this; @@ -1895,11 +2049,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField19(value); } } public Builder SetField19(int value) { + PrepareBuilder(); result.hasField19 = true; result.field19_ = value; return this; } public Builder ClearField19() { + PrepareBuilder(); result.hasField19 = false; result.field19_ = 2; return this; @@ -1913,11 +2069,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField20(value); } } public Builder SetField20(bool value) { + PrepareBuilder(); result.hasField20 = true; result.field20_ = value; return this; } public Builder ClearField20() { + PrepareBuilder(); result.hasField20 = false; result.field20_ = true; return this; @@ -1931,11 +2089,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField28(value); } } public Builder SetField28(bool value) { + PrepareBuilder(); result.hasField28 = true; result.field28_ = value; return this; } public Builder ClearField28() { + PrepareBuilder(); result.hasField28 = false; result.field28_ = true; return this; @@ -1951,11 +2111,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetField21(ulong value) { + PrepareBuilder(); result.hasField21 = true; result.field21_ = value; return this; } public Builder ClearField21() { + PrepareBuilder(); result.hasField21 = false; result.field21_ = 0; return this; @@ -1969,11 +2131,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField22(value); } } public Builder SetField22(int value) { + PrepareBuilder(); result.hasField22 = true; result.field22_ = value; return this; } public Builder ClearField22() { + PrepareBuilder(); result.hasField22 = false; result.field22_ = 0; return this; @@ -1987,11 +2151,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField23(value); } } public Builder SetField23(bool value) { + PrepareBuilder(); result.hasField23 = true; result.field23_ = value; return this; } public Builder ClearField23() { + PrepareBuilder(); result.hasField23 = false; result.field23_ = false; return this; @@ -2005,11 +2171,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField206(value); } } public Builder SetField206(bool value) { + PrepareBuilder(); result.hasField206 = true; result.field206_ = value; return this; } public Builder ClearField206() { + PrepareBuilder(); result.hasField206 = false; result.field206_ = false; return this; @@ -2025,11 +2193,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetField203(uint value) { + PrepareBuilder(); result.hasField203 = true; result.field203_ = value; return this; } public Builder ClearField203() { + PrepareBuilder(); result.hasField203 = false; result.field203_ = 0; return this; @@ -2043,11 +2213,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField204(value); } } public Builder SetField204(int value) { + PrepareBuilder(); result.hasField204 = true; result.field204_ = value; return this; } public Builder ClearField204() { + PrepareBuilder(); result.hasField204 = false; result.field204_ = 0; return this; @@ -2062,11 +2234,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField205(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField205 = true; result.field205_ = value; return this; } public Builder ClearField205() { + PrepareBuilder(); result.hasField205 = false; result.field205_ = ""; return this; @@ -2082,11 +2256,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetField207(ulong value) { + PrepareBuilder(); result.hasField207 = true; result.field207_ = value; return this; } public Builder ClearField207() { + PrepareBuilder(); result.hasField207 = false; result.field207_ = 0UL; return this; @@ -2102,11 +2278,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetField300(ulong value) { + PrepareBuilder(); result.hasField300 = true; result.field300_ = value; return this; } public Builder ClearField300() { + PrepareBuilder(); result.hasField300 = false; result.field300_ = 0UL; return this; @@ -2373,7 +2551,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(Group1 prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -2383,21 +2561,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new Group1(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(Group1 cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + Group1 result; - Group1 result = new Group1(); + private Group1 PrepareBuilder() { + if (builderIsReadOnly) { + Group1 original = result; + result = new Group1(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override Group1 MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new Group1(); + result = DefaultInstance ?? new Group1(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -2409,15 +2614,14 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Group1 BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.field14_.MakeReadOnly(); result.field22_.MakeReadOnly(); result.field73_.MakeReadOnly(); - Group1 returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } @@ -2429,11 +2633,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField11(value); } } public Builder SetField11(float value) { + PrepareBuilder(); result.hasField11 = true; result.field11_ = value; return this; } public Builder ClearField11() { + PrepareBuilder(); result.hasField11 = false; result.field11_ = 0F; return this; @@ -2447,11 +2653,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField26(value); } } public Builder SetField26(float value) { + PrepareBuilder(); result.hasField26 = true; result.field26_ = value; return this; } public Builder ClearField26() { + PrepareBuilder(); result.hasField26 = false; result.field26_ = 0F; return this; @@ -2466,11 +2674,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField12(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField12 = true; result.field12_ = value; return this; } public Builder ClearField12() { + PrepareBuilder(); result.hasField12 = false; result.field12_ = ""; return this; @@ -2485,18 +2695,20 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField13(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField13 = true; result.field13_ = value; return this; } public Builder ClearField13() { + PrepareBuilder(); result.hasField13 = false; result.field13_ = ""; return this; } public pbc::IPopsicleList Field14List { - get { return result.field14_; } + get { return PrepareBuilder().field14_; } } public int Field14Count { get { return result.Field14Count; } @@ -2506,19 +2718,23 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField14(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field14_[index] = value; return this; } public Builder AddField14(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field14_.Add(value); return this; } public Builder AddRangeField14(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.field14_); return this; } public Builder ClearField14() { + PrepareBuilder(); result.field14_.Clear(); return this; } @@ -2533,11 +2749,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetField15(ulong value) { + PrepareBuilder(); result.hasField15 = true; result.field15_ = value; return this; } public Builder ClearField15() { + PrepareBuilder(); result.hasField15 = false; result.field15_ = 0UL; return this; @@ -2551,11 +2769,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField5(value); } } public Builder SetField5(int value) { + PrepareBuilder(); result.hasField5 = true; result.field5_ = value; return this; } public Builder ClearField5() { + PrepareBuilder(); result.hasField5 = false; result.field5_ = 0; return this; @@ -2570,11 +2790,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField27(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField27 = true; result.field27_ = value; return this; } public Builder ClearField27() { + PrepareBuilder(); result.hasField27 = false; result.field27_ = ""; return this; @@ -2588,11 +2810,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField28(value); } } public Builder SetField28(int value) { + PrepareBuilder(); result.hasField28 = true; result.field28_ = value; return this; } public Builder ClearField28() { + PrepareBuilder(); result.hasField28 = false; result.field28_ = 0; return this; @@ -2607,11 +2831,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField29(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField29 = true; result.field29_ = value; return this; } public Builder ClearField29() { + PrepareBuilder(); result.hasField29 = false; result.field29_ = ""; return this; @@ -2626,18 +2852,20 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField16(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField16 = true; result.field16_ = value; return this; } public Builder ClearField16() { + PrepareBuilder(); result.hasField16 = false; result.field16_ = ""; return this; } public pbc::IPopsicleList Field22List { - get { return result.field22_; } + get { return PrepareBuilder().field22_; } } public int Field22Count { get { return result.Field22Count; } @@ -2647,25 +2875,29 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField22(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field22_[index] = value; return this; } public Builder AddField22(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field22_.Add(value); return this; } public Builder AddRangeField22(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.field22_); return this; } public Builder ClearField22() { + PrepareBuilder(); result.field22_.Clear(); return this; } public pbc::IPopsicleList Field73List { - get { return result.field73_; } + get { return PrepareBuilder().field73_; } } public int Field73Count { get { return result.Field73Count; } @@ -2674,18 +2906,22 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetField73(index); } public Builder SetField73(int index, int value) { + PrepareBuilder(); result.field73_[index] = value; return this; } public Builder AddField73(int value) { + PrepareBuilder(); result.field73_.Add(value); return this; } public Builder AddRangeField73(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.field73_); return this; } public Builder ClearField73() { + PrepareBuilder(); result.field73_.Clear(); return this; } @@ -2698,11 +2934,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField20(value); } } public Builder SetField20(int value) { + PrepareBuilder(); result.hasField20 = true; result.field20_ = value; return this; } public Builder ClearField20() { + PrepareBuilder(); result.hasField20 = false; result.field20_ = 0; return this; @@ -2717,11 +2955,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField24(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField24 = true; result.field24_ = value; return this; } public Builder ClearField24() { + PrepareBuilder(); result.hasField24 = false; result.field24_ = ""; return this; @@ -2736,18 +2976,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField31(global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField31 = true; result.field31_ = value; return this; } public Builder SetField31(global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasField31 = true; result.field31_ = builderForValue.Build(); return this; } public Builder MergeField31(global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasField31 && result.field31_ != global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage.DefaultInstance) { result.field31_ = global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage.CreateBuilder(result.field31_).MergeFrom(value).BuildPartial(); @@ -2758,6 +3001,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearField31() { + PrepareBuilder(); result.hasField31 = false; result.field31_ = global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage.DefaultInstance; return this; @@ -3113,7 +3357,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(SizeMessage2 prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -3123,21 +3367,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new SizeMessage2(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(SizeMessage2 cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - SizeMessage2 result = new SizeMessage2(); + bool builderIsReadOnly; + SizeMessage2 result; + + private SizeMessage2 PrepareBuilder() { + if (builderIsReadOnly) { + SizeMessage2 original = result; + result = new SizeMessage2(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override SizeMessage2 MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new SizeMessage2(); + result = DefaultInstance ?? new SizeMessage2(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -3149,16 +3420,15 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SizeMessage2 BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.group1_.MakeReadOnly(); result.field128_.MakeReadOnly(); result.field127_.MakeReadOnly(); result.field130_.MakeReadOnly(); - SizeMessage2 returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } @@ -3171,11 +3441,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField1(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField1 = true; result.field1_ = value; return this; } public Builder ClearField1() { + PrepareBuilder(); result.hasField1 = false; result.field1_ = ""; return this; @@ -3189,11 +3461,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField3(value); } } public Builder SetField3(long value) { + PrepareBuilder(); result.hasField3 = true; result.field3_ = value; return this; } public Builder ClearField3() { + PrepareBuilder(); result.hasField3 = false; result.field3_ = 0L; return this; @@ -3207,11 +3481,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField4(value); } } public Builder SetField4(long value) { + PrepareBuilder(); result.hasField4 = true; result.field4_ = value; return this; } public Builder ClearField4() { + PrepareBuilder(); result.hasField4 = false; result.field4_ = 0L; return this; @@ -3225,11 +3501,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField30(value); } } public Builder SetField30(long value) { + PrepareBuilder(); result.hasField30 = true; result.field30_ = value; return this; } public Builder ClearField30() { + PrepareBuilder(); result.hasField30 = false; result.field30_ = 0L; return this; @@ -3243,11 +3521,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField75(value); } } public Builder SetField75(bool value) { + PrepareBuilder(); result.hasField75 = true; result.field75_ = value; return this; } public Builder ClearField75() { + PrepareBuilder(); result.hasField75 = false; result.field75_ = false; return this; @@ -3262,11 +3542,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField6(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField6 = true; result.field6_ = value; return this; } public Builder ClearField6() { + PrepareBuilder(); result.hasField6 = false; result.field6_ = ""; return this; @@ -3281,11 +3563,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField2(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField2 = true; result.field2_ = value; return this; } public Builder ClearField2() { + PrepareBuilder(); result.hasField2 = false; result.field2_ = pb::ByteString.Empty; return this; @@ -3299,11 +3583,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField21(value); } } public Builder SetField21(int value) { + PrepareBuilder(); result.hasField21 = true; result.field21_ = value; return this; } public Builder ClearField21() { + PrepareBuilder(); result.hasField21 = false; result.field21_ = 0; return this; @@ -3317,11 +3603,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField71(value); } } public Builder SetField71(int value) { + PrepareBuilder(); result.hasField71 = true; result.field71_ = value; return this; } public Builder ClearField71() { + PrepareBuilder(); result.hasField71 = false; result.field71_ = 0; return this; @@ -3335,11 +3623,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField25(value); } } public Builder SetField25(float value) { + PrepareBuilder(); result.hasField25 = true; result.field25_ = value; return this; } public Builder ClearField25() { + PrepareBuilder(); result.hasField25 = false; result.field25_ = 0F; return this; @@ -3353,11 +3643,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField109(value); } } public Builder SetField109(int value) { + PrepareBuilder(); result.hasField109 = true; result.field109_ = value; return this; } public Builder ClearField109() { + PrepareBuilder(); result.hasField109 = false; result.field109_ = 0; return this; @@ -3371,11 +3663,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField210(value); } } public Builder SetField210(int value) { + PrepareBuilder(); result.hasField210 = true; result.field210_ = value; return this; } public Builder ClearField210() { + PrepareBuilder(); result.hasField210 = false; result.field210_ = 0; return this; @@ -3389,11 +3683,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField211(value); } } public Builder SetField211(int value) { + PrepareBuilder(); result.hasField211 = true; result.field211_ = value; return this; } public Builder ClearField211() { + PrepareBuilder(); result.hasField211 = false; result.field211_ = 0; return this; @@ -3407,11 +3703,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField212(value); } } public Builder SetField212(int value) { + PrepareBuilder(); result.hasField212 = true; result.field212_ = value; return this; } public Builder ClearField212() { + PrepareBuilder(); result.hasField212 = false; result.field212_ = 0; return this; @@ -3425,11 +3723,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField213(value); } } public Builder SetField213(int value) { + PrepareBuilder(); result.hasField213 = true; result.field213_ = value; return this; } public Builder ClearField213() { + PrepareBuilder(); result.hasField213 = false; result.field213_ = 0; return this; @@ -3443,11 +3743,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField216(value); } } public Builder SetField216(int value) { + PrepareBuilder(); result.hasField216 = true; result.field216_ = value; return this; } public Builder ClearField216() { + PrepareBuilder(); result.hasField216 = false; result.field216_ = 0; return this; @@ -3461,11 +3763,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField217(value); } } public Builder SetField217(int value) { + PrepareBuilder(); result.hasField217 = true; result.field217_ = value; return this; } public Builder ClearField217() { + PrepareBuilder(); result.hasField217 = false; result.field217_ = 0; return this; @@ -3479,11 +3783,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField218(value); } } public Builder SetField218(int value) { + PrepareBuilder(); result.hasField218 = true; result.field218_ = value; return this; } public Builder ClearField218() { + PrepareBuilder(); result.hasField218 = false; result.field218_ = 0; return this; @@ -3497,11 +3803,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField220(value); } } public Builder SetField220(int value) { + PrepareBuilder(); result.hasField220 = true; result.field220_ = value; return this; } public Builder ClearField220() { + PrepareBuilder(); result.hasField220 = false; result.field220_ = 0; return this; @@ -3515,11 +3823,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField221(value); } } public Builder SetField221(int value) { + PrepareBuilder(); result.hasField221 = true; result.field221_ = value; return this; } public Builder ClearField221() { + PrepareBuilder(); result.hasField221 = false; result.field221_ = 0; return this; @@ -3533,11 +3843,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField222(value); } } public Builder SetField222(float value) { + PrepareBuilder(); result.hasField222 = true; result.field222_ = value; return this; } public Builder ClearField222() { + PrepareBuilder(); result.hasField222 = false; result.field222_ = 0F; return this; @@ -3551,18 +3863,20 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField63(value); } } public Builder SetField63(int value) { + PrepareBuilder(); result.hasField63 = true; result.field63_ = value; return this; } public Builder ClearField63() { + PrepareBuilder(); result.hasField63 = false; result.field63_ = 0; return this; } public pbc::IPopsicleList Group1List { - get { return result.group1_; } + get { return PrepareBuilder().group1_; } } public int Group1Count { get { return result.Group1Count; } @@ -3572,35 +3886,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetGroup1(int index, global::Google.ProtocolBuffers.TestProtos.SizeMessage2.Types.Group1 value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.group1_[index] = value; return this; } public Builder SetGroup1(int index, global::Google.ProtocolBuffers.TestProtos.SizeMessage2.Types.Group1.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.group1_[index] = builderForValue.Build(); return this; } public Builder AddGroup1(global::Google.ProtocolBuffers.TestProtos.SizeMessage2.Types.Group1 value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.group1_.Add(value); return this; } public Builder AddGroup1(global::Google.ProtocolBuffers.TestProtos.SizeMessage2.Types.Group1.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.group1_.Add(builderForValue.Build()); return this; } public Builder AddRangeGroup1(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.group1_); return this; } public Builder ClearGroup1() { + PrepareBuilder(); result.group1_.Clear(); return this; } public pbc::IPopsicleList Field128List { - get { return result.field128_; } + get { return PrepareBuilder().field128_; } } public int Field128Count { get { return result.Field128Count; } @@ -3610,19 +3930,23 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField128(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field128_[index] = value; return this; } public Builder AddField128(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field128_.Add(value); return this; } public Builder AddRangeField128(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.field128_); return this; } public Builder ClearField128() { + PrepareBuilder(); result.field128_.Clear(); return this; } @@ -3635,18 +3959,20 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField131(value); } } public Builder SetField131(long value) { + PrepareBuilder(); result.hasField131 = true; result.field131_ = value; return this; } public Builder ClearField131() { + PrepareBuilder(); result.hasField131 = false; result.field131_ = 0L; return this; } public pbc::IPopsicleList Field127List { - get { return result.field127_; } + get { return PrepareBuilder().field127_; } } public int Field127Count { get { return result.Field127Count; } @@ -3656,19 +3982,23 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField127(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field127_[index] = value; return this; } public Builder AddField127(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field127_.Add(value); return this; } public Builder AddRangeField127(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.field127_); return this; } public Builder ClearField127() { + PrepareBuilder(); result.field127_.Clear(); return this; } @@ -3681,18 +4011,20 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField129(value); } } public Builder SetField129(int value) { + PrepareBuilder(); result.hasField129 = true; result.field129_ = value; return this; } public Builder ClearField129() { + PrepareBuilder(); result.hasField129 = false; result.field129_ = 0; return this; } public pbc::IPopsicleList Field130List { - get { return result.field130_; } + get { return PrepareBuilder().field130_; } } public int Field130Count { get { return result.Field130Count; } @@ -3701,18 +4033,22 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetField130(index); } public Builder SetField130(int index, long value) { + PrepareBuilder(); result.field130_[index] = value; return this; } public Builder AddField130(long value) { + PrepareBuilder(); result.field130_.Add(value); return this; } public Builder AddRangeField130(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.field130_); return this; } public Builder ClearField130() { + PrepareBuilder(); result.field130_.Clear(); return this; } @@ -3725,11 +4061,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField205(value); } } public Builder SetField205(bool value) { + PrepareBuilder(); result.hasField205 = true; result.field205_ = value; return this; } public Builder ClearField205() { + PrepareBuilder(); result.hasField205 = false; result.field205_ = false; return this; @@ -3743,11 +4081,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField206(value); } } public Builder SetField206(bool value) { + PrepareBuilder(); result.hasField206 = true; result.field206_ = value; return this; } public Builder ClearField206() { + PrepareBuilder(); result.hasField206 = false; result.field206_ = false; return this; @@ -3927,7 +4267,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(SizeMessage2GroupedMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -3937,21 +4277,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new SizeMessage2GroupedMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(SizeMessage2GroupedMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - SizeMessage2GroupedMessage result = new SizeMessage2GroupedMessage(); + bool builderIsReadOnly; + SizeMessage2GroupedMessage result; + + private SizeMessage2GroupedMessage PrepareBuilder() { + if (builderIsReadOnly) { + SizeMessage2GroupedMessage original = result; + result = new SizeMessage2GroupedMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override SizeMessage2GroupedMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new SizeMessage2GroupedMessage(); + result = DefaultInstance ?? new SizeMessage2GroupedMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -3963,12 +4330,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SizeMessage2GroupedMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - SizeMessage2GroupedMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } @@ -3980,11 +4346,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField1(value); } } public Builder SetField1(float value) { + PrepareBuilder(); result.hasField1 = true; result.field1_ = value; return this; } public Builder ClearField1() { + PrepareBuilder(); result.hasField1 = false; result.field1_ = 0F; return this; @@ -3998,11 +4366,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField2(value); } } public Builder SetField2(float value) { + PrepareBuilder(); result.hasField2 = true; result.field2_ = value; return this; } public Builder ClearField2() { + PrepareBuilder(); result.hasField2 = false; result.field2_ = 0F; return this; @@ -4016,11 +4386,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField3(value); } } public Builder SetField3(float value) { + PrepareBuilder(); result.hasField3 = true; result.field3_ = value; return this; } public Builder ClearField3() { + PrepareBuilder(); result.hasField3 = false; result.field3_ = 0F; return this; @@ -4034,11 +4406,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField4(value); } } public Builder SetField4(bool value) { + PrepareBuilder(); result.hasField4 = true; result.field4_ = value; return this; } public Builder ClearField4() { + PrepareBuilder(); result.hasField4 = false; result.field4_ = false; return this; @@ -4052,11 +4426,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField5(value); } } public Builder SetField5(bool value) { + PrepareBuilder(); result.hasField5 = true; result.field5_ = value; return this; } public Builder ClearField5() { + PrepareBuilder(); result.hasField5 = false; result.field5_ = false; return this; @@ -4070,11 +4446,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField6(value); } } public Builder SetField6(bool value) { + PrepareBuilder(); result.hasField6 = true; result.field6_ = value; return this; } public Builder ClearField6() { + PrepareBuilder(); result.hasField6 = false; result.field6_ = true; return this; @@ -4088,11 +4466,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField7(value); } } public Builder SetField7(bool value) { + PrepareBuilder(); result.hasField7 = true; result.field7_ = value; return this; } public Builder ClearField7() { + PrepareBuilder(); result.hasField7 = false; result.field7_ = false; return this; @@ -4106,11 +4486,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField8(value); } } public Builder SetField8(float value) { + PrepareBuilder(); result.hasField8 = true; result.field8_ = value; return this; } public Builder ClearField8() { + PrepareBuilder(); result.hasField8 = false; result.field8_ = 0F; return this; @@ -4124,11 +4506,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField9(value); } } public Builder SetField9(bool value) { + PrepareBuilder(); result.hasField9 = true; result.field9_ = value; return this; } public Builder ClearField9() { + PrepareBuilder(); result.hasField9 = false; result.field9_ = false; return this; @@ -4142,11 +4526,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField10(value); } } public Builder SetField10(float value) { + PrepareBuilder(); result.hasField10 = true; result.field10_ = value; return this; } public Builder ClearField10() { + PrepareBuilder(); result.hasField10 = false; result.field10_ = 0F; return this; @@ -4160,11 +4546,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField11(value); } } public Builder SetField11(long value) { + PrepareBuilder(); result.hasField11 = true; result.field11_ = value; return this; } public Builder ClearField11() { + PrepareBuilder(); result.hasField11 = false; result.field11_ = 0L; return this; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs index 918be643ec..379a86f9a5 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs @@ -885,7 +885,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(SpeedMessage1 prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -895,21 +895,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new SpeedMessage1(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(SpeedMessage1 cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + SpeedMessage1 result; - SpeedMessage1 result = new SpeedMessage1(); + private SpeedMessage1 PrepareBuilder() { + if (builderIsReadOnly) { + SpeedMessage1 original = result; + result = new SpeedMessage1(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override SpeedMessage1 MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new SpeedMessage1(); + result = DefaultInstance ?? new SpeedMessage1(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -921,13 +948,12 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SpeedMessage1 BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.field5_.MakeReadOnly(); - SpeedMessage1 returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -941,6 +967,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(SpeedMessage1 other) { if (other == global::Google.ProtocolBuffers.TestProtos.SpeedMessage1.DefaultInstance) return this; + PrepareBuilder(); if (other.HasField1) { Field1 = other.Field1; } @@ -1073,6 +1100,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1295,11 +1323,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField1(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField1 = true; result.field1_ = value; return this; } public Builder ClearField1() { + PrepareBuilder(); result.hasField1 = false; result.field1_ = ""; return this; @@ -1314,11 +1344,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField9(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField9 = true; result.field9_ = value; return this; } public Builder ClearField9() { + PrepareBuilder(); result.hasField9 = false; result.field9_ = ""; return this; @@ -1333,11 +1365,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField18(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField18 = true; result.field18_ = value; return this; } public Builder ClearField18() { + PrepareBuilder(); result.hasField18 = false; result.field18_ = ""; return this; @@ -1351,11 +1385,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField80(value); } } public Builder SetField80(bool value) { + PrepareBuilder(); result.hasField80 = true; result.field80_ = value; return this; } public Builder ClearField80() { + PrepareBuilder(); result.hasField80 = false; result.field80_ = false; return this; @@ -1369,11 +1405,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField81(value); } } public Builder SetField81(bool value) { + PrepareBuilder(); result.hasField81 = true; result.field81_ = value; return this; } public Builder ClearField81() { + PrepareBuilder(); result.hasField81 = false; result.field81_ = true; return this; @@ -1387,11 +1425,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField2(value); } } public Builder SetField2(int value) { + PrepareBuilder(); result.hasField2 = true; result.field2_ = value; return this; } public Builder ClearField2() { + PrepareBuilder(); result.hasField2 = false; result.field2_ = 0; return this; @@ -1405,11 +1445,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField3(value); } } public Builder SetField3(int value) { + PrepareBuilder(); result.hasField3 = true; result.field3_ = value; return this; } public Builder ClearField3() { + PrepareBuilder(); result.hasField3 = false; result.field3_ = 0; return this; @@ -1423,11 +1465,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField280(value); } } public Builder SetField280(int value) { + PrepareBuilder(); result.hasField280 = true; result.field280_ = value; return this; } public Builder ClearField280() { + PrepareBuilder(); result.hasField280 = false; result.field280_ = 0; return this; @@ -1441,11 +1485,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField6(value); } } public Builder SetField6(int value) { + PrepareBuilder(); result.hasField6 = true; result.field6_ = value; return this; } public Builder ClearField6() { + PrepareBuilder(); result.hasField6 = false; result.field6_ = 0; return this; @@ -1459,11 +1505,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField22(value); } } public Builder SetField22(long value) { + PrepareBuilder(); result.hasField22 = true; result.field22_ = value; return this; } public Builder ClearField22() { + PrepareBuilder(); result.hasField22 = false; result.field22_ = 0L; return this; @@ -1478,11 +1526,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField4(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField4 = true; result.field4_ = value; return this; } public Builder ClearField4() { + PrepareBuilder(); result.hasField4 = false; result.field4_ = ""; return this; @@ -1490,7 +1540,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.CLSCompliant(false)] public pbc::IPopsicleList Field5List { - get { return result.field5_; } + get { return PrepareBuilder().field5_; } } public int Field5Count { get { return result.Field5Count; } @@ -1501,20 +1551,24 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetField5(int index, ulong value) { + PrepareBuilder(); result.field5_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddField5(ulong value) { + PrepareBuilder(); result.field5_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeField5(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.field5_); return this; } public Builder ClearField5() { + PrepareBuilder(); result.field5_.Clear(); return this; } @@ -1527,11 +1581,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField59(value); } } public Builder SetField59(bool value) { + PrepareBuilder(); result.hasField59 = true; result.field59_ = value; return this; } public Builder ClearField59() { + PrepareBuilder(); result.hasField59 = false; result.field59_ = false; return this; @@ -1546,11 +1602,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField7(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField7 = true; result.field7_ = value; return this; } public Builder ClearField7() { + PrepareBuilder(); result.hasField7 = false; result.field7_ = ""; return this; @@ -1564,11 +1622,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField16(value); } } public Builder SetField16(int value) { + PrepareBuilder(); result.hasField16 = true; result.field16_ = value; return this; } public Builder ClearField16() { + PrepareBuilder(); result.hasField16 = false; result.field16_ = 0; return this; @@ -1582,11 +1642,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField130(value); } } public Builder SetField130(int value) { + PrepareBuilder(); result.hasField130 = true; result.field130_ = value; return this; } public Builder ClearField130() { + PrepareBuilder(); result.hasField130 = false; result.field130_ = 0; return this; @@ -1600,11 +1662,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField12(value); } } public Builder SetField12(bool value) { + PrepareBuilder(); result.hasField12 = true; result.field12_ = value; return this; } public Builder ClearField12() { + PrepareBuilder(); result.hasField12 = false; result.field12_ = true; return this; @@ -1618,11 +1682,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField17(value); } } public Builder SetField17(bool value) { + PrepareBuilder(); result.hasField17 = true; result.field17_ = value; return this; } public Builder ClearField17() { + PrepareBuilder(); result.hasField17 = false; result.field17_ = true; return this; @@ -1636,11 +1702,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField13(value); } } public Builder SetField13(bool value) { + PrepareBuilder(); result.hasField13 = true; result.field13_ = value; return this; } public Builder ClearField13() { + PrepareBuilder(); result.hasField13 = false; result.field13_ = true; return this; @@ -1654,11 +1722,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField14(value); } } public Builder SetField14(bool value) { + PrepareBuilder(); result.hasField14 = true; result.field14_ = value; return this; } public Builder ClearField14() { + PrepareBuilder(); result.hasField14 = false; result.field14_ = true; return this; @@ -1672,11 +1742,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField104(value); } } public Builder SetField104(int value) { + PrepareBuilder(); result.hasField104 = true; result.field104_ = value; return this; } public Builder ClearField104() { + PrepareBuilder(); result.hasField104 = false; result.field104_ = 0; return this; @@ -1690,11 +1762,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField100(value); } } public Builder SetField100(int value) { + PrepareBuilder(); result.hasField100 = true; result.field100_ = value; return this; } public Builder ClearField100() { + PrepareBuilder(); result.hasField100 = false; result.field100_ = 0; return this; @@ -1708,11 +1782,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField101(value); } } public Builder SetField101(int value) { + PrepareBuilder(); result.hasField101 = true; result.field101_ = value; return this; } public Builder ClearField101() { + PrepareBuilder(); result.hasField101 = false; result.field101_ = 0; return this; @@ -1727,11 +1803,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField102(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField102 = true; result.field102_ = value; return this; } public Builder ClearField102() { + PrepareBuilder(); result.hasField102 = false; result.field102_ = ""; return this; @@ -1746,11 +1824,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField103(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField103 = true; result.field103_ = value; return this; } public Builder ClearField103() { + PrepareBuilder(); result.hasField103 = false; result.field103_ = ""; return this; @@ -1764,11 +1844,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField29(value); } } public Builder SetField29(int value) { + PrepareBuilder(); result.hasField29 = true; result.field29_ = value; return this; } public Builder ClearField29() { + PrepareBuilder(); result.hasField29 = false; result.field29_ = 0; return this; @@ -1782,11 +1864,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField30(value); } } public Builder SetField30(bool value) { + PrepareBuilder(); result.hasField30 = true; result.field30_ = value; return this; } public Builder ClearField30() { + PrepareBuilder(); result.hasField30 = false; result.field30_ = false; return this; @@ -1800,11 +1884,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField60(value); } } public Builder SetField60(int value) { + PrepareBuilder(); result.hasField60 = true; result.field60_ = value; return this; } public Builder ClearField60() { + PrepareBuilder(); result.hasField60 = false; result.field60_ = -1; return this; @@ -1818,11 +1904,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField271(value); } } public Builder SetField271(int value) { + PrepareBuilder(); result.hasField271 = true; result.field271_ = value; return this; } public Builder ClearField271() { + PrepareBuilder(); result.hasField271 = false; result.field271_ = -1; return this; @@ -1836,11 +1924,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField272(value); } } public Builder SetField272(int value) { + PrepareBuilder(); result.hasField272 = true; result.field272_ = value; return this; } public Builder ClearField272() { + PrepareBuilder(); result.hasField272 = false; result.field272_ = -1; return this; @@ -1854,11 +1944,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField150(value); } } public Builder SetField150(int value) { + PrepareBuilder(); result.hasField150 = true; result.field150_ = value; return this; } public Builder ClearField150() { + PrepareBuilder(); result.hasField150 = false; result.field150_ = 0; return this; @@ -1872,11 +1964,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField23(value); } } public Builder SetField23(int value) { + PrepareBuilder(); result.hasField23 = true; result.field23_ = value; return this; } public Builder ClearField23() { + PrepareBuilder(); result.hasField23 = false; result.field23_ = 0; return this; @@ -1890,11 +1984,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField24(value); } } public Builder SetField24(bool value) { + PrepareBuilder(); result.hasField24 = true; result.field24_ = value; return this; } public Builder ClearField24() { + PrepareBuilder(); result.hasField24 = false; result.field24_ = false; return this; @@ -1908,11 +2004,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField25(value); } } public Builder SetField25(int value) { + PrepareBuilder(); result.hasField25 = true; result.field25_ = value; return this; } public Builder ClearField25() { + PrepareBuilder(); result.hasField25 = false; result.field25_ = 0; return this; @@ -1927,18 +2025,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField15(global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField15 = true; result.field15_ = value; return this; } public Builder SetField15(global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasField15 = true; result.field15_ = builderForValue.Build(); return this; } public Builder MergeField15(global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasField15 && result.field15_ != global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.DefaultInstance) { result.field15_ = global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.CreateBuilder(result.field15_).MergeFrom(value).BuildPartial(); @@ -1949,6 +2050,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearField15() { + PrepareBuilder(); result.hasField15 = false; result.field15_ = global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.DefaultInstance; return this; @@ -1962,11 +2064,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField78(value); } } public Builder SetField78(bool value) { + PrepareBuilder(); result.hasField78 = true; result.field78_ = value; return this; } public Builder ClearField78() { + PrepareBuilder(); result.hasField78 = false; result.field78_ = false; return this; @@ -1980,11 +2084,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField67(value); } } public Builder SetField67(int value) { + PrepareBuilder(); result.hasField67 = true; result.field67_ = value; return this; } public Builder ClearField67() { + PrepareBuilder(); result.hasField67 = false; result.field67_ = 0; return this; @@ -1998,11 +2104,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField68(value); } } public Builder SetField68(int value) { + PrepareBuilder(); result.hasField68 = true; result.field68_ = value; return this; } public Builder ClearField68() { + PrepareBuilder(); result.hasField68 = false; result.field68_ = 0; return this; @@ -2016,11 +2124,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField128(value); } } public Builder SetField128(int value) { + PrepareBuilder(); result.hasField128 = true; result.field128_ = value; return this; } public Builder ClearField128() { + PrepareBuilder(); result.hasField128 = false; result.field128_ = 0; return this; @@ -2035,11 +2145,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField129(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField129 = true; result.field129_ = value; return this; } public Builder ClearField129() { + PrepareBuilder(); result.hasField129 = false; result.field129_ = "xxxxxxxxxxxxxxxxxxxxx"; return this; @@ -2053,11 +2165,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField131(value); } } public Builder SetField131(int value) { + PrepareBuilder(); result.hasField131 = true; result.field131_ = value; return this; } public Builder ClearField131() { + PrepareBuilder(); result.hasField131 = false; result.field131_ = 0; return this; @@ -2478,7 +2592,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(SpeedMessage1SubMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -2488,21 +2602,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new SpeedMessage1SubMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(SpeedMessage1SubMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - SpeedMessage1SubMessage result = new SpeedMessage1SubMessage(); + bool builderIsReadOnly; + SpeedMessage1SubMessage result; + + private SpeedMessage1SubMessage PrepareBuilder() { + if (builderIsReadOnly) { + SpeedMessage1SubMessage original = result; + result = new SpeedMessage1SubMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override SpeedMessage1SubMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new SpeedMessage1SubMessage(); + result = DefaultInstance ?? new SpeedMessage1SubMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -2514,12 +2655,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SpeedMessage1SubMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - SpeedMessage1SubMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -2533,6 +2673,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(SpeedMessage1SubMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.DefaultInstance) return this; + PrepareBuilder(); if (other.HasField1) { Field1 = other.Field1; } @@ -2602,6 +2743,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -2733,11 +2875,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField1(value); } } public Builder SetField1(int value) { + PrepareBuilder(); result.hasField1 = true; result.field1_ = value; return this; } public Builder ClearField1() { + PrepareBuilder(); result.hasField1 = false; result.field1_ = 0; return this; @@ -2751,11 +2895,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField2(value); } } public Builder SetField2(int value) { + PrepareBuilder(); result.hasField2 = true; result.field2_ = value; return this; } public Builder ClearField2() { + PrepareBuilder(); result.hasField2 = false; result.field2_ = 0; return this; @@ -2769,11 +2915,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField3(value); } } public Builder SetField3(int value) { + PrepareBuilder(); result.hasField3 = true; result.field3_ = value; return this; } public Builder ClearField3() { + PrepareBuilder(); result.hasField3 = false; result.field3_ = 0; return this; @@ -2788,11 +2936,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField15(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField15 = true; result.field15_ = value; return this; } public Builder ClearField15() { + PrepareBuilder(); result.hasField15 = false; result.field15_ = ""; return this; @@ -2806,11 +2956,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField12(value); } } public Builder SetField12(bool value) { + PrepareBuilder(); result.hasField12 = true; result.field12_ = value; return this; } public Builder ClearField12() { + PrepareBuilder(); result.hasField12 = false; result.field12_ = true; return this; @@ -2824,11 +2976,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField13(value); } } public Builder SetField13(long value) { + PrepareBuilder(); result.hasField13 = true; result.field13_ = value; return this; } public Builder ClearField13() { + PrepareBuilder(); result.hasField13 = false; result.field13_ = 0L; return this; @@ -2842,11 +2996,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField14(value); } } public Builder SetField14(long value) { + PrepareBuilder(); result.hasField14 = true; result.field14_ = value; return this; } public Builder ClearField14() { + PrepareBuilder(); result.hasField14 = false; result.field14_ = 0L; return this; @@ -2860,11 +3016,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField16(value); } } public Builder SetField16(int value) { + PrepareBuilder(); result.hasField16 = true; result.field16_ = value; return this; } public Builder ClearField16() { + PrepareBuilder(); result.hasField16 = false; result.field16_ = 0; return this; @@ -2878,11 +3036,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField19(value); } } public Builder SetField19(int value) { + PrepareBuilder(); result.hasField19 = true; result.field19_ = value; return this; } public Builder ClearField19() { + PrepareBuilder(); result.hasField19 = false; result.field19_ = 2; return this; @@ -2896,11 +3056,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField20(value); } } public Builder SetField20(bool value) { + PrepareBuilder(); result.hasField20 = true; result.field20_ = value; return this; } public Builder ClearField20() { + PrepareBuilder(); result.hasField20 = false; result.field20_ = true; return this; @@ -2914,11 +3076,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField28(value); } } public Builder SetField28(bool value) { + PrepareBuilder(); result.hasField28 = true; result.field28_ = value; return this; } public Builder ClearField28() { + PrepareBuilder(); result.hasField28 = false; result.field28_ = true; return this; @@ -2934,11 +3098,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetField21(ulong value) { + PrepareBuilder(); result.hasField21 = true; result.field21_ = value; return this; } public Builder ClearField21() { + PrepareBuilder(); result.hasField21 = false; result.field21_ = 0; return this; @@ -2952,11 +3118,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField22(value); } } public Builder SetField22(int value) { + PrepareBuilder(); result.hasField22 = true; result.field22_ = value; return this; } public Builder ClearField22() { + PrepareBuilder(); result.hasField22 = false; result.field22_ = 0; return this; @@ -2970,11 +3138,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField23(value); } } public Builder SetField23(bool value) { + PrepareBuilder(); result.hasField23 = true; result.field23_ = value; return this; } public Builder ClearField23() { + PrepareBuilder(); result.hasField23 = false; result.field23_ = false; return this; @@ -2988,11 +3158,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField206(value); } } public Builder SetField206(bool value) { + PrepareBuilder(); result.hasField206 = true; result.field206_ = value; return this; } public Builder ClearField206() { + PrepareBuilder(); result.hasField206 = false; result.field206_ = false; return this; @@ -3008,11 +3180,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetField203(uint value) { + PrepareBuilder(); result.hasField203 = true; result.field203_ = value; return this; } public Builder ClearField203() { + PrepareBuilder(); result.hasField203 = false; result.field203_ = 0; return this; @@ -3026,11 +3200,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField204(value); } } public Builder SetField204(int value) { + PrepareBuilder(); result.hasField204 = true; result.field204_ = value; return this; } public Builder ClearField204() { + PrepareBuilder(); result.hasField204 = false; result.field204_ = 0; return this; @@ -3045,11 +3221,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField205(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField205 = true; result.field205_ = value; return this; } public Builder ClearField205() { + PrepareBuilder(); result.hasField205 = false; result.field205_ = ""; return this; @@ -3065,11 +3243,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetField207(ulong value) { + PrepareBuilder(); result.hasField207 = true; result.field207_ = value; return this; } public Builder ClearField207() { + PrepareBuilder(); result.hasField207 = false; result.field207_ = 0UL; return this; @@ -3085,11 +3265,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetField300(ulong value) { + PrepareBuilder(); result.hasField300 = true; result.field300_ = value; return this; } public Builder ClearField300() { + PrepareBuilder(); result.hasField300 = false; result.field300_ = 0UL; return this; @@ -3498,7 +3680,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(Group1 prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -3508,21 +3690,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new Group1(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(Group1 cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + Group1 result; + + private Group1 PrepareBuilder() { + if (builderIsReadOnly) { + Group1 original = result; + result = new Group1(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - Group1 result = new Group1(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override Group1 MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new Group1(); + result = DefaultInstance ?? new Group1(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -3534,15 +3743,14 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Group1 BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.field14_.MakeReadOnly(); result.field22_.MakeReadOnly(); result.field73_.MakeReadOnly(); - Group1 returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -3556,6 +3764,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(Group1 other) { if (other == global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1.DefaultInstance) return this; + PrepareBuilder(); if (other.HasField11) { Field11 = other.Field11; } @@ -3613,6 +3822,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -3734,11 +3944,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField11(value); } } public Builder SetField11(float value) { + PrepareBuilder(); result.hasField11 = true; result.field11_ = value; return this; } public Builder ClearField11() { + PrepareBuilder(); result.hasField11 = false; result.field11_ = 0F; return this; @@ -3752,11 +3964,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField26(value); } } public Builder SetField26(float value) { + PrepareBuilder(); result.hasField26 = true; result.field26_ = value; return this; } public Builder ClearField26() { + PrepareBuilder(); result.hasField26 = false; result.field26_ = 0F; return this; @@ -3771,11 +3985,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField12(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField12 = true; result.field12_ = value; return this; } public Builder ClearField12() { + PrepareBuilder(); result.hasField12 = false; result.field12_ = ""; return this; @@ -3790,18 +4006,20 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField13(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField13 = true; result.field13_ = value; return this; } public Builder ClearField13() { + PrepareBuilder(); result.hasField13 = false; result.field13_ = ""; return this; } public pbc::IPopsicleList Field14List { - get { return result.field14_; } + get { return PrepareBuilder().field14_; } } public int Field14Count { get { return result.Field14Count; } @@ -3811,19 +4029,23 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField14(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field14_[index] = value; return this; } public Builder AddField14(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field14_.Add(value); return this; } public Builder AddRangeField14(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.field14_); return this; } public Builder ClearField14() { + PrepareBuilder(); result.field14_.Clear(); return this; } @@ -3838,11 +4060,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetField15(ulong value) { + PrepareBuilder(); result.hasField15 = true; result.field15_ = value; return this; } public Builder ClearField15() { + PrepareBuilder(); result.hasField15 = false; result.field15_ = 0UL; return this; @@ -3856,11 +4080,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField5(value); } } public Builder SetField5(int value) { + PrepareBuilder(); result.hasField5 = true; result.field5_ = value; return this; } public Builder ClearField5() { + PrepareBuilder(); result.hasField5 = false; result.field5_ = 0; return this; @@ -3875,11 +4101,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField27(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField27 = true; result.field27_ = value; return this; } public Builder ClearField27() { + PrepareBuilder(); result.hasField27 = false; result.field27_ = ""; return this; @@ -3893,11 +4121,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField28(value); } } public Builder SetField28(int value) { + PrepareBuilder(); result.hasField28 = true; result.field28_ = value; return this; } public Builder ClearField28() { + PrepareBuilder(); result.hasField28 = false; result.field28_ = 0; return this; @@ -3912,11 +4142,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField29(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField29 = true; result.field29_ = value; return this; } public Builder ClearField29() { + PrepareBuilder(); result.hasField29 = false; result.field29_ = ""; return this; @@ -3931,18 +4163,20 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField16(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField16 = true; result.field16_ = value; return this; } public Builder ClearField16() { + PrepareBuilder(); result.hasField16 = false; result.field16_ = ""; return this; } public pbc::IPopsicleList Field22List { - get { return result.field22_; } + get { return PrepareBuilder().field22_; } } public int Field22Count { get { return result.Field22Count; } @@ -3952,25 +4186,29 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField22(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field22_[index] = value; return this; } public Builder AddField22(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field22_.Add(value); return this; } public Builder AddRangeField22(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.field22_); return this; } public Builder ClearField22() { + PrepareBuilder(); result.field22_.Clear(); return this; } public pbc::IPopsicleList Field73List { - get { return result.field73_; } + get { return PrepareBuilder().field73_; } } public int Field73Count { get { return result.Field73Count; } @@ -3979,18 +4217,22 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetField73(index); } public Builder SetField73(int index, int value) { + PrepareBuilder(); result.field73_[index] = value; return this; } public Builder AddField73(int value) { + PrepareBuilder(); result.field73_.Add(value); return this; } public Builder AddRangeField73(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.field73_); return this; } public Builder ClearField73() { + PrepareBuilder(); result.field73_.Clear(); return this; } @@ -4003,11 +4245,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField20(value); } } public Builder SetField20(int value) { + PrepareBuilder(); result.hasField20 = true; result.field20_ = value; return this; } public Builder ClearField20() { + PrepareBuilder(); result.hasField20 = false; result.field20_ = 0; return this; @@ -4022,11 +4266,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField24(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField24 = true; result.field24_ = value; return this; } public Builder ClearField24() { + PrepareBuilder(); result.hasField24 = false; result.field24_ = ""; return this; @@ -4041,18 +4287,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField31(global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField31 = true; result.field31_ = value; return this; } public Builder SetField31(global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasField31 = true; result.field31_ = builderForValue.Build(); return this; } public Builder MergeField31(global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasField31 && result.field31_ != global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.DefaultInstance) { result.field31_ = global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.CreateBuilder(result.field31_).MergeFrom(value).BuildPartial(); @@ -4063,6 +4312,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearField31() { + PrepareBuilder(); result.hasField31 = false; result.field31_ = global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.DefaultInstance; return this; @@ -4638,7 +4888,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(SpeedMessage2 prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -4648,21 +4898,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new SpeedMessage2(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(SpeedMessage2 cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - SpeedMessage2 result = new SpeedMessage2(); + bool builderIsReadOnly; + SpeedMessage2 result; + + private SpeedMessage2 PrepareBuilder() { + if (builderIsReadOnly) { + SpeedMessage2 original = result; + result = new SpeedMessage2(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override SpeedMessage2 MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new SpeedMessage2(); + result = DefaultInstance ?? new SpeedMessage2(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -4674,16 +4951,15 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SpeedMessage2 BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.group1_.MakeReadOnly(); result.field128_.MakeReadOnly(); result.field127_.MakeReadOnly(); result.field130_.MakeReadOnly(); - SpeedMessage2 returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -4697,6 +4973,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(SpeedMessage2 other) { if (other == global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.DefaultInstance) return this; + PrepareBuilder(); if (other.HasField1) { Field1 = other.Field1; } @@ -4796,6 +5073,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -4969,11 +5247,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField1(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField1 = true; result.field1_ = value; return this; } public Builder ClearField1() { + PrepareBuilder(); result.hasField1 = false; result.field1_ = ""; return this; @@ -4987,11 +5267,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField3(value); } } public Builder SetField3(long value) { + PrepareBuilder(); result.hasField3 = true; result.field3_ = value; return this; } public Builder ClearField3() { + PrepareBuilder(); result.hasField3 = false; result.field3_ = 0L; return this; @@ -5005,11 +5287,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField4(value); } } public Builder SetField4(long value) { + PrepareBuilder(); result.hasField4 = true; result.field4_ = value; return this; } public Builder ClearField4() { + PrepareBuilder(); result.hasField4 = false; result.field4_ = 0L; return this; @@ -5023,11 +5307,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField30(value); } } public Builder SetField30(long value) { + PrepareBuilder(); result.hasField30 = true; result.field30_ = value; return this; } public Builder ClearField30() { + PrepareBuilder(); result.hasField30 = false; result.field30_ = 0L; return this; @@ -5041,11 +5327,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField75(value); } } public Builder SetField75(bool value) { + PrepareBuilder(); result.hasField75 = true; result.field75_ = value; return this; } public Builder ClearField75() { + PrepareBuilder(); result.hasField75 = false; result.field75_ = false; return this; @@ -5060,11 +5348,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField6(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField6 = true; result.field6_ = value; return this; } public Builder ClearField6() { + PrepareBuilder(); result.hasField6 = false; result.field6_ = ""; return this; @@ -5079,11 +5369,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField2(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasField2 = true; result.field2_ = value; return this; } public Builder ClearField2() { + PrepareBuilder(); result.hasField2 = false; result.field2_ = pb::ByteString.Empty; return this; @@ -5097,11 +5389,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField21(value); } } public Builder SetField21(int value) { + PrepareBuilder(); result.hasField21 = true; result.field21_ = value; return this; } public Builder ClearField21() { + PrepareBuilder(); result.hasField21 = false; result.field21_ = 0; return this; @@ -5115,11 +5409,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField71(value); } } public Builder SetField71(int value) { + PrepareBuilder(); result.hasField71 = true; result.field71_ = value; return this; } public Builder ClearField71() { + PrepareBuilder(); result.hasField71 = false; result.field71_ = 0; return this; @@ -5133,11 +5429,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField25(value); } } public Builder SetField25(float value) { + PrepareBuilder(); result.hasField25 = true; result.field25_ = value; return this; } public Builder ClearField25() { + PrepareBuilder(); result.hasField25 = false; result.field25_ = 0F; return this; @@ -5151,11 +5449,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField109(value); } } public Builder SetField109(int value) { + PrepareBuilder(); result.hasField109 = true; result.field109_ = value; return this; } public Builder ClearField109() { + PrepareBuilder(); result.hasField109 = false; result.field109_ = 0; return this; @@ -5169,11 +5469,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField210(value); } } public Builder SetField210(int value) { + PrepareBuilder(); result.hasField210 = true; result.field210_ = value; return this; } public Builder ClearField210() { + PrepareBuilder(); result.hasField210 = false; result.field210_ = 0; return this; @@ -5187,11 +5489,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField211(value); } } public Builder SetField211(int value) { + PrepareBuilder(); result.hasField211 = true; result.field211_ = value; return this; } public Builder ClearField211() { + PrepareBuilder(); result.hasField211 = false; result.field211_ = 0; return this; @@ -5205,11 +5509,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField212(value); } } public Builder SetField212(int value) { + PrepareBuilder(); result.hasField212 = true; result.field212_ = value; return this; } public Builder ClearField212() { + PrepareBuilder(); result.hasField212 = false; result.field212_ = 0; return this; @@ -5223,11 +5529,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField213(value); } } public Builder SetField213(int value) { + PrepareBuilder(); result.hasField213 = true; result.field213_ = value; return this; } public Builder ClearField213() { + PrepareBuilder(); result.hasField213 = false; result.field213_ = 0; return this; @@ -5241,11 +5549,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField216(value); } } public Builder SetField216(int value) { + PrepareBuilder(); result.hasField216 = true; result.field216_ = value; return this; } public Builder ClearField216() { + PrepareBuilder(); result.hasField216 = false; result.field216_ = 0; return this; @@ -5259,11 +5569,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField217(value); } } public Builder SetField217(int value) { + PrepareBuilder(); result.hasField217 = true; result.field217_ = value; return this; } public Builder ClearField217() { + PrepareBuilder(); result.hasField217 = false; result.field217_ = 0; return this; @@ -5277,11 +5589,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField218(value); } } public Builder SetField218(int value) { + PrepareBuilder(); result.hasField218 = true; result.field218_ = value; return this; } public Builder ClearField218() { + PrepareBuilder(); result.hasField218 = false; result.field218_ = 0; return this; @@ -5295,11 +5609,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField220(value); } } public Builder SetField220(int value) { + PrepareBuilder(); result.hasField220 = true; result.field220_ = value; return this; } public Builder ClearField220() { + PrepareBuilder(); result.hasField220 = false; result.field220_ = 0; return this; @@ -5313,11 +5629,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField221(value); } } public Builder SetField221(int value) { + PrepareBuilder(); result.hasField221 = true; result.field221_ = value; return this; } public Builder ClearField221() { + PrepareBuilder(); result.hasField221 = false; result.field221_ = 0; return this; @@ -5331,11 +5649,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField222(value); } } public Builder SetField222(float value) { + PrepareBuilder(); result.hasField222 = true; result.field222_ = value; return this; } public Builder ClearField222() { + PrepareBuilder(); result.hasField222 = false; result.field222_ = 0F; return this; @@ -5349,18 +5669,20 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField63(value); } } public Builder SetField63(int value) { + PrepareBuilder(); result.hasField63 = true; result.field63_ = value; return this; } public Builder ClearField63() { + PrepareBuilder(); result.hasField63 = false; result.field63_ = 0; return this; } public pbc::IPopsicleList Group1List { - get { return result.group1_; } + get { return PrepareBuilder().group1_; } } public int Group1Count { get { return result.Group1Count; } @@ -5370,35 +5692,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetGroup1(int index, global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1 value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.group1_[index] = value; return this; } public Builder SetGroup1(int index, global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.group1_[index] = builderForValue.Build(); return this; } public Builder AddGroup1(global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1 value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.group1_.Add(value); return this; } public Builder AddGroup1(global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.group1_.Add(builderForValue.Build()); return this; } public Builder AddRangeGroup1(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.group1_); return this; } public Builder ClearGroup1() { + PrepareBuilder(); result.group1_.Clear(); return this; } public pbc::IPopsicleList Field128List { - get { return result.field128_; } + get { return PrepareBuilder().field128_; } } public int Field128Count { get { return result.Field128Count; } @@ -5408,19 +5736,23 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField128(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field128_[index] = value; return this; } public Builder AddField128(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field128_.Add(value); return this; } public Builder AddRangeField128(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.field128_); return this; } public Builder ClearField128() { + PrepareBuilder(); result.field128_.Clear(); return this; } @@ -5433,18 +5765,20 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField131(value); } } public Builder SetField131(long value) { + PrepareBuilder(); result.hasField131 = true; result.field131_ = value; return this; } public Builder ClearField131() { + PrepareBuilder(); result.hasField131 = false; result.field131_ = 0L; return this; } public pbc::IPopsicleList Field127List { - get { return result.field127_; } + get { return PrepareBuilder().field127_; } } public int Field127Count { get { return result.Field127Count; } @@ -5454,19 +5788,23 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetField127(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field127_[index] = value; return this; } public Builder AddField127(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field127_.Add(value); return this; } public Builder AddRangeField127(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.field127_); return this; } public Builder ClearField127() { + PrepareBuilder(); result.field127_.Clear(); return this; } @@ -5479,18 +5817,20 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField129(value); } } public Builder SetField129(int value) { + PrepareBuilder(); result.hasField129 = true; result.field129_ = value; return this; } public Builder ClearField129() { + PrepareBuilder(); result.hasField129 = false; result.field129_ = 0; return this; } public pbc::IPopsicleList Field130List { - get { return result.field130_; } + get { return PrepareBuilder().field130_; } } public int Field130Count { get { return result.Field130Count; } @@ -5499,18 +5839,22 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetField130(index); } public Builder SetField130(int index, long value) { + PrepareBuilder(); result.field130_[index] = value; return this; } public Builder AddField130(long value) { + PrepareBuilder(); result.field130_.Add(value); return this; } public Builder AddRangeField130(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.field130_); return this; } public Builder ClearField130() { + PrepareBuilder(); result.field130_.Clear(); return this; } @@ -5523,11 +5867,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField205(value); } } public Builder SetField205(bool value) { + PrepareBuilder(); result.hasField205 = true; result.field205_ = value; return this; } public Builder ClearField205() { + PrepareBuilder(); result.hasField205 = false; result.field205_ = false; return this; @@ -5541,11 +5887,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField206(value); } } public Builder SetField206(bool value) { + PrepareBuilder(); result.hasField206 = true; result.field206_ = value; return this; } public Builder ClearField206() { + PrepareBuilder(); result.hasField206 = false; result.field206_ = false; return this; @@ -5818,7 +6166,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(SpeedMessage2GroupedMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -5828,21 +6176,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new SpeedMessage2GroupedMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(SpeedMessage2GroupedMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - SpeedMessage2GroupedMessage result = new SpeedMessage2GroupedMessage(); + bool builderIsReadOnly; + SpeedMessage2GroupedMessage result; + + private SpeedMessage2GroupedMessage PrepareBuilder() { + if (builderIsReadOnly) { + SpeedMessage2GroupedMessage original = result; + result = new SpeedMessage2GroupedMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override SpeedMessage2GroupedMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new SpeedMessage2GroupedMessage(); + result = DefaultInstance ?? new SpeedMessage2GroupedMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -5854,12 +6229,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SpeedMessage2GroupedMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - SpeedMessage2GroupedMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -5873,6 +6247,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(SpeedMessage2GroupedMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.DefaultInstance) return this; + PrepareBuilder(); if (other.HasField1) { Field1 = other.Field1; } @@ -5915,6 +6290,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -6010,11 +6386,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField1(value); } } public Builder SetField1(float value) { + PrepareBuilder(); result.hasField1 = true; result.field1_ = value; return this; } public Builder ClearField1() { + PrepareBuilder(); result.hasField1 = false; result.field1_ = 0F; return this; @@ -6028,11 +6406,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField2(value); } } public Builder SetField2(float value) { + PrepareBuilder(); result.hasField2 = true; result.field2_ = value; return this; } public Builder ClearField2() { + PrepareBuilder(); result.hasField2 = false; result.field2_ = 0F; return this; @@ -6046,11 +6426,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField3(value); } } public Builder SetField3(float value) { + PrepareBuilder(); result.hasField3 = true; result.field3_ = value; return this; } public Builder ClearField3() { + PrepareBuilder(); result.hasField3 = false; result.field3_ = 0F; return this; @@ -6064,11 +6446,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField4(value); } } public Builder SetField4(bool value) { + PrepareBuilder(); result.hasField4 = true; result.field4_ = value; return this; } public Builder ClearField4() { + PrepareBuilder(); result.hasField4 = false; result.field4_ = false; return this; @@ -6082,11 +6466,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField5(value); } } public Builder SetField5(bool value) { + PrepareBuilder(); result.hasField5 = true; result.field5_ = value; return this; } public Builder ClearField5() { + PrepareBuilder(); result.hasField5 = false; result.field5_ = false; return this; @@ -6100,11 +6486,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField6(value); } } public Builder SetField6(bool value) { + PrepareBuilder(); result.hasField6 = true; result.field6_ = value; return this; } public Builder ClearField6() { + PrepareBuilder(); result.hasField6 = false; result.field6_ = true; return this; @@ -6118,11 +6506,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField7(value); } } public Builder SetField7(bool value) { + PrepareBuilder(); result.hasField7 = true; result.field7_ = value; return this; } public Builder ClearField7() { + PrepareBuilder(); result.hasField7 = false; result.field7_ = false; return this; @@ -6136,11 +6526,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField8(value); } } public Builder SetField8(float value) { + PrepareBuilder(); result.hasField8 = true; result.field8_ = value; return this; } public Builder ClearField8() { + PrepareBuilder(); result.hasField8 = false; result.field8_ = 0F; return this; @@ -6154,11 +6546,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField9(value); } } public Builder SetField9(bool value) { + PrepareBuilder(); result.hasField9 = true; result.field9_ = value; return this; } public Builder ClearField9() { + PrepareBuilder(); result.hasField9 = false; result.field9_ = false; return this; @@ -6172,11 +6566,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField10(value); } } public Builder SetField10(float value) { + PrepareBuilder(); result.hasField10 = true; result.field10_ = value; return this; } public Builder ClearField10() { + PrepareBuilder(); result.hasField10 = false; result.field10_ = 0F; return this; @@ -6190,11 +6586,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetField11(value); } } public Builder SetField11(long value) { + PrepareBuilder(); result.hasField11 = true; result.field11_ = value; return this; } public Builder ClearField11() { + PrepareBuilder(); result.hasField11 = false; result.field11_ = 0L; return this; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs index a96833bef0..0df40f4248 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs @@ -150,7 +150,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ImportMessageLite prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -160,21 +160,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new ImportMessageLite(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(ImportMessageLite cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + ImportMessageLite result; - ImportMessageLite result = new ImportMessageLite(); + private ImportMessageLite PrepareBuilder() { + if (builderIsReadOnly) { + ImportMessageLite original = result; + result = new ImportMessageLite(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override ImportMessageLite MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new ImportMessageLite(); + result = DefaultInstance ?? new ImportMessageLite(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override ImportMessageLite DefaultInstanceForType { @@ -182,12 +209,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ImportMessageLite BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - ImportMessageLite returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -201,6 +227,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(ImportMessageLite other) { if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance) return this; + PrepareBuilder(); if (other.HasD) { D = other.D; } @@ -212,6 +239,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -254,11 +282,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetD(value); } } public Builder SetD(int value) { + PrepareBuilder(); result.hasD = true; result.d_ = value; return this; } public Builder ClearD() { + PrepareBuilder(); result.hasD = false; result.d_ = 0; return this; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs index 5749c97f88..75e746a840 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs @@ -169,7 +169,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ImportMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -179,21 +179,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new ImportMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(ImportMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + ImportMessage result; - ImportMessage result = new ImportMessage(); + private ImportMessage PrepareBuilder() { + if (builderIsReadOnly) { + ImportMessage original = result; + result = new ImportMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override ImportMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new ImportMessage(); + result = DefaultInstance ?? new ImportMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -205,12 +232,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ImportMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - ImportMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -224,6 +250,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(ImportMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance) return this; + PrepareBuilder(); if (other.HasD) { D = other.D; } @@ -236,6 +263,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -291,11 +319,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetD(value); } } public Builder SetD(int value) { + PrepareBuilder(); result.hasD = true; result.d_ = value; return this; } public Builder ClearD() { + PrepareBuilder(); result.hasD = false; result.d_ = 0; return this; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs index 8a6bb58929..f51b2f424e 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs @@ -189,7 +189,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestMessageSet prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -199,21 +199,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestMessageSet(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestMessageSet cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestMessageSet result = new TestMessageSet(); + bool builderIsReadOnly; + TestMessageSet result; + + private TestMessageSet PrepareBuilder() { + if (builderIsReadOnly) { + TestMessageSet original = result; + result = new TestMessageSet(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestMessageSet MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestMessageSet(); + result = DefaultInstance ?? new TestMessageSet(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -225,12 +252,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMessageSet BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestMessageSet returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -244,6 +270,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestMessageSet other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestMessageSet.DefaultInstance) return this; + PrepareBuilder(); this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); return this; @@ -254,6 +281,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -404,7 +432,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestMessageSetContainer prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -414,21 +442,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestMessageSetContainer(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestMessageSetContainer cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestMessageSetContainer result = new TestMessageSetContainer(); + bool builderIsReadOnly; + TestMessageSetContainer result; + + private TestMessageSetContainer PrepareBuilder() { + if (builderIsReadOnly) { + TestMessageSetContainer original = result; + result = new TestMessageSetContainer(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestMessageSetContainer MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestMessageSetContainer(); + result = DefaultInstance ?? new TestMessageSetContainer(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -440,12 +495,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMessageSetContainer BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestMessageSetContainer returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -459,6 +513,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestMessageSetContainer other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestMessageSetContainer.DefaultInstance) return this; + PrepareBuilder(); if (other.HasMessageSet) { MergeMessageSet(other.MessageSet); } @@ -471,6 +526,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -532,18 +588,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetMessageSet(global::Google.ProtocolBuffers.TestProtos.TestMessageSet value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasMessageSet = true; result.messageSet_ = value; return this; } public Builder SetMessageSet(global::Google.ProtocolBuffers.TestProtos.TestMessageSet.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasMessageSet = true; result.messageSet_ = builderForValue.Build(); return this; } public Builder MergeMessageSet(global::Google.ProtocolBuffers.TestProtos.TestMessageSet value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasMessageSet && result.messageSet_ != global::Google.ProtocolBuffers.TestProtos.TestMessageSet.DefaultInstance) { result.messageSet_ = global::Google.ProtocolBuffers.TestProtos.TestMessageSet.CreateBuilder(result.messageSet_).MergeFrom(value).BuildPartial(); @@ -554,6 +613,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearMessageSet() { + PrepareBuilder(); result.hasMessageSet = false; result.messageSet_ = global::Google.ProtocolBuffers.TestProtos.TestMessageSet.DefaultInstance; return this; @@ -668,7 +728,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestMessageSetExtension1 prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -678,21 +738,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestMessageSetExtension1(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestMessageSetExtension1 cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestMessageSetExtension1 result = new TestMessageSetExtension1(); + bool builderIsReadOnly; + TestMessageSetExtension1 result; + + private TestMessageSetExtension1 PrepareBuilder() { + if (builderIsReadOnly) { + TestMessageSetExtension1 original = result; + result = new TestMessageSetExtension1(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestMessageSetExtension1 MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestMessageSetExtension1(); + result = DefaultInstance ?? new TestMessageSetExtension1(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -704,12 +791,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMessageSetExtension1 BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestMessageSetExtension1 returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -723,6 +809,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestMessageSetExtension1 other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestMessageSetExtension1.DefaultInstance) return this; + PrepareBuilder(); if (other.HasI) { I = other.I; } @@ -735,6 +822,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -790,11 +878,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetI(value); } } public Builder SetI(int value) { + PrepareBuilder(); result.hasI = true; result.i_ = value; return this; } public Builder ClearI() { + PrepareBuilder(); result.hasI = false; result.i_ = 0; return this; @@ -909,7 +999,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestMessageSetExtension2 prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -919,21 +1009,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestMessageSetExtension2(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestMessageSetExtension2 cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestMessageSetExtension2 result = new TestMessageSetExtension2(); + bool builderIsReadOnly; + TestMessageSetExtension2 result; + + private TestMessageSetExtension2 PrepareBuilder() { + if (builderIsReadOnly) { + TestMessageSetExtension2 original = result; + result = new TestMessageSetExtension2(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestMessageSetExtension2 MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestMessageSetExtension2(); + result = DefaultInstance ?? new TestMessageSetExtension2(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -945,12 +1062,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMessageSetExtension2 BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestMessageSetExtension2 returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -964,6 +1080,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestMessageSetExtension2 other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestMessageSetExtension2.DefaultInstance) return this; + PrepareBuilder(); if (other.HasStr) { Str = other.Str; } @@ -976,6 +1093,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1032,11 +1150,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetStr(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasStr = true; result.str_ = value; return this; } public Builder ClearStr() { + PrepareBuilder(); result.hasStr = false; result.str_ = ""; return this; @@ -1199,7 +1319,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(Item prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1209,21 +1329,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new Item(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(Item cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - Item result = new Item(); + bool builderIsReadOnly; + Item result; + + private Item PrepareBuilder() { + if (builderIsReadOnly) { + Item original = result; + result = new Item(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override Item MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new Item(); + result = DefaultInstance ?? new Item(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1235,12 +1382,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Item BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - Item returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1254,6 +1400,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(Item other) { if (other == global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item.DefaultInstance) return this; + PrepareBuilder(); if (other.HasTypeId) { TypeId = other.TypeId; } @@ -1269,6 +1416,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1328,11 +1476,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetTypeId(value); } } public Builder SetTypeId(int value) { + PrepareBuilder(); result.hasTypeId = true; result.typeId_ = value; return this; } public Builder ClearTypeId() { + PrepareBuilder(); result.hasTypeId = false; result.typeId_ = 0; return this; @@ -1347,11 +1497,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetMessage(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasMessage = true; result.message_ = value; return this; } public Builder ClearMessage() { + PrepareBuilder(); result.hasMessage = false; result.message_ = pb::ByteString.Empty; return this; @@ -1442,7 +1594,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(RawMessageSet prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1452,21 +1604,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new RawMessageSet(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(RawMessageSet cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - RawMessageSet result = new RawMessageSet(); + bool builderIsReadOnly; + RawMessageSet result; + + private RawMessageSet PrepareBuilder() { + if (builderIsReadOnly) { + RawMessageSet original = result; + result = new RawMessageSet(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override RawMessageSet MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new RawMessageSet(); + result = DefaultInstance ?? new RawMessageSet(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1478,13 +1657,12 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RawMessageSet BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.item_.MakeReadOnly(); - RawMessageSet returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1498,6 +1676,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(RawMessageSet other) { if (other == global::Google.ProtocolBuffers.TestProtos.RawMessageSet.DefaultInstance) return this; + PrepareBuilder(); if (other.item_.Count != 0) { base.AddRange(other.item_, result.item_); } @@ -1510,6 +1689,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1558,7 +1738,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList ItemList { - get { return result.item_; } + get { return PrepareBuilder().item_; } } public int ItemCount { get { return result.ItemCount; } @@ -1568,29 +1748,35 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetItem(int index, global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.item_[index] = value; return this; } public Builder SetItem(int index, global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.item_[index] = builderForValue.Build(); return this; } public Builder AddItem(global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.item_.Add(value); return this; } public Builder AddItem(global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.item_.Add(builderForValue.Build()); return this; } public Builder AddRangeItem(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.item_); return this; } public Builder ClearItem() { + PrepareBuilder(); result.item_.Clear(); return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs index 74d6af60eb..ca401926e3 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs @@ -183,7 +183,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -193,21 +193,48 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestMessage result; - TestMessage result = new TestMessage(); + private TestMessage PrepareBuilder() { + if (builderIsReadOnly) { + TestMessage original = result; + result = new TestMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestMessage(); + result = DefaultInstance ?? new TestMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -219,12 +246,11 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { } public override TestMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -238,6 +264,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { public override Builder MergeFrom(TestMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -251,6 +278,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -306,11 +334,13 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs index c7153abc4c..967d549adf 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs @@ -164,7 +164,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestOptimizedForSize prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -174,21 +174,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestOptimizedForSize(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestOptimizedForSize cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestOptimizedForSize result = new TestOptimizedForSize(); + bool builderIsReadOnly; + TestOptimizedForSize result; + + private TestOptimizedForSize PrepareBuilder() { + if (builderIsReadOnly) { + TestOptimizedForSize original = result; + result = new TestOptimizedForSize(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestOptimizedForSize MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestOptimizedForSize(); + result = DefaultInstance ?? new TestOptimizedForSize(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -200,12 +227,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestOptimizedForSize BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestOptimizedForSize returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } @@ -217,11 +243,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetI(value); } } public Builder SetI(int value) { + PrepareBuilder(); result.hasI = true; result.i_ = value; return this; } public Builder ClearI() { + PrepareBuilder(); result.hasI = false; result.i_ = 0; return this; @@ -236,18 +264,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetMsg(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasMsg = true; result.msg_ = value; return this; } public Builder SetMsg(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasMsg = true; result.msg_ = builderForValue.Build(); return this; } public Builder MergeMsg(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasMsg && result.msg_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { result.msg_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.msg_).MergeFrom(value).BuildPartial(); @@ -258,6 +289,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearMsg() { + PrepareBuilder(); result.hasMsg = false; result.msg_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; return this; @@ -337,7 +369,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestRequiredOptimizedForSize prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -347,21 +379,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestRequiredOptimizedForSize(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestRequiredOptimizedForSize cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestRequiredOptimizedForSize result = new TestRequiredOptimizedForSize(); + bool builderIsReadOnly; + TestRequiredOptimizedForSize result; + + private TestRequiredOptimizedForSize PrepareBuilder() { + if (builderIsReadOnly) { + TestRequiredOptimizedForSize original = result; + result = new TestRequiredOptimizedForSize(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestRequiredOptimizedForSize MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestRequiredOptimizedForSize(); + result = DefaultInstance ?? new TestRequiredOptimizedForSize(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -373,12 +432,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRequiredOptimizedForSize BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestRequiredOptimizedForSize returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } @@ -390,11 +448,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetX(value); } } public Builder SetX(int value) { + PrepareBuilder(); result.hasX = true; result.x_ = value; return this; } public Builder ClearX() { + PrepareBuilder(); result.hasX = false; result.x_ = 0; return this; @@ -474,7 +534,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestOptionalOptimizedForSize prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -484,21 +544,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestOptionalOptimizedForSize(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestOptionalOptimizedForSize cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestOptionalOptimizedForSize result = new TestOptionalOptimizedForSize(); + bool builderIsReadOnly; + TestOptionalOptimizedForSize result; + + private TestOptionalOptimizedForSize PrepareBuilder() { + if (builderIsReadOnly) { + TestOptionalOptimizedForSize original = result; + result = new TestOptionalOptimizedForSize(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestOptionalOptimizedForSize MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestOptionalOptimizedForSize(); + result = DefaultInstance ?? new TestOptionalOptimizedForSize(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -510,12 +597,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestOptionalOptimizedForSize BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestOptionalOptimizedForSize returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } @@ -528,18 +614,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetO(global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasO = true; result.o_ = value; return this; } public Builder SetO(global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasO = true; result.o_ = builderForValue.Build(); return this; } public Builder MergeO(global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasO && result.o_ != global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.DefaultInstance) { result.o_ = global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.CreateBuilder(result.o_).MergeFrom(value).BuildPartial(); @@ -550,6 +639,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearO() { + PrepareBuilder(); result.hasO = false; result.o_ = global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.DefaultInstance; return this; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs index d8824d49a4..aeea673d57 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs @@ -1260,7 +1260,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(NestedMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1270,21 +1270,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new NestedMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(NestedMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + NestedMessage result; + + private NestedMessage PrepareBuilder() { + if (builderIsReadOnly) { + NestedMessage original = result; + result = new NestedMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - NestedMessage result = new NestedMessage(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override NestedMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new NestedMessage(); + result = DefaultInstance ?? new NestedMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1296,12 +1323,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override NestedMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - NestedMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1315,6 +1341,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(NestedMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) return this; + PrepareBuilder(); if (other.HasBb) { Bb = other.Bb; } @@ -1327,6 +1354,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1382,11 +1410,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetBb(value); } } public Builder SetBb(int value) { + PrepareBuilder(); result.hasBb = true; result.bb_ = value; return this; } public Builder ClearBb() { + PrepareBuilder(); result.hasBb = false; result.bb_ = 0; return this; @@ -1499,7 +1529,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(OptionalGroup prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1509,21 +1539,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new OptionalGroup(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(OptionalGroup cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + OptionalGroup result; + + private OptionalGroup PrepareBuilder() { + if (builderIsReadOnly) { + OptionalGroup original = result; + result = new OptionalGroup(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - OptionalGroup result = new OptionalGroup(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override OptionalGroup MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new OptionalGroup(); + result = DefaultInstance ?? new OptionalGroup(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1535,12 +1592,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - OptionalGroup returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1554,6 +1610,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(OptionalGroup other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -1566,6 +1623,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1621,11 +1679,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -1738,7 +1798,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(RepeatedGroup prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1748,21 +1808,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new RepeatedGroup(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(RepeatedGroup cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + RepeatedGroup result; - RepeatedGroup result = new RepeatedGroup(); + private RepeatedGroup PrepareBuilder() { + if (builderIsReadOnly) { + RepeatedGroup original = result; + result = new RepeatedGroup(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override RepeatedGroup MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new RepeatedGroup(); + result = DefaultInstance ?? new RepeatedGroup(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1774,12 +1861,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - RepeatedGroup returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1793,6 +1879,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(RepeatedGroup other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -1805,6 +1892,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1860,11 +1948,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -3181,7 +3271,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestAllTypes prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -3191,21 +3281,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestAllTypes(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestAllTypes cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestAllTypes result; + + private TestAllTypes PrepareBuilder() { + if (builderIsReadOnly) { + TestAllTypes original = result; + result = new TestAllTypes(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestAllTypes result = new TestAllTypes(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestAllTypes MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestAllTypes(); + result = DefaultInstance ?? new TestAllTypes(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -3217,8 +3334,8 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllTypes BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.repeatedInt32_.MakeReadOnly(); result.repeatedInt64_.MakeReadOnly(); @@ -3244,9 +3361,8 @@ namespace Google.ProtocolBuffers.TestProtos { result.repeatedImportEnum_.MakeReadOnly(); result.repeatedStringPiece_.MakeReadOnly(); result.repeatedCord_.MakeReadOnly(); - TestAllTypes returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -3260,6 +3376,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestAllTypes other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance) return this; + PrepareBuilder(); if (other.HasOptionalInt32) { OptionalInt32 = other.OptionalInt32; } @@ -3473,6 +3590,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -3907,11 +4025,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalInt32(value); } } public Builder SetOptionalInt32(int value) { + PrepareBuilder(); result.hasOptionalInt32 = true; result.optionalInt32_ = value; return this; } public Builder ClearOptionalInt32() { + PrepareBuilder(); result.hasOptionalInt32 = false; result.optionalInt32_ = 0; return this; @@ -3925,11 +4045,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalInt64(value); } } public Builder SetOptionalInt64(long value) { + PrepareBuilder(); result.hasOptionalInt64 = true; result.optionalInt64_ = value; return this; } public Builder ClearOptionalInt64() { + PrepareBuilder(); result.hasOptionalInt64 = false; result.optionalInt64_ = 0L; return this; @@ -3945,11 +4067,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetOptionalUint32(uint value) { + PrepareBuilder(); result.hasOptionalUint32 = true; result.optionalUint32_ = value; return this; } public Builder ClearOptionalUint32() { + PrepareBuilder(); result.hasOptionalUint32 = false; result.optionalUint32_ = 0; return this; @@ -3965,11 +4089,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetOptionalUint64(ulong value) { + PrepareBuilder(); result.hasOptionalUint64 = true; result.optionalUint64_ = value; return this; } public Builder ClearOptionalUint64() { + PrepareBuilder(); result.hasOptionalUint64 = false; result.optionalUint64_ = 0UL; return this; @@ -3983,11 +4109,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalSint32(value); } } public Builder SetOptionalSint32(int value) { + PrepareBuilder(); result.hasOptionalSint32 = true; result.optionalSint32_ = value; return this; } public Builder ClearOptionalSint32() { + PrepareBuilder(); result.hasOptionalSint32 = false; result.optionalSint32_ = 0; return this; @@ -4001,11 +4129,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalSint64(value); } } public Builder SetOptionalSint64(long value) { + PrepareBuilder(); result.hasOptionalSint64 = true; result.optionalSint64_ = value; return this; } public Builder ClearOptionalSint64() { + PrepareBuilder(); result.hasOptionalSint64 = false; result.optionalSint64_ = 0; return this; @@ -4021,11 +4151,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetOptionalFixed32(uint value) { + PrepareBuilder(); result.hasOptionalFixed32 = true; result.optionalFixed32_ = value; return this; } public Builder ClearOptionalFixed32() { + PrepareBuilder(); result.hasOptionalFixed32 = false; result.optionalFixed32_ = 0; return this; @@ -4041,11 +4173,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetOptionalFixed64(ulong value) { + PrepareBuilder(); result.hasOptionalFixed64 = true; result.optionalFixed64_ = value; return this; } public Builder ClearOptionalFixed64() { + PrepareBuilder(); result.hasOptionalFixed64 = false; result.optionalFixed64_ = 0; return this; @@ -4059,11 +4193,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalSfixed32(value); } } public Builder SetOptionalSfixed32(int value) { + PrepareBuilder(); result.hasOptionalSfixed32 = true; result.optionalSfixed32_ = value; return this; } public Builder ClearOptionalSfixed32() { + PrepareBuilder(); result.hasOptionalSfixed32 = false; result.optionalSfixed32_ = 0; return this; @@ -4077,11 +4213,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalSfixed64(value); } } public Builder SetOptionalSfixed64(long value) { + PrepareBuilder(); result.hasOptionalSfixed64 = true; result.optionalSfixed64_ = value; return this; } public Builder ClearOptionalSfixed64() { + PrepareBuilder(); result.hasOptionalSfixed64 = false; result.optionalSfixed64_ = 0; return this; @@ -4095,11 +4233,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalFloat(value); } } public Builder SetOptionalFloat(float value) { + PrepareBuilder(); result.hasOptionalFloat = true; result.optionalFloat_ = value; return this; } public Builder ClearOptionalFloat() { + PrepareBuilder(); result.hasOptionalFloat = false; result.optionalFloat_ = 0F; return this; @@ -4113,11 +4253,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalDouble(value); } } public Builder SetOptionalDouble(double value) { + PrepareBuilder(); result.hasOptionalDouble = true; result.optionalDouble_ = value; return this; } public Builder ClearOptionalDouble() { + PrepareBuilder(); result.hasOptionalDouble = false; result.optionalDouble_ = 0D; return this; @@ -4131,11 +4273,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalBool(value); } } public Builder SetOptionalBool(bool value) { + PrepareBuilder(); result.hasOptionalBool = true; result.optionalBool_ = value; return this; } public Builder ClearOptionalBool() { + PrepareBuilder(); result.hasOptionalBool = false; result.optionalBool_ = false; return this; @@ -4150,11 +4294,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalString(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalString = true; result.optionalString_ = value; return this; } public Builder ClearOptionalString() { + PrepareBuilder(); result.hasOptionalString = false; result.optionalString_ = ""; return this; @@ -4169,11 +4315,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalBytes(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalBytes = true; result.optionalBytes_ = value; return this; } public Builder ClearOptionalBytes() { + PrepareBuilder(); result.hasOptionalBytes = false; result.optionalBytes_ = pb::ByteString.Empty; return this; @@ -4188,18 +4336,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalGroup = true; result.optionalGroup_ = value; return this; } public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptionalGroup = true; result.optionalGroup_ = builderForValue.Build(); return this; } public Builder MergeOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptionalGroup && result.optionalGroup_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance) { result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.CreateBuilder(result.optionalGroup_).MergeFrom(value).BuildPartial(); @@ -4210,6 +4361,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearOptionalGroup() { + PrepareBuilder(); result.hasOptionalGroup = false; result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance; return this; @@ -4224,18 +4376,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalNestedMessage = true; result.optionalNestedMessage_ = value; return this; } public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptionalNestedMessage = true; result.optionalNestedMessage_ = builderForValue.Build(); return this; } public Builder MergeOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptionalNestedMessage && result.optionalNestedMessage_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) { result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(result.optionalNestedMessage_).MergeFrom(value).BuildPartial(); @@ -4246,6 +4401,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearOptionalNestedMessage() { + PrepareBuilder(); result.hasOptionalNestedMessage = false; result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; return this; @@ -4260,18 +4416,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalForeignMessage = true; result.optionalForeignMessage_ = value; return this; } public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptionalForeignMessage = true; result.optionalForeignMessage_ = builderForValue.Build(); return this; } public Builder MergeOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptionalForeignMessage && result.optionalForeignMessage_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.optionalForeignMessage_).MergeFrom(value).BuildPartial(); @@ -4282,6 +4441,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearOptionalForeignMessage() { + PrepareBuilder(); result.hasOptionalForeignMessage = false; result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; return this; @@ -4296,18 +4456,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalImportMessage = true; result.optionalImportMessage_ = value; return this; } public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptionalImportMessage = true; result.optionalImportMessage_ = builderForValue.Build(); return this; } public Builder MergeOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptionalImportMessage && result.optionalImportMessage_ != global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance) { result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessage.CreateBuilder(result.optionalImportMessage_).MergeFrom(value).BuildPartial(); @@ -4318,6 +4481,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearOptionalImportMessage() { + PrepareBuilder(); result.hasOptionalImportMessage = false; result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; return this; @@ -4331,11 +4495,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalNestedEnum(value); } } public Builder SetOptionalNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); result.hasOptionalNestedEnum = true; result.optionalNestedEnum_ = value; return this; } public Builder ClearOptionalNestedEnum() { + PrepareBuilder(); result.hasOptionalNestedEnum = false; result.optionalNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.FOO; return this; @@ -4349,11 +4515,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalForeignEnum(value); } } public Builder SetOptionalForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.hasOptionalForeignEnum = true; result.optionalForeignEnum_ = value; return this; } public Builder ClearOptionalForeignEnum() { + PrepareBuilder(); result.hasOptionalForeignEnum = false; result.optionalForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; return this; @@ -4367,11 +4535,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalImportEnum(value); } } public Builder SetOptionalImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); result.hasOptionalImportEnum = true; result.optionalImportEnum_ = value; return this; } public Builder ClearOptionalImportEnum() { + PrepareBuilder(); result.hasOptionalImportEnum = false; result.optionalImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_FOO; return this; @@ -4386,11 +4556,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalStringPiece(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalStringPiece = true; result.optionalStringPiece_ = value; return this; } public Builder ClearOptionalStringPiece() { + PrepareBuilder(); result.hasOptionalStringPiece = false; result.optionalStringPiece_ = ""; return this; @@ -4405,18 +4577,20 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalCord(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalCord = true; result.optionalCord_ = value; return this; } public Builder ClearOptionalCord() { + PrepareBuilder(); result.hasOptionalCord = false; result.optionalCord_ = ""; return this; } public pbc::IPopsicleList RepeatedInt32List { - get { return result.repeatedInt32_; } + get { return PrepareBuilder().repeatedInt32_; } } public int RepeatedInt32Count { get { return result.RepeatedInt32Count; } @@ -4425,24 +4599,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedInt32(index); } public Builder SetRepeatedInt32(int index, int value) { + PrepareBuilder(); result.repeatedInt32_[index] = value; return this; } public Builder AddRepeatedInt32(int value) { + PrepareBuilder(); result.repeatedInt32_.Add(value); return this; } public Builder AddRangeRepeatedInt32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedInt32_); return this; } public Builder ClearRepeatedInt32() { + PrepareBuilder(); result.repeatedInt32_.Clear(); return this; } public pbc::IPopsicleList RepeatedInt64List { - get { return result.repeatedInt64_; } + get { return PrepareBuilder().repeatedInt64_; } } public int RepeatedInt64Count { get { return result.RepeatedInt64Count; } @@ -4451,25 +4629,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedInt64(index); } public Builder SetRepeatedInt64(int index, long value) { + PrepareBuilder(); result.repeatedInt64_[index] = value; return this; } public Builder AddRepeatedInt64(long value) { + PrepareBuilder(); result.repeatedInt64_.Add(value); return this; } public Builder AddRangeRepeatedInt64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedInt64_); return this; } public Builder ClearRepeatedInt64() { + PrepareBuilder(); result.repeatedInt64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedUint32List { - get { return result.repeatedUint32_; } + get { return PrepareBuilder().repeatedUint32_; } } public int RepeatedUint32Count { get { return result.RepeatedUint32Count; } @@ -4480,27 +4662,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedUint32(int index, uint value) { + PrepareBuilder(); result.repeatedUint32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedUint32(uint value) { + PrepareBuilder(); result.repeatedUint32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedUint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedUint32_); return this; } public Builder ClearRepeatedUint32() { + PrepareBuilder(); result.repeatedUint32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedUint64List { - get { return result.repeatedUint64_; } + get { return PrepareBuilder().repeatedUint64_; } } public int RepeatedUint64Count { get { return result.RepeatedUint64Count; } @@ -4511,26 +4697,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedUint64(int index, ulong value) { + PrepareBuilder(); result.repeatedUint64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedUint64(ulong value) { + PrepareBuilder(); result.repeatedUint64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedUint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedUint64_); return this; } public Builder ClearRepeatedUint64() { + PrepareBuilder(); result.repeatedUint64_.Clear(); return this; } public pbc::IPopsicleList RepeatedSint32List { - get { return result.repeatedSint32_; } + get { return PrepareBuilder().repeatedSint32_; } } public int RepeatedSint32Count { get { return result.RepeatedSint32Count; } @@ -4539,24 +4729,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedSint32(index); } public Builder SetRepeatedSint32(int index, int value) { + PrepareBuilder(); result.repeatedSint32_[index] = value; return this; } public Builder AddRepeatedSint32(int value) { + PrepareBuilder(); result.repeatedSint32_.Add(value); return this; } public Builder AddRangeRepeatedSint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedSint32_); return this; } public Builder ClearRepeatedSint32() { + PrepareBuilder(); result.repeatedSint32_.Clear(); return this; } public pbc::IPopsicleList RepeatedSint64List { - get { return result.repeatedSint64_; } + get { return PrepareBuilder().repeatedSint64_; } } public int RepeatedSint64Count { get { return result.RepeatedSint64Count; } @@ -4565,25 +4759,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedSint64(index); } public Builder SetRepeatedSint64(int index, long value) { + PrepareBuilder(); result.repeatedSint64_[index] = value; return this; } public Builder AddRepeatedSint64(long value) { + PrepareBuilder(); result.repeatedSint64_.Add(value); return this; } public Builder AddRangeRepeatedSint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedSint64_); return this; } public Builder ClearRepeatedSint64() { + PrepareBuilder(); result.repeatedSint64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedFixed32List { - get { return result.repeatedFixed32_; } + get { return PrepareBuilder().repeatedFixed32_; } } public int RepeatedFixed32Count { get { return result.RepeatedFixed32Count; } @@ -4594,27 +4792,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedFixed32(int index, uint value) { + PrepareBuilder(); result.repeatedFixed32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedFixed32(uint value) { + PrepareBuilder(); result.repeatedFixed32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedFixed32_); return this; } public Builder ClearRepeatedFixed32() { + PrepareBuilder(); result.repeatedFixed32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedFixed64List { - get { return result.repeatedFixed64_; } + get { return PrepareBuilder().repeatedFixed64_; } } public int RepeatedFixed64Count { get { return result.RepeatedFixed64Count; } @@ -4625,26 +4827,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedFixed64(int index, ulong value) { + PrepareBuilder(); result.repeatedFixed64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedFixed64(ulong value) { + PrepareBuilder(); result.repeatedFixed64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedFixed64_); return this; } public Builder ClearRepeatedFixed64() { + PrepareBuilder(); result.repeatedFixed64_.Clear(); return this; } public pbc::IPopsicleList RepeatedSfixed32List { - get { return result.repeatedSfixed32_; } + get { return PrepareBuilder().repeatedSfixed32_; } } public int RepeatedSfixed32Count { get { return result.RepeatedSfixed32Count; } @@ -4653,24 +4859,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedSfixed32(index); } public Builder SetRepeatedSfixed32(int index, int value) { + PrepareBuilder(); result.repeatedSfixed32_[index] = value; return this; } public Builder AddRepeatedSfixed32(int value) { + PrepareBuilder(); result.repeatedSfixed32_.Add(value); return this; } public Builder AddRangeRepeatedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedSfixed32_); return this; } public Builder ClearRepeatedSfixed32() { + PrepareBuilder(); result.repeatedSfixed32_.Clear(); return this; } public pbc::IPopsicleList RepeatedSfixed64List { - get { return result.repeatedSfixed64_; } + get { return PrepareBuilder().repeatedSfixed64_; } } public int RepeatedSfixed64Count { get { return result.RepeatedSfixed64Count; } @@ -4679,24 +4889,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedSfixed64(index); } public Builder SetRepeatedSfixed64(int index, long value) { + PrepareBuilder(); result.repeatedSfixed64_[index] = value; return this; } public Builder AddRepeatedSfixed64(long value) { + PrepareBuilder(); result.repeatedSfixed64_.Add(value); return this; } public Builder AddRangeRepeatedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedSfixed64_); return this; } public Builder ClearRepeatedSfixed64() { + PrepareBuilder(); result.repeatedSfixed64_.Clear(); return this; } public pbc::IPopsicleList RepeatedFloatList { - get { return result.repeatedFloat_; } + get { return PrepareBuilder().repeatedFloat_; } } public int RepeatedFloatCount { get { return result.RepeatedFloatCount; } @@ -4705,24 +4919,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedFloat(index); } public Builder SetRepeatedFloat(int index, float value) { + PrepareBuilder(); result.repeatedFloat_[index] = value; return this; } public Builder AddRepeatedFloat(float value) { + PrepareBuilder(); result.repeatedFloat_.Add(value); return this; } public Builder AddRangeRepeatedFloat(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedFloat_); return this; } public Builder ClearRepeatedFloat() { + PrepareBuilder(); result.repeatedFloat_.Clear(); return this; } public pbc::IPopsicleList RepeatedDoubleList { - get { return result.repeatedDouble_; } + get { return PrepareBuilder().repeatedDouble_; } } public int RepeatedDoubleCount { get { return result.RepeatedDoubleCount; } @@ -4731,24 +4949,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedDouble(index); } public Builder SetRepeatedDouble(int index, double value) { + PrepareBuilder(); result.repeatedDouble_[index] = value; return this; } public Builder AddRepeatedDouble(double value) { + PrepareBuilder(); result.repeatedDouble_.Add(value); return this; } public Builder AddRangeRepeatedDouble(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedDouble_); return this; } public Builder ClearRepeatedDouble() { + PrepareBuilder(); result.repeatedDouble_.Clear(); return this; } public pbc::IPopsicleList RepeatedBoolList { - get { return result.repeatedBool_; } + get { return PrepareBuilder().repeatedBool_; } } public int RepeatedBoolCount { get { return result.RepeatedBoolCount; } @@ -4757,24 +4979,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedBool(index); } public Builder SetRepeatedBool(int index, bool value) { + PrepareBuilder(); result.repeatedBool_[index] = value; return this; } public Builder AddRepeatedBool(bool value) { + PrepareBuilder(); result.repeatedBool_.Add(value); return this; } public Builder AddRangeRepeatedBool(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedBool_); return this; } public Builder ClearRepeatedBool() { + PrepareBuilder(); result.repeatedBool_.Clear(); return this; } public pbc::IPopsicleList RepeatedStringList { - get { return result.repeatedString_; } + get { return PrepareBuilder().repeatedString_; } } public int RepeatedStringCount { get { return result.RepeatedStringCount; } @@ -4784,25 +5010,29 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedString(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedString_[index] = value; return this; } public Builder AddRepeatedString(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedString_.Add(value); return this; } public Builder AddRangeRepeatedString(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedString_); return this; } public Builder ClearRepeatedString() { + PrepareBuilder(); result.repeatedString_.Clear(); return this; } public pbc::IPopsicleList RepeatedBytesList { - get { return result.repeatedBytes_; } + get { return PrepareBuilder().repeatedBytes_; } } public int RepeatedBytesCount { get { return result.RepeatedBytesCount; } @@ -4812,25 +5042,29 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedBytes(int index, pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedBytes_[index] = value; return this; } public Builder AddRepeatedBytes(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedBytes_.Add(value); return this; } public Builder AddRangeRepeatedBytes(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedBytes_); return this; } public Builder ClearRepeatedBytes() { + PrepareBuilder(); result.repeatedBytes_.Clear(); return this; } public pbc::IPopsicleList RepeatedGroupList { - get { return result.repeatedGroup_; } + get { return PrepareBuilder().repeatedGroup_; } } public int RepeatedGroupCount { get { return result.RepeatedGroupCount; } @@ -4840,35 +5074,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedGroup_[index] = value; return this; } public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedGroup_[index] = builderForValue.Build(); return this; } public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedGroup_.Add(value); return this; } public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedGroup_.Add(builderForValue.Build()); return this; } public Builder AddRangeRepeatedGroup(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedGroup_); return this; } public Builder ClearRepeatedGroup() { + PrepareBuilder(); result.repeatedGroup_.Clear(); return this; } public pbc::IPopsicleList RepeatedNestedMessageList { - get { return result.repeatedNestedMessage_; } + get { return PrepareBuilder().repeatedNestedMessage_; } } public int RepeatedNestedMessageCount { get { return result.RepeatedNestedMessageCount; } @@ -4878,35 +5118,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedNestedMessage_[index] = value; return this; } public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedNestedMessage_[index] = builderForValue.Build(); return this; } public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedNestedMessage_.Add(value); return this; } public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedNestedMessage_.Add(builderForValue.Build()); return this; } public Builder AddRangeRepeatedNestedMessage(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedNestedMessage_); return this; } public Builder ClearRepeatedNestedMessage() { + PrepareBuilder(); result.repeatedNestedMessage_.Clear(); return this; } public pbc::IPopsicleList RepeatedForeignMessageList { - get { return result.repeatedForeignMessage_; } + get { return PrepareBuilder().repeatedForeignMessage_; } } public int RepeatedForeignMessageCount { get { return result.RepeatedForeignMessageCount; } @@ -4916,35 +5162,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedForeignMessage_[index] = value; return this; } public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedForeignMessage_[index] = builderForValue.Build(); return this; } public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedForeignMessage_.Add(value); return this; } public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedForeignMessage_.Add(builderForValue.Build()); return this; } public Builder AddRangeRepeatedForeignMessage(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedForeignMessage_); return this; } public Builder ClearRepeatedForeignMessage() { + PrepareBuilder(); result.repeatedForeignMessage_.Clear(); return this; } public pbc::IPopsicleList RepeatedImportMessageList { - get { return result.repeatedImportMessage_; } + get { return PrepareBuilder().repeatedImportMessage_; } } public int RepeatedImportMessageCount { get { return result.RepeatedImportMessageCount; } @@ -4954,35 +5206,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedImportMessage_[index] = value; return this; } public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedImportMessage_[index] = builderForValue.Build(); return this; } public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedImportMessage_.Add(value); return this; } public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedImportMessage_.Add(builderForValue.Build()); return this; } public Builder AddRangeRepeatedImportMessage(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedImportMessage_); return this; } public Builder ClearRepeatedImportMessage() { + PrepareBuilder(); result.repeatedImportMessage_.Clear(); return this; } public pbc::IPopsicleList RepeatedNestedEnumList { - get { return result.repeatedNestedEnum_; } + get { return PrepareBuilder().repeatedNestedEnum_; } } public int RepeatedNestedEnumCount { get { return result.RepeatedNestedEnumCount; } @@ -4991,24 +5249,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedNestedEnum(index); } public Builder SetRepeatedNestedEnum(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); result.repeatedNestedEnum_[index] = value; return this; } public Builder AddRepeatedNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); result.repeatedNestedEnum_.Add(value); return this; } public Builder AddRangeRepeatedNestedEnum(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedNestedEnum_); return this; } public Builder ClearRepeatedNestedEnum() { + PrepareBuilder(); result.repeatedNestedEnum_.Clear(); return this; } public pbc::IPopsicleList RepeatedForeignEnumList { - get { return result.repeatedForeignEnum_; } + get { return PrepareBuilder().repeatedForeignEnum_; } } public int RepeatedForeignEnumCount { get { return result.RepeatedForeignEnumCount; } @@ -5017,24 +5279,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedForeignEnum(index); } public Builder SetRepeatedForeignEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.repeatedForeignEnum_[index] = value; return this; } public Builder AddRepeatedForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.repeatedForeignEnum_.Add(value); return this; } public Builder AddRangeRepeatedForeignEnum(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedForeignEnum_); return this; } public Builder ClearRepeatedForeignEnum() { + PrepareBuilder(); result.repeatedForeignEnum_.Clear(); return this; } public pbc::IPopsicleList RepeatedImportEnumList { - get { return result.repeatedImportEnum_; } + get { return PrepareBuilder().repeatedImportEnum_; } } public int RepeatedImportEnumCount { get { return result.RepeatedImportEnumCount; } @@ -5043,24 +5309,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedImportEnum(index); } public Builder SetRepeatedImportEnum(int index, global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); result.repeatedImportEnum_[index] = value; return this; } public Builder AddRepeatedImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); result.repeatedImportEnum_.Add(value); return this; } public Builder AddRangeRepeatedImportEnum(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedImportEnum_); return this; } public Builder ClearRepeatedImportEnum() { + PrepareBuilder(); result.repeatedImportEnum_.Clear(); return this; } public pbc::IPopsicleList RepeatedStringPieceList { - get { return result.repeatedStringPiece_; } + get { return PrepareBuilder().repeatedStringPiece_; } } public int RepeatedStringPieceCount { get { return result.RepeatedStringPieceCount; } @@ -5070,25 +5340,29 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedStringPiece(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedStringPiece_[index] = value; return this; } public Builder AddRepeatedStringPiece(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedStringPiece_.Add(value); return this; } public Builder AddRangeRepeatedStringPiece(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedStringPiece_); return this; } public Builder ClearRepeatedStringPiece() { + PrepareBuilder(); result.repeatedStringPiece_.Clear(); return this; } public pbc::IPopsicleList RepeatedCordList { - get { return result.repeatedCord_; } + get { return PrepareBuilder().repeatedCord_; } } public int RepeatedCordCount { get { return result.RepeatedCordCount; } @@ -5098,19 +5372,23 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedCord(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedCord_[index] = value; return this; } public Builder AddRepeatedCord(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedCord_.Add(value); return this; } public Builder AddRangeRepeatedCord(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedCord_); return this; } public Builder ClearRepeatedCord() { + PrepareBuilder(); result.repeatedCord_.Clear(); return this; } @@ -5123,11 +5401,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultInt32(value); } } public Builder SetDefaultInt32(int value) { + PrepareBuilder(); result.hasDefaultInt32 = true; result.defaultInt32_ = value; return this; } public Builder ClearDefaultInt32() { + PrepareBuilder(); result.hasDefaultInt32 = false; result.defaultInt32_ = 41; return this; @@ -5141,11 +5421,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultInt64(value); } } public Builder SetDefaultInt64(long value) { + PrepareBuilder(); result.hasDefaultInt64 = true; result.defaultInt64_ = value; return this; } public Builder ClearDefaultInt64() { + PrepareBuilder(); result.hasDefaultInt64 = false; result.defaultInt64_ = 42L; return this; @@ -5161,11 +5443,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetDefaultUint32(uint value) { + PrepareBuilder(); result.hasDefaultUint32 = true; result.defaultUint32_ = value; return this; } public Builder ClearDefaultUint32() { + PrepareBuilder(); result.hasDefaultUint32 = false; result.defaultUint32_ = 43; return this; @@ -5181,11 +5465,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetDefaultUint64(ulong value) { + PrepareBuilder(); result.hasDefaultUint64 = true; result.defaultUint64_ = value; return this; } public Builder ClearDefaultUint64() { + PrepareBuilder(); result.hasDefaultUint64 = false; result.defaultUint64_ = 44UL; return this; @@ -5199,11 +5485,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultSint32(value); } } public Builder SetDefaultSint32(int value) { + PrepareBuilder(); result.hasDefaultSint32 = true; result.defaultSint32_ = value; return this; } public Builder ClearDefaultSint32() { + PrepareBuilder(); result.hasDefaultSint32 = false; result.defaultSint32_ = -45; return this; @@ -5217,11 +5505,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultSint64(value); } } public Builder SetDefaultSint64(long value) { + PrepareBuilder(); result.hasDefaultSint64 = true; result.defaultSint64_ = value; return this; } public Builder ClearDefaultSint64() { + PrepareBuilder(); result.hasDefaultSint64 = false; result.defaultSint64_ = 46; return this; @@ -5237,11 +5527,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetDefaultFixed32(uint value) { + PrepareBuilder(); result.hasDefaultFixed32 = true; result.defaultFixed32_ = value; return this; } public Builder ClearDefaultFixed32() { + PrepareBuilder(); result.hasDefaultFixed32 = false; result.defaultFixed32_ = 47; return this; @@ -5257,11 +5549,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetDefaultFixed64(ulong value) { + PrepareBuilder(); result.hasDefaultFixed64 = true; result.defaultFixed64_ = value; return this; } public Builder ClearDefaultFixed64() { + PrepareBuilder(); result.hasDefaultFixed64 = false; result.defaultFixed64_ = 48; return this; @@ -5275,11 +5569,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultSfixed32(value); } } public Builder SetDefaultSfixed32(int value) { + PrepareBuilder(); result.hasDefaultSfixed32 = true; result.defaultSfixed32_ = value; return this; } public Builder ClearDefaultSfixed32() { + PrepareBuilder(); result.hasDefaultSfixed32 = false; result.defaultSfixed32_ = 49; return this; @@ -5293,11 +5589,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultSfixed64(value); } } public Builder SetDefaultSfixed64(long value) { + PrepareBuilder(); result.hasDefaultSfixed64 = true; result.defaultSfixed64_ = value; return this; } public Builder ClearDefaultSfixed64() { + PrepareBuilder(); result.hasDefaultSfixed64 = false; result.defaultSfixed64_ = -50; return this; @@ -5311,11 +5609,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultFloat(value); } } public Builder SetDefaultFloat(float value) { + PrepareBuilder(); result.hasDefaultFloat = true; result.defaultFloat_ = value; return this; } public Builder ClearDefaultFloat() { + PrepareBuilder(); result.hasDefaultFloat = false; result.defaultFloat_ = 51.5F; return this; @@ -5329,11 +5629,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultDouble(value); } } public Builder SetDefaultDouble(double value) { + PrepareBuilder(); result.hasDefaultDouble = true; result.defaultDouble_ = value; return this; } public Builder ClearDefaultDouble() { + PrepareBuilder(); result.hasDefaultDouble = false; result.defaultDouble_ = 52000D; return this; @@ -5347,11 +5649,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultBool(value); } } public Builder SetDefaultBool(bool value) { + PrepareBuilder(); result.hasDefaultBool = true; result.defaultBool_ = value; return this; } public Builder ClearDefaultBool() { + PrepareBuilder(); result.hasDefaultBool = false; result.defaultBool_ = true; return this; @@ -5366,11 +5670,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetDefaultString(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasDefaultString = true; result.defaultString_ = value; return this; } public Builder ClearDefaultString() { + PrepareBuilder(); result.hasDefaultString = false; result.defaultString_ = "hello"; return this; @@ -5385,11 +5691,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetDefaultBytes(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasDefaultBytes = true; result.defaultBytes_ = value; return this; } public Builder ClearDefaultBytes() { + PrepareBuilder(); result.hasDefaultBytes = false; result.defaultBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Descriptor.Fields[62].DefaultValue; return this; @@ -5403,11 +5711,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultNestedEnum(value); } } public Builder SetDefaultNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); result.hasDefaultNestedEnum = true; result.defaultNestedEnum_ = value; return this; } public Builder ClearDefaultNestedEnum() { + PrepareBuilder(); result.hasDefaultNestedEnum = false; result.defaultNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.BAR; return this; @@ -5421,11 +5731,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultForeignEnum(value); } } public Builder SetDefaultForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.hasDefaultForeignEnum = true; result.defaultForeignEnum_ = value; return this; } public Builder ClearDefaultForeignEnum() { + PrepareBuilder(); result.hasDefaultForeignEnum = false; result.defaultForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_BAR; return this; @@ -5439,11 +5751,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultImportEnum(value); } } public Builder SetDefaultImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); result.hasDefaultImportEnum = true; result.defaultImportEnum_ = value; return this; } public Builder ClearDefaultImportEnum() { + PrepareBuilder(); result.hasDefaultImportEnum = false; result.defaultImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_BAR; return this; @@ -5458,11 +5772,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetDefaultStringPiece(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasDefaultStringPiece = true; result.defaultStringPiece_ = value; return this; } public Builder ClearDefaultStringPiece() { + PrepareBuilder(); result.hasDefaultStringPiece = false; result.defaultStringPiece_ = "abc"; return this; @@ -5477,11 +5793,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetDefaultCord(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasDefaultCord = true; result.defaultCord_ = value; return this; } public Builder ClearDefaultCord() { + PrepareBuilder(); result.hasDefaultCord = false; result.defaultCord_ = "123"; return this; @@ -5594,7 +5912,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestDeprecatedFields prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -5604,21 +5922,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestDeprecatedFields(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestDeprecatedFields cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestDeprecatedFields result; - TestDeprecatedFields result = new TestDeprecatedFields(); + private TestDeprecatedFields PrepareBuilder() { + if (builderIsReadOnly) { + TestDeprecatedFields original = result; + result = new TestDeprecatedFields(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestDeprecatedFields MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestDeprecatedFields(); + result = DefaultInstance ?? new TestDeprecatedFields(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -5630,12 +5975,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDeprecatedFields BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestDeprecatedFields returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -5649,6 +5993,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestDeprecatedFields other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestDeprecatedFields.DefaultInstance) return this; + PrepareBuilder(); if (other.HasDeprecatedInt32) { DeprecatedInt32 = other.DeprecatedInt32; } @@ -5661,6 +6006,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -5716,11 +6062,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDeprecatedInt32(value); } } public Builder SetDeprecatedInt32(int value) { + PrepareBuilder(); result.hasDeprecatedInt32 = true; result.deprecatedInt32_ = value; return this; } public Builder ClearDeprecatedInt32() { + PrepareBuilder(); result.hasDeprecatedInt32 = false; result.deprecatedInt32_ = 0; return this; @@ -5833,7 +6181,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ForeignMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -5843,21 +6191,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new ForeignMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(ForeignMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - ForeignMessage result = new ForeignMessage(); + bool builderIsReadOnly; + ForeignMessage result; + + private ForeignMessage PrepareBuilder() { + if (builderIsReadOnly) { + ForeignMessage original = result; + result = new ForeignMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override ForeignMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new ForeignMessage(); + result = DefaultInstance ?? new ForeignMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -5869,12 +6244,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ForeignMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - ForeignMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -5888,6 +6262,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(ForeignMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) return this; + PrepareBuilder(); if (other.HasC) { C = other.C; } @@ -5900,6 +6275,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -5955,11 +6331,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetC(value); } } public Builder SetC(int value) { + PrepareBuilder(); result.hasC = true; result.c_ = value; return this; } public Builder ClearC() { + PrepareBuilder(); result.hasC = false; result.c_ = 0; return this; @@ -6060,7 +6438,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestAllExtensions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -6070,21 +6448,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestAllExtensions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestAllExtensions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestAllExtensions result = new TestAllExtensions(); + bool builderIsReadOnly; + TestAllExtensions result; + + private TestAllExtensions PrepareBuilder() { + if (builderIsReadOnly) { + TestAllExtensions original = result; + result = new TestAllExtensions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestAllExtensions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestAllExtensions(); + result = DefaultInstance ?? new TestAllExtensions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -6096,12 +6501,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllExtensions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestAllExtensions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -6115,6 +6519,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestAllExtensions other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestAllExtensions.DefaultInstance) return this; + PrepareBuilder(); this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); return this; @@ -6125,6 +6530,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -6275,7 +6681,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(OptionalGroup_extension prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -6285,21 +6691,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new OptionalGroup_extension(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(OptionalGroup_extension cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - OptionalGroup_extension result = new OptionalGroup_extension(); + bool builderIsReadOnly; + OptionalGroup_extension result; + + private OptionalGroup_extension PrepareBuilder() { + if (builderIsReadOnly) { + OptionalGroup_extension original = result; + result = new OptionalGroup_extension(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override OptionalGroup_extension MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new OptionalGroup_extension(); + result = DefaultInstance ?? new OptionalGroup_extension(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -6311,12 +6744,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup_extension BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - OptionalGroup_extension returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -6330,6 +6762,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(OptionalGroup_extension other) { if (other == global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -6342,6 +6775,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -6397,11 +6831,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -6514,7 +6950,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(RepeatedGroup_extension prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -6524,21 +6960,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new RepeatedGroup_extension(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(RepeatedGroup_extension cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + RepeatedGroup_extension result; + + private RepeatedGroup_extension PrepareBuilder() { + if (builderIsReadOnly) { + RepeatedGroup_extension original = result; + result = new RepeatedGroup_extension(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - RepeatedGroup_extension result = new RepeatedGroup_extension(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override RepeatedGroup_extension MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new RepeatedGroup_extension(); + result = DefaultInstance ?? new RepeatedGroup_extension(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -6550,12 +7013,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup_extension BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - RepeatedGroup_extension returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -6569,6 +7031,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(RepeatedGroup_extension other) { if (other == global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -6581,6 +7044,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -6636,11 +7100,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -6739,7 +7205,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestNestedExtension prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -6749,21 +7215,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestNestedExtension(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestNestedExtension cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestNestedExtension result; + + private TestNestedExtension PrepareBuilder() { + if (builderIsReadOnly) { + TestNestedExtension original = result; + result = new TestNestedExtension(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestNestedExtension result = new TestNestedExtension(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestNestedExtension MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestNestedExtension(); + result = DefaultInstance ?? new TestNestedExtension(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -6775,12 +7268,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestNestedExtension BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestNestedExtension returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -6794,6 +7286,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestNestedExtension other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -6803,6 +7296,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -7472,7 +7966,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestRequired prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -7482,21 +7976,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestRequired(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestRequired cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestRequired result = new TestRequired(); + bool builderIsReadOnly; + TestRequired result; + + private TestRequired PrepareBuilder() { + if (builderIsReadOnly) { + TestRequired original = result; + result = new TestRequired(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestRequired MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestRequired(); + result = DefaultInstance ?? new TestRequired(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -7508,12 +8029,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRequired BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestRequired returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -7527,6 +8047,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestRequired other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -7635,6 +8156,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -7818,11 +8340,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -7836,11 +8360,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy2(value); } } public Builder SetDummy2(int value) { + PrepareBuilder(); result.hasDummy2 = true; result.dummy2_ = value; return this; } public Builder ClearDummy2() { + PrepareBuilder(); result.hasDummy2 = false; result.dummy2_ = 0; return this; @@ -7854,11 +8380,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetB(value); } } public Builder SetB(int value) { + PrepareBuilder(); result.hasB = true; result.b_ = value; return this; } public Builder ClearB() { + PrepareBuilder(); result.hasB = false; result.b_ = 0; return this; @@ -7872,11 +8400,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy4(value); } } public Builder SetDummy4(int value) { + PrepareBuilder(); result.hasDummy4 = true; result.dummy4_ = value; return this; } public Builder ClearDummy4() { + PrepareBuilder(); result.hasDummy4 = false; result.dummy4_ = 0; return this; @@ -7890,11 +8420,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy5(value); } } public Builder SetDummy5(int value) { + PrepareBuilder(); result.hasDummy5 = true; result.dummy5_ = value; return this; } public Builder ClearDummy5() { + PrepareBuilder(); result.hasDummy5 = false; result.dummy5_ = 0; return this; @@ -7908,11 +8440,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy6(value); } } public Builder SetDummy6(int value) { + PrepareBuilder(); result.hasDummy6 = true; result.dummy6_ = value; return this; } public Builder ClearDummy6() { + PrepareBuilder(); result.hasDummy6 = false; result.dummy6_ = 0; return this; @@ -7926,11 +8460,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy7(value); } } public Builder SetDummy7(int value) { + PrepareBuilder(); result.hasDummy7 = true; result.dummy7_ = value; return this; } public Builder ClearDummy7() { + PrepareBuilder(); result.hasDummy7 = false; result.dummy7_ = 0; return this; @@ -7944,11 +8480,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy8(value); } } public Builder SetDummy8(int value) { + PrepareBuilder(); result.hasDummy8 = true; result.dummy8_ = value; return this; } public Builder ClearDummy8() { + PrepareBuilder(); result.hasDummy8 = false; result.dummy8_ = 0; return this; @@ -7962,11 +8500,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy9(value); } } public Builder SetDummy9(int value) { + PrepareBuilder(); result.hasDummy9 = true; result.dummy9_ = value; return this; } public Builder ClearDummy9() { + PrepareBuilder(); result.hasDummy9 = false; result.dummy9_ = 0; return this; @@ -7980,11 +8520,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy10(value); } } public Builder SetDummy10(int value) { + PrepareBuilder(); result.hasDummy10 = true; result.dummy10_ = value; return this; } public Builder ClearDummy10() { + PrepareBuilder(); result.hasDummy10 = false; result.dummy10_ = 0; return this; @@ -7998,11 +8540,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy11(value); } } public Builder SetDummy11(int value) { + PrepareBuilder(); result.hasDummy11 = true; result.dummy11_ = value; return this; } public Builder ClearDummy11() { + PrepareBuilder(); result.hasDummy11 = false; result.dummy11_ = 0; return this; @@ -8016,11 +8560,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy12(value); } } public Builder SetDummy12(int value) { + PrepareBuilder(); result.hasDummy12 = true; result.dummy12_ = value; return this; } public Builder ClearDummy12() { + PrepareBuilder(); result.hasDummy12 = false; result.dummy12_ = 0; return this; @@ -8034,11 +8580,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy13(value); } } public Builder SetDummy13(int value) { + PrepareBuilder(); result.hasDummy13 = true; result.dummy13_ = value; return this; } public Builder ClearDummy13() { + PrepareBuilder(); result.hasDummy13 = false; result.dummy13_ = 0; return this; @@ -8052,11 +8600,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy14(value); } } public Builder SetDummy14(int value) { + PrepareBuilder(); result.hasDummy14 = true; result.dummy14_ = value; return this; } public Builder ClearDummy14() { + PrepareBuilder(); result.hasDummy14 = false; result.dummy14_ = 0; return this; @@ -8070,11 +8620,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy15(value); } } public Builder SetDummy15(int value) { + PrepareBuilder(); result.hasDummy15 = true; result.dummy15_ = value; return this; } public Builder ClearDummy15() { + PrepareBuilder(); result.hasDummy15 = false; result.dummy15_ = 0; return this; @@ -8088,11 +8640,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy16(value); } } public Builder SetDummy16(int value) { + PrepareBuilder(); result.hasDummy16 = true; result.dummy16_ = value; return this; } public Builder ClearDummy16() { + PrepareBuilder(); result.hasDummy16 = false; result.dummy16_ = 0; return this; @@ -8106,11 +8660,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy17(value); } } public Builder SetDummy17(int value) { + PrepareBuilder(); result.hasDummy17 = true; result.dummy17_ = value; return this; } public Builder ClearDummy17() { + PrepareBuilder(); result.hasDummy17 = false; result.dummy17_ = 0; return this; @@ -8124,11 +8680,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy18(value); } } public Builder SetDummy18(int value) { + PrepareBuilder(); result.hasDummy18 = true; result.dummy18_ = value; return this; } public Builder ClearDummy18() { + PrepareBuilder(); result.hasDummy18 = false; result.dummy18_ = 0; return this; @@ -8142,11 +8700,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy19(value); } } public Builder SetDummy19(int value) { + PrepareBuilder(); result.hasDummy19 = true; result.dummy19_ = value; return this; } public Builder ClearDummy19() { + PrepareBuilder(); result.hasDummy19 = false; result.dummy19_ = 0; return this; @@ -8160,11 +8720,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy20(value); } } public Builder SetDummy20(int value) { + PrepareBuilder(); result.hasDummy20 = true; result.dummy20_ = value; return this; } public Builder ClearDummy20() { + PrepareBuilder(); result.hasDummy20 = false; result.dummy20_ = 0; return this; @@ -8178,11 +8740,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy21(value); } } public Builder SetDummy21(int value) { + PrepareBuilder(); result.hasDummy21 = true; result.dummy21_ = value; return this; } public Builder ClearDummy21() { + PrepareBuilder(); result.hasDummy21 = false; result.dummy21_ = 0; return this; @@ -8196,11 +8760,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy22(value); } } public Builder SetDummy22(int value) { + PrepareBuilder(); result.hasDummy22 = true; result.dummy22_ = value; return this; } public Builder ClearDummy22() { + PrepareBuilder(); result.hasDummy22 = false; result.dummy22_ = 0; return this; @@ -8214,11 +8780,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy23(value); } } public Builder SetDummy23(int value) { + PrepareBuilder(); result.hasDummy23 = true; result.dummy23_ = value; return this; } public Builder ClearDummy23() { + PrepareBuilder(); result.hasDummy23 = false; result.dummy23_ = 0; return this; @@ -8232,11 +8800,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy24(value); } } public Builder SetDummy24(int value) { + PrepareBuilder(); result.hasDummy24 = true; result.dummy24_ = value; return this; } public Builder ClearDummy24() { + PrepareBuilder(); result.hasDummy24 = false; result.dummy24_ = 0; return this; @@ -8250,11 +8820,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy25(value); } } public Builder SetDummy25(int value) { + PrepareBuilder(); result.hasDummy25 = true; result.dummy25_ = value; return this; } public Builder ClearDummy25() { + PrepareBuilder(); result.hasDummy25 = false; result.dummy25_ = 0; return this; @@ -8268,11 +8840,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy26(value); } } public Builder SetDummy26(int value) { + PrepareBuilder(); result.hasDummy26 = true; result.dummy26_ = value; return this; } public Builder ClearDummy26() { + PrepareBuilder(); result.hasDummy26 = false; result.dummy26_ = 0; return this; @@ -8286,11 +8860,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy27(value); } } public Builder SetDummy27(int value) { + PrepareBuilder(); result.hasDummy27 = true; result.dummy27_ = value; return this; } public Builder ClearDummy27() { + PrepareBuilder(); result.hasDummy27 = false; result.dummy27_ = 0; return this; @@ -8304,11 +8880,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy28(value); } } public Builder SetDummy28(int value) { + PrepareBuilder(); result.hasDummy28 = true; result.dummy28_ = value; return this; } public Builder ClearDummy28() { + PrepareBuilder(); result.hasDummy28 = false; result.dummy28_ = 0; return this; @@ -8322,11 +8900,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy29(value); } } public Builder SetDummy29(int value) { + PrepareBuilder(); result.hasDummy29 = true; result.dummy29_ = value; return this; } public Builder ClearDummy29() { + PrepareBuilder(); result.hasDummy29 = false; result.dummy29_ = 0; return this; @@ -8340,11 +8920,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy30(value); } } public Builder SetDummy30(int value) { + PrepareBuilder(); result.hasDummy30 = true; result.dummy30_ = value; return this; } public Builder ClearDummy30() { + PrepareBuilder(); result.hasDummy30 = false; result.dummy30_ = 0; return this; @@ -8358,11 +8940,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy31(value); } } public Builder SetDummy31(int value) { + PrepareBuilder(); result.hasDummy31 = true; result.dummy31_ = value; return this; } public Builder ClearDummy31() { + PrepareBuilder(); result.hasDummy31 = false; result.dummy31_ = 0; return this; @@ -8376,11 +8960,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy32(value); } } public Builder SetDummy32(int value) { + PrepareBuilder(); result.hasDummy32 = true; result.dummy32_ = value; return this; } public Builder ClearDummy32() { + PrepareBuilder(); result.hasDummy32 = false; result.dummy32_ = 0; return this; @@ -8394,11 +8980,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetC(value); } } public Builder SetC(int value) { + PrepareBuilder(); result.hasC = true; result.c_ = value; return this; } public Builder ClearC() { + PrepareBuilder(); result.hasC = false; result.c_ = 0; return this; @@ -8551,7 +9139,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestRequiredForeign prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -8561,21 +9149,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestRequiredForeign(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestRequiredForeign cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestRequiredForeign result; - TestRequiredForeign result = new TestRequiredForeign(); + private TestRequiredForeign PrepareBuilder() { + if (builderIsReadOnly) { + TestRequiredForeign original = result; + result = new TestRequiredForeign(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestRequiredForeign MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestRequiredForeign(); + result = DefaultInstance ?? new TestRequiredForeign(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -8587,13 +9202,12 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRequiredForeign BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.repeatedMessage_.MakeReadOnly(); - TestRequiredForeign returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -8607,6 +9221,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestRequiredForeign other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestRequiredForeign.DefaultInstance) return this; + PrepareBuilder(); if (other.HasOptionalMessage) { MergeOptionalMessage(other.OptionalMessage); } @@ -8625,6 +9240,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -8694,18 +9310,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalMessage = true; result.optionalMessage_ = value; return this; } public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptionalMessage = true; result.optionalMessage_ = builderForValue.Build(); return this; } public Builder MergeOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptionalMessage && result.optionalMessage_ != global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance) { result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestRequired.CreateBuilder(result.optionalMessage_).MergeFrom(value).BuildPartial(); @@ -8716,13 +9335,14 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearOptionalMessage() { + PrepareBuilder(); result.hasOptionalMessage = false; result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance; return this; } public pbc::IPopsicleList RepeatedMessageList { - get { return result.repeatedMessage_; } + get { return PrepareBuilder().repeatedMessage_; } } public int RepeatedMessageCount { get { return result.RepeatedMessageCount; } @@ -8732,29 +9352,35 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestRequired value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedMessage_[index] = value; return this; } public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedMessage_[index] = builderForValue.Build(); return this; } public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedMessage_.Add(value); return this; } public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedMessage_.Add(builderForValue.Build()); return this; } public Builder AddRangeRepeatedMessage(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedMessage_); return this; } public Builder ClearRepeatedMessage() { + PrepareBuilder(); result.repeatedMessage_.Clear(); return this; } @@ -8767,11 +9393,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy(value); } } public Builder SetDummy(int value) { + PrepareBuilder(); result.hasDummy = true; result.dummy_ = value; return this; } public Builder ClearDummy() { + PrepareBuilder(); result.hasDummy = false; result.dummy_ = 0; return this; @@ -8884,7 +9512,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestForeignNested prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -8894,21 +9522,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestForeignNested(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestForeignNested cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestForeignNested result = new TestForeignNested(); + bool builderIsReadOnly; + TestForeignNested result; + + private TestForeignNested PrepareBuilder() { + if (builderIsReadOnly) { + TestForeignNested original = result; + result = new TestForeignNested(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestForeignNested MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestForeignNested(); + result = DefaultInstance ?? new TestForeignNested(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -8920,12 +9575,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestForeignNested BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestForeignNested returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -8939,6 +9593,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestForeignNested other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestForeignNested.DefaultInstance) return this; + PrepareBuilder(); if (other.HasForeignNested) { MergeForeignNested(other.ForeignNested); } @@ -8951,6 +9606,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -9012,18 +9668,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasForeignNested = true; result.foreignNested_ = value; return this; } public Builder SetForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasForeignNested = true; result.foreignNested_ = builderForValue.Build(); return this; } public Builder MergeForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasForeignNested && result.foreignNested_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) { result.foreignNested_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(result.foreignNested_).MergeFrom(value).BuildPartial(); @@ -9034,6 +9693,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearForeignNested() { + PrepareBuilder(); result.hasForeignNested = false; result.foreignNested_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; return this; @@ -9130,7 +9790,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestEmptyMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -9140,21 +9800,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestEmptyMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestEmptyMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestEmptyMessage result; + + private TestEmptyMessage PrepareBuilder() { + if (builderIsReadOnly) { + TestEmptyMessage original = result; + result = new TestEmptyMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestEmptyMessage result = new TestEmptyMessage(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestEmptyMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestEmptyMessage(); + result = DefaultInstance ?? new TestEmptyMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -9166,12 +9853,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestEmptyMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestEmptyMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -9185,6 +9871,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestEmptyMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestEmptyMessage.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -9194,6 +9881,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -9332,7 +10020,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestEmptyMessageWithExtensions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -9342,21 +10030,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestEmptyMessageWithExtensions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestEmptyMessageWithExtensions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestEmptyMessageWithExtensions result = new TestEmptyMessageWithExtensions(); + bool builderIsReadOnly; + TestEmptyMessageWithExtensions result; + + private TestEmptyMessageWithExtensions PrepareBuilder() { + if (builderIsReadOnly) { + TestEmptyMessageWithExtensions original = result; + result = new TestEmptyMessageWithExtensions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestEmptyMessageWithExtensions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestEmptyMessageWithExtensions(); + result = DefaultInstance ?? new TestEmptyMessageWithExtensions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -9368,12 +10083,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestEmptyMessageWithExtensions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestEmptyMessageWithExtensions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -9387,6 +10101,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestEmptyMessageWithExtensions other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestEmptyMessageWithExtensions.DefaultInstance) return this; + PrepareBuilder(); this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); return this; @@ -9397,6 +10112,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -9537,7 +10253,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestMultipleExtensionRanges prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -9547,21 +10263,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestMultipleExtensionRanges(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestMultipleExtensionRanges cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestMultipleExtensionRanges result; + + private TestMultipleExtensionRanges PrepareBuilder() { + if (builderIsReadOnly) { + TestMultipleExtensionRanges original = result; + result = new TestMultipleExtensionRanges(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestMultipleExtensionRanges result = new TestMultipleExtensionRanges(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestMultipleExtensionRanges MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestMultipleExtensionRanges(); + result = DefaultInstance ?? new TestMultipleExtensionRanges(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -9573,12 +10316,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMultipleExtensionRanges BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestMultipleExtensionRanges returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -9592,6 +10334,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestMultipleExtensionRanges other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestMultipleExtensionRanges.DefaultInstance) return this; + PrepareBuilder(); this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); return this; @@ -9602,6 +10345,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -9768,7 +10512,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestReallyLargeTagNumber prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -9778,21 +10522,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestReallyLargeTagNumber(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestReallyLargeTagNumber cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestReallyLargeTagNumber result; + + private TestReallyLargeTagNumber PrepareBuilder() { + if (builderIsReadOnly) { + TestReallyLargeTagNumber original = result; + result = new TestReallyLargeTagNumber(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestReallyLargeTagNumber result = new TestReallyLargeTagNumber(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestReallyLargeTagNumber MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestReallyLargeTagNumber(); + result = DefaultInstance ?? new TestReallyLargeTagNumber(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -9804,12 +10575,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestReallyLargeTagNumber BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestReallyLargeTagNumber returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -9823,6 +10593,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestReallyLargeTagNumber other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestReallyLargeTagNumber.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -9838,6 +10609,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -9897,11 +10669,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -9915,11 +10689,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetBb(value); } } public Builder SetBb(int value) { + PrepareBuilder(); result.hasBb = true; result.bb_ = value; return this; } public Builder ClearBb() { + PrepareBuilder(); result.hasBb = false; result.bb_ = 0; return this; @@ -10048,7 +10824,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestRecursiveMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -10058,21 +10834,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestRecursiveMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestRecursiveMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestRecursiveMessage result = new TestRecursiveMessage(); + bool builderIsReadOnly; + TestRecursiveMessage result; + + private TestRecursiveMessage PrepareBuilder() { + if (builderIsReadOnly) { + TestRecursiveMessage original = result; + result = new TestRecursiveMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestRecursiveMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestRecursiveMessage(); + result = DefaultInstance ?? new TestRecursiveMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -10084,12 +10887,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRecursiveMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestRecursiveMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -10103,6 +10905,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestRecursiveMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { MergeA(other.A); } @@ -10118,6 +10921,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -10183,18 +10987,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasA = true; result.a_ = builderForValue.Build(); return this; } public Builder MergeA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasA && result.a_ != global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance) { result.a_ = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.CreateBuilder(result.a_).MergeFrom(value).BuildPartial(); @@ -10205,6 +11012,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance; return this; @@ -10218,11 +11026,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetI(value); } } public Builder SetI(int value) { + PrepareBuilder(); result.hasI = true; result.i_ = value; return this; } public Builder ClearI() { + PrepareBuilder(); result.hasI = false; result.i_ = 0; return this; @@ -10335,7 +11145,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestMutualRecursionA prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -10345,21 +11155,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestMutualRecursionA(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestMutualRecursionA cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestMutualRecursionA result; + + private TestMutualRecursionA PrepareBuilder() { + if (builderIsReadOnly) { + TestMutualRecursionA original = result; + result = new TestMutualRecursionA(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestMutualRecursionA result = new TestMutualRecursionA(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestMutualRecursionA MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestMutualRecursionA(); + result = DefaultInstance ?? new TestMutualRecursionA(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -10371,12 +11208,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMutualRecursionA BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestMutualRecursionA returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -10390,6 +11226,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestMutualRecursionA other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance) return this; + PrepareBuilder(); if (other.HasBb) { MergeBb(other.Bb); } @@ -10402,6 +11239,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -10463,18 +11301,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasBb = true; result.bb_ = value; return this; } public Builder SetBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasBb = true; result.bb_ = builderForValue.Build(); return this; } public Builder MergeBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasBb && result.bb_ != global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance) { result.bb_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.CreateBuilder(result.bb_).MergeFrom(value).BuildPartial(); @@ -10485,6 +11326,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearBb() { + PrepareBuilder(); result.hasBb = false; result.bb_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance; return this; @@ -10613,7 +11455,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestMutualRecursionB prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -10623,21 +11465,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestMutualRecursionB(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestMutualRecursionB cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestMutualRecursionB result = new TestMutualRecursionB(); + bool builderIsReadOnly; + TestMutualRecursionB result; + + private TestMutualRecursionB PrepareBuilder() { + if (builderIsReadOnly) { + TestMutualRecursionB original = result; + result = new TestMutualRecursionB(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestMutualRecursionB MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestMutualRecursionB(); + result = DefaultInstance ?? new TestMutualRecursionB(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -10649,12 +11518,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMutualRecursionB BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestMutualRecursionB returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -10668,6 +11536,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestMutualRecursionB other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { MergeA(other.A); } @@ -10683,6 +11552,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -10748,18 +11618,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasA = true; result.a_ = builderForValue.Build(); return this; } public Builder MergeA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasA && result.a_ != global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance) { result.a_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.CreateBuilder(result.a_).MergeFrom(value).BuildPartial(); @@ -10770,6 +11643,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance; return this; @@ -10783,11 +11657,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalInt32(value); } } public Builder SetOptionalInt32(int value) { + PrepareBuilder(); result.hasOptionalInt32 = true; result.optionalInt32_ = value; return this; } public Builder ClearOptionalInt32() { + PrepareBuilder(); result.hasOptionalInt32 = false; result.optionalInt32_ = 0; return this; @@ -10932,7 +11808,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(Foo prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -10942,21 +11818,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new Foo(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(Foo cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + Foo result; - Foo result = new Foo(); + private Foo PrepareBuilder() { + if (builderIsReadOnly) { + Foo original = result; + result = new Foo(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override Foo MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new Foo(); + result = DefaultInstance ?? new Foo(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -10968,12 +11871,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Foo BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - Foo returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -10987,6 +11889,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(Foo other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -10999,6 +11902,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -11054,11 +11958,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -11171,7 +12077,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(Bar prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -11181,21 +12087,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new Bar(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(Bar cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - Bar result = new Bar(); + bool builderIsReadOnly; + Bar result; + + private Bar PrepareBuilder() { + if (builderIsReadOnly) { + Bar original = result; + result = new Bar(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override Bar MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new Bar(); + result = DefaultInstance ?? new Bar(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -11207,12 +12140,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Bar BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - Bar returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -11226,6 +12158,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(Bar other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -11238,6 +12171,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -11293,11 +12227,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -11418,7 +12354,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestDupFieldNumber prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -11428,21 +12364,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestDupFieldNumber(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestDupFieldNumber cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestDupFieldNumber result = new TestDupFieldNumber(); + bool builderIsReadOnly; + TestDupFieldNumber result; + + private TestDupFieldNumber PrepareBuilder() { + if (builderIsReadOnly) { + TestDupFieldNumber original = result; + result = new TestDupFieldNumber(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestDupFieldNumber MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestDupFieldNumber(); + result = DefaultInstance ?? new TestDupFieldNumber(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -11454,12 +12417,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDupFieldNumber BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestDupFieldNumber returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -11473,6 +12435,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestDupFieldNumber other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -11491,6 +12454,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -11564,11 +12528,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -11583,18 +12549,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasFoo = true; result.foo_ = value; return this; } public Builder SetFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasFoo = true; result.foo_ = builderForValue.Build(); return this; } public Builder MergeFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasFoo && result.foo_ != global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance) { result.foo_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.CreateBuilder(result.foo_).MergeFrom(value).BuildPartial(); @@ -11605,6 +12574,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearFoo() { + PrepareBuilder(); result.hasFoo = false; result.foo_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance; return this; @@ -11619,18 +12589,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasBar = true; result.bar_ = value; return this; } public Builder SetBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasBar = true; result.bar_ = builderForValue.Build(); return this; } public Builder MergeBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasBar && result.bar_ != global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance) { result.bar_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.CreateBuilder(result.bar_).MergeFrom(value).BuildPartial(); @@ -11641,6 +12614,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearBar() { + PrepareBuilder(); result.hasBar = false; result.bar_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance; return this; @@ -11810,7 +12784,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(NestedMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -11820,21 +12794,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new NestedMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(NestedMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + NestedMessage result; + + private NestedMessage PrepareBuilder() { + if (builderIsReadOnly) { + NestedMessage original = result; + result = new NestedMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - NestedMessage result = new NestedMessage(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override NestedMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new NestedMessage(); + result = DefaultInstance ?? new NestedMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -11846,14 +12847,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override NestedMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.nestedmessageRepeatedInt32_.MakeReadOnly(); result.nestedmessageRepeatedForeignmessage_.MakeReadOnly(); - NestedMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -11867,6 +12867,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(NestedMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance) return this; + PrepareBuilder(); if (other.nestedmessageRepeatedInt32_.Count != 0) { base.AddRange(other.nestedmessageRepeatedInt32_, result.nestedmessageRepeatedInt32_); } @@ -11882,6 +12883,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -11935,7 +12937,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList NestedmessageRepeatedInt32List { - get { return result.nestedmessageRepeatedInt32_; } + get { return PrepareBuilder().nestedmessageRepeatedInt32_; } } public int NestedmessageRepeatedInt32Count { get { return result.NestedmessageRepeatedInt32Count; } @@ -11944,24 +12946,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetNestedmessageRepeatedInt32(index); } public Builder SetNestedmessageRepeatedInt32(int index, int value) { + PrepareBuilder(); result.nestedmessageRepeatedInt32_[index] = value; return this; } public Builder AddNestedmessageRepeatedInt32(int value) { + PrepareBuilder(); result.nestedmessageRepeatedInt32_.Add(value); return this; } public Builder AddRangeNestedmessageRepeatedInt32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.nestedmessageRepeatedInt32_); return this; } public Builder ClearNestedmessageRepeatedInt32() { + PrepareBuilder(); result.nestedmessageRepeatedInt32_.Clear(); return this; } public pbc::IPopsicleList NestedmessageRepeatedForeignmessageList { - get { return result.nestedmessageRepeatedForeignmessage_; } + get { return PrepareBuilder().nestedmessageRepeatedForeignmessage_; } } public int NestedmessageRepeatedForeignmessageCount { get { return result.NestedmessageRepeatedForeignmessageCount; } @@ -11971,29 +12977,35 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetNestedmessageRepeatedForeignmessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.nestedmessageRepeatedForeignmessage_[index] = value; return this; } public Builder SetNestedmessageRepeatedForeignmessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.nestedmessageRepeatedForeignmessage_[index] = builderForValue.Build(); return this; } public Builder AddNestedmessageRepeatedForeignmessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.nestedmessageRepeatedForeignmessage_.Add(value); return this; } public Builder AddNestedmessageRepeatedForeignmessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.nestedmessageRepeatedForeignmessage_.Add(builderForValue.Build()); return this; } public Builder AddRangeNestedmessageRepeatedForeignmessage(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.nestedmessageRepeatedForeignmessage_); return this; } public Builder ClearNestedmessageRepeatedForeignmessage() { + PrepareBuilder(); result.nestedmessageRepeatedForeignmessage_.Clear(); return this; } @@ -12081,7 +13093,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestNestedMessageHasBits prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -12091,21 +13103,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestNestedMessageHasBits(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestNestedMessageHasBits cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestNestedMessageHasBits result = new TestNestedMessageHasBits(); + bool builderIsReadOnly; + TestNestedMessageHasBits result; + + private TestNestedMessageHasBits PrepareBuilder() { + if (builderIsReadOnly) { + TestNestedMessageHasBits original = result; + result = new TestNestedMessageHasBits(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestNestedMessageHasBits MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestNestedMessageHasBits(); + result = DefaultInstance ?? new TestNestedMessageHasBits(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -12117,12 +13156,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestNestedMessageHasBits BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestNestedMessageHasBits returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -12136,6 +13174,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestNestedMessageHasBits other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.DefaultInstance) return this; + PrepareBuilder(); if (other.HasOptionalNestedMessage) { MergeOptionalNestedMessage(other.OptionalNestedMessage); } @@ -12148,6 +13187,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -12209,18 +13249,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalNestedMessage = true; result.optionalNestedMessage_ = value; return this; } public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptionalNestedMessage = true; result.optionalNestedMessage_ = builderForValue.Build(); return this; } public Builder MergeOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptionalNestedMessage && result.optionalNestedMessage_ != global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance) { result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.CreateBuilder(result.optionalNestedMessage_).MergeFrom(value).BuildPartial(); @@ -12231,6 +13274,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearOptionalNestedMessage() { + PrepareBuilder(); result.hasOptionalNestedMessage = false; result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance; return this; @@ -12558,7 +13602,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestCamelCaseFieldNames prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -12568,21 +13612,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestCamelCaseFieldNames(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestCamelCaseFieldNames cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestCamelCaseFieldNames result; + + private TestCamelCaseFieldNames PrepareBuilder() { + if (builderIsReadOnly) { + TestCamelCaseFieldNames original = result; + result = new TestCamelCaseFieldNames(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestCamelCaseFieldNames result = new TestCamelCaseFieldNames(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestCamelCaseFieldNames MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestCamelCaseFieldNames(); + result = DefaultInstance ?? new TestCamelCaseFieldNames(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -12594,8 +13665,8 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestCamelCaseFieldNames BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.repeatedPrimitiveField_.MakeReadOnly(); result.repeatedStringField_.MakeReadOnly(); @@ -12603,9 +13674,8 @@ namespace Google.ProtocolBuffers.TestProtos { result.repeatedMessageField_.MakeReadOnly(); result.repeatedStringPieceField_.MakeReadOnly(); result.repeatedCordField_.MakeReadOnly(); - TestCamelCaseFieldNames returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -12619,6 +13689,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestCamelCaseFieldNames other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestCamelCaseFieldNames.DefaultInstance) return this; + PrepareBuilder(); if (other.HasPrimitiveField) { PrimitiveField = other.PrimitiveField; } @@ -12664,6 +13735,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -12787,11 +13859,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetPrimitiveField(value); } } public Builder SetPrimitiveField(int value) { + PrepareBuilder(); result.hasPrimitiveField = true; result.primitiveField_ = value; return this; } public Builder ClearPrimitiveField() { + PrepareBuilder(); result.hasPrimitiveField = false; result.primitiveField_ = 0; return this; @@ -12806,11 +13880,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetStringField(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasStringField = true; result.stringField_ = value; return this; } public Builder ClearStringField() { + PrepareBuilder(); result.hasStringField = false; result.stringField_ = ""; return this; @@ -12824,11 +13900,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetEnumField(value); } } public Builder SetEnumField(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.hasEnumField = true; result.enumField_ = value; return this; } public Builder ClearEnumField() { + PrepareBuilder(); result.hasEnumField = false; result.enumField_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; return this; @@ -12843,18 +13921,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasMessageField = true; result.messageField_ = value; return this; } public Builder SetMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasMessageField = true; result.messageField_ = builderForValue.Build(); return this; } public Builder MergeMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasMessageField && result.messageField_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { result.messageField_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.messageField_).MergeFrom(value).BuildPartial(); @@ -12865,6 +13946,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearMessageField() { + PrepareBuilder(); result.hasMessageField = false; result.messageField_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; return this; @@ -12879,11 +13961,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetStringPieceField(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasStringPieceField = true; result.stringPieceField_ = value; return this; } public Builder ClearStringPieceField() { + PrepareBuilder(); result.hasStringPieceField = false; result.stringPieceField_ = ""; return this; @@ -12898,18 +13982,20 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetCordField(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasCordField = true; result.cordField_ = value; return this; } public Builder ClearCordField() { + PrepareBuilder(); result.hasCordField = false; result.cordField_ = ""; return this; } public pbc::IPopsicleList RepeatedPrimitiveFieldList { - get { return result.repeatedPrimitiveField_; } + get { return PrepareBuilder().repeatedPrimitiveField_; } } public int RepeatedPrimitiveFieldCount { get { return result.RepeatedPrimitiveFieldCount; } @@ -12918,24 +14004,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedPrimitiveField(index); } public Builder SetRepeatedPrimitiveField(int index, int value) { + PrepareBuilder(); result.repeatedPrimitiveField_[index] = value; return this; } public Builder AddRepeatedPrimitiveField(int value) { + PrepareBuilder(); result.repeatedPrimitiveField_.Add(value); return this; } public Builder AddRangeRepeatedPrimitiveField(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedPrimitiveField_); return this; } public Builder ClearRepeatedPrimitiveField() { + PrepareBuilder(); result.repeatedPrimitiveField_.Clear(); return this; } public pbc::IPopsicleList RepeatedStringFieldList { - get { return result.repeatedStringField_; } + get { return PrepareBuilder().repeatedStringField_; } } public int RepeatedStringFieldCount { get { return result.RepeatedStringFieldCount; } @@ -12945,25 +14035,29 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedStringField(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedStringField_[index] = value; return this; } public Builder AddRepeatedStringField(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedStringField_.Add(value); return this; } public Builder AddRangeRepeatedStringField(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedStringField_); return this; } public Builder ClearRepeatedStringField() { + PrepareBuilder(); result.repeatedStringField_.Clear(); return this; } public pbc::IPopsicleList RepeatedEnumFieldList { - get { return result.repeatedEnumField_; } + get { return PrepareBuilder().repeatedEnumField_; } } public int RepeatedEnumFieldCount { get { return result.RepeatedEnumFieldCount; } @@ -12972,24 +14066,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedEnumField(index); } public Builder SetRepeatedEnumField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.repeatedEnumField_[index] = value; return this; } public Builder AddRepeatedEnumField(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.repeatedEnumField_.Add(value); return this; } public Builder AddRangeRepeatedEnumField(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedEnumField_); return this; } public Builder ClearRepeatedEnumField() { + PrepareBuilder(); result.repeatedEnumField_.Clear(); return this; } public pbc::IPopsicleList RepeatedMessageFieldList { - get { return result.repeatedMessageField_; } + get { return PrepareBuilder().repeatedMessageField_; } } public int RepeatedMessageFieldCount { get { return result.RepeatedMessageFieldCount; } @@ -12999,35 +14097,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedMessageField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedMessageField_[index] = value; return this; } public Builder SetRepeatedMessageField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedMessageField_[index] = builderForValue.Build(); return this; } public Builder AddRepeatedMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedMessageField_.Add(value); return this; } public Builder AddRepeatedMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedMessageField_.Add(builderForValue.Build()); return this; } public Builder AddRangeRepeatedMessageField(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedMessageField_); return this; } public Builder ClearRepeatedMessageField() { + PrepareBuilder(); result.repeatedMessageField_.Clear(); return this; } public pbc::IPopsicleList RepeatedStringPieceFieldList { - get { return result.repeatedStringPieceField_; } + get { return PrepareBuilder().repeatedStringPieceField_; } } public int RepeatedStringPieceFieldCount { get { return result.RepeatedStringPieceFieldCount; } @@ -13037,25 +14141,29 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedStringPieceField(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedStringPieceField_[index] = value; return this; } public Builder AddRepeatedStringPieceField(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedStringPieceField_.Add(value); return this; } public Builder AddRangeRepeatedStringPieceField(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedStringPieceField_); return this; } public Builder ClearRepeatedStringPieceField() { + PrepareBuilder(); result.repeatedStringPieceField_.Clear(); return this; } public pbc::IPopsicleList RepeatedCordFieldList { - get { return result.repeatedCordField_; } + get { return PrepareBuilder().repeatedCordField_; } } public int RepeatedCordFieldCount { get { return result.RepeatedCordFieldCount; } @@ -13065,19 +14173,23 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedCordField(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedCordField_[index] = value; return this; } public Builder AddRepeatedCordField(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedCordField_.Add(value); return this; } public Builder AddRangeRepeatedCordField(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedCordField_); return this; } public Builder ClearRepeatedCordField() { + PrepareBuilder(); result.repeatedCordField_.Clear(); return this; } @@ -13226,7 +14338,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestFieldOrderings prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -13236,21 +14348,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestFieldOrderings(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestFieldOrderings cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestFieldOrderings result; + + private TestFieldOrderings PrepareBuilder() { + if (builderIsReadOnly) { + TestFieldOrderings original = result; + result = new TestFieldOrderings(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestFieldOrderings result = new TestFieldOrderings(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestFieldOrderings MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestFieldOrderings(); + result = DefaultInstance ?? new TestFieldOrderings(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -13262,12 +14401,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestFieldOrderings BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestFieldOrderings returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -13281,6 +14419,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestFieldOrderings other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestFieldOrderings.DefaultInstance) return this; + PrepareBuilder(); if (other.HasMyString) { MyString = other.MyString; } @@ -13300,6 +14439,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -13364,11 +14504,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetMyString(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasMyString = true; result.myString_ = value; return this; } public Builder ClearMyString() { + PrepareBuilder(); result.hasMyString = false; result.myString_ = ""; return this; @@ -13382,11 +14524,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetMyInt(value); } } public Builder SetMyInt(long value) { + PrepareBuilder(); result.hasMyInt = true; result.myInt_ = value; return this; } public Builder ClearMyInt() { + PrepareBuilder(); result.hasMyInt = false; result.myInt_ = 0L; return this; @@ -13400,11 +14544,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetMyFloat(value); } } public Builder SetMyFloat(float value) { + PrepareBuilder(); result.hasMyFloat = true; result.myFloat_ = value; return this; } public Builder ClearMyFloat() { + PrepareBuilder(); result.hasMyFloat = false; result.myFloat_ = 0F; return this; @@ -13807,7 +14953,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestExtremeDefaultValues prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -13817,21 +14963,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestExtremeDefaultValues(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestExtremeDefaultValues cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestExtremeDefaultValues result; - TestExtremeDefaultValues result = new TestExtremeDefaultValues(); + private TestExtremeDefaultValues PrepareBuilder() { + if (builderIsReadOnly) { + TestExtremeDefaultValues original = result; + result = new TestExtremeDefaultValues(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestExtremeDefaultValues MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestExtremeDefaultValues(); + result = DefaultInstance ?? new TestExtremeDefaultValues(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -13843,12 +15016,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestExtremeDefaultValues BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestExtremeDefaultValues returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -13862,6 +15034,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestExtremeDefaultValues other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.DefaultInstance) return this; + PrepareBuilder(); if (other.HasEscapedBytes) { EscapedBytes = other.EscapedBytes; } @@ -13928,6 +15101,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -14056,11 +15230,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetEscapedBytes(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasEscapedBytes = true; result.escapedBytes_ = value; return this; } public Builder ClearEscapedBytes() { + PrepareBuilder(); result.hasEscapedBytes = false; result.escapedBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[0].DefaultValue; return this; @@ -14076,11 +15252,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetLargeUint32(uint value) { + PrepareBuilder(); result.hasLargeUint32 = true; result.largeUint32_ = value; return this; } public Builder ClearLargeUint32() { + PrepareBuilder(); result.hasLargeUint32 = false; result.largeUint32_ = 4294967295; return this; @@ -14096,11 +15274,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetLargeUint64(ulong value) { + PrepareBuilder(); result.hasLargeUint64 = true; result.largeUint64_ = value; return this; } public Builder ClearLargeUint64() { + PrepareBuilder(); result.hasLargeUint64 = false; result.largeUint64_ = 18446744073709551615UL; return this; @@ -14114,11 +15294,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetSmallInt32(value); } } public Builder SetSmallInt32(int value) { + PrepareBuilder(); result.hasSmallInt32 = true; result.smallInt32_ = value; return this; } public Builder ClearSmallInt32() { + PrepareBuilder(); result.hasSmallInt32 = false; result.smallInt32_ = -2147483647; return this; @@ -14132,11 +15314,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetSmallInt64(value); } } public Builder SetSmallInt64(long value) { + PrepareBuilder(); result.hasSmallInt64 = true; result.smallInt64_ = value; return this; } public Builder ClearSmallInt64() { + PrepareBuilder(); result.hasSmallInt64 = false; result.smallInt64_ = -9223372036854775807L; return this; @@ -14151,11 +15335,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetUtf8String(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasUtf8String = true; result.utf8String_ = value; return this; } public Builder ClearUtf8String() { + PrepareBuilder(); result.hasUtf8String = false; result.utf8String_ = (string) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[5].DefaultValue; return this; @@ -14169,11 +15355,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetZeroFloat(value); } } public Builder SetZeroFloat(float value) { + PrepareBuilder(); result.hasZeroFloat = true; result.zeroFloat_ = value; return this; } public Builder ClearZeroFloat() { + PrepareBuilder(); result.hasZeroFloat = false; result.zeroFloat_ = 0F; return this; @@ -14187,11 +15375,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOneFloat(value); } } public Builder SetOneFloat(float value) { + PrepareBuilder(); result.hasOneFloat = true; result.oneFloat_ = value; return this; } public Builder ClearOneFloat() { + PrepareBuilder(); result.hasOneFloat = false; result.oneFloat_ = 1F; return this; @@ -14205,11 +15395,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetSmallFloat(value); } } public Builder SetSmallFloat(float value) { + PrepareBuilder(); result.hasSmallFloat = true; result.smallFloat_ = value; return this; } public Builder ClearSmallFloat() { + PrepareBuilder(); result.hasSmallFloat = false; result.smallFloat_ = 1.5F; return this; @@ -14223,11 +15415,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetNegativeOneFloat(value); } } public Builder SetNegativeOneFloat(float value) { + PrepareBuilder(); result.hasNegativeOneFloat = true; result.negativeOneFloat_ = value; return this; } public Builder ClearNegativeOneFloat() { + PrepareBuilder(); result.hasNegativeOneFloat = false; result.negativeOneFloat_ = -1F; return this; @@ -14241,11 +15435,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetNegativeFloat(value); } } public Builder SetNegativeFloat(float value) { + PrepareBuilder(); result.hasNegativeFloat = true; result.negativeFloat_ = value; return this; } public Builder ClearNegativeFloat() { + PrepareBuilder(); result.hasNegativeFloat = false; result.negativeFloat_ = -1.5F; return this; @@ -14259,11 +15455,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetLargeFloat(value); } } public Builder SetLargeFloat(float value) { + PrepareBuilder(); result.hasLargeFloat = true; result.largeFloat_ = value; return this; } public Builder ClearLargeFloat() { + PrepareBuilder(); result.hasLargeFloat = false; result.largeFloat_ = 2E+08F; return this; @@ -14277,11 +15475,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetSmallNegativeFloat(value); } } public Builder SetSmallNegativeFloat(float value) { + PrepareBuilder(); result.hasSmallNegativeFloat = true; result.smallNegativeFloat_ = value; return this; } public Builder ClearSmallNegativeFloat() { + PrepareBuilder(); result.hasSmallNegativeFloat = false; result.smallNegativeFloat_ = -8E-28F; return this; @@ -14295,11 +15495,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetInfDouble(value); } } public Builder SetInfDouble(double value) { + PrepareBuilder(); result.hasInfDouble = true; result.infDouble_ = value; return this; } public Builder ClearInfDouble() { + PrepareBuilder(); result.hasInfDouble = false; result.infDouble_ = double.PositiveInfinity; return this; @@ -14313,11 +15515,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetNegInfDouble(value); } } public Builder SetNegInfDouble(double value) { + PrepareBuilder(); result.hasNegInfDouble = true; result.negInfDouble_ = value; return this; } public Builder ClearNegInfDouble() { + PrepareBuilder(); result.hasNegInfDouble = false; result.negInfDouble_ = double.NegativeInfinity; return this; @@ -14331,11 +15535,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetNanDouble(value); } } public Builder SetNanDouble(double value) { + PrepareBuilder(); result.hasNanDouble = true; result.nanDouble_ = value; return this; } public Builder ClearNanDouble() { + PrepareBuilder(); result.hasNanDouble = false; result.nanDouble_ = double.NaN; return this; @@ -14349,11 +15555,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetInfFloat(value); } } public Builder SetInfFloat(float value) { + PrepareBuilder(); result.hasInfFloat = true; result.infFloat_ = value; return this; } public Builder ClearInfFloat() { + PrepareBuilder(); result.hasInfFloat = false; result.infFloat_ = float.PositiveInfinity; return this; @@ -14367,11 +15575,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetNegInfFloat(value); } } public Builder SetNegInfFloat(float value) { + PrepareBuilder(); result.hasNegInfFloat = true; result.negInfFloat_ = value; return this; } public Builder ClearNegInfFloat() { + PrepareBuilder(); result.hasNegInfFloat = false; result.negInfFloat_ = float.NegativeInfinity; return this; @@ -14385,11 +15595,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetNanFloat(value); } } public Builder SetNanFloat(float value) { + PrepareBuilder(); result.hasNanFloat = true; result.nanFloat_ = value; return this; } public Builder ClearNanFloat() { + PrepareBuilder(); result.hasNanFloat = false; result.nanFloat_ = float.NaN; return this; @@ -14502,7 +15714,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(OneString prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -14512,21 +15724,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new OneString(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(OneString cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - OneString result = new OneString(); + bool builderIsReadOnly; + OneString result; + + private OneString PrepareBuilder() { + if (builderIsReadOnly) { + OneString original = result; + result = new OneString(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override OneString MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new OneString(); + result = DefaultInstance ?? new OneString(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -14538,12 +15777,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OneString BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - OneString returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -14557,6 +15795,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(OneString other) { if (other == global::Google.ProtocolBuffers.TestProtos.OneString.DefaultInstance) return this; + PrepareBuilder(); if (other.HasData) { Data = other.Data; } @@ -14569,6 +15808,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -14625,11 +15865,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetData(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasData = true; result.data_ = value; return this; } public Builder ClearData() { + PrepareBuilder(); result.hasData = false; result.data_ = ""; return this; @@ -14742,7 +15984,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(OneBytes prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -14752,21 +15994,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new OneBytes(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(OneBytes cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - OneBytes result = new OneBytes(); + bool builderIsReadOnly; + OneBytes result; + + private OneBytes PrepareBuilder() { + if (builderIsReadOnly) { + OneBytes original = result; + result = new OneBytes(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override OneBytes MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new OneBytes(); + result = DefaultInstance ?? new OneBytes(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -14778,12 +16047,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OneBytes BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - OneBytes returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -14797,6 +16065,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(OneBytes other) { if (other == global::Google.ProtocolBuffers.TestProtos.OneBytes.DefaultInstance) return this; + PrepareBuilder(); if (other.HasData) { Data = other.Data; } @@ -14809,6 +16078,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -14865,11 +16135,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetData(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasData = true; result.data_ = value; return this; } public Builder ClearData() { + PrepareBuilder(); result.hasData = false; result.data_ = pb::ByteString.Empty; return this; @@ -15339,7 +16611,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestPackedTypes prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -15349,21 +16621,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestPackedTypes(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestPackedTypes cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestPackedTypes result = new TestPackedTypes(); + bool builderIsReadOnly; + TestPackedTypes result; + + private TestPackedTypes PrepareBuilder() { + if (builderIsReadOnly) { + TestPackedTypes original = result; + result = new TestPackedTypes(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestPackedTypes MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestPackedTypes(); + result = DefaultInstance ?? new TestPackedTypes(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -15375,8 +16674,8 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedTypes BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.packedInt32_.MakeReadOnly(); result.packedInt64_.MakeReadOnly(); @@ -15392,9 +16691,8 @@ namespace Google.ProtocolBuffers.TestProtos { result.packedDouble_.MakeReadOnly(); result.packedBool_.MakeReadOnly(); result.packedEnum_.MakeReadOnly(); - TestPackedTypes returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -15408,6 +16706,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestPackedTypes other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedTypes.DefaultInstance) return this; + PrepareBuilder(); if (other.packedInt32_.Count != 0) { base.AddRange(other.packedInt32_, result.packedInt32_); } @@ -15459,6 +16758,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -15582,7 +16882,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList PackedInt32List { - get { return result.packedInt32_; } + get { return PrepareBuilder().packedInt32_; } } public int PackedInt32Count { get { return result.PackedInt32Count; } @@ -15591,24 +16891,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedInt32(index); } public Builder SetPackedInt32(int index, int value) { + PrepareBuilder(); result.packedInt32_[index] = value; return this; } public Builder AddPackedInt32(int value) { + PrepareBuilder(); result.packedInt32_.Add(value); return this; } public Builder AddRangePackedInt32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedInt32_); return this; } public Builder ClearPackedInt32() { + PrepareBuilder(); result.packedInt32_.Clear(); return this; } public pbc::IPopsicleList PackedInt64List { - get { return result.packedInt64_; } + get { return PrepareBuilder().packedInt64_; } } public int PackedInt64Count { get { return result.PackedInt64Count; } @@ -15617,25 +16921,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedInt64(index); } public Builder SetPackedInt64(int index, long value) { + PrepareBuilder(); result.packedInt64_[index] = value; return this; } public Builder AddPackedInt64(long value) { + PrepareBuilder(); result.packedInt64_.Add(value); return this; } public Builder AddRangePackedInt64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedInt64_); return this; } public Builder ClearPackedInt64() { + PrepareBuilder(); result.packedInt64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList PackedUint32List { - get { return result.packedUint32_; } + get { return PrepareBuilder().packedUint32_; } } public int PackedUint32Count { get { return result.PackedUint32Count; } @@ -15646,27 +16954,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetPackedUint32(int index, uint value) { + PrepareBuilder(); result.packedUint32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddPackedUint32(uint value) { + PrepareBuilder(); result.packedUint32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangePackedUint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedUint32_); return this; } public Builder ClearPackedUint32() { + PrepareBuilder(); result.packedUint32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList PackedUint64List { - get { return result.packedUint64_; } + get { return PrepareBuilder().packedUint64_; } } public int PackedUint64Count { get { return result.PackedUint64Count; } @@ -15677,26 +16989,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetPackedUint64(int index, ulong value) { + PrepareBuilder(); result.packedUint64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddPackedUint64(ulong value) { + PrepareBuilder(); result.packedUint64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangePackedUint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedUint64_); return this; } public Builder ClearPackedUint64() { + PrepareBuilder(); result.packedUint64_.Clear(); return this; } public pbc::IPopsicleList PackedSint32List { - get { return result.packedSint32_; } + get { return PrepareBuilder().packedSint32_; } } public int PackedSint32Count { get { return result.PackedSint32Count; } @@ -15705,24 +17021,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedSint32(index); } public Builder SetPackedSint32(int index, int value) { + PrepareBuilder(); result.packedSint32_[index] = value; return this; } public Builder AddPackedSint32(int value) { + PrepareBuilder(); result.packedSint32_.Add(value); return this; } public Builder AddRangePackedSint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedSint32_); return this; } public Builder ClearPackedSint32() { + PrepareBuilder(); result.packedSint32_.Clear(); return this; } public pbc::IPopsicleList PackedSint64List { - get { return result.packedSint64_; } + get { return PrepareBuilder().packedSint64_; } } public int PackedSint64Count { get { return result.PackedSint64Count; } @@ -15731,25 +17051,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedSint64(index); } public Builder SetPackedSint64(int index, long value) { + PrepareBuilder(); result.packedSint64_[index] = value; return this; } public Builder AddPackedSint64(long value) { + PrepareBuilder(); result.packedSint64_.Add(value); return this; } public Builder AddRangePackedSint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedSint64_); return this; } public Builder ClearPackedSint64() { + PrepareBuilder(); result.packedSint64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList PackedFixed32List { - get { return result.packedFixed32_; } + get { return PrepareBuilder().packedFixed32_; } } public int PackedFixed32Count { get { return result.PackedFixed32Count; } @@ -15760,27 +17084,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetPackedFixed32(int index, uint value) { + PrepareBuilder(); result.packedFixed32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddPackedFixed32(uint value) { + PrepareBuilder(); result.packedFixed32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangePackedFixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedFixed32_); return this; } public Builder ClearPackedFixed32() { + PrepareBuilder(); result.packedFixed32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList PackedFixed64List { - get { return result.packedFixed64_; } + get { return PrepareBuilder().packedFixed64_; } } public int PackedFixed64Count { get { return result.PackedFixed64Count; } @@ -15791,26 +17119,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetPackedFixed64(int index, ulong value) { + PrepareBuilder(); result.packedFixed64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddPackedFixed64(ulong value) { + PrepareBuilder(); result.packedFixed64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangePackedFixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedFixed64_); return this; } public Builder ClearPackedFixed64() { + PrepareBuilder(); result.packedFixed64_.Clear(); return this; } public pbc::IPopsicleList PackedSfixed32List { - get { return result.packedSfixed32_; } + get { return PrepareBuilder().packedSfixed32_; } } public int PackedSfixed32Count { get { return result.PackedSfixed32Count; } @@ -15819,24 +17151,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedSfixed32(index); } public Builder SetPackedSfixed32(int index, int value) { + PrepareBuilder(); result.packedSfixed32_[index] = value; return this; } public Builder AddPackedSfixed32(int value) { + PrepareBuilder(); result.packedSfixed32_.Add(value); return this; } public Builder AddRangePackedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedSfixed32_); return this; } public Builder ClearPackedSfixed32() { + PrepareBuilder(); result.packedSfixed32_.Clear(); return this; } public pbc::IPopsicleList PackedSfixed64List { - get { return result.packedSfixed64_; } + get { return PrepareBuilder().packedSfixed64_; } } public int PackedSfixed64Count { get { return result.PackedSfixed64Count; } @@ -15845,24 +17181,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedSfixed64(index); } public Builder SetPackedSfixed64(int index, long value) { + PrepareBuilder(); result.packedSfixed64_[index] = value; return this; } public Builder AddPackedSfixed64(long value) { + PrepareBuilder(); result.packedSfixed64_.Add(value); return this; } public Builder AddRangePackedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedSfixed64_); return this; } public Builder ClearPackedSfixed64() { + PrepareBuilder(); result.packedSfixed64_.Clear(); return this; } public pbc::IPopsicleList PackedFloatList { - get { return result.packedFloat_; } + get { return PrepareBuilder().packedFloat_; } } public int PackedFloatCount { get { return result.PackedFloatCount; } @@ -15871,24 +17211,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedFloat(index); } public Builder SetPackedFloat(int index, float value) { + PrepareBuilder(); result.packedFloat_[index] = value; return this; } public Builder AddPackedFloat(float value) { + PrepareBuilder(); result.packedFloat_.Add(value); return this; } public Builder AddRangePackedFloat(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedFloat_); return this; } public Builder ClearPackedFloat() { + PrepareBuilder(); result.packedFloat_.Clear(); return this; } public pbc::IPopsicleList PackedDoubleList { - get { return result.packedDouble_; } + get { return PrepareBuilder().packedDouble_; } } public int PackedDoubleCount { get { return result.PackedDoubleCount; } @@ -15897,24 +17241,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedDouble(index); } public Builder SetPackedDouble(int index, double value) { + PrepareBuilder(); result.packedDouble_[index] = value; return this; } public Builder AddPackedDouble(double value) { + PrepareBuilder(); result.packedDouble_.Add(value); return this; } public Builder AddRangePackedDouble(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedDouble_); return this; } public Builder ClearPackedDouble() { + PrepareBuilder(); result.packedDouble_.Clear(); return this; } public pbc::IPopsicleList PackedBoolList { - get { return result.packedBool_; } + get { return PrepareBuilder().packedBool_; } } public int PackedBoolCount { get { return result.PackedBoolCount; } @@ -15923,24 +17271,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedBool(index); } public Builder SetPackedBool(int index, bool value) { + PrepareBuilder(); result.packedBool_[index] = value; return this; } public Builder AddPackedBool(bool value) { + PrepareBuilder(); result.packedBool_.Add(value); return this; } public Builder AddRangePackedBool(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedBool_); return this; } public Builder ClearPackedBool() { + PrepareBuilder(); result.packedBool_.Clear(); return this; } public pbc::IPopsicleList PackedEnumList { - get { return result.packedEnum_; } + get { return PrepareBuilder().packedEnum_; } } public int PackedEnumCount { get { return result.PackedEnumCount; } @@ -15949,18 +17301,22 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedEnum(index); } public Builder SetPackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.packedEnum_[index] = value; return this; } public Builder AddPackedEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.packedEnum_.Add(value); return this; } public Builder AddRangePackedEnum(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedEnum_); return this; } public Builder ClearPackedEnum() { + PrepareBuilder(); result.packedEnum_.Clear(); return this; } @@ -16374,7 +17730,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestUnpackedTypes prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -16384,21 +17740,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestUnpackedTypes(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestUnpackedTypes cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestUnpackedTypes result; + + private TestUnpackedTypes PrepareBuilder() { + if (builderIsReadOnly) { + TestUnpackedTypes original = result; + result = new TestUnpackedTypes(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestUnpackedTypes result = new TestUnpackedTypes(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestUnpackedTypes MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestUnpackedTypes(); + result = DefaultInstance ?? new TestUnpackedTypes(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -16410,8 +17793,8 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedTypes BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.unpackedInt32_.MakeReadOnly(); result.unpackedInt64_.MakeReadOnly(); @@ -16427,9 +17810,8 @@ namespace Google.ProtocolBuffers.TestProtos { result.unpackedDouble_.MakeReadOnly(); result.unpackedBool_.MakeReadOnly(); result.unpackedEnum_.MakeReadOnly(); - TestUnpackedTypes returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -16443,6 +17825,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestUnpackedTypes other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypes.DefaultInstance) return this; + PrepareBuilder(); if (other.unpackedInt32_.Count != 0) { base.AddRange(other.unpackedInt32_, result.unpackedInt32_); } @@ -16494,6 +17877,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -16617,7 +18001,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList UnpackedInt32List { - get { return result.unpackedInt32_; } + get { return PrepareBuilder().unpackedInt32_; } } public int UnpackedInt32Count { get { return result.UnpackedInt32Count; } @@ -16626,24 +18010,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedInt32(index); } public Builder SetUnpackedInt32(int index, int value) { + PrepareBuilder(); result.unpackedInt32_[index] = value; return this; } public Builder AddUnpackedInt32(int value) { + PrepareBuilder(); result.unpackedInt32_.Add(value); return this; } public Builder AddRangeUnpackedInt32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedInt32_); return this; } public Builder ClearUnpackedInt32() { + PrepareBuilder(); result.unpackedInt32_.Clear(); return this; } public pbc::IPopsicleList UnpackedInt64List { - get { return result.unpackedInt64_; } + get { return PrepareBuilder().unpackedInt64_; } } public int UnpackedInt64Count { get { return result.UnpackedInt64Count; } @@ -16652,25 +18040,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedInt64(index); } public Builder SetUnpackedInt64(int index, long value) { + PrepareBuilder(); result.unpackedInt64_[index] = value; return this; } public Builder AddUnpackedInt64(long value) { + PrepareBuilder(); result.unpackedInt64_.Add(value); return this; } public Builder AddRangeUnpackedInt64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedInt64_); return this; } public Builder ClearUnpackedInt64() { + PrepareBuilder(); result.unpackedInt64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList UnpackedUint32List { - get { return result.unpackedUint32_; } + get { return PrepareBuilder().unpackedUint32_; } } public int UnpackedUint32Count { get { return result.UnpackedUint32Count; } @@ -16681,27 +18073,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetUnpackedUint32(int index, uint value) { + PrepareBuilder(); result.unpackedUint32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddUnpackedUint32(uint value) { + PrepareBuilder(); result.unpackedUint32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedUint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedUint32_); return this; } public Builder ClearUnpackedUint32() { + PrepareBuilder(); result.unpackedUint32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList UnpackedUint64List { - get { return result.unpackedUint64_; } + get { return PrepareBuilder().unpackedUint64_; } } public int UnpackedUint64Count { get { return result.UnpackedUint64Count; } @@ -16712,26 +18108,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetUnpackedUint64(int index, ulong value) { + PrepareBuilder(); result.unpackedUint64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddUnpackedUint64(ulong value) { + PrepareBuilder(); result.unpackedUint64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedUint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedUint64_); return this; } public Builder ClearUnpackedUint64() { + PrepareBuilder(); result.unpackedUint64_.Clear(); return this; } public pbc::IPopsicleList UnpackedSint32List { - get { return result.unpackedSint32_; } + get { return PrepareBuilder().unpackedSint32_; } } public int UnpackedSint32Count { get { return result.UnpackedSint32Count; } @@ -16740,24 +18140,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedSint32(index); } public Builder SetUnpackedSint32(int index, int value) { + PrepareBuilder(); result.unpackedSint32_[index] = value; return this; } public Builder AddUnpackedSint32(int value) { + PrepareBuilder(); result.unpackedSint32_.Add(value); return this; } public Builder AddRangeUnpackedSint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedSint32_); return this; } public Builder ClearUnpackedSint32() { + PrepareBuilder(); result.unpackedSint32_.Clear(); return this; } public pbc::IPopsicleList UnpackedSint64List { - get { return result.unpackedSint64_; } + get { return PrepareBuilder().unpackedSint64_; } } public int UnpackedSint64Count { get { return result.UnpackedSint64Count; } @@ -16766,25 +18170,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedSint64(index); } public Builder SetUnpackedSint64(int index, long value) { + PrepareBuilder(); result.unpackedSint64_[index] = value; return this; } public Builder AddUnpackedSint64(long value) { + PrepareBuilder(); result.unpackedSint64_.Add(value); return this; } public Builder AddRangeUnpackedSint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedSint64_); return this; } public Builder ClearUnpackedSint64() { + PrepareBuilder(); result.unpackedSint64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList UnpackedFixed32List { - get { return result.unpackedFixed32_; } + get { return PrepareBuilder().unpackedFixed32_; } } public int UnpackedFixed32Count { get { return result.UnpackedFixed32Count; } @@ -16795,27 +18203,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetUnpackedFixed32(int index, uint value) { + PrepareBuilder(); result.unpackedFixed32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddUnpackedFixed32(uint value) { + PrepareBuilder(); result.unpackedFixed32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedFixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedFixed32_); return this; } public Builder ClearUnpackedFixed32() { + PrepareBuilder(); result.unpackedFixed32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList UnpackedFixed64List { - get { return result.unpackedFixed64_; } + get { return PrepareBuilder().unpackedFixed64_; } } public int UnpackedFixed64Count { get { return result.UnpackedFixed64Count; } @@ -16826,26 +18238,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetUnpackedFixed64(int index, ulong value) { + PrepareBuilder(); result.unpackedFixed64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddUnpackedFixed64(ulong value) { + PrepareBuilder(); result.unpackedFixed64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedFixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedFixed64_); return this; } public Builder ClearUnpackedFixed64() { + PrepareBuilder(); result.unpackedFixed64_.Clear(); return this; } public pbc::IPopsicleList UnpackedSfixed32List { - get { return result.unpackedSfixed32_; } + get { return PrepareBuilder().unpackedSfixed32_; } } public int UnpackedSfixed32Count { get { return result.UnpackedSfixed32Count; } @@ -16854,24 +18270,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedSfixed32(index); } public Builder SetUnpackedSfixed32(int index, int value) { + PrepareBuilder(); result.unpackedSfixed32_[index] = value; return this; } public Builder AddUnpackedSfixed32(int value) { + PrepareBuilder(); result.unpackedSfixed32_.Add(value); return this; } public Builder AddRangeUnpackedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedSfixed32_); return this; } public Builder ClearUnpackedSfixed32() { + PrepareBuilder(); result.unpackedSfixed32_.Clear(); return this; } public pbc::IPopsicleList UnpackedSfixed64List { - get { return result.unpackedSfixed64_; } + get { return PrepareBuilder().unpackedSfixed64_; } } public int UnpackedSfixed64Count { get { return result.UnpackedSfixed64Count; } @@ -16880,24 +18300,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedSfixed64(index); } public Builder SetUnpackedSfixed64(int index, long value) { + PrepareBuilder(); result.unpackedSfixed64_[index] = value; return this; } public Builder AddUnpackedSfixed64(long value) { + PrepareBuilder(); result.unpackedSfixed64_.Add(value); return this; } public Builder AddRangeUnpackedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedSfixed64_); return this; } public Builder ClearUnpackedSfixed64() { + PrepareBuilder(); result.unpackedSfixed64_.Clear(); return this; } public pbc::IPopsicleList UnpackedFloatList { - get { return result.unpackedFloat_; } + get { return PrepareBuilder().unpackedFloat_; } } public int UnpackedFloatCount { get { return result.UnpackedFloatCount; } @@ -16906,24 +18330,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedFloat(index); } public Builder SetUnpackedFloat(int index, float value) { + PrepareBuilder(); result.unpackedFloat_[index] = value; return this; } public Builder AddUnpackedFloat(float value) { + PrepareBuilder(); result.unpackedFloat_.Add(value); return this; } public Builder AddRangeUnpackedFloat(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedFloat_); return this; } public Builder ClearUnpackedFloat() { + PrepareBuilder(); result.unpackedFloat_.Clear(); return this; } public pbc::IPopsicleList UnpackedDoubleList { - get { return result.unpackedDouble_; } + get { return PrepareBuilder().unpackedDouble_; } } public int UnpackedDoubleCount { get { return result.UnpackedDoubleCount; } @@ -16932,24 +18360,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedDouble(index); } public Builder SetUnpackedDouble(int index, double value) { + PrepareBuilder(); result.unpackedDouble_[index] = value; return this; } public Builder AddUnpackedDouble(double value) { + PrepareBuilder(); result.unpackedDouble_.Add(value); return this; } public Builder AddRangeUnpackedDouble(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedDouble_); return this; } public Builder ClearUnpackedDouble() { + PrepareBuilder(); result.unpackedDouble_.Clear(); return this; } public pbc::IPopsicleList UnpackedBoolList { - get { return result.unpackedBool_; } + get { return PrepareBuilder().unpackedBool_; } } public int UnpackedBoolCount { get { return result.UnpackedBoolCount; } @@ -16958,24 +18390,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedBool(index); } public Builder SetUnpackedBool(int index, bool value) { + PrepareBuilder(); result.unpackedBool_[index] = value; return this; } public Builder AddUnpackedBool(bool value) { + PrepareBuilder(); result.unpackedBool_.Add(value); return this; } public Builder AddRangeUnpackedBool(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedBool_); return this; } public Builder ClearUnpackedBool() { + PrepareBuilder(); result.unpackedBool_.Clear(); return this; } public pbc::IPopsicleList UnpackedEnumList { - get { return result.unpackedEnum_; } + get { return PrepareBuilder().unpackedEnum_; } } public int UnpackedEnumCount { get { return result.UnpackedEnumCount; } @@ -16984,18 +18420,22 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedEnum(index); } public Builder SetUnpackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.unpackedEnum_[index] = value; return this; } public Builder AddUnpackedEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.unpackedEnum_.Add(value); return this; } public Builder AddRangeUnpackedEnum(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedEnum_); return this; } public Builder ClearUnpackedEnum() { + PrepareBuilder(); result.unpackedEnum_.Clear(); return this; } @@ -17095,7 +18535,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestPackedExtensions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -17105,21 +18545,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestPackedExtensions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestPackedExtensions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestPackedExtensions result; + + private TestPackedExtensions PrepareBuilder() { + if (builderIsReadOnly) { + TestPackedExtensions original = result; + result = new TestPackedExtensions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestPackedExtensions result = new TestPackedExtensions(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestPackedExtensions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestPackedExtensions(); + result = DefaultInstance ?? new TestPackedExtensions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -17131,12 +18598,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedExtensions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestPackedExtensions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -17150,6 +18616,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestPackedExtensions other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedExtensions.DefaultInstance) return this; + PrepareBuilder(); this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); return this; @@ -17160,6 +18627,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -17298,7 +18766,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestUnpackedExtensions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -17308,21 +18776,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestUnpackedExtensions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestUnpackedExtensions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestUnpackedExtensions result; + + private TestUnpackedExtensions PrepareBuilder() { + if (builderIsReadOnly) { + TestUnpackedExtensions original = result; + result = new TestUnpackedExtensions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestUnpackedExtensions result = new TestUnpackedExtensions(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestUnpackedExtensions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestUnpackedExtensions(); + result = DefaultInstance ?? new TestUnpackedExtensions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -17334,12 +18829,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedExtensions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestUnpackedExtensions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -17353,6 +18847,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestUnpackedExtensions other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensions.DefaultInstance) return this; + PrepareBuilder(); this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); return this; @@ -17363,6 +18858,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -17553,7 +19049,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(DynamicMessageType prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -17563,21 +19059,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new DynamicMessageType(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(DynamicMessageType cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + DynamicMessageType result; - DynamicMessageType result = new DynamicMessageType(); + private DynamicMessageType PrepareBuilder() { + if (builderIsReadOnly) { + DynamicMessageType original = result; + result = new DynamicMessageType(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override DynamicMessageType MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new DynamicMessageType(); + result = DefaultInstance ?? new DynamicMessageType(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -17589,12 +19112,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override DynamicMessageType BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - DynamicMessageType returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -17608,6 +19130,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(DynamicMessageType other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance) return this; + PrepareBuilder(); if (other.HasDynamicField) { DynamicField = other.DynamicField; } @@ -17620,6 +19143,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -17675,11 +19199,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDynamicField(value); } } public Builder SetDynamicField(int value) { + PrepareBuilder(); result.hasDynamicField = true; result.dynamicField_ = value; return this; } public Builder ClearDynamicField() { + PrepareBuilder(); result.hasDynamicField = false; result.dynamicField_ = 0; return this; @@ -17883,7 +19409,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestDynamicExtensions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -17893,21 +19419,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestDynamicExtensions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestDynamicExtensions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestDynamicExtensions result = new TestDynamicExtensions(); + bool builderIsReadOnly; + TestDynamicExtensions result; + + private TestDynamicExtensions PrepareBuilder() { + if (builderIsReadOnly) { + TestDynamicExtensions original = result; + result = new TestDynamicExtensions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestDynamicExtensions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestDynamicExtensions(); + result = DefaultInstance ?? new TestDynamicExtensions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -17919,14 +19472,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDynamicExtensions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.repeatedExtension_.MakeReadOnly(); result.packedExtension_.MakeReadOnly(); - TestDynamicExtensions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -17940,6 +19492,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestDynamicExtensions other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.DefaultInstance) return this; + PrepareBuilder(); if (other.HasScalarExtension) { ScalarExtension = other.ScalarExtension; } @@ -17970,6 +19523,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -18078,11 +19632,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetScalarExtension(uint value) { + PrepareBuilder(); result.hasScalarExtension = true; result.scalarExtension_ = value; return this; } public Builder ClearScalarExtension() { + PrepareBuilder(); result.hasScalarExtension = false; result.scalarExtension_ = 0; return this; @@ -18096,11 +19652,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetEnumExtension(value); } } public Builder SetEnumExtension(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.hasEnumExtension = true; result.enumExtension_ = value; return this; } public Builder ClearEnumExtension() { + PrepareBuilder(); result.hasEnumExtension = false; result.enumExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; return this; @@ -18114,11 +19672,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDynamicEnumExtension(value); } } public Builder SetDynamicEnumExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType value) { + PrepareBuilder(); result.hasDynamicEnumExtension = true; result.dynamicEnumExtension_ = value; return this; } public Builder ClearDynamicEnumExtension() { + PrepareBuilder(); result.hasDynamicEnumExtension = false; result.dynamicEnumExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType.DYNAMIC_FOO; return this; @@ -18133,18 +19693,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasMessageExtension = true; result.messageExtension_ = value; return this; } public Builder SetMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasMessageExtension = true; result.messageExtension_ = builderForValue.Build(); return this; } public Builder MergeMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasMessageExtension && result.messageExtension_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { result.messageExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.messageExtension_).MergeFrom(value).BuildPartial(); @@ -18155,6 +19718,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearMessageExtension() { + PrepareBuilder(); result.hasMessageExtension = false; result.messageExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; return this; @@ -18169,18 +19733,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasDynamicMessageExtension = true; result.dynamicMessageExtension_ = value; return this; } public Builder SetDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasDynamicMessageExtension = true; result.dynamicMessageExtension_ = builderForValue.Build(); return this; } public Builder MergeDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasDynamicMessageExtension && result.dynamicMessageExtension_ != global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance) { result.dynamicMessageExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.CreateBuilder(result.dynamicMessageExtension_).MergeFrom(value).BuildPartial(); @@ -18191,13 +19758,14 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearDynamicMessageExtension() { + PrepareBuilder(); result.hasDynamicMessageExtension = false; result.dynamicMessageExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance; return this; } public pbc::IPopsicleList RepeatedExtensionList { - get { return result.repeatedExtension_; } + get { return PrepareBuilder().repeatedExtension_; } } public int RepeatedExtensionCount { get { return result.RepeatedExtensionCount; } @@ -18207,25 +19775,29 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedExtension(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedExtension_[index] = value; return this; } public Builder AddRepeatedExtension(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedExtension_.Add(value); return this; } public Builder AddRangeRepeatedExtension(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedExtension_); return this; } public Builder ClearRepeatedExtension() { + PrepareBuilder(); result.repeatedExtension_.Clear(); return this; } public pbc::IPopsicleList PackedExtensionList { - get { return result.packedExtension_; } + get { return PrepareBuilder().packedExtension_; } } public int PackedExtensionCount { get { return result.PackedExtensionCount; } @@ -18234,18 +19806,22 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedExtension(index); } public Builder SetPackedExtension(int index, int value) { + PrepareBuilder(); result.packedExtension_[index] = value; return this; } public Builder AddPackedExtension(int value) { + PrepareBuilder(); result.packedExtension_.Add(value); return this; } public Builder AddRangePackedExtension(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedExtension_); return this; } public Builder ClearPackedExtension() { + PrepareBuilder(); result.packedExtension_.Clear(); return this; } @@ -18479,7 +20055,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestRepeatedScalarDifferentTagSizes prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -18489,21 +20065,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestRepeatedScalarDifferentTagSizes(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestRepeatedScalarDifferentTagSizes cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestRepeatedScalarDifferentTagSizes result; + + private TestRepeatedScalarDifferentTagSizes PrepareBuilder() { + if (builderIsReadOnly) { + TestRepeatedScalarDifferentTagSizes original = result; + result = new TestRepeatedScalarDifferentTagSizes(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestRepeatedScalarDifferentTagSizes result = new TestRepeatedScalarDifferentTagSizes(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestRepeatedScalarDifferentTagSizes MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestRepeatedScalarDifferentTagSizes(); + result = DefaultInstance ?? new TestRepeatedScalarDifferentTagSizes(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -18515,8 +20118,8 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRepeatedScalarDifferentTagSizes BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.repeatedFixed32_.MakeReadOnly(); result.repeatedInt32_.MakeReadOnly(); @@ -18524,9 +20127,8 @@ namespace Google.ProtocolBuffers.TestProtos { result.repeatedInt64_.MakeReadOnly(); result.repeatedFloat_.MakeReadOnly(); result.repeatedUint64_.MakeReadOnly(); - TestRepeatedScalarDifferentTagSizes returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -18540,6 +20142,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestRepeatedScalarDifferentTagSizes other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestRepeatedScalarDifferentTagSizes.DefaultInstance) return this; + PrepareBuilder(); if (other.repeatedFixed32_.Count != 0) { base.AddRange(other.repeatedFixed32_, result.repeatedFixed32_); } @@ -18567,6 +20170,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -18642,7 +20246,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedFixed32List { - get { return result.repeatedFixed32_; } + get { return PrepareBuilder().repeatedFixed32_; } } public int RepeatedFixed32Count { get { return result.RepeatedFixed32Count; } @@ -18653,26 +20257,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedFixed32(int index, uint value) { + PrepareBuilder(); result.repeatedFixed32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedFixed32(uint value) { + PrepareBuilder(); result.repeatedFixed32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedFixed32_); return this; } public Builder ClearRepeatedFixed32() { + PrepareBuilder(); result.repeatedFixed32_.Clear(); return this; } public pbc::IPopsicleList RepeatedInt32List { - get { return result.repeatedInt32_; } + get { return PrepareBuilder().repeatedInt32_; } } public int RepeatedInt32Count { get { return result.RepeatedInt32Count; } @@ -18681,25 +20289,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedInt32(index); } public Builder SetRepeatedInt32(int index, int value) { + PrepareBuilder(); result.repeatedInt32_[index] = value; return this; } public Builder AddRepeatedInt32(int value) { + PrepareBuilder(); result.repeatedInt32_.Add(value); return this; } public Builder AddRangeRepeatedInt32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedInt32_); return this; } public Builder ClearRepeatedInt32() { + PrepareBuilder(); result.repeatedInt32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedFixed64List { - get { return result.repeatedFixed64_; } + get { return PrepareBuilder().repeatedFixed64_; } } public int RepeatedFixed64Count { get { return result.RepeatedFixed64Count; } @@ -18710,26 +20322,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedFixed64(int index, ulong value) { + PrepareBuilder(); result.repeatedFixed64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedFixed64(ulong value) { + PrepareBuilder(); result.repeatedFixed64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedFixed64_); return this; } public Builder ClearRepeatedFixed64() { + PrepareBuilder(); result.repeatedFixed64_.Clear(); return this; } public pbc::IPopsicleList RepeatedInt64List { - get { return result.repeatedInt64_; } + get { return PrepareBuilder().repeatedInt64_; } } public int RepeatedInt64Count { get { return result.RepeatedInt64Count; } @@ -18738,24 +20354,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedInt64(index); } public Builder SetRepeatedInt64(int index, long value) { + PrepareBuilder(); result.repeatedInt64_[index] = value; return this; } public Builder AddRepeatedInt64(long value) { + PrepareBuilder(); result.repeatedInt64_.Add(value); return this; } public Builder AddRangeRepeatedInt64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedInt64_); return this; } public Builder ClearRepeatedInt64() { + PrepareBuilder(); result.repeatedInt64_.Clear(); return this; } public pbc::IPopsicleList RepeatedFloatList { - get { return result.repeatedFloat_; } + get { return PrepareBuilder().repeatedFloat_; } } public int RepeatedFloatCount { get { return result.RepeatedFloatCount; } @@ -18764,25 +20384,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedFloat(index); } public Builder SetRepeatedFloat(int index, float value) { + PrepareBuilder(); result.repeatedFloat_[index] = value; return this; } public Builder AddRepeatedFloat(float value) { + PrepareBuilder(); result.repeatedFloat_.Add(value); return this; } public Builder AddRangeRepeatedFloat(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedFloat_); return this; } public Builder ClearRepeatedFloat() { + PrepareBuilder(); result.repeatedFloat_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedUint64List { - get { return result.repeatedUint64_; } + get { return PrepareBuilder().repeatedUint64_; } } public int RepeatedUint64Count { get { return result.RepeatedUint64Count; } @@ -18793,20 +20417,24 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedUint64(int index, ulong value) { + PrepareBuilder(); result.repeatedUint64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedUint64(ulong value) { + PrepareBuilder(); result.repeatedUint64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedUint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedUint64_); return this; } public Builder ClearRepeatedUint64() { + PrepareBuilder(); result.repeatedUint64_.Clear(); return this; } @@ -18902,7 +20530,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(FooRequest prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -18912,21 +20540,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new FooRequest(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(FooRequest cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - FooRequest result = new FooRequest(); + bool builderIsReadOnly; + FooRequest result; + + private FooRequest PrepareBuilder() { + if (builderIsReadOnly) { + FooRequest original = result; + result = new FooRequest(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override FooRequest MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new FooRequest(); + result = DefaultInstance ?? new FooRequest(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -18938,12 +20593,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override FooRequest BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - FooRequest returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -18957,6 +20611,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(FooRequest other) { if (other == global::Google.ProtocolBuffers.TestProtos.FooRequest.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -18966,6 +20621,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -19100,7 +20756,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(FooResponse prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -19110,21 +20766,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new FooResponse(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(FooResponse cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + FooResponse result; + + private FooResponse PrepareBuilder() { + if (builderIsReadOnly) { + FooResponse original = result; + result = new FooResponse(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - FooResponse result = new FooResponse(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override FooResponse MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new FooResponse(); + result = DefaultInstance ?? new FooResponse(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -19136,12 +20819,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override FooResponse BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - FooResponse returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -19155,6 +20837,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(FooResponse other) { if (other == global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -19164,6 +20847,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -19298,7 +20982,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(BarRequest prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -19308,21 +20992,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new BarRequest(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(BarRequest cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + BarRequest result; + + private BarRequest PrepareBuilder() { + if (builderIsReadOnly) { + BarRequest original = result; + result = new BarRequest(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - BarRequest result = new BarRequest(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override BarRequest MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new BarRequest(); + result = DefaultInstance ?? new BarRequest(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -19334,12 +21045,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override BarRequest BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - BarRequest returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -19353,6 +21063,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(BarRequest other) { if (other == global::Google.ProtocolBuffers.TestProtos.BarRequest.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -19362,6 +21073,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -19496,7 +21208,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(BarResponse prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -19506,21 +21218,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new BarResponse(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(BarResponse cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - BarResponse result = new BarResponse(); + bool builderIsReadOnly; + BarResponse result; + + private BarResponse PrepareBuilder() { + if (builderIsReadOnly) { + BarResponse original = result; + result = new BarResponse(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override BarResponse MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new BarResponse(); + result = DefaultInstance ?? new BarResponse(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -19532,12 +21271,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override BarResponse BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - BarResponse returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -19551,6 +21289,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(BarResponse other) { if (other == global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -19560,6 +21299,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs index ae309fa706..3c5e9307d1 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs @@ -188,7 +188,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(SearchRequest prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -198,21 +198,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new SearchRequest(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(SearchRequest cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + SearchRequest result; - SearchRequest result = new SearchRequest(); + private SearchRequest PrepareBuilder() { + if (builderIsReadOnly) { + SearchRequest original = result; + result = new SearchRequest(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override SearchRequest MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new SearchRequest(); + result = DefaultInstance ?? new SearchRequest(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -224,13 +251,12 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SearchRequest BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.criteria_.MakeReadOnly(); - SearchRequest returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -244,6 +270,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(SearchRequest other) { if (other == global::Google.ProtocolBuffers.TestProtos.SearchRequest.DefaultInstance) return this; + PrepareBuilder(); if (other.criteria_.Count != 0) { base.AddRange(other.criteria_, result.criteria_); } @@ -256,6 +283,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -304,7 +332,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList CriteriaList { - get { return result.criteria_; } + get { return PrepareBuilder().criteria_; } } public int CriteriaCount { get { return result.CriteriaCount; } @@ -314,19 +342,23 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetCriteria(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.criteria_[index] = value; return this; } public Builder AddCriteria(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.criteria_.Add(value); return this; } public Builder AddRangeCriteria(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.criteria_); return this; } public Builder ClearCriteria() { + PrepareBuilder(); result.criteria_.Clear(); return this; } @@ -487,7 +519,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ResultItem prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -497,21 +529,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new ResultItem(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(ResultItem cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + ResultItem result; - ResultItem result = new ResultItem(); + private ResultItem PrepareBuilder() { + if (builderIsReadOnly) { + ResultItem original = result; + result = new ResultItem(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override ResultItem MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new ResultItem(); + result = DefaultInstance ?? new ResultItem(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -523,12 +582,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ResultItem BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - ResultItem returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -542,6 +600,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(ResultItem other) { if (other == global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.DefaultInstance) return this; + PrepareBuilder(); if (other.HasUrl) { Url = other.Url; } @@ -557,6 +616,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -617,11 +677,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetUrl(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasUrl = true; result.url_ = value; return this; } public Builder ClearUrl() { + PrepareBuilder(); result.hasUrl = false; result.url_ = ""; return this; @@ -636,11 +698,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetName(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasName = true; result.name_ = value; return this; } public Builder ClearName() { + PrepareBuilder(); result.hasName = false; result.name_ = ""; return this; @@ -734,7 +798,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(SearchResponse prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -744,21 +808,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new SearchResponse(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(SearchResponse cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + SearchResponse result; - SearchResponse result = new SearchResponse(); + private SearchResponse PrepareBuilder() { + if (builderIsReadOnly) { + SearchResponse original = result; + result = new SearchResponse(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override SearchResponse MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new SearchResponse(); + result = DefaultInstance ?? new SearchResponse(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -770,13 +861,12 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SearchResponse BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.results_.MakeReadOnly(); - SearchResponse returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -790,6 +880,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(SearchResponse other) { if (other == global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance) return this; + PrepareBuilder(); if (other.results_.Count != 0) { base.AddRange(other.results_, result.results_); } @@ -802,6 +893,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -850,7 +942,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList ResultsList { - get { return result.results_; } + get { return PrepareBuilder().results_; } } public int ResultsCount { get { return result.ResultsCount; } @@ -860,29 +952,35 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetResults(int index, global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.results_[index] = value; return this; } public Builder SetResults(int index, global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.results_[index] = builderForValue.Build(); return this; } public Builder AddResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.results_.Add(value); return this; } public Builder AddResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.results_.Add(builderForValue.Build()); return this; } public Builder AddRangeResults(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.results_); return this; } public Builder ClearResults() { + PrepareBuilder(); result.results_.Clear(); return this; } @@ -1019,7 +1117,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(RefineSearchRequest prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1029,21 +1127,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new RefineSearchRequest(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(RefineSearchRequest cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + RefineSearchRequest result; - RefineSearchRequest result = new RefineSearchRequest(); + private RefineSearchRequest PrepareBuilder() { + if (builderIsReadOnly) { + RefineSearchRequest original = result; + result = new RefineSearchRequest(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override RefineSearchRequest MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new RefineSearchRequest(); + result = DefaultInstance ?? new RefineSearchRequest(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1055,13 +1180,12 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RefineSearchRequest BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.criteria_.MakeReadOnly(); - RefineSearchRequest returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1075,6 +1199,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(RefineSearchRequest other) { if (other == global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest.DefaultInstance) return this; + PrepareBuilder(); if (other.criteria_.Count != 0) { base.AddRange(other.criteria_, result.criteria_); } @@ -1090,6 +1215,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1147,7 +1273,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList CriteriaList { - get { return result.criteria_; } + get { return PrepareBuilder().criteria_; } } public int CriteriaCount { get { return result.CriteriaCount; } @@ -1157,19 +1283,23 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetCriteria(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.criteria_[index] = value; return this; } public Builder AddCriteria(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.criteria_.Add(value); return this; } public Builder AddRangeCriteria(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.criteria_); return this; } public Builder ClearCriteria() { + PrepareBuilder(); result.criteria_.Clear(); return this; } @@ -1183,18 +1313,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetPreviousResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasPreviousResults = true; result.previousResults_ = value; return this; } public Builder SetPreviousResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasPreviousResults = true; result.previousResults_ = builderForValue.Build(); return this; } public Builder MergePreviousResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasPreviousResults && result.previousResults_ != global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance) { result.previousResults_ = global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder(result.previousResults_).MergeFrom(value).BuildPartial(); @@ -1205,6 +1338,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearPreviousResults() { + PrepareBuilder(); result.hasPreviousResults = false; result.previousResults_ = global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance; return this; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs index 3d818a6082..c0e53348c2 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs @@ -261,7 +261,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestXmlChild prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -271,21 +271,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestXmlChild(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestXmlChild cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestXmlChild result = new TestXmlChild(); + bool builderIsReadOnly; + TestXmlChild result; + + private TestXmlChild PrepareBuilder() { + if (builderIsReadOnly) { + TestXmlChild original = result; + result = new TestXmlChild(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestXmlChild MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestXmlChild(); + result = DefaultInstance ?? new TestXmlChild(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -297,13 +324,12 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestXmlChild BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.options_.MakeReadOnly(); - TestXmlChild returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -317,6 +343,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestXmlChild other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestXmlChild.DefaultInstance) return this; + PrepareBuilder(); if (other.options_.Count != 0) { base.AddRange(other.options_, result.options_); } @@ -332,6 +359,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -394,7 +422,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList OptionsList { - get { return result.options_; } + get { return PrepareBuilder().options_; } } public int OptionsCount { get { return result.OptionsCount; } @@ -403,18 +431,22 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetOptions(index); } public Builder SetOptions(int index, global::Google.ProtocolBuffers.TestProtos.EnumOptions value) { + PrepareBuilder(); result.options_[index] = value; return this; } public Builder AddOptions(global::Google.ProtocolBuffers.TestProtos.EnumOptions value) { + PrepareBuilder(); result.options_.Add(value); return this; } public Builder AddRangeOptions(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.options_); return this; } public Builder ClearOptions() { + PrepareBuilder(); result.options_.Clear(); return this; } @@ -428,11 +460,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetBinary(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasBinary = true; result.binary_ = value; return this; } public Builder ClearBinary() { + PrepareBuilder(); result.hasBinary = false; result.binary_ = pb::ByteString.Empty; return this; @@ -529,7 +563,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestXmlNoFields prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -539,21 +573,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestXmlNoFields(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestXmlNoFields cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestXmlNoFields result = new TestXmlNoFields(); + bool builderIsReadOnly; + TestXmlNoFields result; + + private TestXmlNoFields PrepareBuilder() { + if (builderIsReadOnly) { + TestXmlNoFields original = result; + result = new TestXmlNoFields(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestXmlNoFields MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestXmlNoFields(); + result = DefaultInstance ?? new TestXmlNoFields(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -565,12 +626,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestXmlNoFields BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestXmlNoFields returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -584,6 +644,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestXmlNoFields other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestXmlNoFields.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -593,6 +654,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -743,7 +805,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestXmlRescursive prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -753,21 +815,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestXmlRescursive(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestXmlRescursive cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestXmlRescursive result = new TestXmlRescursive(); + bool builderIsReadOnly; + TestXmlRescursive result; + + private TestXmlRescursive PrepareBuilder() { + if (builderIsReadOnly) { + TestXmlRescursive original = result; + result = new TestXmlRescursive(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestXmlRescursive MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestXmlRescursive(); + result = DefaultInstance ?? new TestXmlRescursive(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -779,12 +868,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestXmlRescursive BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestXmlRescursive returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -798,6 +886,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestXmlRescursive other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.DefaultInstance) return this; + PrepareBuilder(); if (other.HasChild) { MergeChild(other.Child); } @@ -810,6 +899,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -871,18 +961,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetChild(global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasChild = true; result.child_ = value; return this; } public Builder SetChild(global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasChild = true; result.child_ = builderForValue.Build(); return this; } public Builder MergeChild(global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasChild && result.child_ != global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.DefaultInstance) { result.child_ = global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.CreateBuilder(result.child_).MergeFrom(value).BuildPartial(); @@ -893,6 +986,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearChild() { + PrepareBuilder(); result.hasChild = false; result.child_ = global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.DefaultInstance; return this; @@ -1062,7 +1156,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(Children prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1072,21 +1166,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new Children(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(Children cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - Children result = new Children(); + bool builderIsReadOnly; + Children result; + + private Children PrepareBuilder() { + if (builderIsReadOnly) { + Children original = result; + result = new Children(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override Children MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new Children(); + result = DefaultInstance ?? new Children(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1098,13 +1219,12 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Children BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.options_.MakeReadOnly(); - Children returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1118,6 +1238,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(Children other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children.DefaultInstance) return this; + PrepareBuilder(); if (other.options_.Count != 0) { base.AddRange(other.options_, result.options_); } @@ -1133,6 +1254,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1195,7 +1317,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList OptionsList { - get { return result.options_; } + get { return PrepareBuilder().options_; } } public int OptionsCount { get { return result.OptionsCount; } @@ -1204,18 +1326,22 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetOptions(index); } public Builder SetOptions(int index, global::Google.ProtocolBuffers.TestProtos.EnumOptions value) { + PrepareBuilder(); result.options_[index] = value; return this; } public Builder AddOptions(global::Google.ProtocolBuffers.TestProtos.EnumOptions value) { + PrepareBuilder(); result.options_.Add(value); return this; } public Builder AddRangeOptions(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.options_); return this; } public Builder ClearOptions() { + PrepareBuilder(); result.options_.Clear(); return this; } @@ -1229,11 +1355,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetBinary(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasBinary = true; result.binary_ = value; return this; } public Builder ClearBinary() { + PrepareBuilder(); result.hasBinary = false; result.binary_ = pb::ByteString.Empty; return this; @@ -1438,7 +1566,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestXmlMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1448,21 +1576,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestXmlMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestXmlMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestXmlMessage result = new TestXmlMessage(); + bool builderIsReadOnly; + TestXmlMessage result; + + private TestXmlMessage PrepareBuilder() { + if (builderIsReadOnly) { + TestXmlMessage original = result; + result = new TestXmlMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestXmlMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestXmlMessage(); + result = DefaultInstance ?? new TestXmlMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1474,15 +1629,14 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestXmlMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.numbers_.MakeReadOnly(); result.textlines_.MakeReadOnly(); result.children_.MakeReadOnly(); - TestXmlMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1496,6 +1650,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestXmlMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.DefaultInstance) return this; + PrepareBuilder(); if (other.HasNumber) { Number = other.Number; } @@ -1527,6 +1682,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1612,18 +1768,20 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetNumber(value); } } public Builder SetNumber(long value) { + PrepareBuilder(); result.hasNumber = true; result.number_ = value; return this; } public Builder ClearNumber() { + PrepareBuilder(); result.hasNumber = false; result.number_ = 0L; return this; } public pbc::IPopsicleList NumbersList { - get { return result.numbers_; } + get { return PrepareBuilder().numbers_; } } public int NumbersCount { get { return result.NumbersCount; } @@ -1632,18 +1790,22 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetNumbers(index); } public Builder SetNumbers(int index, int value) { + PrepareBuilder(); result.numbers_[index] = value; return this; } public Builder AddNumbers(int value) { + PrepareBuilder(); result.numbers_.Add(value); return this; } public Builder AddRangeNumbers(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.numbers_); return this; } public Builder ClearNumbers() { + PrepareBuilder(); result.numbers_.Clear(); return this; } @@ -1657,18 +1819,20 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetText(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasText = true; result.text_ = value; return this; } public Builder ClearText() { + PrepareBuilder(); result.hasText = false; result.text_ = ""; return this; } public pbc::IPopsicleList TextlinesList { - get { return result.textlines_; } + get { return PrepareBuilder().textlines_; } } public int TextlinesCount { get { return result.TextlinesCount; } @@ -1678,19 +1842,23 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetTextlines(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.textlines_[index] = value; return this; } public Builder AddTextlines(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.textlines_.Add(value); return this; } public Builder AddRangeTextlines(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.textlines_); return this; } public Builder ClearTextlines() { + PrepareBuilder(); result.textlines_.Clear(); return this; } @@ -1703,11 +1871,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetValid(value); } } public Builder SetValid(bool value) { + PrepareBuilder(); result.hasValid = true; result.valid_ = value; return this; } public Builder ClearValid() { + PrepareBuilder(); result.hasValid = false; result.valid_ = false; return this; @@ -1722,18 +1892,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetChild(global::Google.ProtocolBuffers.TestProtos.TestXmlChild value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasChild = true; result.child_ = value; return this; } public Builder SetChild(global::Google.ProtocolBuffers.TestProtos.TestXmlChild.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasChild = true; result.child_ = builderForValue.Build(); return this; } public Builder MergeChild(global::Google.ProtocolBuffers.TestProtos.TestXmlChild value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasChild && result.child_ != global::Google.ProtocolBuffers.TestProtos.TestXmlChild.DefaultInstance) { result.child_ = global::Google.ProtocolBuffers.TestProtos.TestXmlChild.CreateBuilder(result.child_).MergeFrom(value).BuildPartial(); @@ -1744,13 +1917,14 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearChild() { + PrepareBuilder(); result.hasChild = false; result.child_ = global::Google.ProtocolBuffers.TestProtos.TestXmlChild.DefaultInstance; return this; } public pbc::IPopsicleList ChildrenList { - get { return result.children_; } + get { return PrepareBuilder().children_; } } public int ChildrenCount { get { return result.ChildrenCount; } @@ -1760,29 +1934,35 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetChildren(int index, global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.children_[index] = value; return this; } public Builder SetChildren(int index, global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.children_[index] = builderForValue.Build(); return this; } public Builder AddChildren(global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.children_.Add(value); return this; } public Builder AddChildren(global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.children_.Add(builderForValue.Build()); return this; } public Builder AddRangeChildren(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.children_); return this; } public Builder ClearChildren() { + PrepareBuilder(); result.children_.Clear(); return this; } @@ -1895,7 +2075,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestXmlExtension prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1905,21 +2085,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestXmlExtension(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestXmlExtension cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestXmlExtension result = new TestXmlExtension(); + bool builderIsReadOnly; + TestXmlExtension result; + + private TestXmlExtension PrepareBuilder() { + if (builderIsReadOnly) { + TestXmlExtension original = result; + result = new TestXmlExtension(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestXmlExtension MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestXmlExtension(); + result = DefaultInstance ?? new TestXmlExtension(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1931,12 +2138,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestXmlExtension BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestXmlExtension returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1950,6 +2156,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestXmlExtension other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestXmlExtension.DefaultInstance) return this; + PrepareBuilder(); if (other.HasNumber) { Number = other.Number; } @@ -1962,6 +2169,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -2017,11 +2225,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetNumber(value); } } public Builder SetNumber(int value) { + PrepareBuilder(); result.hasNumber = true; result.number_ = value; return this; } public Builder ClearNumber() { + PrepareBuilder(); result.hasNumber = false; result.number_ = 0; return this; diff --git a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs index 853b0e7d09..0d9109a265 100644 --- a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs +++ b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs @@ -415,7 +415,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(CSharpFileOptions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -425,21 +425,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new CSharpFileOptions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(CSharpFileOptions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + CSharpFileOptions result; - CSharpFileOptions result = new CSharpFileOptions(); + private CSharpFileOptions PrepareBuilder() { + if (builderIsReadOnly) { + CSharpFileOptions original = result; + result = new CSharpFileOptions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override CSharpFileOptions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new CSharpFileOptions(); + result = DefaultInstance ?? new CSharpFileOptions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -451,12 +478,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override CSharpFileOptions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - CSharpFileOptions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -470,6 +496,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(CSharpFileOptions other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.CSharpFileOptions.DefaultInstance) return this; + PrepareBuilder(); if (other.HasNamespace) { Namespace = other.Namespace; } @@ -518,6 +545,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -630,11 +658,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetNamespace(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasNamespace = true; result.namespace_ = value; return this; } public Builder ClearNamespace() { + PrepareBuilder(); result.hasNamespace = false; result.namespace_ = ""; return this; @@ -649,11 +679,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetUmbrellaClassname(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasUmbrellaClassname = true; result.umbrellaClassname_ = value; return this; } public Builder ClearUmbrellaClassname() { + PrepareBuilder(); result.hasUmbrellaClassname = false; result.umbrellaClassname_ = ""; return this; @@ -667,11 +699,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetPublicClasses(value); } } public Builder SetPublicClasses(bool value) { + PrepareBuilder(); result.hasPublicClasses = true; result.publicClasses_ = value; return this; } public Builder ClearPublicClasses() { + PrepareBuilder(); result.hasPublicClasses = false; result.publicClasses_ = true; return this; @@ -685,11 +719,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetMultipleFiles(value); } } public Builder SetMultipleFiles(bool value) { + PrepareBuilder(); result.hasMultipleFiles = true; result.multipleFiles_ = value; return this; } public Builder ClearMultipleFiles() { + PrepareBuilder(); result.hasMultipleFiles = false; result.multipleFiles_ = false; return this; @@ -703,11 +739,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetNestClasses(value); } } public Builder SetNestClasses(bool value) { + PrepareBuilder(); result.hasNestClasses = true; result.nestClasses_ = value; return this; } public Builder ClearNestClasses() { + PrepareBuilder(); result.hasNestClasses = false; result.nestClasses_ = false; return this; @@ -721,11 +759,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetCodeContracts(value); } } public Builder SetCodeContracts(bool value) { + PrepareBuilder(); result.hasCodeContracts = true; result.codeContracts_ = value; return this; } public Builder ClearCodeContracts() { + PrepareBuilder(); result.hasCodeContracts = false; result.codeContracts_ = false; return this; @@ -739,11 +779,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetExpandNamespaceDirectories(value); } } public Builder SetExpandNamespaceDirectories(bool value) { + PrepareBuilder(); result.hasExpandNamespaceDirectories = true; result.expandNamespaceDirectories_ = value; return this; } public Builder ClearExpandNamespaceDirectories() { + PrepareBuilder(); result.hasExpandNamespaceDirectories = false; result.expandNamespaceDirectories_ = false; return this; @@ -757,11 +799,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetClsCompliance(value); } } public Builder SetClsCompliance(bool value) { + PrepareBuilder(); result.hasClsCompliance = true; result.clsCompliance_ = value; return this; } public Builder ClearClsCompliance() { + PrepareBuilder(); result.hasClsCompliance = false; result.clsCompliance_ = true; return this; @@ -776,11 +820,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetFileExtension(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasFileExtension = true; result.fileExtension_ = value; return this; } public Builder ClearFileExtension() { + PrepareBuilder(); result.hasFileExtension = false; result.fileExtension_ = ".cs"; return this; @@ -795,11 +841,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetUmbrellaNamespace(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasUmbrellaNamespace = true; result.umbrellaNamespace_ = value; return this; } public Builder ClearUmbrellaNamespace() { + PrepareBuilder(); result.hasUmbrellaNamespace = false; result.umbrellaNamespace_ = ""; return this; @@ -814,11 +862,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetOutputDirectory(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOutputDirectory = true; result.outputDirectory_ = value; return this; } public Builder ClearOutputDirectory() { + PrepareBuilder(); result.hasOutputDirectory = false; result.outputDirectory_ = "."; return this; @@ -832,11 +882,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetIgnoreGoogleProtobuf(value); } } public Builder SetIgnoreGoogleProtobuf(bool value) { + PrepareBuilder(); result.hasIgnoreGoogleProtobuf = true; result.ignoreGoogleProtobuf_ = value; return this; } public Builder ClearIgnoreGoogleProtobuf() { + PrepareBuilder(); result.hasIgnoreGoogleProtobuf = false; result.ignoreGoogleProtobuf_ = false; return this; @@ -850,11 +902,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetServiceGeneratorType(value); } } public Builder SetServiceGeneratorType(global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType value) { + PrepareBuilder(); result.hasServiceGeneratorType = true; result.serviceGeneratorType_ = value; return this; } public Builder ClearServiceGeneratorType() { + PrepareBuilder(); result.hasServiceGeneratorType = false; result.serviceGeneratorType_ = global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType.NONE; return this; @@ -967,7 +1021,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(CSharpFieldOptions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -977,21 +1031,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new CSharpFieldOptions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(CSharpFieldOptions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + CSharpFieldOptions result; - CSharpFieldOptions result = new CSharpFieldOptions(); + private CSharpFieldOptions PrepareBuilder() { + if (builderIsReadOnly) { + CSharpFieldOptions original = result; + result = new CSharpFieldOptions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override CSharpFieldOptions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new CSharpFieldOptions(); + result = DefaultInstance ?? new CSharpFieldOptions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1003,12 +1084,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override CSharpFieldOptions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - CSharpFieldOptions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1022,6 +1102,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(CSharpFieldOptions other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.CSharpFieldOptions.DefaultInstance) return this; + PrepareBuilder(); if (other.HasPropertyName) { PropertyName = other.PropertyName; } @@ -1034,6 +1115,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1090,11 +1172,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetPropertyName(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasPropertyName = true; result.propertyName_ = value; return this; } public Builder ClearPropertyName() { + PrepareBuilder(); result.hasPropertyName = false; result.propertyName_ = ""; return this; @@ -1207,7 +1291,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(CSharpServiceOptions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1217,21 +1301,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new CSharpServiceOptions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(CSharpServiceOptions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + CSharpServiceOptions result; - CSharpServiceOptions result = new CSharpServiceOptions(); + private CSharpServiceOptions PrepareBuilder() { + if (builderIsReadOnly) { + CSharpServiceOptions original = result; + result = new CSharpServiceOptions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override CSharpServiceOptions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new CSharpServiceOptions(); + result = DefaultInstance ?? new CSharpServiceOptions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1243,12 +1354,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override CSharpServiceOptions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - CSharpServiceOptions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1262,6 +1372,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(CSharpServiceOptions other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceOptions.DefaultInstance) return this; + PrepareBuilder(); if (other.HasInterfaceId) { InterfaceId = other.InterfaceId; } @@ -1274,6 +1385,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1330,11 +1442,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetInterfaceId(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasInterfaceId = true; result.interfaceId_ = value; return this; } public Builder ClearInterfaceId() { + PrepareBuilder(); result.hasInterfaceId = false; result.interfaceId_ = ""; return this; @@ -1447,7 +1561,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(CSharpMethodOptions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1457,21 +1571,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new CSharpMethodOptions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(CSharpMethodOptions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + CSharpMethodOptions result; - CSharpMethodOptions result = new CSharpMethodOptions(); + private CSharpMethodOptions PrepareBuilder() { + if (builderIsReadOnly) { + CSharpMethodOptions original = result; + result = new CSharpMethodOptions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override CSharpMethodOptions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new CSharpMethodOptions(); + result = DefaultInstance ?? new CSharpMethodOptions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1483,12 +1624,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override CSharpMethodOptions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - CSharpMethodOptions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1502,6 +1642,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(CSharpMethodOptions other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.CSharpMethodOptions.DefaultInstance) return this; + PrepareBuilder(); if (other.HasDispatchId) { DispatchId = other.DispatchId; } @@ -1514,6 +1655,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1569,11 +1711,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetDispatchId(value); } } public Builder SetDispatchId(int value) { + PrepareBuilder(); result.hasDispatchId = true; result.dispatchId_ = value; return this; } public Builder ClearDispatchId() { + PrepareBuilder(); result.hasDispatchId = false; result.dispatchId_ = 0; return this; diff --git a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs index 5b48cde198..631ec21fb7 100644 --- a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs +++ b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs @@ -336,7 +336,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(FileDescriptorSet prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -346,21 +346,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new FileDescriptorSet(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(FileDescriptorSet cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + FileDescriptorSet result; - FileDescriptorSet result = new FileDescriptorSet(); + private FileDescriptorSet PrepareBuilder() { + if (builderIsReadOnly) { + FileDescriptorSet original = result; + result = new FileDescriptorSet(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override FileDescriptorSet MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new FileDescriptorSet(); + result = DefaultInstance ?? new FileDescriptorSet(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -372,13 +399,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override FileDescriptorSet BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.file_.MakeReadOnly(); - FileDescriptorSet returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -392,6 +418,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(FileDescriptorSet other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet.DefaultInstance) return this; + PrepareBuilder(); if (other.file_.Count != 0) { base.AddRange(other.file_, result.file_); } @@ -404,6 +431,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -452,7 +480,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public pbc::IPopsicleList FileList { - get { return result.file_; } + get { return PrepareBuilder().file_; } } public int FileCount { get { return result.FileCount; } @@ -462,29 +490,35 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetFile(int index, global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.file_[index] = value; return this; } public Builder SetFile(int index, global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.file_[index] = builderForValue.Build(); return this; } public Builder AddFile(global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.file_.Add(value); return this; } public Builder AddFile(global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.file_.Add(builderForValue.Build()); return this; } public Builder AddRangeFile(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.file_); return this; } public Builder ClearFile() { + PrepareBuilder(); result.file_.Clear(); return this; } @@ -738,7 +772,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(FileDescriptorProto prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -748,21 +782,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new FileDescriptorProto(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(FileDescriptorProto cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - FileDescriptorProto result = new FileDescriptorProto(); + bool builderIsReadOnly; + FileDescriptorProto result; + + private FileDescriptorProto PrepareBuilder() { + if (builderIsReadOnly) { + FileDescriptorProto original = result; + result = new FileDescriptorProto(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override FileDescriptorProto MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new FileDescriptorProto(); + result = DefaultInstance ?? new FileDescriptorProto(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -774,17 +835,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override FileDescriptorProto BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.dependency_.MakeReadOnly(); result.messageType_.MakeReadOnly(); result.enumType_.MakeReadOnly(); result.service_.MakeReadOnly(); result.extension_.MakeReadOnly(); - FileDescriptorProto returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -798,6 +858,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(FileDescriptorProto other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto.DefaultInstance) return this; + PrepareBuilder(); if (other.HasName) { Name = other.Name; } @@ -831,6 +892,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -920,11 +982,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetName(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasName = true; result.name_ = value; return this; } public Builder ClearName() { + PrepareBuilder(); result.hasName = false; result.name_ = ""; return this; @@ -939,18 +1003,20 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetPackage(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasPackage = true; result.package_ = value; return this; } public Builder ClearPackage() { + PrepareBuilder(); result.hasPackage = false; result.package_ = ""; return this; } public pbc::IPopsicleList DependencyList { - get { return result.dependency_; } + get { return PrepareBuilder().dependency_; } } public int DependencyCount { get { return result.DependencyCount; } @@ -960,25 +1026,29 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetDependency(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.dependency_[index] = value; return this; } public Builder AddDependency(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.dependency_.Add(value); return this; } public Builder AddRangeDependency(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.dependency_); return this; } public Builder ClearDependency() { + PrepareBuilder(); result.dependency_.Clear(); return this; } public pbc::IPopsicleList MessageTypeList { - get { return result.messageType_; } + get { return PrepareBuilder().messageType_; } } public int MessageTypeCount { get { return result.MessageTypeCount; } @@ -988,35 +1058,41 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetMessageType(int index, global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.messageType_[index] = value; return this; } public Builder SetMessageType(int index, global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.messageType_[index] = builderForValue.Build(); return this; } public Builder AddMessageType(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.messageType_.Add(value); return this; } public Builder AddMessageType(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.messageType_.Add(builderForValue.Build()); return this; } public Builder AddRangeMessageType(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.messageType_); return this; } public Builder ClearMessageType() { + PrepareBuilder(); result.messageType_.Clear(); return this; } public pbc::IPopsicleList EnumTypeList { - get { return result.enumType_; } + get { return PrepareBuilder().enumType_; } } public int EnumTypeCount { get { return result.EnumTypeCount; } @@ -1026,35 +1102,41 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetEnumType(int index, global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.enumType_[index] = value; return this; } public Builder SetEnumType(int index, global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.enumType_[index] = builderForValue.Build(); return this; } public Builder AddEnumType(global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.enumType_.Add(value); return this; } public Builder AddEnumType(global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.enumType_.Add(builderForValue.Build()); return this; } public Builder AddRangeEnumType(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.enumType_); return this; } public Builder ClearEnumType() { + PrepareBuilder(); result.enumType_.Clear(); return this; } public pbc::IPopsicleList ServiceList { - get { return result.service_; } + get { return PrepareBuilder().service_; } } public int ServiceCount { get { return result.ServiceCount; } @@ -1064,35 +1146,41 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetService(int index, global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.service_[index] = value; return this; } public Builder SetService(int index, global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.service_[index] = builderForValue.Build(); return this; } public Builder AddService(global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.service_.Add(value); return this; } public Builder AddService(global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.service_.Add(builderForValue.Build()); return this; } public Builder AddRangeService(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.service_); return this; } public Builder ClearService() { + PrepareBuilder(); result.service_.Clear(); return this; } public pbc::IPopsicleList ExtensionList { - get { return result.extension_; } + get { return PrepareBuilder().extension_; } } public int ExtensionCount { get { return result.ExtensionCount; } @@ -1102,29 +1190,35 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetExtension(int index, global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.extension_[index] = value; return this; } public Builder SetExtension(int index, global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.extension_[index] = builderForValue.Build(); return this; } public Builder AddExtension(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.extension_.Add(value); return this; } public Builder AddExtension(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.extension_.Add(builderForValue.Build()); return this; } public Builder AddRangeExtension(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.extension_); return this; } public Builder ClearExtension() { + PrepareBuilder(); result.extension_.Clear(); return this; } @@ -1138,18 +1232,21 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.FileOptions value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptions = true; result.options_ = value; return this; } public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptions = true; result.options_ = builderForValue.Build(); return this; } public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.FileOptions value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptions && result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.DefaultInstance) { result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); @@ -1160,6 +1257,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder ClearOptions() { + PrepareBuilder(); result.hasOptions = false; result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.DefaultInstance; return this; @@ -1320,7 +1418,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ExtensionRange prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1330,21 +1428,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new ExtensionRange(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(ExtensionRange cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - ExtensionRange result = new ExtensionRange(); + bool builderIsReadOnly; + ExtensionRange result; + + private ExtensionRange PrepareBuilder() { + if (builderIsReadOnly) { + ExtensionRange original = result; + result = new ExtensionRange(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override ExtensionRange MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new ExtensionRange(); + result = DefaultInstance ?? new ExtensionRange(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1356,12 +1481,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override ExtensionRange BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - ExtensionRange returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1375,6 +1499,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(ExtensionRange other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange.DefaultInstance) return this; + PrepareBuilder(); if (other.HasStart) { Start = other.Start; } @@ -1390,6 +1515,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1449,11 +1575,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetStart(value); } } public Builder SetStart(int value) { + PrepareBuilder(); result.hasStart = true; result.start_ = value; return this; } public Builder ClearStart() { + PrepareBuilder(); result.hasStart = false; result.start_ = 0; return this; @@ -1467,11 +1595,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetEnd(value); } } public Builder SetEnd(int value) { + PrepareBuilder(); result.hasEnd = true; result.end_ = value; return this; } public Builder ClearEnd() { + PrepareBuilder(); result.hasEnd = false; result.end_ = 0; return this; @@ -1681,7 +1811,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(DescriptorProto prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1691,21 +1821,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new DescriptorProto(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(DescriptorProto cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + DescriptorProto result; + + private DescriptorProto PrepareBuilder() { + if (builderIsReadOnly) { + DescriptorProto original = result; + result = new DescriptorProto(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - DescriptorProto result = new DescriptorProto(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override DescriptorProto MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new DescriptorProto(); + result = DefaultInstance ?? new DescriptorProto(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1717,17 +1874,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override DescriptorProto BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.field_.MakeReadOnly(); result.extension_.MakeReadOnly(); result.nestedType_.MakeReadOnly(); result.enumType_.MakeReadOnly(); result.extensionRange_.MakeReadOnly(); - DescriptorProto returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1741,6 +1897,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(DescriptorProto other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.DefaultInstance) return this; + PrepareBuilder(); if (other.HasName) { Name = other.Name; } @@ -1771,6 +1928,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1856,18 +2014,20 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetName(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasName = true; result.name_ = value; return this; } public Builder ClearName() { + PrepareBuilder(); result.hasName = false; result.name_ = ""; return this; } public pbc::IPopsicleList FieldList { - get { return result.field_; } + get { return PrepareBuilder().field_; } } public int FieldCount { get { return result.FieldCount; } @@ -1877,35 +2037,41 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetField(int index, global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field_[index] = value; return this; } public Builder SetField(int index, global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.field_[index] = builderForValue.Build(); return this; } public Builder AddField(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.field_.Add(value); return this; } public Builder AddField(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.field_.Add(builderForValue.Build()); return this; } public Builder AddRangeField(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.field_); return this; } public Builder ClearField() { + PrepareBuilder(); result.field_.Clear(); return this; } public pbc::IPopsicleList ExtensionList { - get { return result.extension_; } + get { return PrepareBuilder().extension_; } } public int ExtensionCount { get { return result.ExtensionCount; } @@ -1915,35 +2081,41 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetExtension(int index, global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.extension_[index] = value; return this; } public Builder SetExtension(int index, global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.extension_[index] = builderForValue.Build(); return this; } public Builder AddExtension(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.extension_.Add(value); return this; } public Builder AddExtension(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.extension_.Add(builderForValue.Build()); return this; } public Builder AddRangeExtension(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.extension_); return this; } public Builder ClearExtension() { + PrepareBuilder(); result.extension_.Clear(); return this; } public pbc::IPopsicleList NestedTypeList { - get { return result.nestedType_; } + get { return PrepareBuilder().nestedType_; } } public int NestedTypeCount { get { return result.NestedTypeCount; } @@ -1953,35 +2125,41 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetNestedType(int index, global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.nestedType_[index] = value; return this; } public Builder SetNestedType(int index, global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.nestedType_[index] = builderForValue.Build(); return this; } public Builder AddNestedType(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.nestedType_.Add(value); return this; } public Builder AddNestedType(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.nestedType_.Add(builderForValue.Build()); return this; } public Builder AddRangeNestedType(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.nestedType_); return this; } public Builder ClearNestedType() { + PrepareBuilder(); result.nestedType_.Clear(); return this; } public pbc::IPopsicleList EnumTypeList { - get { return result.enumType_; } + get { return PrepareBuilder().enumType_; } } public int EnumTypeCount { get { return result.EnumTypeCount; } @@ -1991,35 +2169,41 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetEnumType(int index, global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.enumType_[index] = value; return this; } public Builder SetEnumType(int index, global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.enumType_[index] = builderForValue.Build(); return this; } public Builder AddEnumType(global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.enumType_.Add(value); return this; } public Builder AddEnumType(global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.enumType_.Add(builderForValue.Build()); return this; } public Builder AddRangeEnumType(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.enumType_); return this; } public Builder ClearEnumType() { + PrepareBuilder(); result.enumType_.Clear(); return this; } public pbc::IPopsicleList ExtensionRangeList { - get { return result.extensionRange_; } + get { return PrepareBuilder().extensionRange_; } } public int ExtensionRangeCount { get { return result.ExtensionRangeCount; } @@ -2029,29 +2213,35 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetExtensionRange(int index, global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.extensionRange_[index] = value; return this; } public Builder SetExtensionRange(int index, global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.extensionRange_[index] = builderForValue.Build(); return this; } public Builder AddExtensionRange(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.extensionRange_.Add(value); return this; } public Builder AddExtensionRange(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.extensionRange_.Add(builderForValue.Build()); return this; } public Builder AddRangeExtensionRange(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.extensionRange_); return this; } public Builder ClearExtensionRange() { + PrepareBuilder(); result.extensionRange_.Clear(); return this; } @@ -2065,18 +2255,21 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptions = true; result.options_ = value; return this; } public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptions = true; result.options_ = builderForValue.Build(); return this; } public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptions && result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.DefaultInstance) { result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); @@ -2087,6 +2280,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder ClearOptions() { + PrepareBuilder(); result.hasOptions = false; result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.DefaultInstance; return this; @@ -2353,7 +2547,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(FieldDescriptorProto prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -2363,21 +2557,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new FieldDescriptorProto(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(FieldDescriptorProto cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + FieldDescriptorProto result; - FieldDescriptorProto result = new FieldDescriptorProto(); + private FieldDescriptorProto PrepareBuilder() { + if (builderIsReadOnly) { + FieldDescriptorProto original = result; + result = new FieldDescriptorProto(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override FieldDescriptorProto MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new FieldDescriptorProto(); + result = DefaultInstance ?? new FieldDescriptorProto(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -2389,12 +2610,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override FieldDescriptorProto BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - FieldDescriptorProto returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -2408,6 +2628,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(FieldDescriptorProto other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.DefaultInstance) return this; + PrepareBuilder(); if (other.HasName) { Name = other.Name; } @@ -2441,6 +2662,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -2546,11 +2768,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetName(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasName = true; result.name_ = value; return this; } public Builder ClearName() { + PrepareBuilder(); result.hasName = false; result.name_ = ""; return this; @@ -2564,11 +2788,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetNumber(value); } } public Builder SetNumber(int value) { + PrepareBuilder(); result.hasNumber = true; result.number_ = value; return this; } public Builder ClearNumber() { + PrepareBuilder(); result.hasNumber = false; result.number_ = 0; return this; @@ -2582,11 +2808,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetLabel(value); } } public Builder SetLabel(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Label value) { + PrepareBuilder(); result.hasLabel = true; result.label_ = value; return this; } public Builder ClearLabel() { + PrepareBuilder(); result.hasLabel = false; result.label_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL; return this; @@ -2600,11 +2828,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetType(value); } } public Builder SetType(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Type value) { + PrepareBuilder(); result.hasType = true; result.type_ = value; return this; } public Builder ClearType() { + PrepareBuilder(); result.hasType = false; result.type_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Type.TYPE_DOUBLE; return this; @@ -2619,11 +2849,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetTypeName(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasTypeName = true; result.typeName_ = value; return this; } public Builder ClearTypeName() { + PrepareBuilder(); result.hasTypeName = false; result.typeName_ = ""; return this; @@ -2638,11 +2870,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetExtendee(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasExtendee = true; result.extendee_ = value; return this; } public Builder ClearExtendee() { + PrepareBuilder(); result.hasExtendee = false; result.extendee_ = ""; return this; @@ -2657,11 +2891,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetDefaultValue(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasDefaultValue = true; result.defaultValue_ = value; return this; } public Builder ClearDefaultValue() { + PrepareBuilder(); result.hasDefaultValue = false; result.defaultValue_ = ""; return this; @@ -2676,18 +2912,21 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptions = true; result.options_ = value; return this; } public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptions = true; result.options_ = builderForValue.Build(); return this; } public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptions && result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.DefaultInstance) { result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); @@ -2698,6 +2937,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder ClearOptions() { + PrepareBuilder(); result.hasOptions = false; result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.DefaultInstance; return this; @@ -2850,7 +3090,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(EnumDescriptorProto prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -2860,21 +3100,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new EnumDescriptorProto(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(EnumDescriptorProto cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + EnumDescriptorProto result; + + private EnumDescriptorProto PrepareBuilder() { + if (builderIsReadOnly) { + EnumDescriptorProto original = result; + result = new EnumDescriptorProto(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - EnumDescriptorProto result = new EnumDescriptorProto(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override EnumDescriptorProto MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new EnumDescriptorProto(); + result = DefaultInstance ?? new EnumDescriptorProto(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -2886,13 +3153,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override EnumDescriptorProto BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.value_.MakeReadOnly(); - EnumDescriptorProto returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -2906,6 +3172,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(EnumDescriptorProto other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.DefaultInstance) return this; + PrepareBuilder(); if (other.HasName) { Name = other.Name; } @@ -2924,6 +3191,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -2993,18 +3261,20 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetName(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasName = true; result.name_ = value; return this; } public Builder ClearName() { + PrepareBuilder(); result.hasName = false; result.name_ = ""; return this; } public pbc::IPopsicleList ValueList { - get { return result.value_; } + get { return PrepareBuilder().value_; } } public int ValueCount { get { return result.ValueCount; } @@ -3014,29 +3284,35 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetValue(int index, global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.value_[index] = value; return this; } public Builder SetValue(int index, global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.value_[index] = builderForValue.Build(); return this; } public Builder AddValue(global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.value_.Add(value); return this; } public Builder AddValue(global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.value_.Add(builderForValue.Build()); return this; } public Builder AddRangeValue(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.value_); return this; } public Builder ClearValue() { + PrepareBuilder(); result.value_.Clear(); return this; } @@ -3050,18 +3326,21 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptions = true; result.options_ = value; return this; } public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptions = true; result.options_ = builderForValue.Build(); return this; } public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptions && result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.DefaultInstance) { result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); @@ -3072,6 +3351,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder ClearOptions() { + PrepareBuilder(); result.hasOptions = false; result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.DefaultInstance; return this; @@ -3219,7 +3499,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(EnumValueDescriptorProto prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -3229,21 +3509,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new EnumValueDescriptorProto(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(EnumValueDescriptorProto cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - EnumValueDescriptorProto result = new EnumValueDescriptorProto(); + bool builderIsReadOnly; + EnumValueDescriptorProto result; + + private EnumValueDescriptorProto PrepareBuilder() { + if (builderIsReadOnly) { + EnumValueDescriptorProto original = result; + result = new EnumValueDescriptorProto(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override EnumValueDescriptorProto MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new EnumValueDescriptorProto(); + result = DefaultInstance ?? new EnumValueDescriptorProto(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -3255,12 +3562,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override EnumValueDescriptorProto BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - EnumValueDescriptorProto returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -3274,6 +3580,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(EnumValueDescriptorProto other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto.DefaultInstance) return this; + PrepareBuilder(); if (other.HasName) { Name = other.Name; } @@ -3292,6 +3599,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -3361,11 +3669,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetName(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasName = true; result.name_ = value; return this; } public Builder ClearName() { + PrepareBuilder(); result.hasName = false; result.name_ = ""; return this; @@ -3379,11 +3689,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetNumber(value); } } public Builder SetNumber(int value) { + PrepareBuilder(); result.hasNumber = true; result.number_ = value; return this; } public Builder ClearNumber() { + PrepareBuilder(); result.hasNumber = false; result.number_ = 0; return this; @@ -3398,18 +3710,21 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptions = true; result.options_ = value; return this; } public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptions = true; result.options_ = builderForValue.Build(); return this; } public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptions && result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.DefaultInstance) { result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); @@ -3420,6 +3735,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder ClearOptions() { + PrepareBuilder(); result.hasOptions = false; result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.DefaultInstance; return this; @@ -3572,7 +3888,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ServiceDescriptorProto prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -3582,21 +3898,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new ServiceDescriptorProto(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(ServiceDescriptorProto cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + ServiceDescriptorProto result; + + private ServiceDescriptorProto PrepareBuilder() { + if (builderIsReadOnly) { + ServiceDescriptorProto original = result; + result = new ServiceDescriptorProto(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - ServiceDescriptorProto result = new ServiceDescriptorProto(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override ServiceDescriptorProto MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new ServiceDescriptorProto(); + result = DefaultInstance ?? new ServiceDescriptorProto(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -3608,13 +3951,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override ServiceDescriptorProto BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.method_.MakeReadOnly(); - ServiceDescriptorProto returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -3628,6 +3970,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(ServiceDescriptorProto other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto.DefaultInstance) return this; + PrepareBuilder(); if (other.HasName) { Name = other.Name; } @@ -3646,6 +3989,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -3715,18 +4059,20 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetName(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasName = true; result.name_ = value; return this; } public Builder ClearName() { + PrepareBuilder(); result.hasName = false; result.name_ = ""; return this; } public pbc::IPopsicleList MethodList { - get { return result.method_; } + get { return PrepareBuilder().method_; } } public int MethodCount { get { return result.MethodCount; } @@ -3736,29 +4082,35 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetMethod(int index, global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.method_[index] = value; return this; } public Builder SetMethod(int index, global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.method_[index] = builderForValue.Build(); return this; } public Builder AddMethod(global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.method_.Add(value); return this; } public Builder AddMethod(global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.method_.Add(builderForValue.Build()); return this; } public Builder AddRangeMethod(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.method_); return this; } public Builder ClearMethod() { + PrepareBuilder(); result.method_.Clear(); return this; } @@ -3772,18 +4124,21 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptions = true; result.options_ = value; return this; } public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptions = true; result.options_ = builderForValue.Build(); return this; } public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptions && result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.DefaultInstance) { result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); @@ -3794,6 +4149,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder ClearOptions() { + PrepareBuilder(); result.hasOptions = false; result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.DefaultInstance; return this; @@ -3957,7 +4313,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(MethodDescriptorProto prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -3967,21 +4323,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new MethodDescriptorProto(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(MethodDescriptorProto cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + MethodDescriptorProto result; + + private MethodDescriptorProto PrepareBuilder() { + if (builderIsReadOnly) { + MethodDescriptorProto original = result; + result = new MethodDescriptorProto(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - MethodDescriptorProto result = new MethodDescriptorProto(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override MethodDescriptorProto MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new MethodDescriptorProto(); + result = DefaultInstance ?? new MethodDescriptorProto(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -3993,12 +4376,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override MethodDescriptorProto BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - MethodDescriptorProto returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -4012,6 +4394,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(MethodDescriptorProto other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto.DefaultInstance) return this; + PrepareBuilder(); if (other.HasName) { Name = other.Name; } @@ -4033,6 +4416,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -4106,11 +4490,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetName(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasName = true; result.name_ = value; return this; } public Builder ClearName() { + PrepareBuilder(); result.hasName = false; result.name_ = ""; return this; @@ -4125,11 +4511,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetInputType(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasInputType = true; result.inputType_ = value; return this; } public Builder ClearInputType() { + PrepareBuilder(); result.hasInputType = false; result.inputType_ = ""; return this; @@ -4144,11 +4532,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetOutputType(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOutputType = true; result.outputType_ = value; return this; } public Builder ClearOutputType() { + PrepareBuilder(); result.hasOutputType = false; result.outputType_ = ""; return this; @@ -4163,18 +4553,21 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptions = true; result.options_ = value; return this; } public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptions = true; result.options_ = builderForValue.Build(); return this; } public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptions && result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.DefaultInstance) { result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); @@ -4185,6 +4578,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder ClearOptions() { + PrepareBuilder(); result.hasOptions = false; result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.DefaultInstance; return this; @@ -4434,7 +4828,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(FileOptions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -4444,21 +4838,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new FileOptions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(FileOptions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + FileOptions result; - FileOptions result = new FileOptions(); + private FileOptions PrepareBuilder() { + if (builderIsReadOnly) { + FileOptions original = result; + result = new FileOptions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override FileOptions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new FileOptions(); + result = DefaultInstance ?? new FileOptions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -4470,13 +4891,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override FileOptions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.uninterpretedOption_.MakeReadOnly(); - FileOptions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -4490,6 +4910,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(FileOptions other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.DefaultInstance) return this; + PrepareBuilder(); if (other.HasJavaPackage) { JavaPackage = other.JavaPackage; } @@ -4524,6 +4945,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -4616,11 +5038,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetJavaPackage(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasJavaPackage = true; result.javaPackage_ = value; return this; } public Builder ClearJavaPackage() { + PrepareBuilder(); result.hasJavaPackage = false; result.javaPackage_ = ""; return this; @@ -4635,11 +5059,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetJavaOuterClassname(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasJavaOuterClassname = true; result.javaOuterClassname_ = value; return this; } public Builder ClearJavaOuterClassname() { + PrepareBuilder(); result.hasJavaOuterClassname = false; result.javaOuterClassname_ = ""; return this; @@ -4653,11 +5079,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetJavaMultipleFiles(value); } } public Builder SetJavaMultipleFiles(bool value) { + PrepareBuilder(); result.hasJavaMultipleFiles = true; result.javaMultipleFiles_ = value; return this; } public Builder ClearJavaMultipleFiles() { + PrepareBuilder(); result.hasJavaMultipleFiles = false; result.javaMultipleFiles_ = false; return this; @@ -4671,11 +5099,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetOptimizeFor(value); } } public Builder SetOptimizeFor(global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Types.OptimizeMode value) { + PrepareBuilder(); result.hasOptimizeFor = true; result.optimizeFor_ = value; return this; } public Builder ClearOptimizeFor() { + PrepareBuilder(); result.hasOptimizeFor = false; result.optimizeFor_ = global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Types.OptimizeMode.SPEED; return this; @@ -4689,11 +5119,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetCcGenericServices(value); } } public Builder SetCcGenericServices(bool value) { + PrepareBuilder(); result.hasCcGenericServices = true; result.ccGenericServices_ = value; return this; } public Builder ClearCcGenericServices() { + PrepareBuilder(); result.hasCcGenericServices = false; result.ccGenericServices_ = true; return this; @@ -4707,11 +5139,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetJavaGenericServices(value); } } public Builder SetJavaGenericServices(bool value) { + PrepareBuilder(); result.hasJavaGenericServices = true; result.javaGenericServices_ = value; return this; } public Builder ClearJavaGenericServices() { + PrepareBuilder(); result.hasJavaGenericServices = false; result.javaGenericServices_ = true; return this; @@ -4725,18 +5159,20 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetPyGenericServices(value); } } public Builder SetPyGenericServices(bool value) { + PrepareBuilder(); result.hasPyGenericServices = true; result.pyGenericServices_ = value; return this; } public Builder ClearPyGenericServices() { + PrepareBuilder(); result.hasPyGenericServices = false; result.pyGenericServices_ = true; return this; } public pbc::IPopsicleList UninterpretedOptionList { - get { return result.uninterpretedOption_; } + get { return PrepareBuilder().uninterpretedOption_; } } public int UninterpretedOptionCount { get { return result.UninterpretedOptionCount; } @@ -4746,29 +5182,35 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.uninterpretedOption_[index] = value; return this; } public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.uninterpretedOption_[index] = builderForValue.Build(); return this; } public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.uninterpretedOption_.Add(value); return this; } public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.uninterpretedOption_.Add(builderForValue.Build()); return this; } public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.uninterpretedOption_); return this; } public Builder ClearUninterpretedOption() { + PrepareBuilder(); result.uninterpretedOption_.Clear(); return this; } @@ -4921,7 +5363,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(MessageOptions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -4931,21 +5373,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new MessageOptions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(MessageOptions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - MessageOptions result = new MessageOptions(); + bool builderIsReadOnly; + MessageOptions result; + + private MessageOptions PrepareBuilder() { + if (builderIsReadOnly) { + MessageOptions original = result; + result = new MessageOptions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override MessageOptions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new MessageOptions(); + result = DefaultInstance ?? new MessageOptions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -4957,13 +5426,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override MessageOptions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.uninterpretedOption_.MakeReadOnly(); - MessageOptions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -4977,6 +5445,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(MessageOptions other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.DefaultInstance) return this; + PrepareBuilder(); if (other.HasMessageSetWireFormat) { MessageSetWireFormat = other.MessageSetWireFormat; } @@ -4996,6 +5465,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -5059,11 +5529,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetMessageSetWireFormat(value); } } public Builder SetMessageSetWireFormat(bool value) { + PrepareBuilder(); result.hasMessageSetWireFormat = true; result.messageSetWireFormat_ = value; return this; } public Builder ClearMessageSetWireFormat() { + PrepareBuilder(); result.hasMessageSetWireFormat = false; result.messageSetWireFormat_ = false; return this; @@ -5077,18 +5549,20 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetNoStandardDescriptorAccessor(value); } } public Builder SetNoStandardDescriptorAccessor(bool value) { + PrepareBuilder(); result.hasNoStandardDescriptorAccessor = true; result.noStandardDescriptorAccessor_ = value; return this; } public Builder ClearNoStandardDescriptorAccessor() { + PrepareBuilder(); result.hasNoStandardDescriptorAccessor = false; result.noStandardDescriptorAccessor_ = false; return this; } public pbc::IPopsicleList UninterpretedOptionList { - get { return result.uninterpretedOption_; } + get { return PrepareBuilder().uninterpretedOption_; } } public int UninterpretedOptionCount { get { return result.UninterpretedOptionCount; } @@ -5098,29 +5572,35 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.uninterpretedOption_[index] = value; return this; } public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.uninterpretedOption_[index] = builderForValue.Build(); return this; } public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.uninterpretedOption_.Add(value); return this; } public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.uninterpretedOption_.Add(builderForValue.Build()); return this; } public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.uninterpretedOption_); return this; } public Builder ClearUninterpretedOption() { + PrepareBuilder(); result.uninterpretedOption_.Clear(); return this; } @@ -5321,7 +5801,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(FieldOptions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -5331,21 +5811,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new FieldOptions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(FieldOptions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - FieldOptions result = new FieldOptions(); + bool builderIsReadOnly; + FieldOptions result; + + private FieldOptions PrepareBuilder() { + if (builderIsReadOnly) { + FieldOptions original = result; + result = new FieldOptions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override FieldOptions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new FieldOptions(); + result = DefaultInstance ?? new FieldOptions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -5357,13 +5864,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override FieldOptions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.uninterpretedOption_.MakeReadOnly(); - FieldOptions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -5377,6 +5883,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(FieldOptions other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.DefaultInstance) return this; + PrepareBuilder(); if (other.HasCtype) { Ctype = other.Ctype; } @@ -5402,6 +5909,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -5481,11 +5989,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetCtype(value); } } public Builder SetCtype(global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Types.CType value) { + PrepareBuilder(); result.hasCtype = true; result.ctype_ = value; return this; } public Builder ClearCtype() { + PrepareBuilder(); result.hasCtype = false; result.ctype_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Types.CType.STRING; return this; @@ -5499,11 +6009,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetPacked(value); } } public Builder SetPacked(bool value) { + PrepareBuilder(); result.hasPacked = true; result.packed_ = value; return this; } public Builder ClearPacked() { + PrepareBuilder(); result.hasPacked = false; result.packed_ = false; return this; @@ -5517,11 +6029,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetDeprecated(value); } } public Builder SetDeprecated(bool value) { + PrepareBuilder(); result.hasDeprecated = true; result.deprecated_ = value; return this; } public Builder ClearDeprecated() { + PrepareBuilder(); result.hasDeprecated = false; result.deprecated_ = false; return this; @@ -5536,18 +6050,20 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetExperimentalMapKey(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasExperimentalMapKey = true; result.experimentalMapKey_ = value; return this; } public Builder ClearExperimentalMapKey() { + PrepareBuilder(); result.hasExperimentalMapKey = false; result.experimentalMapKey_ = ""; return this; } public pbc::IPopsicleList UninterpretedOptionList { - get { return result.uninterpretedOption_; } + get { return PrepareBuilder().uninterpretedOption_; } } public int UninterpretedOptionCount { get { return result.UninterpretedOptionCount; } @@ -5557,29 +6073,35 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.uninterpretedOption_[index] = value; return this; } public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.uninterpretedOption_[index] = builderForValue.Build(); return this; } public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.uninterpretedOption_.Add(value); return this; } public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.uninterpretedOption_.Add(builderForValue.Build()); return this; } public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.uninterpretedOption_); return this; } public Builder ClearUninterpretedOption() { + PrepareBuilder(); result.uninterpretedOption_.Clear(); return this; } @@ -5700,7 +6222,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(EnumOptions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -5710,21 +6232,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new EnumOptions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(EnumOptions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + EnumOptions result; + + private EnumOptions PrepareBuilder() { + if (builderIsReadOnly) { + EnumOptions original = result; + result = new EnumOptions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - EnumOptions result = new EnumOptions(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override EnumOptions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new EnumOptions(); + result = DefaultInstance ?? new EnumOptions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -5736,13 +6285,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override EnumOptions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.uninterpretedOption_.MakeReadOnly(); - EnumOptions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -5756,6 +6304,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(EnumOptions other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.DefaultInstance) return this; + PrepareBuilder(); if (other.uninterpretedOption_.Count != 0) { base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); } @@ -5769,6 +6318,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -5817,7 +6367,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public pbc::IPopsicleList UninterpretedOptionList { - get { return result.uninterpretedOption_; } + get { return PrepareBuilder().uninterpretedOption_; } } public int UninterpretedOptionCount { get { return result.UninterpretedOptionCount; } @@ -5827,29 +6377,35 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.uninterpretedOption_[index] = value; return this; } public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.uninterpretedOption_[index] = builderForValue.Build(); return this; } public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.uninterpretedOption_.Add(value); return this; } public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.uninterpretedOption_.Add(builderForValue.Build()); return this; } public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.uninterpretedOption_); return this; } public Builder ClearUninterpretedOption() { + PrepareBuilder(); result.uninterpretedOption_.Clear(); return this; } @@ -5970,7 +6526,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(EnumValueOptions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -5980,21 +6536,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new EnumValueOptions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(EnumValueOptions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + EnumValueOptions result; - EnumValueOptions result = new EnumValueOptions(); + private EnumValueOptions PrepareBuilder() { + if (builderIsReadOnly) { + EnumValueOptions original = result; + result = new EnumValueOptions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override EnumValueOptions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new EnumValueOptions(); + result = DefaultInstance ?? new EnumValueOptions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -6006,13 +6589,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override EnumValueOptions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.uninterpretedOption_.MakeReadOnly(); - EnumValueOptions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -6026,6 +6608,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(EnumValueOptions other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.DefaultInstance) return this; + PrepareBuilder(); if (other.uninterpretedOption_.Count != 0) { base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); } @@ -6039,6 +6622,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -6087,7 +6671,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public pbc::IPopsicleList UninterpretedOptionList { - get { return result.uninterpretedOption_; } + get { return PrepareBuilder().uninterpretedOption_; } } public int UninterpretedOptionCount { get { return result.UninterpretedOptionCount; } @@ -6097,29 +6681,35 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.uninterpretedOption_[index] = value; return this; } public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.uninterpretedOption_[index] = builderForValue.Build(); return this; } public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.uninterpretedOption_.Add(value); return this; } public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.uninterpretedOption_.Add(builderForValue.Build()); return this; } public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.uninterpretedOption_); return this; } public Builder ClearUninterpretedOption() { + PrepareBuilder(); result.uninterpretedOption_.Clear(); return this; } @@ -6240,7 +6830,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ServiceOptions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -6250,21 +6840,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new ServiceOptions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(ServiceOptions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + ServiceOptions result; + + private ServiceOptions PrepareBuilder() { + if (builderIsReadOnly) { + ServiceOptions original = result; + result = new ServiceOptions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - ServiceOptions result = new ServiceOptions(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override ServiceOptions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new ServiceOptions(); + result = DefaultInstance ?? new ServiceOptions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -6276,13 +6893,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override ServiceOptions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.uninterpretedOption_.MakeReadOnly(); - ServiceOptions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -6296,6 +6912,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(ServiceOptions other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.DefaultInstance) return this; + PrepareBuilder(); if (other.uninterpretedOption_.Count != 0) { base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); } @@ -6309,6 +6926,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -6357,7 +6975,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public pbc::IPopsicleList UninterpretedOptionList { - get { return result.uninterpretedOption_; } + get { return PrepareBuilder().uninterpretedOption_; } } public int UninterpretedOptionCount { get { return result.UninterpretedOptionCount; } @@ -6367,29 +6985,35 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.uninterpretedOption_[index] = value; return this; } public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.uninterpretedOption_[index] = builderForValue.Build(); return this; } public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.uninterpretedOption_.Add(value); return this; } public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.uninterpretedOption_.Add(builderForValue.Build()); return this; } public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.uninterpretedOption_); return this; } public Builder ClearUninterpretedOption() { + PrepareBuilder(); result.uninterpretedOption_.Clear(); return this; } @@ -6510,7 +7134,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(MethodOptions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -6520,21 +7144,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new MethodOptions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(MethodOptions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - MethodOptions result = new MethodOptions(); + bool builderIsReadOnly; + MethodOptions result; + + private MethodOptions PrepareBuilder() { + if (builderIsReadOnly) { + MethodOptions original = result; + result = new MethodOptions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override MethodOptions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new MethodOptions(); + result = DefaultInstance ?? new MethodOptions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -6546,13 +7197,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override MethodOptions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.uninterpretedOption_.MakeReadOnly(); - MethodOptions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -6566,6 +7216,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(MethodOptions other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.DefaultInstance) return this; + PrepareBuilder(); if (other.uninterpretedOption_.Count != 0) { base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); } @@ -6579,6 +7230,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -6627,7 +7279,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public pbc::IPopsicleList UninterpretedOptionList { - get { return result.uninterpretedOption_; } + get { return PrepareBuilder().uninterpretedOption_; } } public int UninterpretedOptionCount { get { return result.UninterpretedOptionCount; } @@ -6637,29 +7289,35 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.uninterpretedOption_[index] = value; return this; } public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.uninterpretedOption_[index] = builderForValue.Build(); return this; } public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.uninterpretedOption_.Add(value); return this; } public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.uninterpretedOption_.Add(builderForValue.Build()); return this; } public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.uninterpretedOption_); return this; } public Builder ClearUninterpretedOption() { + PrepareBuilder(); result.uninterpretedOption_.Clear(); return this; } @@ -6821,7 +7479,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(NamePart prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -6831,21 +7489,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new NamePart(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(NamePart cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + NamePart result; + + private NamePart PrepareBuilder() { + if (builderIsReadOnly) { + NamePart original = result; + result = new NamePart(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - NamePart result = new NamePart(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override NamePart MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new NamePart(); + result = DefaultInstance ?? new NamePart(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -6857,12 +7542,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override NamePart BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - NamePart returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -6876,6 +7560,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(NamePart other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart.DefaultInstance) return this; + PrepareBuilder(); if (other.HasNamePart_) { NamePart_ = other.NamePart_; } @@ -6891,6 +7576,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -6951,11 +7637,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetNamePart_(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasNamePart_ = true; result.namePart_ = value; return this; } public Builder ClearNamePart_() { + PrepareBuilder(); result.hasNamePart_ = false; result.namePart_ = ""; return this; @@ -6969,11 +7657,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetIsExtension(value); } } public Builder SetIsExtension(bool value) { + PrepareBuilder(); result.hasIsExtension = true; result.isExtension_ = value; return this; } public Builder ClearIsExtension() { + PrepareBuilder(); result.hasIsExtension = false; result.isExtension_ = false; return this; @@ -7148,7 +7838,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(UninterpretedOption prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -7158,21 +7848,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new UninterpretedOption(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(UninterpretedOption cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + UninterpretedOption result; + + private UninterpretedOption PrepareBuilder() { + if (builderIsReadOnly) { + UninterpretedOption original = result; + result = new UninterpretedOption(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - UninterpretedOption result = new UninterpretedOption(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override UninterpretedOption MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new UninterpretedOption(); + result = DefaultInstance ?? new UninterpretedOption(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -7184,13 +7901,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override UninterpretedOption BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.name_.MakeReadOnly(); - UninterpretedOption returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -7204,6 +7920,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(UninterpretedOption other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.DefaultInstance) return this; + PrepareBuilder(); if (other.name_.Count != 0) { base.AddRange(other.name_, result.name_); } @@ -7231,6 +7948,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -7299,7 +8017,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public pbc::IPopsicleList NameList { - get { return result.name_; } + get { return PrepareBuilder().name_; } } public int NameCount { get { return result.NameCount; } @@ -7309,29 +8027,35 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetName(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.name_[index] = value; return this; } public Builder SetName(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.name_[index] = builderForValue.Build(); return this; } public Builder AddName(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.name_.Add(value); return this; } public Builder AddName(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.name_.Add(builderForValue.Build()); return this; } public Builder AddRangeName(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.name_); return this; } public Builder ClearName() { + PrepareBuilder(); result.name_.Clear(); return this; } @@ -7345,11 +8069,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetIdentifierValue(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasIdentifierValue = true; result.identifierValue_ = value; return this; } public Builder ClearIdentifierValue() { + PrepareBuilder(); result.hasIdentifierValue = false; result.identifierValue_ = ""; return this; @@ -7365,11 +8091,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } [global::System.CLSCompliant(false)] public Builder SetPositiveIntValue(ulong value) { + PrepareBuilder(); result.hasPositiveIntValue = true; result.positiveIntValue_ = value; return this; } public Builder ClearPositiveIntValue() { + PrepareBuilder(); result.hasPositiveIntValue = false; result.positiveIntValue_ = 0UL; return this; @@ -7383,11 +8111,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetNegativeIntValue(value); } } public Builder SetNegativeIntValue(long value) { + PrepareBuilder(); result.hasNegativeIntValue = true; result.negativeIntValue_ = value; return this; } public Builder ClearNegativeIntValue() { + PrepareBuilder(); result.hasNegativeIntValue = false; result.negativeIntValue_ = 0L; return this; @@ -7401,11 +8131,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { set { SetDoubleValue(value); } } public Builder SetDoubleValue(double value) { + PrepareBuilder(); result.hasDoubleValue = true; result.doubleValue_ = value; return this; } public Builder ClearDoubleValue() { + PrepareBuilder(); result.hasDoubleValue = false; result.doubleValue_ = 0D; return this; @@ -7420,11 +8152,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public Builder SetStringValue(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasStringValue = true; result.stringValue_ = value; return this; } public Builder ClearStringValue() { + PrepareBuilder(); result.hasStringValue = false; result.stringValue_ = pb::ByteString.Empty; return this; diff --git a/src/ProtocolBuffers/GeneratedBuilder.cs b/src/ProtocolBuffers/GeneratedBuilder.cs index 94948e495c..2472d2b0ae 100644 --- a/src/ProtocolBuffers/GeneratedBuilder.cs +++ b/src/ProtocolBuffers/GeneratedBuilder.cs @@ -58,12 +58,7 @@ namespace Google.ProtocolBuffers protected internal FieldAccessorTable InternalFieldAccessors { - get { return MessageBeingBuilt.FieldAccessorsFromBuilder; } - } - - public override bool IsInitialized - { - get { return MessageBeingBuilt.IsInitialized; } + get { return DefaultInstanceForType.FieldAccessorsFromBuilder; } } public override IDictionary AllFields @@ -123,7 +118,7 @@ namespace Google.ProtocolBuffers public override MessageDescriptor DescriptorForType { - get { return MessageBeingBuilt.DescriptorForType; } + get { return DefaultInstanceForType.DescriptorForType; } } public override int GetRepeatedFieldCount(FieldDescriptor field) @@ -230,7 +225,7 @@ namespace Google.ProtocolBuffers public override TMessage Build() { // If the message is null, we'll throw a more appropriate exception in BuildPartial. - if (MessageBeingBuilt != null && !IsInitialized) + if (!IsInitialized) { throw new UninitializedMessageException(MessageBeingBuilt); } diff --git a/src/ProtocolBuffers/GeneratedBuilderLite.cs b/src/ProtocolBuffers/GeneratedBuilderLite.cs index cd2b8395c0..165edc10a1 100644 --- a/src/ProtocolBuffers/GeneratedBuilderLite.cs +++ b/src/ProtocolBuffers/GeneratedBuilderLite.cs @@ -61,11 +61,6 @@ namespace Google.ProtocolBuffers public abstract TBuilder MergeFrom(TMessage other); - public override bool IsInitialized - { - get { return MessageBeingBuilt.IsInitialized; } - } - /// /// Adds all of the specified values to the given collection. /// @@ -122,7 +117,7 @@ namespace Google.ProtocolBuffers public override TMessage Build() { // If the message is null, we'll throw a more appropriate exception in BuildPartial. - if (MessageBeingBuilt != null && !IsInitialized) + if (!IsInitialized) { throw new UninitializedMessageException(MessageBeingBuilt); } diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs index a9ee77724b..563cea5ed2 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs @@ -241,7 +241,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(PhoneNumber prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -251,21 +251,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new PhoneNumber(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(PhoneNumber cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + PhoneNumber result; - PhoneNumber result = new PhoneNumber(); + private PhoneNumber PrepareBuilder() { + if (builderIsReadOnly) { + PhoneNumber original = result; + result = new PhoneNumber(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override PhoneNumber MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new PhoneNumber(); + result = DefaultInstance ?? new PhoneNumber(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -277,12 +304,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override PhoneNumber BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - PhoneNumber returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } @@ -295,11 +321,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetNumber(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasNumber = true; result.number_ = value; return this; } public Builder ClearNumber() { + PrepareBuilder(); result.hasNumber = false; result.number_ = ""; return this; @@ -313,11 +341,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetType(value); } } public Builder SetType(global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneType value) { + PrepareBuilder(); result.hasType = true; result.type_ = value; return this; } public Builder ClearType() { + PrepareBuilder(); result.hasType = false; result.type_ = global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneType.HOME; return this; @@ -438,7 +468,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(Addresses prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -448,21 +478,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new Addresses(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(Addresses cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + Addresses result; + + private Addresses PrepareBuilder() { + if (builderIsReadOnly) { + Addresses original = result; + result = new Addresses(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - Addresses result = new Addresses(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override Addresses MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new Addresses(); + result = DefaultInstance ?? new Addresses(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -474,12 +531,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Addresses BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - Addresses returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } @@ -492,11 +548,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetAddress(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasAddress = true; result.address_ = value; return this; } public Builder ClearAddress() { + PrepareBuilder(); result.hasAddress = false; result.address_ = ""; return this; @@ -511,11 +569,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetAddress2(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasAddress2 = true; result.address2_ = value; return this; } public Builder ClearAddress2() { + PrepareBuilder(); result.hasAddress2 = false; result.address2_ = ""; return this; @@ -530,11 +590,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetCity(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasCity = true; result.city_ = value; return this; } public Builder ClearCity() { + PrepareBuilder(); result.hasCity = false; result.city_ = ""; return this; @@ -549,11 +611,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetState(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasState = true; result.state_ = value; return this; } public Builder ClearState() { + PrepareBuilder(); result.hasState = false; result.state_ = ""; return this; @@ -569,11 +633,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetZip(uint value) { + PrepareBuilder(); result.hasZip = true; result.zip_ = value; return this; } public Builder ClearZip() { + PrepareBuilder(); result.hasZip = false; result.zip_ = 0; return this; @@ -687,7 +753,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestInteropPerson prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -697,21 +763,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestInteropPerson(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestInteropPerson cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestInteropPerson result = new TestInteropPerson(); + bool builderIsReadOnly; + TestInteropPerson result; + + private TestInteropPerson PrepareBuilder() { + if (builderIsReadOnly) { + TestInteropPerson original = result; + result = new TestInteropPerson(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestInteropPerson MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestInteropPerson(); + result = DefaultInstance ?? new TestInteropPerson(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -723,15 +816,14 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestInteropPerson BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.codes_.MakeReadOnly(); result.phone_.MakeReadOnly(); result.addresses_.MakeReadOnly(); - TestInteropPerson returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } @@ -744,11 +836,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetName(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasName = true; result.name_ = value; return this; } public Builder ClearName() { + PrepareBuilder(); result.hasName = false; result.name_ = ""; return this; @@ -762,11 +856,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetId(value); } } public Builder SetId(int value) { + PrepareBuilder(); result.hasId = true; result.id_ = value; return this; } public Builder ClearId() { + PrepareBuilder(); result.hasId = false; result.id_ = 0; return this; @@ -781,18 +877,20 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetEmail(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasEmail = true; result.email_ = value; return this; } public Builder ClearEmail() { + PrepareBuilder(); result.hasEmail = false; result.email_ = ""; return this; } public pbc::IPopsicleList CodesList { - get { return result.codes_; } + get { return PrepareBuilder().codes_; } } public int CodesCount { get { return result.CodesCount; } @@ -801,24 +899,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetCodes(index); } public Builder SetCodes(int index, int value) { + PrepareBuilder(); result.codes_[index] = value; return this; } public Builder AddCodes(int value) { + PrepareBuilder(); result.codes_.Add(value); return this; } public Builder AddRangeCodes(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.codes_); return this; } public Builder ClearCodes() { + PrepareBuilder(); result.codes_.Clear(); return this; } public pbc::IPopsicleList PhoneList { - get { return result.phone_; } + get { return PrepareBuilder().phone_; } } public int PhoneCount { get { return result.PhoneCount; } @@ -828,35 +930,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetPhone(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.phone_[index] = value; return this; } public Builder SetPhone(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.phone_[index] = builderForValue.Build(); return this; } public Builder AddPhone(global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.phone_.Add(value); return this; } public Builder AddPhone(global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.phone_.Add(builderForValue.Build()); return this; } public Builder AddRangePhone(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.phone_); return this; } public Builder ClearPhone() { + PrepareBuilder(); result.phone_.Clear(); return this; } public pbc::IPopsicleList AddressesList { - get { return result.addresses_; } + get { return PrepareBuilder().addresses_; } } public int AddressesCount { get { return result.AddressesCount; } @@ -866,29 +974,35 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetAddresses(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.addresses_[index] = value; return this; } public Builder SetAddresses(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.addresses_[index] = builderForValue.Build(); return this; } public Builder AddAddresses(global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.addresses_.Add(value); return this; } public Builder AddAddresses(global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.addresses_.Add(builderForValue.Build()); return this; } public Builder AddRangeAddresses(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.addresses_); return this; } public Builder ClearAddresses() { + PrepareBuilder(); result.addresses_.Clear(); return this; } @@ -967,7 +1081,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestInteropEmployeeId prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -977,21 +1091,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestInteropEmployeeId(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestInteropEmployeeId cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestInteropEmployeeId result; + + private TestInteropEmployeeId PrepareBuilder() { + if (builderIsReadOnly) { + TestInteropEmployeeId original = result; + result = new TestInteropEmployeeId(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestInteropEmployeeId result = new TestInteropEmployeeId(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestInteropEmployeeId MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestInteropEmployeeId(); + result = DefaultInstance ?? new TestInteropEmployeeId(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1003,12 +1144,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestInteropEmployeeId BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestInteropEmployeeId returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } @@ -1021,11 +1161,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetNumber(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasNumber = true; result.number_ = value; return this; } public Builder ClearNumber() { + PrepareBuilder(); result.hasNumber = false; result.number_ = ""; return this; @@ -1147,7 +1289,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(SubA prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1157,21 +1299,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new SubA(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(SubA cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + SubA result; - SubA result = new SubA(); + private SubA PrepareBuilder() { + if (builderIsReadOnly) { + SubA original = result; + result = new SubA(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override SubA MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new SubA(); + result = DefaultInstance ?? new SubA(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1183,13 +1352,12 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SubA BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.values_.MakeReadOnly(); - SubA returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } @@ -1201,18 +1369,20 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetCount(value); } } public Builder SetCount(int value) { + PrepareBuilder(); result.hasCount = true; result.count_ = value; return this; } public Builder ClearCount() { + PrepareBuilder(); result.hasCount = false; result.count_ = 0; return this; } public pbc::IPopsicleList ValuesList { - get { return result.values_; } + get { return PrepareBuilder().values_; } } public int ValuesCount { get { return result.ValuesCount; } @@ -1222,19 +1392,23 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetValues(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.values_[index] = value; return this; } public Builder AddValues(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.values_.Add(value); return this; } public Builder AddRangeValues(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.values_); return this; } public Builder ClearValues() { + PrepareBuilder(); result.values_.Clear(); return this; } @@ -1321,7 +1495,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestMissingFieldsA prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1331,21 +1505,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestMissingFieldsA(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestMissingFieldsA cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestMissingFieldsA result; + + private TestMissingFieldsA PrepareBuilder() { + if (builderIsReadOnly) { + TestMissingFieldsA original = result; + result = new TestMissingFieldsA(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestMissingFieldsA result = new TestMissingFieldsA(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestMissingFieldsA MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestMissingFieldsA(); + result = DefaultInstance ?? new TestMissingFieldsA(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1357,12 +1558,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMissingFieldsA BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestMissingFieldsA returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } @@ -1375,11 +1575,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetName(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasName = true; result.name_ = value; return this; } public Builder ClearName() { + PrepareBuilder(); result.hasName = false; result.name_ = ""; return this; @@ -1393,11 +1595,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetId(value); } } public Builder SetId(int value) { + PrepareBuilder(); result.hasId = true; result.id_ = value; return this; } public Builder ClearId() { + PrepareBuilder(); result.hasId = false; result.id_ = 0; return this; @@ -1412,11 +1616,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetEmail(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasEmail = true; result.email_ = value; return this; } public Builder ClearEmail() { + PrepareBuilder(); result.hasEmail = false; result.email_ = ""; return this; @@ -1431,18 +1637,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetTestA(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasTestA = true; result.testA_ = value; return this; } public Builder SetTestA(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasTestA = true; result.testA_ = builderForValue.Build(); return this; } public Builder MergeTestA(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasTestA && result.testA_ != global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.DefaultInstance) { result.testA_ = global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.CreateBuilder(result.testA_).MergeFrom(value).BuildPartial(); @@ -1453,6 +1662,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearTestA() { + PrepareBuilder(); result.hasTestA = false; result.testA_ = global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.DefaultInstance; return this; @@ -1564,7 +1774,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(SubB prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1574,21 +1784,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new SubB(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(SubB cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + SubB result; - SubB result = new SubB(); + private SubB PrepareBuilder() { + if (builderIsReadOnly) { + SubB original = result; + result = new SubB(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override SubB MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new SubB(); + result = DefaultInstance ?? new SubB(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1600,18 +1837,17 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SubB BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.values_.MakeReadOnly(); - SubB returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public pbc::IPopsicleList ValuesList { - get { return result.values_; } + get { return PrepareBuilder().values_; } } public int ValuesCount { get { return result.ValuesCount; } @@ -1621,19 +1857,23 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetValues(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.values_[index] = value; return this; } public Builder AddValues(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.values_.Add(value); return this; } public Builder AddRangeValues(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.values_); return this; } public Builder ClearValues() { + PrepareBuilder(); result.values_.Clear(); return this; } @@ -1720,7 +1960,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestMissingFieldsB prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1730,21 +1970,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestMissingFieldsB(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestMissingFieldsB cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestMissingFieldsB result; + + private TestMissingFieldsB PrepareBuilder() { + if (builderIsReadOnly) { + TestMissingFieldsB original = result; + result = new TestMissingFieldsB(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestMissingFieldsB result = new TestMissingFieldsB(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestMissingFieldsB MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestMissingFieldsB(); + result = DefaultInstance ?? new TestMissingFieldsB(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1756,12 +2023,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMissingFieldsB BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestMissingFieldsB returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } @@ -1774,11 +2040,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetName(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasName = true; result.name_ = value; return this; } public Builder ClearName() { + PrepareBuilder(); result.hasName = false; result.name_ = ""; return this; @@ -1792,11 +2060,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetId(value); } } public Builder SetId(int value) { + PrepareBuilder(); result.hasId = true; result.id_ = value; return this; } public Builder ClearId() { + PrepareBuilder(); result.hasId = false; result.id_ = 0; return this; @@ -1811,11 +2081,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetWebsite(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasWebsite = true; result.website_ = value; return this; } public Builder ClearWebsite() { + PrepareBuilder(); result.hasWebsite = false; result.website_ = ""; return this; @@ -1830,18 +2102,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetTestB(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasTestB = true; result.testB_ = value; return this; } public Builder SetTestB(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasTestB = true; result.testB_ = builderForValue.Build(); return this; } public Builder MergeTestB(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasTestB && result.testB_ != global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB.DefaultInstance) { result.testB_ = global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB.CreateBuilder(result.testB_).MergeFrom(value).BuildPartial(); @@ -1852,6 +2127,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearTestB() { + PrepareBuilder(); result.hasTestB = false; result.testB_ = global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB.DefaultInstance; return this; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs index bc214e2565..cbbc50db22 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs @@ -187,7 +187,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestRequiredLite prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -197,21 +197,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestRequiredLite(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestRequiredLite cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestRequiredLite result; + + private TestRequiredLite PrepareBuilder() { + if (builderIsReadOnly) { + TestRequiredLite original = result; + result = new TestRequiredLite(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestRequiredLite result = new TestRequiredLite(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestRequiredLite MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestRequiredLite(); + result = DefaultInstance ?? new TestRequiredLite(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override TestRequiredLite DefaultInstanceForType { @@ -219,12 +246,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRequiredLite BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestRequiredLite returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -238,6 +264,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestRequiredLite other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestRequiredLite.DefaultInstance) return this; + PrepareBuilder(); if (other.HasD) { D = other.D; } @@ -252,6 +279,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -302,11 +330,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetD(value); } } public Builder SetD(int value) { + PrepareBuilder(); result.hasD = true; result.d_ = value; return this; } public Builder ClearD() { + PrepareBuilder(); result.hasD = false; result.d_ = 0; return this; @@ -320,11 +350,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetEn(value); } } public Builder SetEn(global::Google.ProtocolBuffers.TestProtos.ExtraEnum value) { + PrepareBuilder(); result.hasEn = true; result.en_ = value; return this; } public Builder ClearEn() { + PrepareBuilder(); result.hasEn = false; result.en_ = global::Google.ProtocolBuffers.TestProtos.ExtraEnum.DEFAULT; return this; @@ -498,7 +530,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(PhoneNumber prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -508,21 +540,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new PhoneNumber(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(PhoneNumber cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - PhoneNumber result = new PhoneNumber(); + bool builderIsReadOnly; + PhoneNumber result; + + private PhoneNumber PrepareBuilder() { + if (builderIsReadOnly) { + PhoneNumber original = result; + result = new PhoneNumber(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override PhoneNumber MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new PhoneNumber(); + result = DefaultInstance ?? new PhoneNumber(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override PhoneNumber DefaultInstanceForType { @@ -530,12 +589,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override PhoneNumber BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - PhoneNumber returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -549,6 +607,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(PhoneNumber other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber.DefaultInstance) return this; + PrepareBuilder(); if (other.HasNumber) { Number = other.Number; } @@ -563,6 +622,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -614,11 +674,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetNumber(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasNumber = true; result.number_ = value; return this; } public Builder ClearNumber() { + PrepareBuilder(); result.hasNumber = false; result.number_ = ""; return this; @@ -632,11 +694,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetType(value); } } public Builder SetType(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneType value) { + PrepareBuilder(); result.hasType = true; result.type_ = value; return this; } public Builder ClearType() { + PrepareBuilder(); result.hasType = false; result.type_ = global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneType.HOME; return this; @@ -839,7 +903,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(Addresses prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -849,21 +913,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new Addresses(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(Addresses cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + Addresses result; - Addresses result = new Addresses(); + private Addresses PrepareBuilder() { + if (builderIsReadOnly) { + Addresses original = result; + result = new Addresses(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override Addresses MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new Addresses(); + result = DefaultInstance ?? new Addresses(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override Addresses DefaultInstanceForType { @@ -871,12 +962,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Addresses BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - Addresses returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -890,6 +980,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(Addresses other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses.DefaultInstance) return this; + PrepareBuilder(); if (other.HasAddress) { Address = other.Address; } @@ -913,6 +1004,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -972,11 +1064,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetAddress(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasAddress = true; result.address_ = value; return this; } public Builder ClearAddress() { + PrepareBuilder(); result.hasAddress = false; result.address_ = ""; return this; @@ -991,11 +1085,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetAddress2(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasAddress2 = true; result.address2_ = value; return this; } public Builder ClearAddress2() { + PrepareBuilder(); result.hasAddress2 = false; result.address2_ = ""; return this; @@ -1010,11 +1106,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetCity(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasCity = true; result.city_ = value; return this; } public Builder ClearCity() { + PrepareBuilder(); result.hasCity = false; result.city_ = ""; return this; @@ -1029,11 +1127,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetState(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasState = true; result.state_ = value; return this; } public Builder ClearState() { + PrepareBuilder(); result.hasState = false; result.state_ = ""; return this; @@ -1049,11 +1149,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetZip(uint value) { + PrepareBuilder(); result.hasZip = true; result.zip_ = value; return this; } public Builder ClearZip() { + PrepareBuilder(); result.hasZip = false; result.zip_ = 0; return this; @@ -1290,7 +1392,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestInteropPersonLite prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1300,21 +1402,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestInteropPersonLite(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestInteropPersonLite cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestInteropPersonLite result = new TestInteropPersonLite(); + bool builderIsReadOnly; + TestInteropPersonLite result; + + private TestInteropPersonLite PrepareBuilder() { + if (builderIsReadOnly) { + TestInteropPersonLite original = result; + result = new TestInteropPersonLite(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestInteropPersonLite MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestInteropPersonLite(); + result = DefaultInstance ?? new TestInteropPersonLite(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override TestInteropPersonLite DefaultInstanceForType { @@ -1322,15 +1451,14 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestInteropPersonLite BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.codes_.MakeReadOnly(); result.phone_.MakeReadOnly(); result.addresses_.MakeReadOnly(); - TestInteropPersonLite returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -1344,6 +1472,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestInteropPersonLite other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.DefaultInstance) return this; + PrepareBuilder(); if (other.HasName) { Name = other.Name; } @@ -1371,6 +1500,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -1435,11 +1565,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetName(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasName = true; result.name_ = value; return this; } public Builder ClearName() { + PrepareBuilder(); result.hasName = false; result.name_ = ""; return this; @@ -1453,11 +1585,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetId(value); } } public Builder SetId(int value) { + PrepareBuilder(); result.hasId = true; result.id_ = value; return this; } public Builder ClearId() { + PrepareBuilder(); result.hasId = false; result.id_ = 0; return this; @@ -1472,18 +1606,20 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetEmail(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasEmail = true; result.email_ = value; return this; } public Builder ClearEmail() { + PrepareBuilder(); result.hasEmail = false; result.email_ = ""; return this; } public pbc::IPopsicleList CodesList { - get { return result.codes_; } + get { return PrepareBuilder().codes_; } } public int CodesCount { get { return result.CodesCount; } @@ -1492,24 +1628,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetCodes(index); } public Builder SetCodes(int index, int value) { + PrepareBuilder(); result.codes_[index] = value; return this; } public Builder AddCodes(int value) { + PrepareBuilder(); result.codes_.Add(value); return this; } public Builder AddRangeCodes(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.codes_); return this; } public Builder ClearCodes() { + PrepareBuilder(); result.codes_.Clear(); return this; } public pbc::IPopsicleList PhoneList { - get { return result.phone_; } + get { return PrepareBuilder().phone_; } } public int PhoneCount { get { return result.PhoneCount; } @@ -1519,35 +1659,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetPhone(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.phone_[index] = value; return this; } public Builder SetPhone(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.phone_[index] = builderForValue.Build(); return this; } public Builder AddPhone(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.phone_.Add(value); return this; } public Builder AddPhone(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.phone_.Add(builderForValue.Build()); return this; } public Builder AddRangePhone(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.phone_); return this; } public Builder ClearPhone() { + PrepareBuilder(); result.phone_.Clear(); return this; } public pbc::IPopsicleList AddressesList { - get { return result.addresses_; } + get { return PrepareBuilder().addresses_; } } public int AddressesCount { get { return result.AddressesCount; } @@ -1557,29 +1703,35 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetAddresses(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.addresses_[index] = value; return this; } public Builder SetAddresses(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.addresses_[index] = builderForValue.Build(); return this; } public Builder AddAddresses(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.addresses_.Add(value); return this; } public Builder AddAddresses(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.addresses_.Add(builderForValue.Build()); return this; } public Builder AddRangeAddresses(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.addresses_); return this; } public Builder ClearAddresses() { + PrepareBuilder(); result.addresses_.Clear(); return this; } @@ -1701,7 +1853,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestInteropEmployeeIdLite prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1711,21 +1863,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestInteropEmployeeIdLite(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestInteropEmployeeIdLite cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestInteropEmployeeIdLite result = new TestInteropEmployeeIdLite(); + bool builderIsReadOnly; + TestInteropEmployeeIdLite result; + + private TestInteropEmployeeIdLite PrepareBuilder() { + if (builderIsReadOnly) { + TestInteropEmployeeIdLite original = result; + result = new TestInteropEmployeeIdLite(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestInteropEmployeeIdLite MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestInteropEmployeeIdLite(); + result = DefaultInstance ?? new TestInteropEmployeeIdLite(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override TestInteropEmployeeIdLite DefaultInstanceForType { @@ -1733,12 +1912,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestInteropEmployeeIdLite BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestInteropEmployeeIdLite returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -1752,6 +1930,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestInteropEmployeeIdLite other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestInteropEmployeeIdLite.DefaultInstance) return this; + PrepareBuilder(); if (other.HasNumber) { Number = other.Number; } @@ -1763,6 +1942,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -1806,11 +1986,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetNumber(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasNumber = true; result.number_ = value; return this; } public Builder ClearNumber() { + PrepareBuilder(); result.hasNumber = false; result.number_ = ""; return this; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs index a96833bef0..0df40f4248 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs @@ -150,7 +150,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ImportMessageLite prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -160,21 +160,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new ImportMessageLite(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(ImportMessageLite cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + ImportMessageLite result; - ImportMessageLite result = new ImportMessageLite(); + private ImportMessageLite PrepareBuilder() { + if (builderIsReadOnly) { + ImportMessageLite original = result; + result = new ImportMessageLite(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override ImportMessageLite MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new ImportMessageLite(); + result = DefaultInstance ?? new ImportMessageLite(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override ImportMessageLite DefaultInstanceForType { @@ -182,12 +209,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ImportMessageLite BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - ImportMessageLite returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -201,6 +227,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(ImportMessageLite other) { if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance) return this; + PrepareBuilder(); if (other.HasD) { D = other.D; } @@ -212,6 +239,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -254,11 +282,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetD(value); } } public Builder SetD(int value) { + PrepareBuilder(); result.hasD = true; result.d_ = value; return this; } public Builder ClearD() { + PrepareBuilder(); result.hasD = false; result.d_ = 0; return this; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs index 5749c97f88..75e746a840 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs @@ -169,7 +169,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ImportMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -179,21 +179,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new ImportMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(ImportMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + ImportMessage result; - ImportMessage result = new ImportMessage(); + private ImportMessage PrepareBuilder() { + if (builderIsReadOnly) { + ImportMessage original = result; + result = new ImportMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override ImportMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new ImportMessage(); + result = DefaultInstance ?? new ImportMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -205,12 +232,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ImportMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - ImportMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -224,6 +250,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(ImportMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance) return this; + PrepareBuilder(); if (other.HasD) { D = other.D; } @@ -236,6 +263,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -291,11 +319,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetD(value); } } public Builder SetD(int value) { + PrepareBuilder(); result.hasD = true; result.d_ = value; return this; } public Builder ClearD() { + PrepareBuilder(); result.hasD = false; result.d_ = 0; return this; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs index 7c2836cdb3..5a6033a185 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs @@ -139,7 +139,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestLiteImportsNonlite prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -149,21 +149,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestLiteImportsNonlite(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestLiteImportsNonlite cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestLiteImportsNonlite result; - TestLiteImportsNonlite result = new TestLiteImportsNonlite(); + private TestLiteImportsNonlite PrepareBuilder() { + if (builderIsReadOnly) { + TestLiteImportsNonlite original = result; + result = new TestLiteImportsNonlite(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestLiteImportsNonlite MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestLiteImportsNonlite(); + result = DefaultInstance ?? new TestLiteImportsNonlite(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override TestLiteImportsNonlite DefaultInstanceForType { @@ -171,12 +198,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestLiteImportsNonlite BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestLiteImportsNonlite returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -190,6 +216,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestLiteImportsNonlite other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestLiteImportsNonlite.DefaultInstance) return this; + PrepareBuilder(); if (other.HasMessage) { MergeMessage(other.Message); } @@ -201,6 +228,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -249,18 +277,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasMessage = true; result.message_ = value; return this; } public Builder SetMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasMessage = true; result.message_ = builderForValue.Build(); return this; } public Builder MergeMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasMessage && result.message_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance) { result.message_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.CreateBuilder(result.message_).MergeFrom(value).BuildPartial(); @@ -271,6 +302,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearMessage() { + PrepareBuilder(); result.hasMessage = false; result.message_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance; return this; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs index 78bed7e204..2592c83333 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs @@ -1367,7 +1367,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(NestedMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1377,21 +1377,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new NestedMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(NestedMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + NestedMessage result; + + private NestedMessage PrepareBuilder() { + if (builderIsReadOnly) { + NestedMessage original = result; + result = new NestedMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - NestedMessage result = new NestedMessage(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override NestedMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new NestedMessage(); + result = DefaultInstance ?? new NestedMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override NestedMessage DefaultInstanceForType { @@ -1399,12 +1426,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override NestedMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - NestedMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -1418,6 +1444,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(NestedMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance) return this; + PrepareBuilder(); if (other.HasBb) { Bb = other.Bb; } @@ -1429,6 +1456,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -1471,11 +1499,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetBb(value); } } public Builder SetBb(int value) { + PrepareBuilder(); result.hasBb = true; result.bb_ = value; return this; } public Builder ClearBb() { + PrepareBuilder(); result.hasBb = false; result.bb_ = 0; return this; @@ -1597,7 +1627,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(OptionalGroup prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1607,21 +1637,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new OptionalGroup(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(OptionalGroup cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + OptionalGroup result; + + private OptionalGroup PrepareBuilder() { + if (builderIsReadOnly) { + OptionalGroup original = result; + result = new OptionalGroup(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - OptionalGroup result = new OptionalGroup(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override OptionalGroup MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new OptionalGroup(); + result = DefaultInstance ?? new OptionalGroup(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override OptionalGroup DefaultInstanceForType { @@ -1629,12 +1686,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - OptionalGroup returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -1648,6 +1704,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(OptionalGroup other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -1659,6 +1716,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -1701,11 +1759,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -1827,7 +1887,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(RepeatedGroup prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1837,21 +1897,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new RepeatedGroup(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(RepeatedGroup cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + RepeatedGroup result; + + private RepeatedGroup PrepareBuilder() { + if (builderIsReadOnly) { + RepeatedGroup original = result; + result = new RepeatedGroup(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - RepeatedGroup result = new RepeatedGroup(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override RepeatedGroup MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new RepeatedGroup(); + result = DefaultInstance ?? new RepeatedGroup(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override RepeatedGroup DefaultInstanceForType { @@ -1859,12 +1946,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - RepeatedGroup returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -1878,6 +1964,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(RepeatedGroup other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -1889,6 +1976,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -1931,11 +2019,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -3542,7 +3632,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestAllTypesLite prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -3552,21 +3642,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestAllTypesLite(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestAllTypesLite cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestAllTypesLite result = new TestAllTypesLite(); + bool builderIsReadOnly; + TestAllTypesLite result; + + private TestAllTypesLite PrepareBuilder() { + if (builderIsReadOnly) { + TestAllTypesLite original = result; + result = new TestAllTypesLite(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestAllTypesLite MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestAllTypesLite(); + result = DefaultInstance ?? new TestAllTypesLite(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override TestAllTypesLite DefaultInstanceForType { @@ -3574,8 +3691,8 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllTypesLite BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.repeatedInt32_.MakeReadOnly(); result.repeatedInt64_.MakeReadOnly(); @@ -3601,9 +3718,8 @@ namespace Google.ProtocolBuffers.TestProtos { result.repeatedImportEnum_.MakeReadOnly(); result.repeatedStringPiece_.MakeReadOnly(); result.repeatedCord_.MakeReadOnly(); - TestAllTypesLite returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -3617,6 +3733,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestAllTypesLite other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.DefaultInstance) return this; + PrepareBuilder(); if (other.HasOptionalInt32) { OptionalInt32 = other.OptionalInt32; } @@ -3829,6 +3946,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -4202,11 +4320,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalInt32(value); } } public Builder SetOptionalInt32(int value) { + PrepareBuilder(); result.hasOptionalInt32 = true; result.optionalInt32_ = value; return this; } public Builder ClearOptionalInt32() { + PrepareBuilder(); result.hasOptionalInt32 = false; result.optionalInt32_ = 0; return this; @@ -4220,11 +4340,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalInt64(value); } } public Builder SetOptionalInt64(long value) { + PrepareBuilder(); result.hasOptionalInt64 = true; result.optionalInt64_ = value; return this; } public Builder ClearOptionalInt64() { + PrepareBuilder(); result.hasOptionalInt64 = false; result.optionalInt64_ = 0L; return this; @@ -4240,11 +4362,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetOptionalUint32(uint value) { + PrepareBuilder(); result.hasOptionalUint32 = true; result.optionalUint32_ = value; return this; } public Builder ClearOptionalUint32() { + PrepareBuilder(); result.hasOptionalUint32 = false; result.optionalUint32_ = 0; return this; @@ -4260,11 +4384,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetOptionalUint64(ulong value) { + PrepareBuilder(); result.hasOptionalUint64 = true; result.optionalUint64_ = value; return this; } public Builder ClearOptionalUint64() { + PrepareBuilder(); result.hasOptionalUint64 = false; result.optionalUint64_ = 0UL; return this; @@ -4278,11 +4404,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalSint32(value); } } public Builder SetOptionalSint32(int value) { + PrepareBuilder(); result.hasOptionalSint32 = true; result.optionalSint32_ = value; return this; } public Builder ClearOptionalSint32() { + PrepareBuilder(); result.hasOptionalSint32 = false; result.optionalSint32_ = 0; return this; @@ -4296,11 +4424,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalSint64(value); } } public Builder SetOptionalSint64(long value) { + PrepareBuilder(); result.hasOptionalSint64 = true; result.optionalSint64_ = value; return this; } public Builder ClearOptionalSint64() { + PrepareBuilder(); result.hasOptionalSint64 = false; result.optionalSint64_ = 0; return this; @@ -4316,11 +4446,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetOptionalFixed32(uint value) { + PrepareBuilder(); result.hasOptionalFixed32 = true; result.optionalFixed32_ = value; return this; } public Builder ClearOptionalFixed32() { + PrepareBuilder(); result.hasOptionalFixed32 = false; result.optionalFixed32_ = 0; return this; @@ -4336,11 +4468,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetOptionalFixed64(ulong value) { + PrepareBuilder(); result.hasOptionalFixed64 = true; result.optionalFixed64_ = value; return this; } public Builder ClearOptionalFixed64() { + PrepareBuilder(); result.hasOptionalFixed64 = false; result.optionalFixed64_ = 0; return this; @@ -4354,11 +4488,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalSfixed32(value); } } public Builder SetOptionalSfixed32(int value) { + PrepareBuilder(); result.hasOptionalSfixed32 = true; result.optionalSfixed32_ = value; return this; } public Builder ClearOptionalSfixed32() { + PrepareBuilder(); result.hasOptionalSfixed32 = false; result.optionalSfixed32_ = 0; return this; @@ -4372,11 +4508,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalSfixed64(value); } } public Builder SetOptionalSfixed64(long value) { + PrepareBuilder(); result.hasOptionalSfixed64 = true; result.optionalSfixed64_ = value; return this; } public Builder ClearOptionalSfixed64() { + PrepareBuilder(); result.hasOptionalSfixed64 = false; result.optionalSfixed64_ = 0; return this; @@ -4390,11 +4528,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalFloat(value); } } public Builder SetOptionalFloat(float value) { + PrepareBuilder(); result.hasOptionalFloat = true; result.optionalFloat_ = value; return this; } public Builder ClearOptionalFloat() { + PrepareBuilder(); result.hasOptionalFloat = false; result.optionalFloat_ = 0F; return this; @@ -4408,11 +4548,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalDouble(value); } } public Builder SetOptionalDouble(double value) { + PrepareBuilder(); result.hasOptionalDouble = true; result.optionalDouble_ = value; return this; } public Builder ClearOptionalDouble() { + PrepareBuilder(); result.hasOptionalDouble = false; result.optionalDouble_ = 0D; return this; @@ -4426,11 +4568,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalBool(value); } } public Builder SetOptionalBool(bool value) { + PrepareBuilder(); result.hasOptionalBool = true; result.optionalBool_ = value; return this; } public Builder ClearOptionalBool() { + PrepareBuilder(); result.hasOptionalBool = false; result.optionalBool_ = false; return this; @@ -4445,11 +4589,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalString(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalString = true; result.optionalString_ = value; return this; } public Builder ClearOptionalString() { + PrepareBuilder(); result.hasOptionalString = false; result.optionalString_ = ""; return this; @@ -4464,11 +4610,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalBytes(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalBytes = true; result.optionalBytes_ = value; return this; } public Builder ClearOptionalBytes() { + PrepareBuilder(); result.hasOptionalBytes = false; result.optionalBytes_ = pb::ByteString.Empty; return this; @@ -4483,18 +4631,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalGroup = true; result.optionalGroup_ = value; return this; } public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptionalGroup = true; result.optionalGroup_ = builderForValue.Build(); return this; } public Builder MergeOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptionalGroup && result.optionalGroup_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.DefaultInstance) { result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.CreateBuilder(result.optionalGroup_).MergeFrom(value).BuildPartial(); @@ -4505,6 +4656,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearOptionalGroup() { + PrepareBuilder(); result.hasOptionalGroup = false; result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.DefaultInstance; return this; @@ -4519,18 +4671,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalNestedMessage = true; result.optionalNestedMessage_ = value; return this; } public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptionalNestedMessage = true; result.optionalNestedMessage_ = builderForValue.Build(); return this; } public Builder MergeOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptionalNestedMessage && result.optionalNestedMessage_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance) { result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.CreateBuilder(result.optionalNestedMessage_).MergeFrom(value).BuildPartial(); @@ -4541,6 +4696,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearOptionalNestedMessage() { + PrepareBuilder(); result.hasOptionalNestedMessage = false; result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance; return this; @@ -4555,18 +4711,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalForeignMessage = true; result.optionalForeignMessage_ = value; return this; } public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptionalForeignMessage = true; result.optionalForeignMessage_ = builderForValue.Build(); return this; } public Builder MergeOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptionalForeignMessage && result.optionalForeignMessage_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance) { result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.CreateBuilder(result.optionalForeignMessage_).MergeFrom(value).BuildPartial(); @@ -4577,6 +4736,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearOptionalForeignMessage() { + PrepareBuilder(); result.hasOptionalForeignMessage = false; result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance; return this; @@ -4591,18 +4751,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessageLite value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalImportMessage = true; result.optionalImportMessage_ = value; return this; } public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptionalImportMessage = true; result.optionalImportMessage_ = builderForValue.Build(); return this; } public Builder MergeOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessageLite value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptionalImportMessage && result.optionalImportMessage_ != global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance) { result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.CreateBuilder(result.optionalImportMessage_).MergeFrom(value).BuildPartial(); @@ -4613,6 +4776,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearOptionalImportMessage() { + PrepareBuilder(); result.hasOptionalImportMessage = false; result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance; return this; @@ -4626,11 +4790,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalNestedEnum(value); } } public Builder SetOptionalNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum value) { + PrepareBuilder(); result.hasOptionalNestedEnum = true; result.optionalNestedEnum_ = value; return this; } public Builder ClearOptionalNestedEnum() { + PrepareBuilder(); result.hasOptionalNestedEnum = false; result.optionalNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum.FOO; return this; @@ -4644,11 +4810,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalForeignEnum(value); } } public Builder SetOptionalForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) { + PrepareBuilder(); result.hasOptionalForeignEnum = true; result.optionalForeignEnum_ = value; return this; } public Builder ClearOptionalForeignEnum() { + PrepareBuilder(); result.hasOptionalForeignEnum = false; result.optionalForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite.FOREIGN_LITE_FOO; return this; @@ -4662,11 +4830,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalImportEnum(value); } } public Builder SetOptionalImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnumLite value) { + PrepareBuilder(); result.hasOptionalImportEnum = true; result.optionalImportEnum_ = value; return this; } public Builder ClearOptionalImportEnum() { + PrepareBuilder(); result.hasOptionalImportEnum = false; result.optionalImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnumLite.IMPORT_LITE_FOO; return this; @@ -4681,11 +4851,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalStringPiece(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalStringPiece = true; result.optionalStringPiece_ = value; return this; } public Builder ClearOptionalStringPiece() { + PrepareBuilder(); result.hasOptionalStringPiece = false; result.optionalStringPiece_ = ""; return this; @@ -4700,18 +4872,20 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalCord(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalCord = true; result.optionalCord_ = value; return this; } public Builder ClearOptionalCord() { + PrepareBuilder(); result.hasOptionalCord = false; result.optionalCord_ = ""; return this; } public pbc::IPopsicleList RepeatedInt32List { - get { return result.repeatedInt32_; } + get { return PrepareBuilder().repeatedInt32_; } } public int RepeatedInt32Count { get { return result.RepeatedInt32Count; } @@ -4720,24 +4894,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedInt32(index); } public Builder SetRepeatedInt32(int index, int value) { + PrepareBuilder(); result.repeatedInt32_[index] = value; return this; } public Builder AddRepeatedInt32(int value) { + PrepareBuilder(); result.repeatedInt32_.Add(value); return this; } public Builder AddRangeRepeatedInt32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedInt32_); return this; } public Builder ClearRepeatedInt32() { + PrepareBuilder(); result.repeatedInt32_.Clear(); return this; } public pbc::IPopsicleList RepeatedInt64List { - get { return result.repeatedInt64_; } + get { return PrepareBuilder().repeatedInt64_; } } public int RepeatedInt64Count { get { return result.RepeatedInt64Count; } @@ -4746,25 +4924,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedInt64(index); } public Builder SetRepeatedInt64(int index, long value) { + PrepareBuilder(); result.repeatedInt64_[index] = value; return this; } public Builder AddRepeatedInt64(long value) { + PrepareBuilder(); result.repeatedInt64_.Add(value); return this; } public Builder AddRangeRepeatedInt64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedInt64_); return this; } public Builder ClearRepeatedInt64() { + PrepareBuilder(); result.repeatedInt64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedUint32List { - get { return result.repeatedUint32_; } + get { return PrepareBuilder().repeatedUint32_; } } public int RepeatedUint32Count { get { return result.RepeatedUint32Count; } @@ -4775,27 +4957,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedUint32(int index, uint value) { + PrepareBuilder(); result.repeatedUint32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedUint32(uint value) { + PrepareBuilder(); result.repeatedUint32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedUint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedUint32_); return this; } public Builder ClearRepeatedUint32() { + PrepareBuilder(); result.repeatedUint32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedUint64List { - get { return result.repeatedUint64_; } + get { return PrepareBuilder().repeatedUint64_; } } public int RepeatedUint64Count { get { return result.RepeatedUint64Count; } @@ -4806,26 +4992,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedUint64(int index, ulong value) { + PrepareBuilder(); result.repeatedUint64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedUint64(ulong value) { + PrepareBuilder(); result.repeatedUint64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedUint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedUint64_); return this; } public Builder ClearRepeatedUint64() { + PrepareBuilder(); result.repeatedUint64_.Clear(); return this; } public pbc::IPopsicleList RepeatedSint32List { - get { return result.repeatedSint32_; } + get { return PrepareBuilder().repeatedSint32_; } } public int RepeatedSint32Count { get { return result.RepeatedSint32Count; } @@ -4834,24 +5024,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedSint32(index); } public Builder SetRepeatedSint32(int index, int value) { + PrepareBuilder(); result.repeatedSint32_[index] = value; return this; } public Builder AddRepeatedSint32(int value) { + PrepareBuilder(); result.repeatedSint32_.Add(value); return this; } public Builder AddRangeRepeatedSint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedSint32_); return this; } public Builder ClearRepeatedSint32() { + PrepareBuilder(); result.repeatedSint32_.Clear(); return this; } public pbc::IPopsicleList RepeatedSint64List { - get { return result.repeatedSint64_; } + get { return PrepareBuilder().repeatedSint64_; } } public int RepeatedSint64Count { get { return result.RepeatedSint64Count; } @@ -4860,25 +5054,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedSint64(index); } public Builder SetRepeatedSint64(int index, long value) { + PrepareBuilder(); result.repeatedSint64_[index] = value; return this; } public Builder AddRepeatedSint64(long value) { + PrepareBuilder(); result.repeatedSint64_.Add(value); return this; } public Builder AddRangeRepeatedSint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedSint64_); return this; } public Builder ClearRepeatedSint64() { + PrepareBuilder(); result.repeatedSint64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedFixed32List { - get { return result.repeatedFixed32_; } + get { return PrepareBuilder().repeatedFixed32_; } } public int RepeatedFixed32Count { get { return result.RepeatedFixed32Count; } @@ -4889,27 +5087,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedFixed32(int index, uint value) { + PrepareBuilder(); result.repeatedFixed32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedFixed32(uint value) { + PrepareBuilder(); result.repeatedFixed32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedFixed32_); return this; } public Builder ClearRepeatedFixed32() { + PrepareBuilder(); result.repeatedFixed32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedFixed64List { - get { return result.repeatedFixed64_; } + get { return PrepareBuilder().repeatedFixed64_; } } public int RepeatedFixed64Count { get { return result.RepeatedFixed64Count; } @@ -4920,26 +5122,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedFixed64(int index, ulong value) { + PrepareBuilder(); result.repeatedFixed64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedFixed64(ulong value) { + PrepareBuilder(); result.repeatedFixed64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedFixed64_); return this; } public Builder ClearRepeatedFixed64() { + PrepareBuilder(); result.repeatedFixed64_.Clear(); return this; } public pbc::IPopsicleList RepeatedSfixed32List { - get { return result.repeatedSfixed32_; } + get { return PrepareBuilder().repeatedSfixed32_; } } public int RepeatedSfixed32Count { get { return result.RepeatedSfixed32Count; } @@ -4948,24 +5154,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedSfixed32(index); } public Builder SetRepeatedSfixed32(int index, int value) { + PrepareBuilder(); result.repeatedSfixed32_[index] = value; return this; } public Builder AddRepeatedSfixed32(int value) { + PrepareBuilder(); result.repeatedSfixed32_.Add(value); return this; } public Builder AddRangeRepeatedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedSfixed32_); return this; } public Builder ClearRepeatedSfixed32() { + PrepareBuilder(); result.repeatedSfixed32_.Clear(); return this; } public pbc::IPopsicleList RepeatedSfixed64List { - get { return result.repeatedSfixed64_; } + get { return PrepareBuilder().repeatedSfixed64_; } } public int RepeatedSfixed64Count { get { return result.RepeatedSfixed64Count; } @@ -4974,24 +5184,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedSfixed64(index); } public Builder SetRepeatedSfixed64(int index, long value) { + PrepareBuilder(); result.repeatedSfixed64_[index] = value; return this; } public Builder AddRepeatedSfixed64(long value) { + PrepareBuilder(); result.repeatedSfixed64_.Add(value); return this; } public Builder AddRangeRepeatedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedSfixed64_); return this; } public Builder ClearRepeatedSfixed64() { + PrepareBuilder(); result.repeatedSfixed64_.Clear(); return this; } public pbc::IPopsicleList RepeatedFloatList { - get { return result.repeatedFloat_; } + get { return PrepareBuilder().repeatedFloat_; } } public int RepeatedFloatCount { get { return result.RepeatedFloatCount; } @@ -5000,24 +5214,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedFloat(index); } public Builder SetRepeatedFloat(int index, float value) { + PrepareBuilder(); result.repeatedFloat_[index] = value; return this; } public Builder AddRepeatedFloat(float value) { + PrepareBuilder(); result.repeatedFloat_.Add(value); return this; } public Builder AddRangeRepeatedFloat(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedFloat_); return this; } public Builder ClearRepeatedFloat() { + PrepareBuilder(); result.repeatedFloat_.Clear(); return this; } public pbc::IPopsicleList RepeatedDoubleList { - get { return result.repeatedDouble_; } + get { return PrepareBuilder().repeatedDouble_; } } public int RepeatedDoubleCount { get { return result.RepeatedDoubleCount; } @@ -5026,24 +5244,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedDouble(index); } public Builder SetRepeatedDouble(int index, double value) { + PrepareBuilder(); result.repeatedDouble_[index] = value; return this; } public Builder AddRepeatedDouble(double value) { + PrepareBuilder(); result.repeatedDouble_.Add(value); return this; } public Builder AddRangeRepeatedDouble(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedDouble_); return this; } public Builder ClearRepeatedDouble() { + PrepareBuilder(); result.repeatedDouble_.Clear(); return this; } public pbc::IPopsicleList RepeatedBoolList { - get { return result.repeatedBool_; } + get { return PrepareBuilder().repeatedBool_; } } public int RepeatedBoolCount { get { return result.RepeatedBoolCount; } @@ -5052,24 +5274,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedBool(index); } public Builder SetRepeatedBool(int index, bool value) { + PrepareBuilder(); result.repeatedBool_[index] = value; return this; } public Builder AddRepeatedBool(bool value) { + PrepareBuilder(); result.repeatedBool_.Add(value); return this; } public Builder AddRangeRepeatedBool(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedBool_); return this; } public Builder ClearRepeatedBool() { + PrepareBuilder(); result.repeatedBool_.Clear(); return this; } public pbc::IPopsicleList RepeatedStringList { - get { return result.repeatedString_; } + get { return PrepareBuilder().repeatedString_; } } public int RepeatedStringCount { get { return result.RepeatedStringCount; } @@ -5079,25 +5305,29 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedString(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedString_[index] = value; return this; } public Builder AddRepeatedString(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedString_.Add(value); return this; } public Builder AddRangeRepeatedString(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedString_); return this; } public Builder ClearRepeatedString() { + PrepareBuilder(); result.repeatedString_.Clear(); return this; } public pbc::IPopsicleList RepeatedBytesList { - get { return result.repeatedBytes_; } + get { return PrepareBuilder().repeatedBytes_; } } public int RepeatedBytesCount { get { return result.RepeatedBytesCount; } @@ -5107,25 +5337,29 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedBytes(int index, pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedBytes_[index] = value; return this; } public Builder AddRepeatedBytes(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedBytes_.Add(value); return this; } public Builder AddRangeRepeatedBytes(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedBytes_); return this; } public Builder ClearRepeatedBytes() { + PrepareBuilder(); result.repeatedBytes_.Clear(); return this; } public pbc::IPopsicleList RepeatedGroupList { - get { return result.repeatedGroup_; } + get { return PrepareBuilder().repeatedGroup_; } } public int RepeatedGroupCount { get { return result.RepeatedGroupCount; } @@ -5135,35 +5369,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedGroup_[index] = value; return this; } public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedGroup_[index] = builderForValue.Build(); return this; } public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedGroup_.Add(value); return this; } public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedGroup_.Add(builderForValue.Build()); return this; } public Builder AddRangeRepeatedGroup(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedGroup_); return this; } public Builder ClearRepeatedGroup() { + PrepareBuilder(); result.repeatedGroup_.Clear(); return this; } public pbc::IPopsicleList RepeatedNestedMessageList { - get { return result.repeatedNestedMessage_; } + get { return PrepareBuilder().repeatedNestedMessage_; } } public int RepeatedNestedMessageCount { get { return result.RepeatedNestedMessageCount; } @@ -5173,35 +5413,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedNestedMessage_[index] = value; return this; } public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedNestedMessage_[index] = builderForValue.Build(); return this; } public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedNestedMessage_.Add(value); return this; } public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedNestedMessage_.Add(builderForValue.Build()); return this; } public Builder AddRangeRepeatedNestedMessage(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedNestedMessage_); return this; } public Builder ClearRepeatedNestedMessage() { + PrepareBuilder(); result.repeatedNestedMessage_.Clear(); return this; } public pbc::IPopsicleList RepeatedForeignMessageList { - get { return result.repeatedForeignMessage_; } + get { return PrepareBuilder().repeatedForeignMessage_; } } public int RepeatedForeignMessageCount { get { return result.RepeatedForeignMessageCount; } @@ -5211,35 +5457,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedForeignMessage_[index] = value; return this; } public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedForeignMessage_[index] = builderForValue.Build(); return this; } public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedForeignMessage_.Add(value); return this; } public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedForeignMessage_.Add(builderForValue.Build()); return this; } public Builder AddRangeRepeatedForeignMessage(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedForeignMessage_); return this; } public Builder ClearRepeatedForeignMessage() { + PrepareBuilder(); result.repeatedForeignMessage_.Clear(); return this; } public pbc::IPopsicleList RepeatedImportMessageList { - get { return result.repeatedImportMessage_; } + get { return PrepareBuilder().repeatedImportMessage_; } } public int RepeatedImportMessageCount { get { return result.RepeatedImportMessageCount; } @@ -5249,35 +5501,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessageLite value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedImportMessage_[index] = value; return this; } public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedImportMessage_[index] = builderForValue.Build(); return this; } public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessageLite value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedImportMessage_.Add(value); return this; } public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedImportMessage_.Add(builderForValue.Build()); return this; } public Builder AddRangeRepeatedImportMessage(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedImportMessage_); return this; } public Builder ClearRepeatedImportMessage() { + PrepareBuilder(); result.repeatedImportMessage_.Clear(); return this; } public pbc::IPopsicleList RepeatedNestedEnumList { - get { return result.repeatedNestedEnum_; } + get { return PrepareBuilder().repeatedNestedEnum_; } } public int RepeatedNestedEnumCount { get { return result.RepeatedNestedEnumCount; } @@ -5286,24 +5544,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedNestedEnum(index); } public Builder SetRepeatedNestedEnum(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum value) { + PrepareBuilder(); result.repeatedNestedEnum_[index] = value; return this; } public Builder AddRepeatedNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum value) { + PrepareBuilder(); result.repeatedNestedEnum_.Add(value); return this; } public Builder AddRangeRepeatedNestedEnum(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedNestedEnum_); return this; } public Builder ClearRepeatedNestedEnum() { + PrepareBuilder(); result.repeatedNestedEnum_.Clear(); return this; } public pbc::IPopsicleList RepeatedForeignEnumList { - get { return result.repeatedForeignEnum_; } + get { return PrepareBuilder().repeatedForeignEnum_; } } public int RepeatedForeignEnumCount { get { return result.RepeatedForeignEnumCount; } @@ -5312,24 +5574,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedForeignEnum(index); } public Builder SetRepeatedForeignEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) { + PrepareBuilder(); result.repeatedForeignEnum_[index] = value; return this; } public Builder AddRepeatedForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) { + PrepareBuilder(); result.repeatedForeignEnum_.Add(value); return this; } public Builder AddRangeRepeatedForeignEnum(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedForeignEnum_); return this; } public Builder ClearRepeatedForeignEnum() { + PrepareBuilder(); result.repeatedForeignEnum_.Clear(); return this; } public pbc::IPopsicleList RepeatedImportEnumList { - get { return result.repeatedImportEnum_; } + get { return PrepareBuilder().repeatedImportEnum_; } } public int RepeatedImportEnumCount { get { return result.RepeatedImportEnumCount; } @@ -5338,24 +5604,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedImportEnum(index); } public Builder SetRepeatedImportEnum(int index, global::Google.ProtocolBuffers.TestProtos.ImportEnumLite value) { + PrepareBuilder(); result.repeatedImportEnum_[index] = value; return this; } public Builder AddRepeatedImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnumLite value) { + PrepareBuilder(); result.repeatedImportEnum_.Add(value); return this; } public Builder AddRangeRepeatedImportEnum(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedImportEnum_); return this; } public Builder ClearRepeatedImportEnum() { + PrepareBuilder(); result.repeatedImportEnum_.Clear(); return this; } public pbc::IPopsicleList RepeatedStringPieceList { - get { return result.repeatedStringPiece_; } + get { return PrepareBuilder().repeatedStringPiece_; } } public int RepeatedStringPieceCount { get { return result.RepeatedStringPieceCount; } @@ -5365,25 +5635,29 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedStringPiece(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedStringPiece_[index] = value; return this; } public Builder AddRepeatedStringPiece(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedStringPiece_.Add(value); return this; } public Builder AddRangeRepeatedStringPiece(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedStringPiece_); return this; } public Builder ClearRepeatedStringPiece() { + PrepareBuilder(); result.repeatedStringPiece_.Clear(); return this; } public pbc::IPopsicleList RepeatedCordList { - get { return result.repeatedCord_; } + get { return PrepareBuilder().repeatedCord_; } } public int RepeatedCordCount { get { return result.RepeatedCordCount; } @@ -5393,19 +5667,23 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedCord(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedCord_[index] = value; return this; } public Builder AddRepeatedCord(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedCord_.Add(value); return this; } public Builder AddRangeRepeatedCord(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedCord_); return this; } public Builder ClearRepeatedCord() { + PrepareBuilder(); result.repeatedCord_.Clear(); return this; } @@ -5418,11 +5696,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultInt32(value); } } public Builder SetDefaultInt32(int value) { + PrepareBuilder(); result.hasDefaultInt32 = true; result.defaultInt32_ = value; return this; } public Builder ClearDefaultInt32() { + PrepareBuilder(); result.hasDefaultInt32 = false; result.defaultInt32_ = 41; return this; @@ -5436,11 +5716,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultInt64(value); } } public Builder SetDefaultInt64(long value) { + PrepareBuilder(); result.hasDefaultInt64 = true; result.defaultInt64_ = value; return this; } public Builder ClearDefaultInt64() { + PrepareBuilder(); result.hasDefaultInt64 = false; result.defaultInt64_ = 42L; return this; @@ -5456,11 +5738,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetDefaultUint32(uint value) { + PrepareBuilder(); result.hasDefaultUint32 = true; result.defaultUint32_ = value; return this; } public Builder ClearDefaultUint32() { + PrepareBuilder(); result.hasDefaultUint32 = false; result.defaultUint32_ = 43; return this; @@ -5476,11 +5760,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetDefaultUint64(ulong value) { + PrepareBuilder(); result.hasDefaultUint64 = true; result.defaultUint64_ = value; return this; } public Builder ClearDefaultUint64() { + PrepareBuilder(); result.hasDefaultUint64 = false; result.defaultUint64_ = 44UL; return this; @@ -5494,11 +5780,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultSint32(value); } } public Builder SetDefaultSint32(int value) { + PrepareBuilder(); result.hasDefaultSint32 = true; result.defaultSint32_ = value; return this; } public Builder ClearDefaultSint32() { + PrepareBuilder(); result.hasDefaultSint32 = false; result.defaultSint32_ = -45; return this; @@ -5512,11 +5800,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultSint64(value); } } public Builder SetDefaultSint64(long value) { + PrepareBuilder(); result.hasDefaultSint64 = true; result.defaultSint64_ = value; return this; } public Builder ClearDefaultSint64() { + PrepareBuilder(); result.hasDefaultSint64 = false; result.defaultSint64_ = 46; return this; @@ -5532,11 +5822,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetDefaultFixed32(uint value) { + PrepareBuilder(); result.hasDefaultFixed32 = true; result.defaultFixed32_ = value; return this; } public Builder ClearDefaultFixed32() { + PrepareBuilder(); result.hasDefaultFixed32 = false; result.defaultFixed32_ = 47; return this; @@ -5552,11 +5844,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetDefaultFixed64(ulong value) { + PrepareBuilder(); result.hasDefaultFixed64 = true; result.defaultFixed64_ = value; return this; } public Builder ClearDefaultFixed64() { + PrepareBuilder(); result.hasDefaultFixed64 = false; result.defaultFixed64_ = 48; return this; @@ -5570,11 +5864,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultSfixed32(value); } } public Builder SetDefaultSfixed32(int value) { + PrepareBuilder(); result.hasDefaultSfixed32 = true; result.defaultSfixed32_ = value; return this; } public Builder ClearDefaultSfixed32() { + PrepareBuilder(); result.hasDefaultSfixed32 = false; result.defaultSfixed32_ = 49; return this; @@ -5588,11 +5884,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultSfixed64(value); } } public Builder SetDefaultSfixed64(long value) { + PrepareBuilder(); result.hasDefaultSfixed64 = true; result.defaultSfixed64_ = value; return this; } public Builder ClearDefaultSfixed64() { + PrepareBuilder(); result.hasDefaultSfixed64 = false; result.defaultSfixed64_ = -50; return this; @@ -5606,11 +5904,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultFloat(value); } } public Builder SetDefaultFloat(float value) { + PrepareBuilder(); result.hasDefaultFloat = true; result.defaultFloat_ = value; return this; } public Builder ClearDefaultFloat() { + PrepareBuilder(); result.hasDefaultFloat = false; result.defaultFloat_ = 51.5F; return this; @@ -5624,11 +5924,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultDouble(value); } } public Builder SetDefaultDouble(double value) { + PrepareBuilder(); result.hasDefaultDouble = true; result.defaultDouble_ = value; return this; } public Builder ClearDefaultDouble() { + PrepareBuilder(); result.hasDefaultDouble = false; result.defaultDouble_ = 52000D; return this; @@ -5642,11 +5944,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultBool(value); } } public Builder SetDefaultBool(bool value) { + PrepareBuilder(); result.hasDefaultBool = true; result.defaultBool_ = value; return this; } public Builder ClearDefaultBool() { + PrepareBuilder(); result.hasDefaultBool = false; result.defaultBool_ = true; return this; @@ -5661,11 +5965,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetDefaultString(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasDefaultString = true; result.defaultString_ = value; return this; } public Builder ClearDefaultString() { + PrepareBuilder(); result.hasDefaultString = false; result.defaultString_ = "hello"; return this; @@ -5680,11 +5986,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetDefaultBytes(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasDefaultBytes = true; result.defaultBytes_ = value; return this; } public Builder ClearDefaultBytes() { + PrepareBuilder(); result.hasDefaultBytes = false; result.defaultBytes_ = pb::ByteString.FromBase64("d29ybGQ="); return this; @@ -5698,11 +6006,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultNestedEnum(value); } } public Builder SetDefaultNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum value) { + PrepareBuilder(); result.hasDefaultNestedEnum = true; result.defaultNestedEnum_ = value; return this; } public Builder ClearDefaultNestedEnum() { + PrepareBuilder(); result.hasDefaultNestedEnum = false; result.defaultNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum.BAR; return this; @@ -5716,11 +6026,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultForeignEnum(value); } } public Builder SetDefaultForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) { + PrepareBuilder(); result.hasDefaultForeignEnum = true; result.defaultForeignEnum_ = value; return this; } public Builder ClearDefaultForeignEnum() { + PrepareBuilder(); result.hasDefaultForeignEnum = false; result.defaultForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite.FOREIGN_LITE_BAR; return this; @@ -5734,11 +6046,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultImportEnum(value); } } public Builder SetDefaultImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnumLite value) { + PrepareBuilder(); result.hasDefaultImportEnum = true; result.defaultImportEnum_ = value; return this; } public Builder ClearDefaultImportEnum() { + PrepareBuilder(); result.hasDefaultImportEnum = false; result.defaultImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnumLite.IMPORT_LITE_BAR; return this; @@ -5753,11 +6067,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetDefaultStringPiece(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasDefaultStringPiece = true; result.defaultStringPiece_ = value; return this; } public Builder ClearDefaultStringPiece() { + PrepareBuilder(); result.hasDefaultStringPiece = false; result.defaultStringPiece_ = "abc"; return this; @@ -5772,11 +6088,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetDefaultCord(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasDefaultCord = true; result.defaultCord_ = value; return this; } public Builder ClearDefaultCord() { + PrepareBuilder(); result.hasDefaultCord = false; result.defaultCord_ = "123"; return this; @@ -5898,7 +6216,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ForeignMessageLite prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -5908,21 +6226,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new ForeignMessageLite(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(ForeignMessageLite cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + ForeignMessageLite result; + + private ForeignMessageLite PrepareBuilder() { + if (builderIsReadOnly) { + ForeignMessageLite original = result; + result = new ForeignMessageLite(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - ForeignMessageLite result = new ForeignMessageLite(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override ForeignMessageLite MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new ForeignMessageLite(); + result = DefaultInstance ?? new ForeignMessageLite(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override ForeignMessageLite DefaultInstanceForType { @@ -5930,12 +6275,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ForeignMessageLite BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - ForeignMessageLite returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -5949,6 +6293,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(ForeignMessageLite other) { if (other == global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance) return this; + PrepareBuilder(); if (other.HasC) { C = other.C; } @@ -5960,6 +6305,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -6002,11 +6348,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetC(value); } } public Builder SetC(int value) { + PrepareBuilder(); result.hasC = true; result.c_ = value; return this; } public Builder ClearC() { + PrepareBuilder(); result.hasC = false; result.c_ = 0; return this; @@ -6566,7 +6914,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestPackedTypesLite prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -6576,21 +6924,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestPackedTypesLite(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestPackedTypesLite cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestPackedTypesLite result; - TestPackedTypesLite result = new TestPackedTypesLite(); + private TestPackedTypesLite PrepareBuilder() { + if (builderIsReadOnly) { + TestPackedTypesLite original = result; + result = new TestPackedTypesLite(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestPackedTypesLite MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestPackedTypesLite(); + result = DefaultInstance ?? new TestPackedTypesLite(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override TestPackedTypesLite DefaultInstanceForType { @@ -6598,8 +6973,8 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedTypesLite BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.packedInt32_.MakeReadOnly(); result.packedInt64_.MakeReadOnly(); @@ -6615,9 +6990,8 @@ namespace Google.ProtocolBuffers.TestProtos { result.packedDouble_.MakeReadOnly(); result.packedBool_.MakeReadOnly(); result.packedEnum_.MakeReadOnly(); - TestPackedTypesLite returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -6631,6 +7005,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestPackedTypesLite other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedTypesLite.DefaultInstance) return this; + PrepareBuilder(); if (other.packedInt32_.Count != 0) { base.AddRange(other.packedInt32_, result.packedInt32_); } @@ -6681,6 +7056,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -6783,7 +7159,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList PackedInt32List { - get { return result.packedInt32_; } + get { return PrepareBuilder().packedInt32_; } } public int PackedInt32Count { get { return result.PackedInt32Count; } @@ -6792,24 +7168,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedInt32(index); } public Builder SetPackedInt32(int index, int value) { + PrepareBuilder(); result.packedInt32_[index] = value; return this; } public Builder AddPackedInt32(int value) { + PrepareBuilder(); result.packedInt32_.Add(value); return this; } public Builder AddRangePackedInt32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedInt32_); return this; } public Builder ClearPackedInt32() { + PrepareBuilder(); result.packedInt32_.Clear(); return this; } public pbc::IPopsicleList PackedInt64List { - get { return result.packedInt64_; } + get { return PrepareBuilder().packedInt64_; } } public int PackedInt64Count { get { return result.PackedInt64Count; } @@ -6818,25 +7198,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedInt64(index); } public Builder SetPackedInt64(int index, long value) { + PrepareBuilder(); result.packedInt64_[index] = value; return this; } public Builder AddPackedInt64(long value) { + PrepareBuilder(); result.packedInt64_.Add(value); return this; } public Builder AddRangePackedInt64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedInt64_); return this; } public Builder ClearPackedInt64() { + PrepareBuilder(); result.packedInt64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList PackedUint32List { - get { return result.packedUint32_; } + get { return PrepareBuilder().packedUint32_; } } public int PackedUint32Count { get { return result.PackedUint32Count; } @@ -6847,27 +7231,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetPackedUint32(int index, uint value) { + PrepareBuilder(); result.packedUint32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddPackedUint32(uint value) { + PrepareBuilder(); result.packedUint32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangePackedUint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedUint32_); return this; } public Builder ClearPackedUint32() { + PrepareBuilder(); result.packedUint32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList PackedUint64List { - get { return result.packedUint64_; } + get { return PrepareBuilder().packedUint64_; } } public int PackedUint64Count { get { return result.PackedUint64Count; } @@ -6878,26 +7266,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetPackedUint64(int index, ulong value) { + PrepareBuilder(); result.packedUint64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddPackedUint64(ulong value) { + PrepareBuilder(); result.packedUint64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangePackedUint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedUint64_); return this; } public Builder ClearPackedUint64() { + PrepareBuilder(); result.packedUint64_.Clear(); return this; } public pbc::IPopsicleList PackedSint32List { - get { return result.packedSint32_; } + get { return PrepareBuilder().packedSint32_; } } public int PackedSint32Count { get { return result.PackedSint32Count; } @@ -6906,24 +7298,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedSint32(index); } public Builder SetPackedSint32(int index, int value) { + PrepareBuilder(); result.packedSint32_[index] = value; return this; } public Builder AddPackedSint32(int value) { + PrepareBuilder(); result.packedSint32_.Add(value); return this; } public Builder AddRangePackedSint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedSint32_); return this; } public Builder ClearPackedSint32() { + PrepareBuilder(); result.packedSint32_.Clear(); return this; } public pbc::IPopsicleList PackedSint64List { - get { return result.packedSint64_; } + get { return PrepareBuilder().packedSint64_; } } public int PackedSint64Count { get { return result.PackedSint64Count; } @@ -6932,25 +7328,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedSint64(index); } public Builder SetPackedSint64(int index, long value) { + PrepareBuilder(); result.packedSint64_[index] = value; return this; } public Builder AddPackedSint64(long value) { + PrepareBuilder(); result.packedSint64_.Add(value); return this; } public Builder AddRangePackedSint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedSint64_); return this; } public Builder ClearPackedSint64() { + PrepareBuilder(); result.packedSint64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList PackedFixed32List { - get { return result.packedFixed32_; } + get { return PrepareBuilder().packedFixed32_; } } public int PackedFixed32Count { get { return result.PackedFixed32Count; } @@ -6961,27 +7361,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetPackedFixed32(int index, uint value) { + PrepareBuilder(); result.packedFixed32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddPackedFixed32(uint value) { + PrepareBuilder(); result.packedFixed32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangePackedFixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedFixed32_); return this; } public Builder ClearPackedFixed32() { + PrepareBuilder(); result.packedFixed32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList PackedFixed64List { - get { return result.packedFixed64_; } + get { return PrepareBuilder().packedFixed64_; } } public int PackedFixed64Count { get { return result.PackedFixed64Count; } @@ -6992,26 +7396,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetPackedFixed64(int index, ulong value) { + PrepareBuilder(); result.packedFixed64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddPackedFixed64(ulong value) { + PrepareBuilder(); result.packedFixed64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangePackedFixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedFixed64_); return this; } public Builder ClearPackedFixed64() { + PrepareBuilder(); result.packedFixed64_.Clear(); return this; } public pbc::IPopsicleList PackedSfixed32List { - get { return result.packedSfixed32_; } + get { return PrepareBuilder().packedSfixed32_; } } public int PackedSfixed32Count { get { return result.PackedSfixed32Count; } @@ -7020,24 +7428,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedSfixed32(index); } public Builder SetPackedSfixed32(int index, int value) { + PrepareBuilder(); result.packedSfixed32_[index] = value; return this; } public Builder AddPackedSfixed32(int value) { + PrepareBuilder(); result.packedSfixed32_.Add(value); return this; } public Builder AddRangePackedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedSfixed32_); return this; } public Builder ClearPackedSfixed32() { + PrepareBuilder(); result.packedSfixed32_.Clear(); return this; } public pbc::IPopsicleList PackedSfixed64List { - get { return result.packedSfixed64_; } + get { return PrepareBuilder().packedSfixed64_; } } public int PackedSfixed64Count { get { return result.PackedSfixed64Count; } @@ -7046,24 +7458,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedSfixed64(index); } public Builder SetPackedSfixed64(int index, long value) { + PrepareBuilder(); result.packedSfixed64_[index] = value; return this; } public Builder AddPackedSfixed64(long value) { + PrepareBuilder(); result.packedSfixed64_.Add(value); return this; } public Builder AddRangePackedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedSfixed64_); return this; } public Builder ClearPackedSfixed64() { + PrepareBuilder(); result.packedSfixed64_.Clear(); return this; } public pbc::IPopsicleList PackedFloatList { - get { return result.packedFloat_; } + get { return PrepareBuilder().packedFloat_; } } public int PackedFloatCount { get { return result.PackedFloatCount; } @@ -7072,24 +7488,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedFloat(index); } public Builder SetPackedFloat(int index, float value) { + PrepareBuilder(); result.packedFloat_[index] = value; return this; } public Builder AddPackedFloat(float value) { + PrepareBuilder(); result.packedFloat_.Add(value); return this; } public Builder AddRangePackedFloat(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedFloat_); return this; } public Builder ClearPackedFloat() { + PrepareBuilder(); result.packedFloat_.Clear(); return this; } public pbc::IPopsicleList PackedDoubleList { - get { return result.packedDouble_; } + get { return PrepareBuilder().packedDouble_; } } public int PackedDoubleCount { get { return result.PackedDoubleCount; } @@ -7098,24 +7518,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedDouble(index); } public Builder SetPackedDouble(int index, double value) { + PrepareBuilder(); result.packedDouble_[index] = value; return this; } public Builder AddPackedDouble(double value) { + PrepareBuilder(); result.packedDouble_.Add(value); return this; } public Builder AddRangePackedDouble(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedDouble_); return this; } public Builder ClearPackedDouble() { + PrepareBuilder(); result.packedDouble_.Clear(); return this; } public pbc::IPopsicleList PackedBoolList { - get { return result.packedBool_; } + get { return PrepareBuilder().packedBool_; } } public int PackedBoolCount { get { return result.PackedBoolCount; } @@ -7124,24 +7548,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedBool(index); } public Builder SetPackedBool(int index, bool value) { + PrepareBuilder(); result.packedBool_[index] = value; return this; } public Builder AddPackedBool(bool value) { + PrepareBuilder(); result.packedBool_.Add(value); return this; } public Builder AddRangePackedBool(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedBool_); return this; } public Builder ClearPackedBool() { + PrepareBuilder(); result.packedBool_.Clear(); return this; } public pbc::IPopsicleList PackedEnumList { - get { return result.packedEnum_; } + get { return PrepareBuilder().packedEnum_; } } public int PackedEnumCount { get { return result.PackedEnumCount; } @@ -7150,18 +7578,22 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedEnum(index); } public Builder SetPackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) { + PrepareBuilder(); result.packedEnum_[index] = value; return this; } public Builder AddPackedEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) { + PrepareBuilder(); result.packedEnum_.Add(value); return this; } public Builder AddRangePackedEnum(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedEnum_); return this; } public Builder ClearPackedEnum() { + PrepareBuilder(); result.packedEnum_.Clear(); return this; } @@ -7665,7 +8097,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestUnpackedTypesLite prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -7675,21 +8107,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestUnpackedTypesLite(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestUnpackedTypesLite cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestUnpackedTypesLite result = new TestUnpackedTypesLite(); + bool builderIsReadOnly; + TestUnpackedTypesLite result; + + private TestUnpackedTypesLite PrepareBuilder() { + if (builderIsReadOnly) { + TestUnpackedTypesLite original = result; + result = new TestUnpackedTypesLite(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestUnpackedTypesLite MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestUnpackedTypesLite(); + result = DefaultInstance ?? new TestUnpackedTypesLite(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override TestUnpackedTypesLite DefaultInstanceForType { @@ -7697,8 +8156,8 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedTypesLite BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.unpackedInt32_.MakeReadOnly(); result.unpackedInt64_.MakeReadOnly(); @@ -7714,9 +8173,8 @@ namespace Google.ProtocolBuffers.TestProtos { result.unpackedDouble_.MakeReadOnly(); result.unpackedBool_.MakeReadOnly(); result.unpackedEnum_.MakeReadOnly(); - TestUnpackedTypesLite returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -7730,6 +8188,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestUnpackedTypesLite other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypesLite.DefaultInstance) return this; + PrepareBuilder(); if (other.unpackedInt32_.Count != 0) { base.AddRange(other.unpackedInt32_, result.unpackedInt32_); } @@ -7780,6 +8239,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -7882,7 +8342,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList UnpackedInt32List { - get { return result.unpackedInt32_; } + get { return PrepareBuilder().unpackedInt32_; } } public int UnpackedInt32Count { get { return result.UnpackedInt32Count; } @@ -7891,24 +8351,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedInt32(index); } public Builder SetUnpackedInt32(int index, int value) { + PrepareBuilder(); result.unpackedInt32_[index] = value; return this; } public Builder AddUnpackedInt32(int value) { + PrepareBuilder(); result.unpackedInt32_.Add(value); return this; } public Builder AddRangeUnpackedInt32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedInt32_); return this; } public Builder ClearUnpackedInt32() { + PrepareBuilder(); result.unpackedInt32_.Clear(); return this; } public pbc::IPopsicleList UnpackedInt64List { - get { return result.unpackedInt64_; } + get { return PrepareBuilder().unpackedInt64_; } } public int UnpackedInt64Count { get { return result.UnpackedInt64Count; } @@ -7917,25 +8381,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedInt64(index); } public Builder SetUnpackedInt64(int index, long value) { + PrepareBuilder(); result.unpackedInt64_[index] = value; return this; } public Builder AddUnpackedInt64(long value) { + PrepareBuilder(); result.unpackedInt64_.Add(value); return this; } public Builder AddRangeUnpackedInt64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedInt64_); return this; } public Builder ClearUnpackedInt64() { + PrepareBuilder(); result.unpackedInt64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList UnpackedUint32List { - get { return result.unpackedUint32_; } + get { return PrepareBuilder().unpackedUint32_; } } public int UnpackedUint32Count { get { return result.UnpackedUint32Count; } @@ -7946,27 +8414,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetUnpackedUint32(int index, uint value) { + PrepareBuilder(); result.unpackedUint32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddUnpackedUint32(uint value) { + PrepareBuilder(); result.unpackedUint32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedUint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedUint32_); return this; } public Builder ClearUnpackedUint32() { + PrepareBuilder(); result.unpackedUint32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList UnpackedUint64List { - get { return result.unpackedUint64_; } + get { return PrepareBuilder().unpackedUint64_; } } public int UnpackedUint64Count { get { return result.UnpackedUint64Count; } @@ -7977,26 +8449,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetUnpackedUint64(int index, ulong value) { + PrepareBuilder(); result.unpackedUint64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddUnpackedUint64(ulong value) { + PrepareBuilder(); result.unpackedUint64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedUint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedUint64_); return this; } public Builder ClearUnpackedUint64() { + PrepareBuilder(); result.unpackedUint64_.Clear(); return this; } public pbc::IPopsicleList UnpackedSint32List { - get { return result.unpackedSint32_; } + get { return PrepareBuilder().unpackedSint32_; } } public int UnpackedSint32Count { get { return result.UnpackedSint32Count; } @@ -8005,24 +8481,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedSint32(index); } public Builder SetUnpackedSint32(int index, int value) { + PrepareBuilder(); result.unpackedSint32_[index] = value; return this; } public Builder AddUnpackedSint32(int value) { + PrepareBuilder(); result.unpackedSint32_.Add(value); return this; } public Builder AddRangeUnpackedSint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedSint32_); return this; } public Builder ClearUnpackedSint32() { + PrepareBuilder(); result.unpackedSint32_.Clear(); return this; } public pbc::IPopsicleList UnpackedSint64List { - get { return result.unpackedSint64_; } + get { return PrepareBuilder().unpackedSint64_; } } public int UnpackedSint64Count { get { return result.UnpackedSint64Count; } @@ -8031,25 +8511,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedSint64(index); } public Builder SetUnpackedSint64(int index, long value) { + PrepareBuilder(); result.unpackedSint64_[index] = value; return this; } public Builder AddUnpackedSint64(long value) { + PrepareBuilder(); result.unpackedSint64_.Add(value); return this; } public Builder AddRangeUnpackedSint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedSint64_); return this; } public Builder ClearUnpackedSint64() { + PrepareBuilder(); result.unpackedSint64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList UnpackedFixed32List { - get { return result.unpackedFixed32_; } + get { return PrepareBuilder().unpackedFixed32_; } } public int UnpackedFixed32Count { get { return result.UnpackedFixed32Count; } @@ -8060,27 +8544,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetUnpackedFixed32(int index, uint value) { + PrepareBuilder(); result.unpackedFixed32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddUnpackedFixed32(uint value) { + PrepareBuilder(); result.unpackedFixed32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedFixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedFixed32_); return this; } public Builder ClearUnpackedFixed32() { + PrepareBuilder(); result.unpackedFixed32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList UnpackedFixed64List { - get { return result.unpackedFixed64_; } + get { return PrepareBuilder().unpackedFixed64_; } } public int UnpackedFixed64Count { get { return result.UnpackedFixed64Count; } @@ -8091,26 +8579,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetUnpackedFixed64(int index, ulong value) { + PrepareBuilder(); result.unpackedFixed64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddUnpackedFixed64(ulong value) { + PrepareBuilder(); result.unpackedFixed64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedFixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedFixed64_); return this; } public Builder ClearUnpackedFixed64() { + PrepareBuilder(); result.unpackedFixed64_.Clear(); return this; } public pbc::IPopsicleList UnpackedSfixed32List { - get { return result.unpackedSfixed32_; } + get { return PrepareBuilder().unpackedSfixed32_; } } public int UnpackedSfixed32Count { get { return result.UnpackedSfixed32Count; } @@ -8119,24 +8611,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedSfixed32(index); } public Builder SetUnpackedSfixed32(int index, int value) { + PrepareBuilder(); result.unpackedSfixed32_[index] = value; return this; } public Builder AddUnpackedSfixed32(int value) { + PrepareBuilder(); result.unpackedSfixed32_.Add(value); return this; } public Builder AddRangeUnpackedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedSfixed32_); return this; } public Builder ClearUnpackedSfixed32() { + PrepareBuilder(); result.unpackedSfixed32_.Clear(); return this; } public pbc::IPopsicleList UnpackedSfixed64List { - get { return result.unpackedSfixed64_; } + get { return PrepareBuilder().unpackedSfixed64_; } } public int UnpackedSfixed64Count { get { return result.UnpackedSfixed64Count; } @@ -8145,24 +8641,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedSfixed64(index); } public Builder SetUnpackedSfixed64(int index, long value) { + PrepareBuilder(); result.unpackedSfixed64_[index] = value; return this; } public Builder AddUnpackedSfixed64(long value) { + PrepareBuilder(); result.unpackedSfixed64_.Add(value); return this; } public Builder AddRangeUnpackedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedSfixed64_); return this; } public Builder ClearUnpackedSfixed64() { + PrepareBuilder(); result.unpackedSfixed64_.Clear(); return this; } public pbc::IPopsicleList UnpackedFloatList { - get { return result.unpackedFloat_; } + get { return PrepareBuilder().unpackedFloat_; } } public int UnpackedFloatCount { get { return result.UnpackedFloatCount; } @@ -8171,24 +8671,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedFloat(index); } public Builder SetUnpackedFloat(int index, float value) { + PrepareBuilder(); result.unpackedFloat_[index] = value; return this; } public Builder AddUnpackedFloat(float value) { + PrepareBuilder(); result.unpackedFloat_.Add(value); return this; } public Builder AddRangeUnpackedFloat(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedFloat_); return this; } public Builder ClearUnpackedFloat() { + PrepareBuilder(); result.unpackedFloat_.Clear(); return this; } public pbc::IPopsicleList UnpackedDoubleList { - get { return result.unpackedDouble_; } + get { return PrepareBuilder().unpackedDouble_; } } public int UnpackedDoubleCount { get { return result.UnpackedDoubleCount; } @@ -8197,24 +8701,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedDouble(index); } public Builder SetUnpackedDouble(int index, double value) { + PrepareBuilder(); result.unpackedDouble_[index] = value; return this; } public Builder AddUnpackedDouble(double value) { + PrepareBuilder(); result.unpackedDouble_.Add(value); return this; } public Builder AddRangeUnpackedDouble(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedDouble_); return this; } public Builder ClearUnpackedDouble() { + PrepareBuilder(); result.unpackedDouble_.Clear(); return this; } public pbc::IPopsicleList UnpackedBoolList { - get { return result.unpackedBool_; } + get { return PrepareBuilder().unpackedBool_; } } public int UnpackedBoolCount { get { return result.UnpackedBoolCount; } @@ -8223,24 +8731,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedBool(index); } public Builder SetUnpackedBool(int index, bool value) { + PrepareBuilder(); result.unpackedBool_[index] = value; return this; } public Builder AddUnpackedBool(bool value) { + PrepareBuilder(); result.unpackedBool_.Add(value); return this; } public Builder AddRangeUnpackedBool(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedBool_); return this; } public Builder ClearUnpackedBool() { + PrepareBuilder(); result.unpackedBool_.Clear(); return this; } public pbc::IPopsicleList UnpackedEnumList { - get { return result.unpackedEnum_; } + get { return PrepareBuilder().unpackedEnum_; } } public int UnpackedEnumCount { get { return result.UnpackedEnumCount; } @@ -8249,18 +8761,22 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedEnum(index); } public Builder SetUnpackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) { + PrepareBuilder(); result.unpackedEnum_[index] = value; return this; } public Builder AddUnpackedEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) { + PrepareBuilder(); result.unpackedEnum_.Add(value); return this; } public Builder AddRangeUnpackedEnum(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedEnum_); return this; } public Builder ClearUnpackedEnum() { + PrepareBuilder(); result.unpackedEnum_.Clear(); return this; } @@ -8369,7 +8885,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestAllExtensionsLite prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -8379,21 +8895,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestAllExtensionsLite(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestAllExtensionsLite cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestAllExtensionsLite result = new TestAllExtensionsLite(); + bool builderIsReadOnly; + TestAllExtensionsLite result; + + private TestAllExtensionsLite PrepareBuilder() { + if (builderIsReadOnly) { + TestAllExtensionsLite original = result; + result = new TestAllExtensionsLite(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestAllExtensionsLite MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestAllExtensionsLite(); + result = DefaultInstance ?? new TestAllExtensionsLite(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override TestAllExtensionsLite DefaultInstanceForType { @@ -8401,12 +8944,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllExtensionsLite BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestAllExtensionsLite returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -8420,6 +8962,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestAllExtensionsLite other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance) return this; + PrepareBuilder(); this.MergeExtensionFields(other); return this; } @@ -8429,6 +8972,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -8575,7 +9119,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(OptionalGroup_extension_lite prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -8585,21 +9129,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new OptionalGroup_extension_lite(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(OptionalGroup_extension_lite cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + OptionalGroup_extension_lite result; + + private OptionalGroup_extension_lite PrepareBuilder() { + if (builderIsReadOnly) { + OptionalGroup_extension_lite original = result; + result = new OptionalGroup_extension_lite(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - OptionalGroup_extension_lite result = new OptionalGroup_extension_lite(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override OptionalGroup_extension_lite MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new OptionalGroup_extension_lite(); + result = DefaultInstance ?? new OptionalGroup_extension_lite(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override OptionalGroup_extension_lite DefaultInstanceForType { @@ -8607,12 +9178,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup_extension_lite BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - OptionalGroup_extension_lite returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -8626,6 +9196,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(OptionalGroup_extension_lite other) { if (other == global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension_lite.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -8637,6 +9208,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -8679,11 +9251,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -8805,7 +9379,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(RepeatedGroup_extension_lite prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -8815,21 +9389,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new RepeatedGroup_extension_lite(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(RepeatedGroup_extension_lite cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + RepeatedGroup_extension_lite result; + + private RepeatedGroup_extension_lite PrepareBuilder() { + if (builderIsReadOnly) { + RepeatedGroup_extension_lite original = result; + result = new RepeatedGroup_extension_lite(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - RepeatedGroup_extension_lite result = new RepeatedGroup_extension_lite(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override RepeatedGroup_extension_lite MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new RepeatedGroup_extension_lite(); + result = DefaultInstance ?? new RepeatedGroup_extension_lite(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override RepeatedGroup_extension_lite DefaultInstanceForType { @@ -8837,12 +9438,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup_extension_lite BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - RepeatedGroup_extension_lite returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -8856,6 +9456,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(RepeatedGroup_extension_lite other) { if (other == global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension_lite.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -8867,6 +9468,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -8909,11 +9511,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -9023,7 +9627,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestPackedExtensionsLite prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -9033,21 +9637,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestPackedExtensionsLite(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestPackedExtensionsLite cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestPackedExtensionsLite result = new TestPackedExtensionsLite(); + bool builderIsReadOnly; + TestPackedExtensionsLite result; + + private TestPackedExtensionsLite PrepareBuilder() { + if (builderIsReadOnly) { + TestPackedExtensionsLite original = result; + result = new TestPackedExtensionsLite(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestPackedExtensionsLite MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestPackedExtensionsLite(); + result = DefaultInstance ?? new TestPackedExtensionsLite(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override TestPackedExtensionsLite DefaultInstanceForType { @@ -9055,12 +9686,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedExtensionsLite BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestPackedExtensionsLite returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -9074,6 +9704,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestPackedExtensionsLite other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance) return this; + PrepareBuilder(); this.MergeExtensionFields(other); return this; } @@ -9083,6 +9714,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -9217,7 +9849,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestUnpackedExtensionsLite prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -9227,21 +9859,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestUnpackedExtensionsLite(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestUnpackedExtensionsLite cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestUnpackedExtensionsLite result; - TestUnpackedExtensionsLite result = new TestUnpackedExtensionsLite(); + private TestUnpackedExtensionsLite PrepareBuilder() { + if (builderIsReadOnly) { + TestUnpackedExtensionsLite original = result; + result = new TestUnpackedExtensionsLite(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestUnpackedExtensionsLite MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestUnpackedExtensionsLite(); + result = DefaultInstance ?? new TestUnpackedExtensionsLite(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override TestUnpackedExtensionsLite DefaultInstanceForType { @@ -9249,12 +9908,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedExtensionsLite BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestUnpackedExtensionsLite returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -9268,6 +9926,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestUnpackedExtensionsLite other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance) return this; + PrepareBuilder(); this.MergeExtensionFields(other); return this; } @@ -9277,6 +9936,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -9406,7 +10066,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestNestedExtensionLite prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -9416,21 +10076,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestNestedExtensionLite(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestNestedExtensionLite cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestNestedExtensionLite result; + + private TestNestedExtensionLite PrepareBuilder() { + if (builderIsReadOnly) { + TestNestedExtensionLite original = result; + result = new TestNestedExtensionLite(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestNestedExtensionLite result = new TestNestedExtensionLite(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestNestedExtensionLite MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestNestedExtensionLite(); + result = DefaultInstance ?? new TestNestedExtensionLite(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override TestNestedExtensionLite DefaultInstanceForType { @@ -9438,12 +10125,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestNestedExtensionLite BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestNestedExtensionLite returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -9457,6 +10143,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestNestedExtensionLite other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedExtensionLite.DefaultInstance) return this; + PrepareBuilder(); return this; } @@ -9465,6 +10152,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -9611,7 +10299,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestDeprecatedLite prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -9621,21 +10309,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestDeprecatedLite(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestDeprecatedLite cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestDeprecatedLite result = new TestDeprecatedLite(); + bool builderIsReadOnly; + TestDeprecatedLite result; + + private TestDeprecatedLite PrepareBuilder() { + if (builderIsReadOnly) { + TestDeprecatedLite original = result; + result = new TestDeprecatedLite(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestDeprecatedLite MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestDeprecatedLite(); + result = DefaultInstance ?? new TestDeprecatedLite(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override TestDeprecatedLite DefaultInstanceForType { @@ -9643,12 +10358,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDeprecatedLite BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestDeprecatedLite returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessageLite other) { @@ -9662,6 +10376,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestDeprecatedLite other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestDeprecatedLite.DefaultInstance) return this; + PrepareBuilder(); if (other.HasDeprecatedField) { DeprecatedField = other.DeprecatedField; } @@ -9673,6 +10388,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); uint tag; string field_name; while (input.ReadTag(out tag, out field_name)) { @@ -9715,11 +10431,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDeprecatedField(value); } } public Builder SetDeprecatedField(int value) { + PrepareBuilder(); result.hasDeprecatedField = true; result.deprecatedField_ = value; return this; } public Builder ClearDeprecatedField() { + PrepareBuilder(); result.hasDeprecatedField = false; result.deprecatedField_ = 0; return this; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs index d8824d49a4..aeea673d57 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs @@ -1260,7 +1260,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(NestedMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1270,21 +1270,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new NestedMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(NestedMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + NestedMessage result; + + private NestedMessage PrepareBuilder() { + if (builderIsReadOnly) { + NestedMessage original = result; + result = new NestedMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - NestedMessage result = new NestedMessage(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override NestedMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new NestedMessage(); + result = DefaultInstance ?? new NestedMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1296,12 +1323,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override NestedMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - NestedMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1315,6 +1341,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(NestedMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) return this; + PrepareBuilder(); if (other.HasBb) { Bb = other.Bb; } @@ -1327,6 +1354,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1382,11 +1410,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetBb(value); } } public Builder SetBb(int value) { + PrepareBuilder(); result.hasBb = true; result.bb_ = value; return this; } public Builder ClearBb() { + PrepareBuilder(); result.hasBb = false; result.bb_ = 0; return this; @@ -1499,7 +1529,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(OptionalGroup prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1509,21 +1539,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new OptionalGroup(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(OptionalGroup cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + OptionalGroup result; + + private OptionalGroup PrepareBuilder() { + if (builderIsReadOnly) { + OptionalGroup original = result; + result = new OptionalGroup(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - OptionalGroup result = new OptionalGroup(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override OptionalGroup MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new OptionalGroup(); + result = DefaultInstance ?? new OptionalGroup(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1535,12 +1592,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - OptionalGroup returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1554,6 +1610,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(OptionalGroup other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -1566,6 +1623,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1621,11 +1679,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -1738,7 +1798,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(RepeatedGroup prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -1748,21 +1808,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new RepeatedGroup(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(RepeatedGroup cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + RepeatedGroup result; - RepeatedGroup result = new RepeatedGroup(); + private RepeatedGroup PrepareBuilder() { + if (builderIsReadOnly) { + RepeatedGroup original = result; + result = new RepeatedGroup(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override RepeatedGroup MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new RepeatedGroup(); + result = DefaultInstance ?? new RepeatedGroup(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -1774,12 +1861,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - RepeatedGroup returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -1793,6 +1879,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(RepeatedGroup other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -1805,6 +1892,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -1860,11 +1948,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -3181,7 +3271,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestAllTypes prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -3191,21 +3281,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestAllTypes(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestAllTypes cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestAllTypes result; + + private TestAllTypes PrepareBuilder() { + if (builderIsReadOnly) { + TestAllTypes original = result; + result = new TestAllTypes(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestAllTypes result = new TestAllTypes(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestAllTypes MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestAllTypes(); + result = DefaultInstance ?? new TestAllTypes(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -3217,8 +3334,8 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllTypes BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.repeatedInt32_.MakeReadOnly(); result.repeatedInt64_.MakeReadOnly(); @@ -3244,9 +3361,8 @@ namespace Google.ProtocolBuffers.TestProtos { result.repeatedImportEnum_.MakeReadOnly(); result.repeatedStringPiece_.MakeReadOnly(); result.repeatedCord_.MakeReadOnly(); - TestAllTypes returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -3260,6 +3376,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestAllTypes other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance) return this; + PrepareBuilder(); if (other.HasOptionalInt32) { OptionalInt32 = other.OptionalInt32; } @@ -3473,6 +3590,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -3907,11 +4025,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalInt32(value); } } public Builder SetOptionalInt32(int value) { + PrepareBuilder(); result.hasOptionalInt32 = true; result.optionalInt32_ = value; return this; } public Builder ClearOptionalInt32() { + PrepareBuilder(); result.hasOptionalInt32 = false; result.optionalInt32_ = 0; return this; @@ -3925,11 +4045,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalInt64(value); } } public Builder SetOptionalInt64(long value) { + PrepareBuilder(); result.hasOptionalInt64 = true; result.optionalInt64_ = value; return this; } public Builder ClearOptionalInt64() { + PrepareBuilder(); result.hasOptionalInt64 = false; result.optionalInt64_ = 0L; return this; @@ -3945,11 +4067,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetOptionalUint32(uint value) { + PrepareBuilder(); result.hasOptionalUint32 = true; result.optionalUint32_ = value; return this; } public Builder ClearOptionalUint32() { + PrepareBuilder(); result.hasOptionalUint32 = false; result.optionalUint32_ = 0; return this; @@ -3965,11 +4089,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetOptionalUint64(ulong value) { + PrepareBuilder(); result.hasOptionalUint64 = true; result.optionalUint64_ = value; return this; } public Builder ClearOptionalUint64() { + PrepareBuilder(); result.hasOptionalUint64 = false; result.optionalUint64_ = 0UL; return this; @@ -3983,11 +4109,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalSint32(value); } } public Builder SetOptionalSint32(int value) { + PrepareBuilder(); result.hasOptionalSint32 = true; result.optionalSint32_ = value; return this; } public Builder ClearOptionalSint32() { + PrepareBuilder(); result.hasOptionalSint32 = false; result.optionalSint32_ = 0; return this; @@ -4001,11 +4129,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalSint64(value); } } public Builder SetOptionalSint64(long value) { + PrepareBuilder(); result.hasOptionalSint64 = true; result.optionalSint64_ = value; return this; } public Builder ClearOptionalSint64() { + PrepareBuilder(); result.hasOptionalSint64 = false; result.optionalSint64_ = 0; return this; @@ -4021,11 +4151,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetOptionalFixed32(uint value) { + PrepareBuilder(); result.hasOptionalFixed32 = true; result.optionalFixed32_ = value; return this; } public Builder ClearOptionalFixed32() { + PrepareBuilder(); result.hasOptionalFixed32 = false; result.optionalFixed32_ = 0; return this; @@ -4041,11 +4173,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetOptionalFixed64(ulong value) { + PrepareBuilder(); result.hasOptionalFixed64 = true; result.optionalFixed64_ = value; return this; } public Builder ClearOptionalFixed64() { + PrepareBuilder(); result.hasOptionalFixed64 = false; result.optionalFixed64_ = 0; return this; @@ -4059,11 +4193,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalSfixed32(value); } } public Builder SetOptionalSfixed32(int value) { + PrepareBuilder(); result.hasOptionalSfixed32 = true; result.optionalSfixed32_ = value; return this; } public Builder ClearOptionalSfixed32() { + PrepareBuilder(); result.hasOptionalSfixed32 = false; result.optionalSfixed32_ = 0; return this; @@ -4077,11 +4213,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalSfixed64(value); } } public Builder SetOptionalSfixed64(long value) { + PrepareBuilder(); result.hasOptionalSfixed64 = true; result.optionalSfixed64_ = value; return this; } public Builder ClearOptionalSfixed64() { + PrepareBuilder(); result.hasOptionalSfixed64 = false; result.optionalSfixed64_ = 0; return this; @@ -4095,11 +4233,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalFloat(value); } } public Builder SetOptionalFloat(float value) { + PrepareBuilder(); result.hasOptionalFloat = true; result.optionalFloat_ = value; return this; } public Builder ClearOptionalFloat() { + PrepareBuilder(); result.hasOptionalFloat = false; result.optionalFloat_ = 0F; return this; @@ -4113,11 +4253,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalDouble(value); } } public Builder SetOptionalDouble(double value) { + PrepareBuilder(); result.hasOptionalDouble = true; result.optionalDouble_ = value; return this; } public Builder ClearOptionalDouble() { + PrepareBuilder(); result.hasOptionalDouble = false; result.optionalDouble_ = 0D; return this; @@ -4131,11 +4273,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalBool(value); } } public Builder SetOptionalBool(bool value) { + PrepareBuilder(); result.hasOptionalBool = true; result.optionalBool_ = value; return this; } public Builder ClearOptionalBool() { + PrepareBuilder(); result.hasOptionalBool = false; result.optionalBool_ = false; return this; @@ -4150,11 +4294,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalString(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalString = true; result.optionalString_ = value; return this; } public Builder ClearOptionalString() { + PrepareBuilder(); result.hasOptionalString = false; result.optionalString_ = ""; return this; @@ -4169,11 +4315,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalBytes(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalBytes = true; result.optionalBytes_ = value; return this; } public Builder ClearOptionalBytes() { + PrepareBuilder(); result.hasOptionalBytes = false; result.optionalBytes_ = pb::ByteString.Empty; return this; @@ -4188,18 +4336,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalGroup = true; result.optionalGroup_ = value; return this; } public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptionalGroup = true; result.optionalGroup_ = builderForValue.Build(); return this; } public Builder MergeOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptionalGroup && result.optionalGroup_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance) { result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.CreateBuilder(result.optionalGroup_).MergeFrom(value).BuildPartial(); @@ -4210,6 +4361,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearOptionalGroup() { + PrepareBuilder(); result.hasOptionalGroup = false; result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance; return this; @@ -4224,18 +4376,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalNestedMessage = true; result.optionalNestedMessage_ = value; return this; } public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptionalNestedMessage = true; result.optionalNestedMessage_ = builderForValue.Build(); return this; } public Builder MergeOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptionalNestedMessage && result.optionalNestedMessage_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) { result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(result.optionalNestedMessage_).MergeFrom(value).BuildPartial(); @@ -4246,6 +4401,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearOptionalNestedMessage() { + PrepareBuilder(); result.hasOptionalNestedMessage = false; result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; return this; @@ -4260,18 +4416,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalForeignMessage = true; result.optionalForeignMessage_ = value; return this; } public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptionalForeignMessage = true; result.optionalForeignMessage_ = builderForValue.Build(); return this; } public Builder MergeOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptionalForeignMessage && result.optionalForeignMessage_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.optionalForeignMessage_).MergeFrom(value).BuildPartial(); @@ -4282,6 +4441,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearOptionalForeignMessage() { + PrepareBuilder(); result.hasOptionalForeignMessage = false; result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; return this; @@ -4296,18 +4456,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalImportMessage = true; result.optionalImportMessage_ = value; return this; } public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptionalImportMessage = true; result.optionalImportMessage_ = builderForValue.Build(); return this; } public Builder MergeOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptionalImportMessage && result.optionalImportMessage_ != global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance) { result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessage.CreateBuilder(result.optionalImportMessage_).MergeFrom(value).BuildPartial(); @@ -4318,6 +4481,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearOptionalImportMessage() { + PrepareBuilder(); result.hasOptionalImportMessage = false; result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; return this; @@ -4331,11 +4495,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalNestedEnum(value); } } public Builder SetOptionalNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); result.hasOptionalNestedEnum = true; result.optionalNestedEnum_ = value; return this; } public Builder ClearOptionalNestedEnum() { + PrepareBuilder(); result.hasOptionalNestedEnum = false; result.optionalNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.FOO; return this; @@ -4349,11 +4515,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalForeignEnum(value); } } public Builder SetOptionalForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.hasOptionalForeignEnum = true; result.optionalForeignEnum_ = value; return this; } public Builder ClearOptionalForeignEnum() { + PrepareBuilder(); result.hasOptionalForeignEnum = false; result.optionalForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; return this; @@ -4367,11 +4535,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalImportEnum(value); } } public Builder SetOptionalImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); result.hasOptionalImportEnum = true; result.optionalImportEnum_ = value; return this; } public Builder ClearOptionalImportEnum() { + PrepareBuilder(); result.hasOptionalImportEnum = false; result.optionalImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_FOO; return this; @@ -4386,11 +4556,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalStringPiece(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalStringPiece = true; result.optionalStringPiece_ = value; return this; } public Builder ClearOptionalStringPiece() { + PrepareBuilder(); result.hasOptionalStringPiece = false; result.optionalStringPiece_ = ""; return this; @@ -4405,18 +4577,20 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalCord(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalCord = true; result.optionalCord_ = value; return this; } public Builder ClearOptionalCord() { + PrepareBuilder(); result.hasOptionalCord = false; result.optionalCord_ = ""; return this; } public pbc::IPopsicleList RepeatedInt32List { - get { return result.repeatedInt32_; } + get { return PrepareBuilder().repeatedInt32_; } } public int RepeatedInt32Count { get { return result.RepeatedInt32Count; } @@ -4425,24 +4599,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedInt32(index); } public Builder SetRepeatedInt32(int index, int value) { + PrepareBuilder(); result.repeatedInt32_[index] = value; return this; } public Builder AddRepeatedInt32(int value) { + PrepareBuilder(); result.repeatedInt32_.Add(value); return this; } public Builder AddRangeRepeatedInt32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedInt32_); return this; } public Builder ClearRepeatedInt32() { + PrepareBuilder(); result.repeatedInt32_.Clear(); return this; } public pbc::IPopsicleList RepeatedInt64List { - get { return result.repeatedInt64_; } + get { return PrepareBuilder().repeatedInt64_; } } public int RepeatedInt64Count { get { return result.RepeatedInt64Count; } @@ -4451,25 +4629,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedInt64(index); } public Builder SetRepeatedInt64(int index, long value) { + PrepareBuilder(); result.repeatedInt64_[index] = value; return this; } public Builder AddRepeatedInt64(long value) { + PrepareBuilder(); result.repeatedInt64_.Add(value); return this; } public Builder AddRangeRepeatedInt64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedInt64_); return this; } public Builder ClearRepeatedInt64() { + PrepareBuilder(); result.repeatedInt64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedUint32List { - get { return result.repeatedUint32_; } + get { return PrepareBuilder().repeatedUint32_; } } public int RepeatedUint32Count { get { return result.RepeatedUint32Count; } @@ -4480,27 +4662,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedUint32(int index, uint value) { + PrepareBuilder(); result.repeatedUint32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedUint32(uint value) { + PrepareBuilder(); result.repeatedUint32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedUint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedUint32_); return this; } public Builder ClearRepeatedUint32() { + PrepareBuilder(); result.repeatedUint32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedUint64List { - get { return result.repeatedUint64_; } + get { return PrepareBuilder().repeatedUint64_; } } public int RepeatedUint64Count { get { return result.RepeatedUint64Count; } @@ -4511,26 +4697,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedUint64(int index, ulong value) { + PrepareBuilder(); result.repeatedUint64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedUint64(ulong value) { + PrepareBuilder(); result.repeatedUint64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedUint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedUint64_); return this; } public Builder ClearRepeatedUint64() { + PrepareBuilder(); result.repeatedUint64_.Clear(); return this; } public pbc::IPopsicleList RepeatedSint32List { - get { return result.repeatedSint32_; } + get { return PrepareBuilder().repeatedSint32_; } } public int RepeatedSint32Count { get { return result.RepeatedSint32Count; } @@ -4539,24 +4729,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedSint32(index); } public Builder SetRepeatedSint32(int index, int value) { + PrepareBuilder(); result.repeatedSint32_[index] = value; return this; } public Builder AddRepeatedSint32(int value) { + PrepareBuilder(); result.repeatedSint32_.Add(value); return this; } public Builder AddRangeRepeatedSint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedSint32_); return this; } public Builder ClearRepeatedSint32() { + PrepareBuilder(); result.repeatedSint32_.Clear(); return this; } public pbc::IPopsicleList RepeatedSint64List { - get { return result.repeatedSint64_; } + get { return PrepareBuilder().repeatedSint64_; } } public int RepeatedSint64Count { get { return result.RepeatedSint64Count; } @@ -4565,25 +4759,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedSint64(index); } public Builder SetRepeatedSint64(int index, long value) { + PrepareBuilder(); result.repeatedSint64_[index] = value; return this; } public Builder AddRepeatedSint64(long value) { + PrepareBuilder(); result.repeatedSint64_.Add(value); return this; } public Builder AddRangeRepeatedSint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedSint64_); return this; } public Builder ClearRepeatedSint64() { + PrepareBuilder(); result.repeatedSint64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedFixed32List { - get { return result.repeatedFixed32_; } + get { return PrepareBuilder().repeatedFixed32_; } } public int RepeatedFixed32Count { get { return result.RepeatedFixed32Count; } @@ -4594,27 +4792,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedFixed32(int index, uint value) { + PrepareBuilder(); result.repeatedFixed32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedFixed32(uint value) { + PrepareBuilder(); result.repeatedFixed32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedFixed32_); return this; } public Builder ClearRepeatedFixed32() { + PrepareBuilder(); result.repeatedFixed32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedFixed64List { - get { return result.repeatedFixed64_; } + get { return PrepareBuilder().repeatedFixed64_; } } public int RepeatedFixed64Count { get { return result.RepeatedFixed64Count; } @@ -4625,26 +4827,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedFixed64(int index, ulong value) { + PrepareBuilder(); result.repeatedFixed64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedFixed64(ulong value) { + PrepareBuilder(); result.repeatedFixed64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedFixed64_); return this; } public Builder ClearRepeatedFixed64() { + PrepareBuilder(); result.repeatedFixed64_.Clear(); return this; } public pbc::IPopsicleList RepeatedSfixed32List { - get { return result.repeatedSfixed32_; } + get { return PrepareBuilder().repeatedSfixed32_; } } public int RepeatedSfixed32Count { get { return result.RepeatedSfixed32Count; } @@ -4653,24 +4859,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedSfixed32(index); } public Builder SetRepeatedSfixed32(int index, int value) { + PrepareBuilder(); result.repeatedSfixed32_[index] = value; return this; } public Builder AddRepeatedSfixed32(int value) { + PrepareBuilder(); result.repeatedSfixed32_.Add(value); return this; } public Builder AddRangeRepeatedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedSfixed32_); return this; } public Builder ClearRepeatedSfixed32() { + PrepareBuilder(); result.repeatedSfixed32_.Clear(); return this; } public pbc::IPopsicleList RepeatedSfixed64List { - get { return result.repeatedSfixed64_; } + get { return PrepareBuilder().repeatedSfixed64_; } } public int RepeatedSfixed64Count { get { return result.RepeatedSfixed64Count; } @@ -4679,24 +4889,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedSfixed64(index); } public Builder SetRepeatedSfixed64(int index, long value) { + PrepareBuilder(); result.repeatedSfixed64_[index] = value; return this; } public Builder AddRepeatedSfixed64(long value) { + PrepareBuilder(); result.repeatedSfixed64_.Add(value); return this; } public Builder AddRangeRepeatedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedSfixed64_); return this; } public Builder ClearRepeatedSfixed64() { + PrepareBuilder(); result.repeatedSfixed64_.Clear(); return this; } public pbc::IPopsicleList RepeatedFloatList { - get { return result.repeatedFloat_; } + get { return PrepareBuilder().repeatedFloat_; } } public int RepeatedFloatCount { get { return result.RepeatedFloatCount; } @@ -4705,24 +4919,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedFloat(index); } public Builder SetRepeatedFloat(int index, float value) { + PrepareBuilder(); result.repeatedFloat_[index] = value; return this; } public Builder AddRepeatedFloat(float value) { + PrepareBuilder(); result.repeatedFloat_.Add(value); return this; } public Builder AddRangeRepeatedFloat(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedFloat_); return this; } public Builder ClearRepeatedFloat() { + PrepareBuilder(); result.repeatedFloat_.Clear(); return this; } public pbc::IPopsicleList RepeatedDoubleList { - get { return result.repeatedDouble_; } + get { return PrepareBuilder().repeatedDouble_; } } public int RepeatedDoubleCount { get { return result.RepeatedDoubleCount; } @@ -4731,24 +4949,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedDouble(index); } public Builder SetRepeatedDouble(int index, double value) { + PrepareBuilder(); result.repeatedDouble_[index] = value; return this; } public Builder AddRepeatedDouble(double value) { + PrepareBuilder(); result.repeatedDouble_.Add(value); return this; } public Builder AddRangeRepeatedDouble(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedDouble_); return this; } public Builder ClearRepeatedDouble() { + PrepareBuilder(); result.repeatedDouble_.Clear(); return this; } public pbc::IPopsicleList RepeatedBoolList { - get { return result.repeatedBool_; } + get { return PrepareBuilder().repeatedBool_; } } public int RepeatedBoolCount { get { return result.RepeatedBoolCount; } @@ -4757,24 +4979,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedBool(index); } public Builder SetRepeatedBool(int index, bool value) { + PrepareBuilder(); result.repeatedBool_[index] = value; return this; } public Builder AddRepeatedBool(bool value) { + PrepareBuilder(); result.repeatedBool_.Add(value); return this; } public Builder AddRangeRepeatedBool(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedBool_); return this; } public Builder ClearRepeatedBool() { + PrepareBuilder(); result.repeatedBool_.Clear(); return this; } public pbc::IPopsicleList RepeatedStringList { - get { return result.repeatedString_; } + get { return PrepareBuilder().repeatedString_; } } public int RepeatedStringCount { get { return result.RepeatedStringCount; } @@ -4784,25 +5010,29 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedString(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedString_[index] = value; return this; } public Builder AddRepeatedString(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedString_.Add(value); return this; } public Builder AddRangeRepeatedString(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedString_); return this; } public Builder ClearRepeatedString() { + PrepareBuilder(); result.repeatedString_.Clear(); return this; } public pbc::IPopsicleList RepeatedBytesList { - get { return result.repeatedBytes_; } + get { return PrepareBuilder().repeatedBytes_; } } public int RepeatedBytesCount { get { return result.RepeatedBytesCount; } @@ -4812,25 +5042,29 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedBytes(int index, pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedBytes_[index] = value; return this; } public Builder AddRepeatedBytes(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedBytes_.Add(value); return this; } public Builder AddRangeRepeatedBytes(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedBytes_); return this; } public Builder ClearRepeatedBytes() { + PrepareBuilder(); result.repeatedBytes_.Clear(); return this; } public pbc::IPopsicleList RepeatedGroupList { - get { return result.repeatedGroup_; } + get { return PrepareBuilder().repeatedGroup_; } } public int RepeatedGroupCount { get { return result.RepeatedGroupCount; } @@ -4840,35 +5074,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedGroup_[index] = value; return this; } public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedGroup_[index] = builderForValue.Build(); return this; } public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedGroup_.Add(value); return this; } public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedGroup_.Add(builderForValue.Build()); return this; } public Builder AddRangeRepeatedGroup(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedGroup_); return this; } public Builder ClearRepeatedGroup() { + PrepareBuilder(); result.repeatedGroup_.Clear(); return this; } public pbc::IPopsicleList RepeatedNestedMessageList { - get { return result.repeatedNestedMessage_; } + get { return PrepareBuilder().repeatedNestedMessage_; } } public int RepeatedNestedMessageCount { get { return result.RepeatedNestedMessageCount; } @@ -4878,35 +5118,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedNestedMessage_[index] = value; return this; } public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedNestedMessage_[index] = builderForValue.Build(); return this; } public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedNestedMessage_.Add(value); return this; } public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedNestedMessage_.Add(builderForValue.Build()); return this; } public Builder AddRangeRepeatedNestedMessage(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedNestedMessage_); return this; } public Builder ClearRepeatedNestedMessage() { + PrepareBuilder(); result.repeatedNestedMessage_.Clear(); return this; } public pbc::IPopsicleList RepeatedForeignMessageList { - get { return result.repeatedForeignMessage_; } + get { return PrepareBuilder().repeatedForeignMessage_; } } public int RepeatedForeignMessageCount { get { return result.RepeatedForeignMessageCount; } @@ -4916,35 +5162,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedForeignMessage_[index] = value; return this; } public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedForeignMessage_[index] = builderForValue.Build(); return this; } public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedForeignMessage_.Add(value); return this; } public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedForeignMessage_.Add(builderForValue.Build()); return this; } public Builder AddRangeRepeatedForeignMessage(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedForeignMessage_); return this; } public Builder ClearRepeatedForeignMessage() { + PrepareBuilder(); result.repeatedForeignMessage_.Clear(); return this; } public pbc::IPopsicleList RepeatedImportMessageList { - get { return result.repeatedImportMessage_; } + get { return PrepareBuilder().repeatedImportMessage_; } } public int RepeatedImportMessageCount { get { return result.RepeatedImportMessageCount; } @@ -4954,35 +5206,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedImportMessage_[index] = value; return this; } public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedImportMessage_[index] = builderForValue.Build(); return this; } public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedImportMessage_.Add(value); return this; } public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedImportMessage_.Add(builderForValue.Build()); return this; } public Builder AddRangeRepeatedImportMessage(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedImportMessage_); return this; } public Builder ClearRepeatedImportMessage() { + PrepareBuilder(); result.repeatedImportMessage_.Clear(); return this; } public pbc::IPopsicleList RepeatedNestedEnumList { - get { return result.repeatedNestedEnum_; } + get { return PrepareBuilder().repeatedNestedEnum_; } } public int RepeatedNestedEnumCount { get { return result.RepeatedNestedEnumCount; } @@ -4991,24 +5249,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedNestedEnum(index); } public Builder SetRepeatedNestedEnum(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); result.repeatedNestedEnum_[index] = value; return this; } public Builder AddRepeatedNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); result.repeatedNestedEnum_.Add(value); return this; } public Builder AddRangeRepeatedNestedEnum(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedNestedEnum_); return this; } public Builder ClearRepeatedNestedEnum() { + PrepareBuilder(); result.repeatedNestedEnum_.Clear(); return this; } public pbc::IPopsicleList RepeatedForeignEnumList { - get { return result.repeatedForeignEnum_; } + get { return PrepareBuilder().repeatedForeignEnum_; } } public int RepeatedForeignEnumCount { get { return result.RepeatedForeignEnumCount; } @@ -5017,24 +5279,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedForeignEnum(index); } public Builder SetRepeatedForeignEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.repeatedForeignEnum_[index] = value; return this; } public Builder AddRepeatedForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.repeatedForeignEnum_.Add(value); return this; } public Builder AddRangeRepeatedForeignEnum(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedForeignEnum_); return this; } public Builder ClearRepeatedForeignEnum() { + PrepareBuilder(); result.repeatedForeignEnum_.Clear(); return this; } public pbc::IPopsicleList RepeatedImportEnumList { - get { return result.repeatedImportEnum_; } + get { return PrepareBuilder().repeatedImportEnum_; } } public int RepeatedImportEnumCount { get { return result.RepeatedImportEnumCount; } @@ -5043,24 +5309,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedImportEnum(index); } public Builder SetRepeatedImportEnum(int index, global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); result.repeatedImportEnum_[index] = value; return this; } public Builder AddRepeatedImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); result.repeatedImportEnum_.Add(value); return this; } public Builder AddRangeRepeatedImportEnum(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedImportEnum_); return this; } public Builder ClearRepeatedImportEnum() { + PrepareBuilder(); result.repeatedImportEnum_.Clear(); return this; } public pbc::IPopsicleList RepeatedStringPieceList { - get { return result.repeatedStringPiece_; } + get { return PrepareBuilder().repeatedStringPiece_; } } public int RepeatedStringPieceCount { get { return result.RepeatedStringPieceCount; } @@ -5070,25 +5340,29 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedStringPiece(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedStringPiece_[index] = value; return this; } public Builder AddRepeatedStringPiece(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedStringPiece_.Add(value); return this; } public Builder AddRangeRepeatedStringPiece(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedStringPiece_); return this; } public Builder ClearRepeatedStringPiece() { + PrepareBuilder(); result.repeatedStringPiece_.Clear(); return this; } public pbc::IPopsicleList RepeatedCordList { - get { return result.repeatedCord_; } + get { return PrepareBuilder().repeatedCord_; } } public int RepeatedCordCount { get { return result.RepeatedCordCount; } @@ -5098,19 +5372,23 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedCord(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedCord_[index] = value; return this; } public Builder AddRepeatedCord(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedCord_.Add(value); return this; } public Builder AddRangeRepeatedCord(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedCord_); return this; } public Builder ClearRepeatedCord() { + PrepareBuilder(); result.repeatedCord_.Clear(); return this; } @@ -5123,11 +5401,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultInt32(value); } } public Builder SetDefaultInt32(int value) { + PrepareBuilder(); result.hasDefaultInt32 = true; result.defaultInt32_ = value; return this; } public Builder ClearDefaultInt32() { + PrepareBuilder(); result.hasDefaultInt32 = false; result.defaultInt32_ = 41; return this; @@ -5141,11 +5421,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultInt64(value); } } public Builder SetDefaultInt64(long value) { + PrepareBuilder(); result.hasDefaultInt64 = true; result.defaultInt64_ = value; return this; } public Builder ClearDefaultInt64() { + PrepareBuilder(); result.hasDefaultInt64 = false; result.defaultInt64_ = 42L; return this; @@ -5161,11 +5443,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetDefaultUint32(uint value) { + PrepareBuilder(); result.hasDefaultUint32 = true; result.defaultUint32_ = value; return this; } public Builder ClearDefaultUint32() { + PrepareBuilder(); result.hasDefaultUint32 = false; result.defaultUint32_ = 43; return this; @@ -5181,11 +5465,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetDefaultUint64(ulong value) { + PrepareBuilder(); result.hasDefaultUint64 = true; result.defaultUint64_ = value; return this; } public Builder ClearDefaultUint64() { + PrepareBuilder(); result.hasDefaultUint64 = false; result.defaultUint64_ = 44UL; return this; @@ -5199,11 +5485,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultSint32(value); } } public Builder SetDefaultSint32(int value) { + PrepareBuilder(); result.hasDefaultSint32 = true; result.defaultSint32_ = value; return this; } public Builder ClearDefaultSint32() { + PrepareBuilder(); result.hasDefaultSint32 = false; result.defaultSint32_ = -45; return this; @@ -5217,11 +5505,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultSint64(value); } } public Builder SetDefaultSint64(long value) { + PrepareBuilder(); result.hasDefaultSint64 = true; result.defaultSint64_ = value; return this; } public Builder ClearDefaultSint64() { + PrepareBuilder(); result.hasDefaultSint64 = false; result.defaultSint64_ = 46; return this; @@ -5237,11 +5527,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetDefaultFixed32(uint value) { + PrepareBuilder(); result.hasDefaultFixed32 = true; result.defaultFixed32_ = value; return this; } public Builder ClearDefaultFixed32() { + PrepareBuilder(); result.hasDefaultFixed32 = false; result.defaultFixed32_ = 47; return this; @@ -5257,11 +5549,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetDefaultFixed64(ulong value) { + PrepareBuilder(); result.hasDefaultFixed64 = true; result.defaultFixed64_ = value; return this; } public Builder ClearDefaultFixed64() { + PrepareBuilder(); result.hasDefaultFixed64 = false; result.defaultFixed64_ = 48; return this; @@ -5275,11 +5569,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultSfixed32(value); } } public Builder SetDefaultSfixed32(int value) { + PrepareBuilder(); result.hasDefaultSfixed32 = true; result.defaultSfixed32_ = value; return this; } public Builder ClearDefaultSfixed32() { + PrepareBuilder(); result.hasDefaultSfixed32 = false; result.defaultSfixed32_ = 49; return this; @@ -5293,11 +5589,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultSfixed64(value); } } public Builder SetDefaultSfixed64(long value) { + PrepareBuilder(); result.hasDefaultSfixed64 = true; result.defaultSfixed64_ = value; return this; } public Builder ClearDefaultSfixed64() { + PrepareBuilder(); result.hasDefaultSfixed64 = false; result.defaultSfixed64_ = -50; return this; @@ -5311,11 +5609,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultFloat(value); } } public Builder SetDefaultFloat(float value) { + PrepareBuilder(); result.hasDefaultFloat = true; result.defaultFloat_ = value; return this; } public Builder ClearDefaultFloat() { + PrepareBuilder(); result.hasDefaultFloat = false; result.defaultFloat_ = 51.5F; return this; @@ -5329,11 +5629,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultDouble(value); } } public Builder SetDefaultDouble(double value) { + PrepareBuilder(); result.hasDefaultDouble = true; result.defaultDouble_ = value; return this; } public Builder ClearDefaultDouble() { + PrepareBuilder(); result.hasDefaultDouble = false; result.defaultDouble_ = 52000D; return this; @@ -5347,11 +5649,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultBool(value); } } public Builder SetDefaultBool(bool value) { + PrepareBuilder(); result.hasDefaultBool = true; result.defaultBool_ = value; return this; } public Builder ClearDefaultBool() { + PrepareBuilder(); result.hasDefaultBool = false; result.defaultBool_ = true; return this; @@ -5366,11 +5670,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetDefaultString(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasDefaultString = true; result.defaultString_ = value; return this; } public Builder ClearDefaultString() { + PrepareBuilder(); result.hasDefaultString = false; result.defaultString_ = "hello"; return this; @@ -5385,11 +5691,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetDefaultBytes(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasDefaultBytes = true; result.defaultBytes_ = value; return this; } public Builder ClearDefaultBytes() { + PrepareBuilder(); result.hasDefaultBytes = false; result.defaultBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Descriptor.Fields[62].DefaultValue; return this; @@ -5403,11 +5711,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultNestedEnum(value); } } public Builder SetDefaultNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); result.hasDefaultNestedEnum = true; result.defaultNestedEnum_ = value; return this; } public Builder ClearDefaultNestedEnum() { + PrepareBuilder(); result.hasDefaultNestedEnum = false; result.defaultNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.BAR; return this; @@ -5421,11 +5731,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultForeignEnum(value); } } public Builder SetDefaultForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.hasDefaultForeignEnum = true; result.defaultForeignEnum_ = value; return this; } public Builder ClearDefaultForeignEnum() { + PrepareBuilder(); result.hasDefaultForeignEnum = false; result.defaultForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_BAR; return this; @@ -5439,11 +5751,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDefaultImportEnum(value); } } public Builder SetDefaultImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); result.hasDefaultImportEnum = true; result.defaultImportEnum_ = value; return this; } public Builder ClearDefaultImportEnum() { + PrepareBuilder(); result.hasDefaultImportEnum = false; result.defaultImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_BAR; return this; @@ -5458,11 +5772,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetDefaultStringPiece(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasDefaultStringPiece = true; result.defaultStringPiece_ = value; return this; } public Builder ClearDefaultStringPiece() { + PrepareBuilder(); result.hasDefaultStringPiece = false; result.defaultStringPiece_ = "abc"; return this; @@ -5477,11 +5793,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetDefaultCord(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasDefaultCord = true; result.defaultCord_ = value; return this; } public Builder ClearDefaultCord() { + PrepareBuilder(); result.hasDefaultCord = false; result.defaultCord_ = "123"; return this; @@ -5594,7 +5912,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestDeprecatedFields prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -5604,21 +5922,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestDeprecatedFields(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestDeprecatedFields cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestDeprecatedFields result; - TestDeprecatedFields result = new TestDeprecatedFields(); + private TestDeprecatedFields PrepareBuilder() { + if (builderIsReadOnly) { + TestDeprecatedFields original = result; + result = new TestDeprecatedFields(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestDeprecatedFields MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestDeprecatedFields(); + result = DefaultInstance ?? new TestDeprecatedFields(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -5630,12 +5975,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDeprecatedFields BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestDeprecatedFields returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -5649,6 +5993,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestDeprecatedFields other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestDeprecatedFields.DefaultInstance) return this; + PrepareBuilder(); if (other.HasDeprecatedInt32) { DeprecatedInt32 = other.DeprecatedInt32; } @@ -5661,6 +6006,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -5716,11 +6062,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDeprecatedInt32(value); } } public Builder SetDeprecatedInt32(int value) { + PrepareBuilder(); result.hasDeprecatedInt32 = true; result.deprecatedInt32_ = value; return this; } public Builder ClearDeprecatedInt32() { + PrepareBuilder(); result.hasDeprecatedInt32 = false; result.deprecatedInt32_ = 0; return this; @@ -5833,7 +6181,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ForeignMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -5843,21 +6191,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new ForeignMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(ForeignMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - ForeignMessage result = new ForeignMessage(); + bool builderIsReadOnly; + ForeignMessage result; + + private ForeignMessage PrepareBuilder() { + if (builderIsReadOnly) { + ForeignMessage original = result; + result = new ForeignMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override ForeignMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new ForeignMessage(); + result = DefaultInstance ?? new ForeignMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -5869,12 +6244,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ForeignMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - ForeignMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -5888,6 +6262,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(ForeignMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) return this; + PrepareBuilder(); if (other.HasC) { C = other.C; } @@ -5900,6 +6275,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -5955,11 +6331,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetC(value); } } public Builder SetC(int value) { + PrepareBuilder(); result.hasC = true; result.c_ = value; return this; } public Builder ClearC() { + PrepareBuilder(); result.hasC = false; result.c_ = 0; return this; @@ -6060,7 +6438,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestAllExtensions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -6070,21 +6448,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestAllExtensions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestAllExtensions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestAllExtensions result = new TestAllExtensions(); + bool builderIsReadOnly; + TestAllExtensions result; + + private TestAllExtensions PrepareBuilder() { + if (builderIsReadOnly) { + TestAllExtensions original = result; + result = new TestAllExtensions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestAllExtensions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestAllExtensions(); + result = DefaultInstance ?? new TestAllExtensions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -6096,12 +6501,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllExtensions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestAllExtensions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -6115,6 +6519,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestAllExtensions other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestAllExtensions.DefaultInstance) return this; + PrepareBuilder(); this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); return this; @@ -6125,6 +6530,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -6275,7 +6681,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(OptionalGroup_extension prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -6285,21 +6691,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new OptionalGroup_extension(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(OptionalGroup_extension cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - OptionalGroup_extension result = new OptionalGroup_extension(); + bool builderIsReadOnly; + OptionalGroup_extension result; + + private OptionalGroup_extension PrepareBuilder() { + if (builderIsReadOnly) { + OptionalGroup_extension original = result; + result = new OptionalGroup_extension(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override OptionalGroup_extension MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new OptionalGroup_extension(); + result = DefaultInstance ?? new OptionalGroup_extension(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -6311,12 +6744,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup_extension BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - OptionalGroup_extension returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -6330,6 +6762,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(OptionalGroup_extension other) { if (other == global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -6342,6 +6775,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -6397,11 +6831,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -6514,7 +6950,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(RepeatedGroup_extension prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -6524,21 +6960,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new RepeatedGroup_extension(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(RepeatedGroup_extension cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + RepeatedGroup_extension result; + + private RepeatedGroup_extension PrepareBuilder() { + if (builderIsReadOnly) { + RepeatedGroup_extension original = result; + result = new RepeatedGroup_extension(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - RepeatedGroup_extension result = new RepeatedGroup_extension(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override RepeatedGroup_extension MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new RepeatedGroup_extension(); + result = DefaultInstance ?? new RepeatedGroup_extension(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -6550,12 +7013,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup_extension BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - RepeatedGroup_extension returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -6569,6 +7031,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(RepeatedGroup_extension other) { if (other == global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -6581,6 +7044,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -6636,11 +7100,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -6739,7 +7205,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestNestedExtension prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -6749,21 +7215,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestNestedExtension(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestNestedExtension cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestNestedExtension result; + + private TestNestedExtension PrepareBuilder() { + if (builderIsReadOnly) { + TestNestedExtension original = result; + result = new TestNestedExtension(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestNestedExtension result = new TestNestedExtension(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestNestedExtension MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestNestedExtension(); + result = DefaultInstance ?? new TestNestedExtension(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -6775,12 +7268,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestNestedExtension BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestNestedExtension returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -6794,6 +7286,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestNestedExtension other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -6803,6 +7296,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -7472,7 +7966,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestRequired prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -7482,21 +7976,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestRequired(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestRequired cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestRequired result = new TestRequired(); + bool builderIsReadOnly; + TestRequired result; + + private TestRequired PrepareBuilder() { + if (builderIsReadOnly) { + TestRequired original = result; + result = new TestRequired(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestRequired MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestRequired(); + result = DefaultInstance ?? new TestRequired(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -7508,12 +8029,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRequired BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestRequired returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -7527,6 +8047,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestRequired other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -7635,6 +8156,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -7818,11 +8340,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -7836,11 +8360,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy2(value); } } public Builder SetDummy2(int value) { + PrepareBuilder(); result.hasDummy2 = true; result.dummy2_ = value; return this; } public Builder ClearDummy2() { + PrepareBuilder(); result.hasDummy2 = false; result.dummy2_ = 0; return this; @@ -7854,11 +8380,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetB(value); } } public Builder SetB(int value) { + PrepareBuilder(); result.hasB = true; result.b_ = value; return this; } public Builder ClearB() { + PrepareBuilder(); result.hasB = false; result.b_ = 0; return this; @@ -7872,11 +8400,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy4(value); } } public Builder SetDummy4(int value) { + PrepareBuilder(); result.hasDummy4 = true; result.dummy4_ = value; return this; } public Builder ClearDummy4() { + PrepareBuilder(); result.hasDummy4 = false; result.dummy4_ = 0; return this; @@ -7890,11 +8420,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy5(value); } } public Builder SetDummy5(int value) { + PrepareBuilder(); result.hasDummy5 = true; result.dummy5_ = value; return this; } public Builder ClearDummy5() { + PrepareBuilder(); result.hasDummy5 = false; result.dummy5_ = 0; return this; @@ -7908,11 +8440,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy6(value); } } public Builder SetDummy6(int value) { + PrepareBuilder(); result.hasDummy6 = true; result.dummy6_ = value; return this; } public Builder ClearDummy6() { + PrepareBuilder(); result.hasDummy6 = false; result.dummy6_ = 0; return this; @@ -7926,11 +8460,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy7(value); } } public Builder SetDummy7(int value) { + PrepareBuilder(); result.hasDummy7 = true; result.dummy7_ = value; return this; } public Builder ClearDummy7() { + PrepareBuilder(); result.hasDummy7 = false; result.dummy7_ = 0; return this; @@ -7944,11 +8480,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy8(value); } } public Builder SetDummy8(int value) { + PrepareBuilder(); result.hasDummy8 = true; result.dummy8_ = value; return this; } public Builder ClearDummy8() { + PrepareBuilder(); result.hasDummy8 = false; result.dummy8_ = 0; return this; @@ -7962,11 +8500,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy9(value); } } public Builder SetDummy9(int value) { + PrepareBuilder(); result.hasDummy9 = true; result.dummy9_ = value; return this; } public Builder ClearDummy9() { + PrepareBuilder(); result.hasDummy9 = false; result.dummy9_ = 0; return this; @@ -7980,11 +8520,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy10(value); } } public Builder SetDummy10(int value) { + PrepareBuilder(); result.hasDummy10 = true; result.dummy10_ = value; return this; } public Builder ClearDummy10() { + PrepareBuilder(); result.hasDummy10 = false; result.dummy10_ = 0; return this; @@ -7998,11 +8540,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy11(value); } } public Builder SetDummy11(int value) { + PrepareBuilder(); result.hasDummy11 = true; result.dummy11_ = value; return this; } public Builder ClearDummy11() { + PrepareBuilder(); result.hasDummy11 = false; result.dummy11_ = 0; return this; @@ -8016,11 +8560,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy12(value); } } public Builder SetDummy12(int value) { + PrepareBuilder(); result.hasDummy12 = true; result.dummy12_ = value; return this; } public Builder ClearDummy12() { + PrepareBuilder(); result.hasDummy12 = false; result.dummy12_ = 0; return this; @@ -8034,11 +8580,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy13(value); } } public Builder SetDummy13(int value) { + PrepareBuilder(); result.hasDummy13 = true; result.dummy13_ = value; return this; } public Builder ClearDummy13() { + PrepareBuilder(); result.hasDummy13 = false; result.dummy13_ = 0; return this; @@ -8052,11 +8600,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy14(value); } } public Builder SetDummy14(int value) { + PrepareBuilder(); result.hasDummy14 = true; result.dummy14_ = value; return this; } public Builder ClearDummy14() { + PrepareBuilder(); result.hasDummy14 = false; result.dummy14_ = 0; return this; @@ -8070,11 +8620,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy15(value); } } public Builder SetDummy15(int value) { + PrepareBuilder(); result.hasDummy15 = true; result.dummy15_ = value; return this; } public Builder ClearDummy15() { + PrepareBuilder(); result.hasDummy15 = false; result.dummy15_ = 0; return this; @@ -8088,11 +8640,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy16(value); } } public Builder SetDummy16(int value) { + PrepareBuilder(); result.hasDummy16 = true; result.dummy16_ = value; return this; } public Builder ClearDummy16() { + PrepareBuilder(); result.hasDummy16 = false; result.dummy16_ = 0; return this; @@ -8106,11 +8660,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy17(value); } } public Builder SetDummy17(int value) { + PrepareBuilder(); result.hasDummy17 = true; result.dummy17_ = value; return this; } public Builder ClearDummy17() { + PrepareBuilder(); result.hasDummy17 = false; result.dummy17_ = 0; return this; @@ -8124,11 +8680,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy18(value); } } public Builder SetDummy18(int value) { + PrepareBuilder(); result.hasDummy18 = true; result.dummy18_ = value; return this; } public Builder ClearDummy18() { + PrepareBuilder(); result.hasDummy18 = false; result.dummy18_ = 0; return this; @@ -8142,11 +8700,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy19(value); } } public Builder SetDummy19(int value) { + PrepareBuilder(); result.hasDummy19 = true; result.dummy19_ = value; return this; } public Builder ClearDummy19() { + PrepareBuilder(); result.hasDummy19 = false; result.dummy19_ = 0; return this; @@ -8160,11 +8720,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy20(value); } } public Builder SetDummy20(int value) { + PrepareBuilder(); result.hasDummy20 = true; result.dummy20_ = value; return this; } public Builder ClearDummy20() { + PrepareBuilder(); result.hasDummy20 = false; result.dummy20_ = 0; return this; @@ -8178,11 +8740,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy21(value); } } public Builder SetDummy21(int value) { + PrepareBuilder(); result.hasDummy21 = true; result.dummy21_ = value; return this; } public Builder ClearDummy21() { + PrepareBuilder(); result.hasDummy21 = false; result.dummy21_ = 0; return this; @@ -8196,11 +8760,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy22(value); } } public Builder SetDummy22(int value) { + PrepareBuilder(); result.hasDummy22 = true; result.dummy22_ = value; return this; } public Builder ClearDummy22() { + PrepareBuilder(); result.hasDummy22 = false; result.dummy22_ = 0; return this; @@ -8214,11 +8780,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy23(value); } } public Builder SetDummy23(int value) { + PrepareBuilder(); result.hasDummy23 = true; result.dummy23_ = value; return this; } public Builder ClearDummy23() { + PrepareBuilder(); result.hasDummy23 = false; result.dummy23_ = 0; return this; @@ -8232,11 +8800,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy24(value); } } public Builder SetDummy24(int value) { + PrepareBuilder(); result.hasDummy24 = true; result.dummy24_ = value; return this; } public Builder ClearDummy24() { + PrepareBuilder(); result.hasDummy24 = false; result.dummy24_ = 0; return this; @@ -8250,11 +8820,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy25(value); } } public Builder SetDummy25(int value) { + PrepareBuilder(); result.hasDummy25 = true; result.dummy25_ = value; return this; } public Builder ClearDummy25() { + PrepareBuilder(); result.hasDummy25 = false; result.dummy25_ = 0; return this; @@ -8268,11 +8840,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy26(value); } } public Builder SetDummy26(int value) { + PrepareBuilder(); result.hasDummy26 = true; result.dummy26_ = value; return this; } public Builder ClearDummy26() { + PrepareBuilder(); result.hasDummy26 = false; result.dummy26_ = 0; return this; @@ -8286,11 +8860,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy27(value); } } public Builder SetDummy27(int value) { + PrepareBuilder(); result.hasDummy27 = true; result.dummy27_ = value; return this; } public Builder ClearDummy27() { + PrepareBuilder(); result.hasDummy27 = false; result.dummy27_ = 0; return this; @@ -8304,11 +8880,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy28(value); } } public Builder SetDummy28(int value) { + PrepareBuilder(); result.hasDummy28 = true; result.dummy28_ = value; return this; } public Builder ClearDummy28() { + PrepareBuilder(); result.hasDummy28 = false; result.dummy28_ = 0; return this; @@ -8322,11 +8900,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy29(value); } } public Builder SetDummy29(int value) { + PrepareBuilder(); result.hasDummy29 = true; result.dummy29_ = value; return this; } public Builder ClearDummy29() { + PrepareBuilder(); result.hasDummy29 = false; result.dummy29_ = 0; return this; @@ -8340,11 +8920,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy30(value); } } public Builder SetDummy30(int value) { + PrepareBuilder(); result.hasDummy30 = true; result.dummy30_ = value; return this; } public Builder ClearDummy30() { + PrepareBuilder(); result.hasDummy30 = false; result.dummy30_ = 0; return this; @@ -8358,11 +8940,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy31(value); } } public Builder SetDummy31(int value) { + PrepareBuilder(); result.hasDummy31 = true; result.dummy31_ = value; return this; } public Builder ClearDummy31() { + PrepareBuilder(); result.hasDummy31 = false; result.dummy31_ = 0; return this; @@ -8376,11 +8960,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy32(value); } } public Builder SetDummy32(int value) { + PrepareBuilder(); result.hasDummy32 = true; result.dummy32_ = value; return this; } public Builder ClearDummy32() { + PrepareBuilder(); result.hasDummy32 = false; result.dummy32_ = 0; return this; @@ -8394,11 +8980,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetC(value); } } public Builder SetC(int value) { + PrepareBuilder(); result.hasC = true; result.c_ = value; return this; } public Builder ClearC() { + PrepareBuilder(); result.hasC = false; result.c_ = 0; return this; @@ -8551,7 +9139,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestRequiredForeign prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -8561,21 +9149,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestRequiredForeign(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestRequiredForeign cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestRequiredForeign result; - TestRequiredForeign result = new TestRequiredForeign(); + private TestRequiredForeign PrepareBuilder() { + if (builderIsReadOnly) { + TestRequiredForeign original = result; + result = new TestRequiredForeign(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestRequiredForeign MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestRequiredForeign(); + result = DefaultInstance ?? new TestRequiredForeign(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -8587,13 +9202,12 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRequiredForeign BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.repeatedMessage_.MakeReadOnly(); - TestRequiredForeign returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -8607,6 +9221,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestRequiredForeign other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestRequiredForeign.DefaultInstance) return this; + PrepareBuilder(); if (other.HasOptionalMessage) { MergeOptionalMessage(other.OptionalMessage); } @@ -8625,6 +9240,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -8694,18 +9310,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalMessage = true; result.optionalMessage_ = value; return this; } public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptionalMessage = true; result.optionalMessage_ = builderForValue.Build(); return this; } public Builder MergeOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptionalMessage && result.optionalMessage_ != global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance) { result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestRequired.CreateBuilder(result.optionalMessage_).MergeFrom(value).BuildPartial(); @@ -8716,13 +9335,14 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearOptionalMessage() { + PrepareBuilder(); result.hasOptionalMessage = false; result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance; return this; } public pbc::IPopsicleList RepeatedMessageList { - get { return result.repeatedMessage_; } + get { return PrepareBuilder().repeatedMessage_; } } public int RepeatedMessageCount { get { return result.RepeatedMessageCount; } @@ -8732,29 +9352,35 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestRequired value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedMessage_[index] = value; return this; } public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedMessage_[index] = builderForValue.Build(); return this; } public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedMessage_.Add(value); return this; } public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedMessage_.Add(builderForValue.Build()); return this; } public Builder AddRangeRepeatedMessage(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedMessage_); return this; } public Builder ClearRepeatedMessage() { + PrepareBuilder(); result.repeatedMessage_.Clear(); return this; } @@ -8767,11 +9393,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDummy(value); } } public Builder SetDummy(int value) { + PrepareBuilder(); result.hasDummy = true; result.dummy_ = value; return this; } public Builder ClearDummy() { + PrepareBuilder(); result.hasDummy = false; result.dummy_ = 0; return this; @@ -8884,7 +9512,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestForeignNested prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -8894,21 +9522,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestForeignNested(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestForeignNested cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestForeignNested result = new TestForeignNested(); + bool builderIsReadOnly; + TestForeignNested result; + + private TestForeignNested PrepareBuilder() { + if (builderIsReadOnly) { + TestForeignNested original = result; + result = new TestForeignNested(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestForeignNested MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestForeignNested(); + result = DefaultInstance ?? new TestForeignNested(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -8920,12 +9575,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestForeignNested BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestForeignNested returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -8939,6 +9593,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestForeignNested other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestForeignNested.DefaultInstance) return this; + PrepareBuilder(); if (other.HasForeignNested) { MergeForeignNested(other.ForeignNested); } @@ -8951,6 +9606,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -9012,18 +9668,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasForeignNested = true; result.foreignNested_ = value; return this; } public Builder SetForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasForeignNested = true; result.foreignNested_ = builderForValue.Build(); return this; } public Builder MergeForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasForeignNested && result.foreignNested_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) { result.foreignNested_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(result.foreignNested_).MergeFrom(value).BuildPartial(); @@ -9034,6 +9693,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearForeignNested() { + PrepareBuilder(); result.hasForeignNested = false; result.foreignNested_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; return this; @@ -9130,7 +9790,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestEmptyMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -9140,21 +9800,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestEmptyMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestEmptyMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestEmptyMessage result; + + private TestEmptyMessage PrepareBuilder() { + if (builderIsReadOnly) { + TestEmptyMessage original = result; + result = new TestEmptyMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestEmptyMessage result = new TestEmptyMessage(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestEmptyMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestEmptyMessage(); + result = DefaultInstance ?? new TestEmptyMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -9166,12 +9853,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestEmptyMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestEmptyMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -9185,6 +9871,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestEmptyMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestEmptyMessage.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -9194,6 +9881,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -9332,7 +10020,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestEmptyMessageWithExtensions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -9342,21 +10030,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestEmptyMessageWithExtensions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestEmptyMessageWithExtensions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestEmptyMessageWithExtensions result = new TestEmptyMessageWithExtensions(); + bool builderIsReadOnly; + TestEmptyMessageWithExtensions result; + + private TestEmptyMessageWithExtensions PrepareBuilder() { + if (builderIsReadOnly) { + TestEmptyMessageWithExtensions original = result; + result = new TestEmptyMessageWithExtensions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestEmptyMessageWithExtensions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestEmptyMessageWithExtensions(); + result = DefaultInstance ?? new TestEmptyMessageWithExtensions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -9368,12 +10083,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestEmptyMessageWithExtensions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestEmptyMessageWithExtensions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -9387,6 +10101,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestEmptyMessageWithExtensions other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestEmptyMessageWithExtensions.DefaultInstance) return this; + PrepareBuilder(); this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); return this; @@ -9397,6 +10112,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -9537,7 +10253,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestMultipleExtensionRanges prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -9547,21 +10263,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestMultipleExtensionRanges(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestMultipleExtensionRanges cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestMultipleExtensionRanges result; + + private TestMultipleExtensionRanges PrepareBuilder() { + if (builderIsReadOnly) { + TestMultipleExtensionRanges original = result; + result = new TestMultipleExtensionRanges(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestMultipleExtensionRanges result = new TestMultipleExtensionRanges(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestMultipleExtensionRanges MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestMultipleExtensionRanges(); + result = DefaultInstance ?? new TestMultipleExtensionRanges(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -9573,12 +10316,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMultipleExtensionRanges BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestMultipleExtensionRanges returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -9592,6 +10334,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestMultipleExtensionRanges other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestMultipleExtensionRanges.DefaultInstance) return this; + PrepareBuilder(); this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); return this; @@ -9602,6 +10345,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -9768,7 +10512,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestReallyLargeTagNumber prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -9778,21 +10522,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestReallyLargeTagNumber(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestReallyLargeTagNumber cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestReallyLargeTagNumber result; + + private TestReallyLargeTagNumber PrepareBuilder() { + if (builderIsReadOnly) { + TestReallyLargeTagNumber original = result; + result = new TestReallyLargeTagNumber(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestReallyLargeTagNumber result = new TestReallyLargeTagNumber(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestReallyLargeTagNumber MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestReallyLargeTagNumber(); + result = DefaultInstance ?? new TestReallyLargeTagNumber(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -9804,12 +10575,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestReallyLargeTagNumber BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestReallyLargeTagNumber returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -9823,6 +10593,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestReallyLargeTagNumber other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestReallyLargeTagNumber.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -9838,6 +10609,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -9897,11 +10669,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -9915,11 +10689,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetBb(value); } } public Builder SetBb(int value) { + PrepareBuilder(); result.hasBb = true; result.bb_ = value; return this; } public Builder ClearBb() { + PrepareBuilder(); result.hasBb = false; result.bb_ = 0; return this; @@ -10048,7 +10824,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestRecursiveMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -10058,21 +10834,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestRecursiveMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestRecursiveMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestRecursiveMessage result = new TestRecursiveMessage(); + bool builderIsReadOnly; + TestRecursiveMessage result; + + private TestRecursiveMessage PrepareBuilder() { + if (builderIsReadOnly) { + TestRecursiveMessage original = result; + result = new TestRecursiveMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestRecursiveMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestRecursiveMessage(); + result = DefaultInstance ?? new TestRecursiveMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -10084,12 +10887,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRecursiveMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestRecursiveMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -10103,6 +10905,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestRecursiveMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { MergeA(other.A); } @@ -10118,6 +10921,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -10183,18 +10987,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasA = true; result.a_ = builderForValue.Build(); return this; } public Builder MergeA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasA && result.a_ != global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance) { result.a_ = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.CreateBuilder(result.a_).MergeFrom(value).BuildPartial(); @@ -10205,6 +11012,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance; return this; @@ -10218,11 +11026,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetI(value); } } public Builder SetI(int value) { + PrepareBuilder(); result.hasI = true; result.i_ = value; return this; } public Builder ClearI() { + PrepareBuilder(); result.hasI = false; result.i_ = 0; return this; @@ -10335,7 +11145,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestMutualRecursionA prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -10345,21 +11155,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestMutualRecursionA(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestMutualRecursionA cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestMutualRecursionA result; + + private TestMutualRecursionA PrepareBuilder() { + if (builderIsReadOnly) { + TestMutualRecursionA original = result; + result = new TestMutualRecursionA(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestMutualRecursionA result = new TestMutualRecursionA(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestMutualRecursionA MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestMutualRecursionA(); + result = DefaultInstance ?? new TestMutualRecursionA(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -10371,12 +11208,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMutualRecursionA BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestMutualRecursionA returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -10390,6 +11226,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestMutualRecursionA other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance) return this; + PrepareBuilder(); if (other.HasBb) { MergeBb(other.Bb); } @@ -10402,6 +11239,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -10463,18 +11301,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasBb = true; result.bb_ = value; return this; } public Builder SetBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasBb = true; result.bb_ = builderForValue.Build(); return this; } public Builder MergeBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasBb && result.bb_ != global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance) { result.bb_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.CreateBuilder(result.bb_).MergeFrom(value).BuildPartial(); @@ -10485,6 +11326,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearBb() { + PrepareBuilder(); result.hasBb = false; result.bb_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance; return this; @@ -10613,7 +11455,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestMutualRecursionB prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -10623,21 +11465,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestMutualRecursionB(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestMutualRecursionB cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestMutualRecursionB result = new TestMutualRecursionB(); + bool builderIsReadOnly; + TestMutualRecursionB result; + + private TestMutualRecursionB PrepareBuilder() { + if (builderIsReadOnly) { + TestMutualRecursionB original = result; + result = new TestMutualRecursionB(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestMutualRecursionB MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestMutualRecursionB(); + result = DefaultInstance ?? new TestMutualRecursionB(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -10649,12 +11518,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMutualRecursionB BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestMutualRecursionB returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -10668,6 +11536,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestMutualRecursionB other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { MergeA(other.A); } @@ -10683,6 +11552,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -10748,18 +11618,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasA = true; result.a_ = builderForValue.Build(); return this; } public Builder MergeA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasA && result.a_ != global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance) { result.a_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.CreateBuilder(result.a_).MergeFrom(value).BuildPartial(); @@ -10770,6 +11643,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance; return this; @@ -10783,11 +11657,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOptionalInt32(value); } } public Builder SetOptionalInt32(int value) { + PrepareBuilder(); result.hasOptionalInt32 = true; result.optionalInt32_ = value; return this; } public Builder ClearOptionalInt32() { + PrepareBuilder(); result.hasOptionalInt32 = false; result.optionalInt32_ = 0; return this; @@ -10932,7 +11808,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(Foo prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -10942,21 +11818,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new Foo(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(Foo cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + Foo result; - Foo result = new Foo(); + private Foo PrepareBuilder() { + if (builderIsReadOnly) { + Foo original = result; + result = new Foo(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override Foo MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new Foo(); + result = DefaultInstance ?? new Foo(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -10968,12 +11871,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Foo BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - Foo returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -10987,6 +11889,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(Foo other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -10999,6 +11902,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -11054,11 +11958,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -11171,7 +12077,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(Bar prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -11181,21 +12087,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new Bar(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(Bar cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - Bar result = new Bar(); + bool builderIsReadOnly; + Bar result; + + private Bar PrepareBuilder() { + if (builderIsReadOnly) { + Bar original = result; + result = new Bar(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override Bar MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new Bar(); + result = DefaultInstance ?? new Bar(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -11207,12 +12140,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Bar BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - Bar returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -11226,6 +12158,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(Bar other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -11238,6 +12171,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -11293,11 +12227,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -11418,7 +12354,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestDupFieldNumber prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -11428,21 +12364,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestDupFieldNumber(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestDupFieldNumber cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestDupFieldNumber result = new TestDupFieldNumber(); + bool builderIsReadOnly; + TestDupFieldNumber result; + + private TestDupFieldNumber PrepareBuilder() { + if (builderIsReadOnly) { + TestDupFieldNumber original = result; + result = new TestDupFieldNumber(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestDupFieldNumber MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestDupFieldNumber(); + result = DefaultInstance ?? new TestDupFieldNumber(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -11454,12 +12417,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDupFieldNumber BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestDupFieldNumber returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -11473,6 +12435,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestDupFieldNumber other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.DefaultInstance) return this; + PrepareBuilder(); if (other.HasA) { A = other.A; } @@ -11491,6 +12454,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -11564,11 +12528,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetA(value); } } public Builder SetA(int value) { + PrepareBuilder(); result.hasA = true; result.a_ = value; return this; } public Builder ClearA() { + PrepareBuilder(); result.hasA = false; result.a_ = 0; return this; @@ -11583,18 +12549,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasFoo = true; result.foo_ = value; return this; } public Builder SetFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasFoo = true; result.foo_ = builderForValue.Build(); return this; } public Builder MergeFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasFoo && result.foo_ != global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance) { result.foo_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.CreateBuilder(result.foo_).MergeFrom(value).BuildPartial(); @@ -11605,6 +12574,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearFoo() { + PrepareBuilder(); result.hasFoo = false; result.foo_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance; return this; @@ -11619,18 +12589,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasBar = true; result.bar_ = value; return this; } public Builder SetBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasBar = true; result.bar_ = builderForValue.Build(); return this; } public Builder MergeBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasBar && result.bar_ != global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance) { result.bar_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.CreateBuilder(result.bar_).MergeFrom(value).BuildPartial(); @@ -11641,6 +12614,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearBar() { + PrepareBuilder(); result.hasBar = false; result.bar_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance; return this; @@ -11810,7 +12784,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(NestedMessage prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -11820,21 +12794,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new NestedMessage(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(NestedMessage cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + NestedMessage result; + + private NestedMessage PrepareBuilder() { + if (builderIsReadOnly) { + NestedMessage original = result; + result = new NestedMessage(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - NestedMessage result = new NestedMessage(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override NestedMessage MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new NestedMessage(); + result = DefaultInstance ?? new NestedMessage(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -11846,14 +12847,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override NestedMessage BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.nestedmessageRepeatedInt32_.MakeReadOnly(); result.nestedmessageRepeatedForeignmessage_.MakeReadOnly(); - NestedMessage returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -11867,6 +12867,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(NestedMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance) return this; + PrepareBuilder(); if (other.nestedmessageRepeatedInt32_.Count != 0) { base.AddRange(other.nestedmessageRepeatedInt32_, result.nestedmessageRepeatedInt32_); } @@ -11882,6 +12883,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -11935,7 +12937,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList NestedmessageRepeatedInt32List { - get { return result.nestedmessageRepeatedInt32_; } + get { return PrepareBuilder().nestedmessageRepeatedInt32_; } } public int NestedmessageRepeatedInt32Count { get { return result.NestedmessageRepeatedInt32Count; } @@ -11944,24 +12946,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetNestedmessageRepeatedInt32(index); } public Builder SetNestedmessageRepeatedInt32(int index, int value) { + PrepareBuilder(); result.nestedmessageRepeatedInt32_[index] = value; return this; } public Builder AddNestedmessageRepeatedInt32(int value) { + PrepareBuilder(); result.nestedmessageRepeatedInt32_.Add(value); return this; } public Builder AddRangeNestedmessageRepeatedInt32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.nestedmessageRepeatedInt32_); return this; } public Builder ClearNestedmessageRepeatedInt32() { + PrepareBuilder(); result.nestedmessageRepeatedInt32_.Clear(); return this; } public pbc::IPopsicleList NestedmessageRepeatedForeignmessageList { - get { return result.nestedmessageRepeatedForeignmessage_; } + get { return PrepareBuilder().nestedmessageRepeatedForeignmessage_; } } public int NestedmessageRepeatedForeignmessageCount { get { return result.NestedmessageRepeatedForeignmessageCount; } @@ -11971,29 +12977,35 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetNestedmessageRepeatedForeignmessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.nestedmessageRepeatedForeignmessage_[index] = value; return this; } public Builder SetNestedmessageRepeatedForeignmessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.nestedmessageRepeatedForeignmessage_[index] = builderForValue.Build(); return this; } public Builder AddNestedmessageRepeatedForeignmessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.nestedmessageRepeatedForeignmessage_.Add(value); return this; } public Builder AddNestedmessageRepeatedForeignmessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.nestedmessageRepeatedForeignmessage_.Add(builderForValue.Build()); return this; } public Builder AddRangeNestedmessageRepeatedForeignmessage(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.nestedmessageRepeatedForeignmessage_); return this; } public Builder ClearNestedmessageRepeatedForeignmessage() { + PrepareBuilder(); result.nestedmessageRepeatedForeignmessage_.Clear(); return this; } @@ -12081,7 +13093,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestNestedMessageHasBits prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -12091,21 +13103,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestNestedMessageHasBits(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestNestedMessageHasBits cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestNestedMessageHasBits result = new TestNestedMessageHasBits(); + bool builderIsReadOnly; + TestNestedMessageHasBits result; + + private TestNestedMessageHasBits PrepareBuilder() { + if (builderIsReadOnly) { + TestNestedMessageHasBits original = result; + result = new TestNestedMessageHasBits(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestNestedMessageHasBits MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestNestedMessageHasBits(); + result = DefaultInstance ?? new TestNestedMessageHasBits(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -12117,12 +13156,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestNestedMessageHasBits BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestNestedMessageHasBits returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -12136,6 +13174,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestNestedMessageHasBits other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.DefaultInstance) return this; + PrepareBuilder(); if (other.HasOptionalNestedMessage) { MergeOptionalNestedMessage(other.OptionalNestedMessage); } @@ -12148,6 +13187,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -12209,18 +13249,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasOptionalNestedMessage = true; result.optionalNestedMessage_ = value; return this; } public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasOptionalNestedMessage = true; result.optionalNestedMessage_ = builderForValue.Build(); return this; } public Builder MergeOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasOptionalNestedMessage && result.optionalNestedMessage_ != global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance) { result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.CreateBuilder(result.optionalNestedMessage_).MergeFrom(value).BuildPartial(); @@ -12231,6 +13274,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearOptionalNestedMessage() { + PrepareBuilder(); result.hasOptionalNestedMessage = false; result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance; return this; @@ -12558,7 +13602,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestCamelCaseFieldNames prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -12568,21 +13612,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestCamelCaseFieldNames(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestCamelCaseFieldNames cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestCamelCaseFieldNames result; + + private TestCamelCaseFieldNames PrepareBuilder() { + if (builderIsReadOnly) { + TestCamelCaseFieldNames original = result; + result = new TestCamelCaseFieldNames(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestCamelCaseFieldNames result = new TestCamelCaseFieldNames(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestCamelCaseFieldNames MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestCamelCaseFieldNames(); + result = DefaultInstance ?? new TestCamelCaseFieldNames(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -12594,8 +13665,8 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestCamelCaseFieldNames BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.repeatedPrimitiveField_.MakeReadOnly(); result.repeatedStringField_.MakeReadOnly(); @@ -12603,9 +13674,8 @@ namespace Google.ProtocolBuffers.TestProtos { result.repeatedMessageField_.MakeReadOnly(); result.repeatedStringPieceField_.MakeReadOnly(); result.repeatedCordField_.MakeReadOnly(); - TestCamelCaseFieldNames returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -12619,6 +13689,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestCamelCaseFieldNames other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestCamelCaseFieldNames.DefaultInstance) return this; + PrepareBuilder(); if (other.HasPrimitiveField) { PrimitiveField = other.PrimitiveField; } @@ -12664,6 +13735,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -12787,11 +13859,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetPrimitiveField(value); } } public Builder SetPrimitiveField(int value) { + PrepareBuilder(); result.hasPrimitiveField = true; result.primitiveField_ = value; return this; } public Builder ClearPrimitiveField() { + PrepareBuilder(); result.hasPrimitiveField = false; result.primitiveField_ = 0; return this; @@ -12806,11 +13880,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetStringField(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasStringField = true; result.stringField_ = value; return this; } public Builder ClearStringField() { + PrepareBuilder(); result.hasStringField = false; result.stringField_ = ""; return this; @@ -12824,11 +13900,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetEnumField(value); } } public Builder SetEnumField(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.hasEnumField = true; result.enumField_ = value; return this; } public Builder ClearEnumField() { + PrepareBuilder(); result.hasEnumField = false; result.enumField_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; return this; @@ -12843,18 +13921,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasMessageField = true; result.messageField_ = value; return this; } public Builder SetMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasMessageField = true; result.messageField_ = builderForValue.Build(); return this; } public Builder MergeMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasMessageField && result.messageField_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { result.messageField_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.messageField_).MergeFrom(value).BuildPartial(); @@ -12865,6 +13946,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearMessageField() { + PrepareBuilder(); result.hasMessageField = false; result.messageField_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; return this; @@ -12879,11 +13961,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetStringPieceField(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasStringPieceField = true; result.stringPieceField_ = value; return this; } public Builder ClearStringPieceField() { + PrepareBuilder(); result.hasStringPieceField = false; result.stringPieceField_ = ""; return this; @@ -12898,18 +13982,20 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetCordField(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasCordField = true; result.cordField_ = value; return this; } public Builder ClearCordField() { + PrepareBuilder(); result.hasCordField = false; result.cordField_ = ""; return this; } public pbc::IPopsicleList RepeatedPrimitiveFieldList { - get { return result.repeatedPrimitiveField_; } + get { return PrepareBuilder().repeatedPrimitiveField_; } } public int RepeatedPrimitiveFieldCount { get { return result.RepeatedPrimitiveFieldCount; } @@ -12918,24 +14004,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedPrimitiveField(index); } public Builder SetRepeatedPrimitiveField(int index, int value) { + PrepareBuilder(); result.repeatedPrimitiveField_[index] = value; return this; } public Builder AddRepeatedPrimitiveField(int value) { + PrepareBuilder(); result.repeatedPrimitiveField_.Add(value); return this; } public Builder AddRangeRepeatedPrimitiveField(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedPrimitiveField_); return this; } public Builder ClearRepeatedPrimitiveField() { + PrepareBuilder(); result.repeatedPrimitiveField_.Clear(); return this; } public pbc::IPopsicleList RepeatedStringFieldList { - get { return result.repeatedStringField_; } + get { return PrepareBuilder().repeatedStringField_; } } public int RepeatedStringFieldCount { get { return result.RepeatedStringFieldCount; } @@ -12945,25 +14035,29 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedStringField(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedStringField_[index] = value; return this; } public Builder AddRepeatedStringField(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedStringField_.Add(value); return this; } public Builder AddRangeRepeatedStringField(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedStringField_); return this; } public Builder ClearRepeatedStringField() { + PrepareBuilder(); result.repeatedStringField_.Clear(); return this; } public pbc::IPopsicleList RepeatedEnumFieldList { - get { return result.repeatedEnumField_; } + get { return PrepareBuilder().repeatedEnumField_; } } public int RepeatedEnumFieldCount { get { return result.RepeatedEnumFieldCount; } @@ -12972,24 +14066,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedEnumField(index); } public Builder SetRepeatedEnumField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.repeatedEnumField_[index] = value; return this; } public Builder AddRepeatedEnumField(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.repeatedEnumField_.Add(value); return this; } public Builder AddRangeRepeatedEnumField(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedEnumField_); return this; } public Builder ClearRepeatedEnumField() { + PrepareBuilder(); result.repeatedEnumField_.Clear(); return this; } public pbc::IPopsicleList RepeatedMessageFieldList { - get { return result.repeatedMessageField_; } + get { return PrepareBuilder().repeatedMessageField_; } } public int RepeatedMessageFieldCount { get { return result.RepeatedMessageFieldCount; } @@ -12999,35 +14097,41 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedMessageField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedMessageField_[index] = value; return this; } public Builder SetRepeatedMessageField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedMessageField_[index] = builderForValue.Build(); return this; } public Builder AddRepeatedMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedMessageField_.Add(value); return this; } public Builder AddRepeatedMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.repeatedMessageField_.Add(builderForValue.Build()); return this; } public Builder AddRangeRepeatedMessageField(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedMessageField_); return this; } public Builder ClearRepeatedMessageField() { + PrepareBuilder(); result.repeatedMessageField_.Clear(); return this; } public pbc::IPopsicleList RepeatedStringPieceFieldList { - get { return result.repeatedStringPieceField_; } + get { return PrepareBuilder().repeatedStringPieceField_; } } public int RepeatedStringPieceFieldCount { get { return result.RepeatedStringPieceFieldCount; } @@ -13037,25 +14141,29 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedStringPieceField(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedStringPieceField_[index] = value; return this; } public Builder AddRepeatedStringPieceField(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedStringPieceField_.Add(value); return this; } public Builder AddRangeRepeatedStringPieceField(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedStringPieceField_); return this; } public Builder ClearRepeatedStringPieceField() { + PrepareBuilder(); result.repeatedStringPieceField_.Clear(); return this; } public pbc::IPopsicleList RepeatedCordFieldList { - get { return result.repeatedCordField_; } + get { return PrepareBuilder().repeatedCordField_; } } public int RepeatedCordFieldCount { get { return result.RepeatedCordFieldCount; } @@ -13065,19 +14173,23 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedCordField(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedCordField_[index] = value; return this; } public Builder AddRepeatedCordField(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedCordField_.Add(value); return this; } public Builder AddRangeRepeatedCordField(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedCordField_); return this; } public Builder ClearRepeatedCordField() { + PrepareBuilder(); result.repeatedCordField_.Clear(); return this; } @@ -13226,7 +14338,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestFieldOrderings prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -13236,21 +14348,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestFieldOrderings(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestFieldOrderings cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestFieldOrderings result; + + private TestFieldOrderings PrepareBuilder() { + if (builderIsReadOnly) { + TestFieldOrderings original = result; + result = new TestFieldOrderings(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestFieldOrderings result = new TestFieldOrderings(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestFieldOrderings MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestFieldOrderings(); + result = DefaultInstance ?? new TestFieldOrderings(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -13262,12 +14401,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestFieldOrderings BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestFieldOrderings returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -13281,6 +14419,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestFieldOrderings other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestFieldOrderings.DefaultInstance) return this; + PrepareBuilder(); if (other.HasMyString) { MyString = other.MyString; } @@ -13300,6 +14439,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -13364,11 +14504,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetMyString(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasMyString = true; result.myString_ = value; return this; } public Builder ClearMyString() { + PrepareBuilder(); result.hasMyString = false; result.myString_ = ""; return this; @@ -13382,11 +14524,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetMyInt(value); } } public Builder SetMyInt(long value) { + PrepareBuilder(); result.hasMyInt = true; result.myInt_ = value; return this; } public Builder ClearMyInt() { + PrepareBuilder(); result.hasMyInt = false; result.myInt_ = 0L; return this; @@ -13400,11 +14544,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetMyFloat(value); } } public Builder SetMyFloat(float value) { + PrepareBuilder(); result.hasMyFloat = true; result.myFloat_ = value; return this; } public Builder ClearMyFloat() { + PrepareBuilder(); result.hasMyFloat = false; result.myFloat_ = 0F; return this; @@ -13807,7 +14953,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestExtremeDefaultValues prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -13817,21 +14963,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestExtremeDefaultValues(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestExtremeDefaultValues cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestExtremeDefaultValues result; - TestExtremeDefaultValues result = new TestExtremeDefaultValues(); + private TestExtremeDefaultValues PrepareBuilder() { + if (builderIsReadOnly) { + TestExtremeDefaultValues original = result; + result = new TestExtremeDefaultValues(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestExtremeDefaultValues MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestExtremeDefaultValues(); + result = DefaultInstance ?? new TestExtremeDefaultValues(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -13843,12 +15016,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestExtremeDefaultValues BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestExtremeDefaultValues returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -13862,6 +15034,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestExtremeDefaultValues other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.DefaultInstance) return this; + PrepareBuilder(); if (other.HasEscapedBytes) { EscapedBytes = other.EscapedBytes; } @@ -13928,6 +15101,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -14056,11 +15230,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetEscapedBytes(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasEscapedBytes = true; result.escapedBytes_ = value; return this; } public Builder ClearEscapedBytes() { + PrepareBuilder(); result.hasEscapedBytes = false; result.escapedBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[0].DefaultValue; return this; @@ -14076,11 +15252,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetLargeUint32(uint value) { + PrepareBuilder(); result.hasLargeUint32 = true; result.largeUint32_ = value; return this; } public Builder ClearLargeUint32() { + PrepareBuilder(); result.hasLargeUint32 = false; result.largeUint32_ = 4294967295; return this; @@ -14096,11 +15274,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetLargeUint64(ulong value) { + PrepareBuilder(); result.hasLargeUint64 = true; result.largeUint64_ = value; return this; } public Builder ClearLargeUint64() { + PrepareBuilder(); result.hasLargeUint64 = false; result.largeUint64_ = 18446744073709551615UL; return this; @@ -14114,11 +15294,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetSmallInt32(value); } } public Builder SetSmallInt32(int value) { + PrepareBuilder(); result.hasSmallInt32 = true; result.smallInt32_ = value; return this; } public Builder ClearSmallInt32() { + PrepareBuilder(); result.hasSmallInt32 = false; result.smallInt32_ = -2147483647; return this; @@ -14132,11 +15314,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetSmallInt64(value); } } public Builder SetSmallInt64(long value) { + PrepareBuilder(); result.hasSmallInt64 = true; result.smallInt64_ = value; return this; } public Builder ClearSmallInt64() { + PrepareBuilder(); result.hasSmallInt64 = false; result.smallInt64_ = -9223372036854775807L; return this; @@ -14151,11 +15335,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetUtf8String(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasUtf8String = true; result.utf8String_ = value; return this; } public Builder ClearUtf8String() { + PrepareBuilder(); result.hasUtf8String = false; result.utf8String_ = (string) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[5].DefaultValue; return this; @@ -14169,11 +15355,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetZeroFloat(value); } } public Builder SetZeroFloat(float value) { + PrepareBuilder(); result.hasZeroFloat = true; result.zeroFloat_ = value; return this; } public Builder ClearZeroFloat() { + PrepareBuilder(); result.hasZeroFloat = false; result.zeroFloat_ = 0F; return this; @@ -14187,11 +15375,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetOneFloat(value); } } public Builder SetOneFloat(float value) { + PrepareBuilder(); result.hasOneFloat = true; result.oneFloat_ = value; return this; } public Builder ClearOneFloat() { + PrepareBuilder(); result.hasOneFloat = false; result.oneFloat_ = 1F; return this; @@ -14205,11 +15395,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetSmallFloat(value); } } public Builder SetSmallFloat(float value) { + PrepareBuilder(); result.hasSmallFloat = true; result.smallFloat_ = value; return this; } public Builder ClearSmallFloat() { + PrepareBuilder(); result.hasSmallFloat = false; result.smallFloat_ = 1.5F; return this; @@ -14223,11 +15415,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetNegativeOneFloat(value); } } public Builder SetNegativeOneFloat(float value) { + PrepareBuilder(); result.hasNegativeOneFloat = true; result.negativeOneFloat_ = value; return this; } public Builder ClearNegativeOneFloat() { + PrepareBuilder(); result.hasNegativeOneFloat = false; result.negativeOneFloat_ = -1F; return this; @@ -14241,11 +15435,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetNegativeFloat(value); } } public Builder SetNegativeFloat(float value) { + PrepareBuilder(); result.hasNegativeFloat = true; result.negativeFloat_ = value; return this; } public Builder ClearNegativeFloat() { + PrepareBuilder(); result.hasNegativeFloat = false; result.negativeFloat_ = -1.5F; return this; @@ -14259,11 +15455,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetLargeFloat(value); } } public Builder SetLargeFloat(float value) { + PrepareBuilder(); result.hasLargeFloat = true; result.largeFloat_ = value; return this; } public Builder ClearLargeFloat() { + PrepareBuilder(); result.hasLargeFloat = false; result.largeFloat_ = 2E+08F; return this; @@ -14277,11 +15475,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetSmallNegativeFloat(value); } } public Builder SetSmallNegativeFloat(float value) { + PrepareBuilder(); result.hasSmallNegativeFloat = true; result.smallNegativeFloat_ = value; return this; } public Builder ClearSmallNegativeFloat() { + PrepareBuilder(); result.hasSmallNegativeFloat = false; result.smallNegativeFloat_ = -8E-28F; return this; @@ -14295,11 +15495,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetInfDouble(value); } } public Builder SetInfDouble(double value) { + PrepareBuilder(); result.hasInfDouble = true; result.infDouble_ = value; return this; } public Builder ClearInfDouble() { + PrepareBuilder(); result.hasInfDouble = false; result.infDouble_ = double.PositiveInfinity; return this; @@ -14313,11 +15515,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetNegInfDouble(value); } } public Builder SetNegInfDouble(double value) { + PrepareBuilder(); result.hasNegInfDouble = true; result.negInfDouble_ = value; return this; } public Builder ClearNegInfDouble() { + PrepareBuilder(); result.hasNegInfDouble = false; result.negInfDouble_ = double.NegativeInfinity; return this; @@ -14331,11 +15535,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetNanDouble(value); } } public Builder SetNanDouble(double value) { + PrepareBuilder(); result.hasNanDouble = true; result.nanDouble_ = value; return this; } public Builder ClearNanDouble() { + PrepareBuilder(); result.hasNanDouble = false; result.nanDouble_ = double.NaN; return this; @@ -14349,11 +15555,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetInfFloat(value); } } public Builder SetInfFloat(float value) { + PrepareBuilder(); result.hasInfFloat = true; result.infFloat_ = value; return this; } public Builder ClearInfFloat() { + PrepareBuilder(); result.hasInfFloat = false; result.infFloat_ = float.PositiveInfinity; return this; @@ -14367,11 +15575,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetNegInfFloat(value); } } public Builder SetNegInfFloat(float value) { + PrepareBuilder(); result.hasNegInfFloat = true; result.negInfFloat_ = value; return this; } public Builder ClearNegInfFloat() { + PrepareBuilder(); result.hasNegInfFloat = false; result.negInfFloat_ = float.NegativeInfinity; return this; @@ -14385,11 +15595,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetNanFloat(value); } } public Builder SetNanFloat(float value) { + PrepareBuilder(); result.hasNanFloat = true; result.nanFloat_ = value; return this; } public Builder ClearNanFloat() { + PrepareBuilder(); result.hasNanFloat = false; result.nanFloat_ = float.NaN; return this; @@ -14502,7 +15714,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(OneString prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -14512,21 +15724,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new OneString(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(OneString cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - OneString result = new OneString(); + bool builderIsReadOnly; + OneString result; + + private OneString PrepareBuilder() { + if (builderIsReadOnly) { + OneString original = result; + result = new OneString(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override OneString MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new OneString(); + result = DefaultInstance ?? new OneString(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -14538,12 +15777,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OneString BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - OneString returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -14557,6 +15795,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(OneString other) { if (other == global::Google.ProtocolBuffers.TestProtos.OneString.DefaultInstance) return this; + PrepareBuilder(); if (other.HasData) { Data = other.Data; } @@ -14569,6 +15808,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -14625,11 +15865,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetData(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasData = true; result.data_ = value; return this; } public Builder ClearData() { + PrepareBuilder(); result.hasData = false; result.data_ = ""; return this; @@ -14742,7 +15984,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(OneBytes prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -14752,21 +15994,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new OneBytes(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(OneBytes cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - OneBytes result = new OneBytes(); + bool builderIsReadOnly; + OneBytes result; + + private OneBytes PrepareBuilder() { + if (builderIsReadOnly) { + OneBytes original = result; + result = new OneBytes(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override OneBytes MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new OneBytes(); + result = DefaultInstance ?? new OneBytes(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -14778,12 +16047,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OneBytes BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - OneBytes returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -14797,6 +16065,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(OneBytes other) { if (other == global::Google.ProtocolBuffers.TestProtos.OneBytes.DefaultInstance) return this; + PrepareBuilder(); if (other.HasData) { Data = other.Data; } @@ -14809,6 +16078,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -14865,11 +16135,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetData(pb::ByteString value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasData = true; result.data_ = value; return this; } public Builder ClearData() { + PrepareBuilder(); result.hasData = false; result.data_ = pb::ByteString.Empty; return this; @@ -15339,7 +16611,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestPackedTypes prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -15349,21 +16621,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestPackedTypes(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestPackedTypes cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestPackedTypes result = new TestPackedTypes(); + bool builderIsReadOnly; + TestPackedTypes result; + + private TestPackedTypes PrepareBuilder() { + if (builderIsReadOnly) { + TestPackedTypes original = result; + result = new TestPackedTypes(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestPackedTypes MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestPackedTypes(); + result = DefaultInstance ?? new TestPackedTypes(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -15375,8 +16674,8 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedTypes BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.packedInt32_.MakeReadOnly(); result.packedInt64_.MakeReadOnly(); @@ -15392,9 +16691,8 @@ namespace Google.ProtocolBuffers.TestProtos { result.packedDouble_.MakeReadOnly(); result.packedBool_.MakeReadOnly(); result.packedEnum_.MakeReadOnly(); - TestPackedTypes returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -15408,6 +16706,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestPackedTypes other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedTypes.DefaultInstance) return this; + PrepareBuilder(); if (other.packedInt32_.Count != 0) { base.AddRange(other.packedInt32_, result.packedInt32_); } @@ -15459,6 +16758,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -15582,7 +16882,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList PackedInt32List { - get { return result.packedInt32_; } + get { return PrepareBuilder().packedInt32_; } } public int PackedInt32Count { get { return result.PackedInt32Count; } @@ -15591,24 +16891,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedInt32(index); } public Builder SetPackedInt32(int index, int value) { + PrepareBuilder(); result.packedInt32_[index] = value; return this; } public Builder AddPackedInt32(int value) { + PrepareBuilder(); result.packedInt32_.Add(value); return this; } public Builder AddRangePackedInt32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedInt32_); return this; } public Builder ClearPackedInt32() { + PrepareBuilder(); result.packedInt32_.Clear(); return this; } public pbc::IPopsicleList PackedInt64List { - get { return result.packedInt64_; } + get { return PrepareBuilder().packedInt64_; } } public int PackedInt64Count { get { return result.PackedInt64Count; } @@ -15617,25 +16921,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedInt64(index); } public Builder SetPackedInt64(int index, long value) { + PrepareBuilder(); result.packedInt64_[index] = value; return this; } public Builder AddPackedInt64(long value) { + PrepareBuilder(); result.packedInt64_.Add(value); return this; } public Builder AddRangePackedInt64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedInt64_); return this; } public Builder ClearPackedInt64() { + PrepareBuilder(); result.packedInt64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList PackedUint32List { - get { return result.packedUint32_; } + get { return PrepareBuilder().packedUint32_; } } public int PackedUint32Count { get { return result.PackedUint32Count; } @@ -15646,27 +16954,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetPackedUint32(int index, uint value) { + PrepareBuilder(); result.packedUint32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddPackedUint32(uint value) { + PrepareBuilder(); result.packedUint32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangePackedUint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedUint32_); return this; } public Builder ClearPackedUint32() { + PrepareBuilder(); result.packedUint32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList PackedUint64List { - get { return result.packedUint64_; } + get { return PrepareBuilder().packedUint64_; } } public int PackedUint64Count { get { return result.PackedUint64Count; } @@ -15677,26 +16989,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetPackedUint64(int index, ulong value) { + PrepareBuilder(); result.packedUint64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddPackedUint64(ulong value) { + PrepareBuilder(); result.packedUint64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangePackedUint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedUint64_); return this; } public Builder ClearPackedUint64() { + PrepareBuilder(); result.packedUint64_.Clear(); return this; } public pbc::IPopsicleList PackedSint32List { - get { return result.packedSint32_; } + get { return PrepareBuilder().packedSint32_; } } public int PackedSint32Count { get { return result.PackedSint32Count; } @@ -15705,24 +17021,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedSint32(index); } public Builder SetPackedSint32(int index, int value) { + PrepareBuilder(); result.packedSint32_[index] = value; return this; } public Builder AddPackedSint32(int value) { + PrepareBuilder(); result.packedSint32_.Add(value); return this; } public Builder AddRangePackedSint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedSint32_); return this; } public Builder ClearPackedSint32() { + PrepareBuilder(); result.packedSint32_.Clear(); return this; } public pbc::IPopsicleList PackedSint64List { - get { return result.packedSint64_; } + get { return PrepareBuilder().packedSint64_; } } public int PackedSint64Count { get { return result.PackedSint64Count; } @@ -15731,25 +17051,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedSint64(index); } public Builder SetPackedSint64(int index, long value) { + PrepareBuilder(); result.packedSint64_[index] = value; return this; } public Builder AddPackedSint64(long value) { + PrepareBuilder(); result.packedSint64_.Add(value); return this; } public Builder AddRangePackedSint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedSint64_); return this; } public Builder ClearPackedSint64() { + PrepareBuilder(); result.packedSint64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList PackedFixed32List { - get { return result.packedFixed32_; } + get { return PrepareBuilder().packedFixed32_; } } public int PackedFixed32Count { get { return result.PackedFixed32Count; } @@ -15760,27 +17084,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetPackedFixed32(int index, uint value) { + PrepareBuilder(); result.packedFixed32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddPackedFixed32(uint value) { + PrepareBuilder(); result.packedFixed32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangePackedFixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedFixed32_); return this; } public Builder ClearPackedFixed32() { + PrepareBuilder(); result.packedFixed32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList PackedFixed64List { - get { return result.packedFixed64_; } + get { return PrepareBuilder().packedFixed64_; } } public int PackedFixed64Count { get { return result.PackedFixed64Count; } @@ -15791,26 +17119,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetPackedFixed64(int index, ulong value) { + PrepareBuilder(); result.packedFixed64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddPackedFixed64(ulong value) { + PrepareBuilder(); result.packedFixed64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangePackedFixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedFixed64_); return this; } public Builder ClearPackedFixed64() { + PrepareBuilder(); result.packedFixed64_.Clear(); return this; } public pbc::IPopsicleList PackedSfixed32List { - get { return result.packedSfixed32_; } + get { return PrepareBuilder().packedSfixed32_; } } public int PackedSfixed32Count { get { return result.PackedSfixed32Count; } @@ -15819,24 +17151,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedSfixed32(index); } public Builder SetPackedSfixed32(int index, int value) { + PrepareBuilder(); result.packedSfixed32_[index] = value; return this; } public Builder AddPackedSfixed32(int value) { + PrepareBuilder(); result.packedSfixed32_.Add(value); return this; } public Builder AddRangePackedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedSfixed32_); return this; } public Builder ClearPackedSfixed32() { + PrepareBuilder(); result.packedSfixed32_.Clear(); return this; } public pbc::IPopsicleList PackedSfixed64List { - get { return result.packedSfixed64_; } + get { return PrepareBuilder().packedSfixed64_; } } public int PackedSfixed64Count { get { return result.PackedSfixed64Count; } @@ -15845,24 +17181,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedSfixed64(index); } public Builder SetPackedSfixed64(int index, long value) { + PrepareBuilder(); result.packedSfixed64_[index] = value; return this; } public Builder AddPackedSfixed64(long value) { + PrepareBuilder(); result.packedSfixed64_.Add(value); return this; } public Builder AddRangePackedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedSfixed64_); return this; } public Builder ClearPackedSfixed64() { + PrepareBuilder(); result.packedSfixed64_.Clear(); return this; } public pbc::IPopsicleList PackedFloatList { - get { return result.packedFloat_; } + get { return PrepareBuilder().packedFloat_; } } public int PackedFloatCount { get { return result.PackedFloatCount; } @@ -15871,24 +17211,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedFloat(index); } public Builder SetPackedFloat(int index, float value) { + PrepareBuilder(); result.packedFloat_[index] = value; return this; } public Builder AddPackedFloat(float value) { + PrepareBuilder(); result.packedFloat_.Add(value); return this; } public Builder AddRangePackedFloat(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedFloat_); return this; } public Builder ClearPackedFloat() { + PrepareBuilder(); result.packedFloat_.Clear(); return this; } public pbc::IPopsicleList PackedDoubleList { - get { return result.packedDouble_; } + get { return PrepareBuilder().packedDouble_; } } public int PackedDoubleCount { get { return result.PackedDoubleCount; } @@ -15897,24 +17241,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedDouble(index); } public Builder SetPackedDouble(int index, double value) { + PrepareBuilder(); result.packedDouble_[index] = value; return this; } public Builder AddPackedDouble(double value) { + PrepareBuilder(); result.packedDouble_.Add(value); return this; } public Builder AddRangePackedDouble(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedDouble_); return this; } public Builder ClearPackedDouble() { + PrepareBuilder(); result.packedDouble_.Clear(); return this; } public pbc::IPopsicleList PackedBoolList { - get { return result.packedBool_; } + get { return PrepareBuilder().packedBool_; } } public int PackedBoolCount { get { return result.PackedBoolCount; } @@ -15923,24 +17271,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedBool(index); } public Builder SetPackedBool(int index, bool value) { + PrepareBuilder(); result.packedBool_[index] = value; return this; } public Builder AddPackedBool(bool value) { + PrepareBuilder(); result.packedBool_.Add(value); return this; } public Builder AddRangePackedBool(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedBool_); return this; } public Builder ClearPackedBool() { + PrepareBuilder(); result.packedBool_.Clear(); return this; } public pbc::IPopsicleList PackedEnumList { - get { return result.packedEnum_; } + get { return PrepareBuilder().packedEnum_; } } public int PackedEnumCount { get { return result.PackedEnumCount; } @@ -15949,18 +17301,22 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedEnum(index); } public Builder SetPackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.packedEnum_[index] = value; return this; } public Builder AddPackedEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.packedEnum_.Add(value); return this; } public Builder AddRangePackedEnum(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedEnum_); return this; } public Builder ClearPackedEnum() { + PrepareBuilder(); result.packedEnum_.Clear(); return this; } @@ -16374,7 +17730,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestUnpackedTypes prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -16384,21 +17740,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestUnpackedTypes(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestUnpackedTypes cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestUnpackedTypes result; + + private TestUnpackedTypes PrepareBuilder() { + if (builderIsReadOnly) { + TestUnpackedTypes original = result; + result = new TestUnpackedTypes(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestUnpackedTypes result = new TestUnpackedTypes(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestUnpackedTypes MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestUnpackedTypes(); + result = DefaultInstance ?? new TestUnpackedTypes(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -16410,8 +17793,8 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedTypes BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.unpackedInt32_.MakeReadOnly(); result.unpackedInt64_.MakeReadOnly(); @@ -16427,9 +17810,8 @@ namespace Google.ProtocolBuffers.TestProtos { result.unpackedDouble_.MakeReadOnly(); result.unpackedBool_.MakeReadOnly(); result.unpackedEnum_.MakeReadOnly(); - TestUnpackedTypes returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -16443,6 +17825,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestUnpackedTypes other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypes.DefaultInstance) return this; + PrepareBuilder(); if (other.unpackedInt32_.Count != 0) { base.AddRange(other.unpackedInt32_, result.unpackedInt32_); } @@ -16494,6 +17877,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -16617,7 +18001,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList UnpackedInt32List { - get { return result.unpackedInt32_; } + get { return PrepareBuilder().unpackedInt32_; } } public int UnpackedInt32Count { get { return result.UnpackedInt32Count; } @@ -16626,24 +18010,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedInt32(index); } public Builder SetUnpackedInt32(int index, int value) { + PrepareBuilder(); result.unpackedInt32_[index] = value; return this; } public Builder AddUnpackedInt32(int value) { + PrepareBuilder(); result.unpackedInt32_.Add(value); return this; } public Builder AddRangeUnpackedInt32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedInt32_); return this; } public Builder ClearUnpackedInt32() { + PrepareBuilder(); result.unpackedInt32_.Clear(); return this; } public pbc::IPopsicleList UnpackedInt64List { - get { return result.unpackedInt64_; } + get { return PrepareBuilder().unpackedInt64_; } } public int UnpackedInt64Count { get { return result.UnpackedInt64Count; } @@ -16652,25 +18040,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedInt64(index); } public Builder SetUnpackedInt64(int index, long value) { + PrepareBuilder(); result.unpackedInt64_[index] = value; return this; } public Builder AddUnpackedInt64(long value) { + PrepareBuilder(); result.unpackedInt64_.Add(value); return this; } public Builder AddRangeUnpackedInt64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedInt64_); return this; } public Builder ClearUnpackedInt64() { + PrepareBuilder(); result.unpackedInt64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList UnpackedUint32List { - get { return result.unpackedUint32_; } + get { return PrepareBuilder().unpackedUint32_; } } public int UnpackedUint32Count { get { return result.UnpackedUint32Count; } @@ -16681,27 +18073,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetUnpackedUint32(int index, uint value) { + PrepareBuilder(); result.unpackedUint32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddUnpackedUint32(uint value) { + PrepareBuilder(); result.unpackedUint32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedUint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedUint32_); return this; } public Builder ClearUnpackedUint32() { + PrepareBuilder(); result.unpackedUint32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList UnpackedUint64List { - get { return result.unpackedUint64_; } + get { return PrepareBuilder().unpackedUint64_; } } public int UnpackedUint64Count { get { return result.UnpackedUint64Count; } @@ -16712,26 +18108,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetUnpackedUint64(int index, ulong value) { + PrepareBuilder(); result.unpackedUint64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddUnpackedUint64(ulong value) { + PrepareBuilder(); result.unpackedUint64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedUint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedUint64_); return this; } public Builder ClearUnpackedUint64() { + PrepareBuilder(); result.unpackedUint64_.Clear(); return this; } public pbc::IPopsicleList UnpackedSint32List { - get { return result.unpackedSint32_; } + get { return PrepareBuilder().unpackedSint32_; } } public int UnpackedSint32Count { get { return result.UnpackedSint32Count; } @@ -16740,24 +18140,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedSint32(index); } public Builder SetUnpackedSint32(int index, int value) { + PrepareBuilder(); result.unpackedSint32_[index] = value; return this; } public Builder AddUnpackedSint32(int value) { + PrepareBuilder(); result.unpackedSint32_.Add(value); return this; } public Builder AddRangeUnpackedSint32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedSint32_); return this; } public Builder ClearUnpackedSint32() { + PrepareBuilder(); result.unpackedSint32_.Clear(); return this; } public pbc::IPopsicleList UnpackedSint64List { - get { return result.unpackedSint64_; } + get { return PrepareBuilder().unpackedSint64_; } } public int UnpackedSint64Count { get { return result.UnpackedSint64Count; } @@ -16766,25 +18170,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedSint64(index); } public Builder SetUnpackedSint64(int index, long value) { + PrepareBuilder(); result.unpackedSint64_[index] = value; return this; } public Builder AddUnpackedSint64(long value) { + PrepareBuilder(); result.unpackedSint64_.Add(value); return this; } public Builder AddRangeUnpackedSint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedSint64_); return this; } public Builder ClearUnpackedSint64() { + PrepareBuilder(); result.unpackedSint64_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList UnpackedFixed32List { - get { return result.unpackedFixed32_; } + get { return PrepareBuilder().unpackedFixed32_; } } public int UnpackedFixed32Count { get { return result.UnpackedFixed32Count; } @@ -16795,27 +18203,31 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetUnpackedFixed32(int index, uint value) { + PrepareBuilder(); result.unpackedFixed32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddUnpackedFixed32(uint value) { + PrepareBuilder(); result.unpackedFixed32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedFixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedFixed32_); return this; } public Builder ClearUnpackedFixed32() { + PrepareBuilder(); result.unpackedFixed32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList UnpackedFixed64List { - get { return result.unpackedFixed64_; } + get { return PrepareBuilder().unpackedFixed64_; } } public int UnpackedFixed64Count { get { return result.UnpackedFixed64Count; } @@ -16826,26 +18238,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetUnpackedFixed64(int index, ulong value) { + PrepareBuilder(); result.unpackedFixed64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddUnpackedFixed64(ulong value) { + PrepareBuilder(); result.unpackedFixed64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedFixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedFixed64_); return this; } public Builder ClearUnpackedFixed64() { + PrepareBuilder(); result.unpackedFixed64_.Clear(); return this; } public pbc::IPopsicleList UnpackedSfixed32List { - get { return result.unpackedSfixed32_; } + get { return PrepareBuilder().unpackedSfixed32_; } } public int UnpackedSfixed32Count { get { return result.UnpackedSfixed32Count; } @@ -16854,24 +18270,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedSfixed32(index); } public Builder SetUnpackedSfixed32(int index, int value) { + PrepareBuilder(); result.unpackedSfixed32_[index] = value; return this; } public Builder AddUnpackedSfixed32(int value) { + PrepareBuilder(); result.unpackedSfixed32_.Add(value); return this; } public Builder AddRangeUnpackedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedSfixed32_); return this; } public Builder ClearUnpackedSfixed32() { + PrepareBuilder(); result.unpackedSfixed32_.Clear(); return this; } public pbc::IPopsicleList UnpackedSfixed64List { - get { return result.unpackedSfixed64_; } + get { return PrepareBuilder().unpackedSfixed64_; } } public int UnpackedSfixed64Count { get { return result.UnpackedSfixed64Count; } @@ -16880,24 +18300,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedSfixed64(index); } public Builder SetUnpackedSfixed64(int index, long value) { + PrepareBuilder(); result.unpackedSfixed64_[index] = value; return this; } public Builder AddUnpackedSfixed64(long value) { + PrepareBuilder(); result.unpackedSfixed64_.Add(value); return this; } public Builder AddRangeUnpackedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedSfixed64_); return this; } public Builder ClearUnpackedSfixed64() { + PrepareBuilder(); result.unpackedSfixed64_.Clear(); return this; } public pbc::IPopsicleList UnpackedFloatList { - get { return result.unpackedFloat_; } + get { return PrepareBuilder().unpackedFloat_; } } public int UnpackedFloatCount { get { return result.UnpackedFloatCount; } @@ -16906,24 +18330,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedFloat(index); } public Builder SetUnpackedFloat(int index, float value) { + PrepareBuilder(); result.unpackedFloat_[index] = value; return this; } public Builder AddUnpackedFloat(float value) { + PrepareBuilder(); result.unpackedFloat_.Add(value); return this; } public Builder AddRangeUnpackedFloat(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedFloat_); return this; } public Builder ClearUnpackedFloat() { + PrepareBuilder(); result.unpackedFloat_.Clear(); return this; } public pbc::IPopsicleList UnpackedDoubleList { - get { return result.unpackedDouble_; } + get { return PrepareBuilder().unpackedDouble_; } } public int UnpackedDoubleCount { get { return result.UnpackedDoubleCount; } @@ -16932,24 +18360,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedDouble(index); } public Builder SetUnpackedDouble(int index, double value) { + PrepareBuilder(); result.unpackedDouble_[index] = value; return this; } public Builder AddUnpackedDouble(double value) { + PrepareBuilder(); result.unpackedDouble_.Add(value); return this; } public Builder AddRangeUnpackedDouble(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedDouble_); return this; } public Builder ClearUnpackedDouble() { + PrepareBuilder(); result.unpackedDouble_.Clear(); return this; } public pbc::IPopsicleList UnpackedBoolList { - get { return result.unpackedBool_; } + get { return PrepareBuilder().unpackedBool_; } } public int UnpackedBoolCount { get { return result.UnpackedBoolCount; } @@ -16958,24 +18390,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedBool(index); } public Builder SetUnpackedBool(int index, bool value) { + PrepareBuilder(); result.unpackedBool_[index] = value; return this; } public Builder AddUnpackedBool(bool value) { + PrepareBuilder(); result.unpackedBool_.Add(value); return this; } public Builder AddRangeUnpackedBool(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedBool_); return this; } public Builder ClearUnpackedBool() { + PrepareBuilder(); result.unpackedBool_.Clear(); return this; } public pbc::IPopsicleList UnpackedEnumList { - get { return result.unpackedEnum_; } + get { return PrepareBuilder().unpackedEnum_; } } public int UnpackedEnumCount { get { return result.UnpackedEnumCount; } @@ -16984,18 +18420,22 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetUnpackedEnum(index); } public Builder SetUnpackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.unpackedEnum_[index] = value; return this; } public Builder AddUnpackedEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.unpackedEnum_.Add(value); return this; } public Builder AddRangeUnpackedEnum(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.unpackedEnum_); return this; } public Builder ClearUnpackedEnum() { + PrepareBuilder(); result.unpackedEnum_.Clear(); return this; } @@ -17095,7 +18535,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestPackedExtensions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -17105,21 +18545,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestPackedExtensions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestPackedExtensions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestPackedExtensions result; + + private TestPackedExtensions PrepareBuilder() { + if (builderIsReadOnly) { + TestPackedExtensions original = result; + result = new TestPackedExtensions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestPackedExtensions result = new TestPackedExtensions(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestPackedExtensions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestPackedExtensions(); + result = DefaultInstance ?? new TestPackedExtensions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -17131,12 +18598,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedExtensions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestPackedExtensions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -17150,6 +18616,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestPackedExtensions other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedExtensions.DefaultInstance) return this; + PrepareBuilder(); this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); return this; @@ -17160,6 +18627,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -17298,7 +18766,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestUnpackedExtensions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -17308,21 +18776,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestUnpackedExtensions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestUnpackedExtensions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestUnpackedExtensions result; + + private TestUnpackedExtensions PrepareBuilder() { + if (builderIsReadOnly) { + TestUnpackedExtensions original = result; + result = new TestUnpackedExtensions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestUnpackedExtensions result = new TestUnpackedExtensions(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestUnpackedExtensions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestUnpackedExtensions(); + result = DefaultInstance ?? new TestUnpackedExtensions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -17334,12 +18829,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedExtensions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - TestUnpackedExtensions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -17353,6 +18847,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestUnpackedExtensions other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensions.DefaultInstance) return this; + PrepareBuilder(); this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); return this; @@ -17363,6 +18858,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -17553,7 +19049,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(DynamicMessageType prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -17563,21 +19059,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new DynamicMessageType(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(DynamicMessageType cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + DynamicMessageType result; - DynamicMessageType result = new DynamicMessageType(); + private DynamicMessageType PrepareBuilder() { + if (builderIsReadOnly) { + DynamicMessageType original = result; + result = new DynamicMessageType(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override DynamicMessageType MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new DynamicMessageType(); + result = DefaultInstance ?? new DynamicMessageType(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -17589,12 +19112,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override DynamicMessageType BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - DynamicMessageType returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -17608,6 +19130,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(DynamicMessageType other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance) return this; + PrepareBuilder(); if (other.HasDynamicField) { DynamicField = other.DynamicField; } @@ -17620,6 +19143,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -17675,11 +19199,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDynamicField(value); } } public Builder SetDynamicField(int value) { + PrepareBuilder(); result.hasDynamicField = true; result.dynamicField_ = value; return this; } public Builder ClearDynamicField() { + PrepareBuilder(); result.hasDynamicField = false; result.dynamicField_ = 0; return this; @@ -17883,7 +19409,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestDynamicExtensions prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -17893,21 +19419,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestDynamicExtensions(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestDynamicExtensions cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - TestDynamicExtensions result = new TestDynamicExtensions(); + bool builderIsReadOnly; + TestDynamicExtensions result; + + private TestDynamicExtensions PrepareBuilder() { + if (builderIsReadOnly) { + TestDynamicExtensions original = result; + result = new TestDynamicExtensions(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestDynamicExtensions MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestDynamicExtensions(); + result = DefaultInstance ?? new TestDynamicExtensions(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -17919,14 +19472,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDynamicExtensions BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.repeatedExtension_.MakeReadOnly(); result.packedExtension_.MakeReadOnly(); - TestDynamicExtensions returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -17940,6 +19492,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestDynamicExtensions other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.DefaultInstance) return this; + PrepareBuilder(); if (other.HasScalarExtension) { ScalarExtension = other.ScalarExtension; } @@ -17970,6 +19523,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -18078,11 +19632,13 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetScalarExtension(uint value) { + PrepareBuilder(); result.hasScalarExtension = true; result.scalarExtension_ = value; return this; } public Builder ClearScalarExtension() { + PrepareBuilder(); result.hasScalarExtension = false; result.scalarExtension_ = 0; return this; @@ -18096,11 +19652,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetEnumExtension(value); } } public Builder SetEnumExtension(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); result.hasEnumExtension = true; result.enumExtension_ = value; return this; } public Builder ClearEnumExtension() { + PrepareBuilder(); result.hasEnumExtension = false; result.enumExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; return this; @@ -18114,11 +19672,13 @@ namespace Google.ProtocolBuffers.TestProtos { set { SetDynamicEnumExtension(value); } } public Builder SetDynamicEnumExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType value) { + PrepareBuilder(); result.hasDynamicEnumExtension = true; result.dynamicEnumExtension_ = value; return this; } public Builder ClearDynamicEnumExtension() { + PrepareBuilder(); result.hasDynamicEnumExtension = false; result.dynamicEnumExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType.DYNAMIC_FOO; return this; @@ -18133,18 +19693,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasMessageExtension = true; result.messageExtension_ = value; return this; } public Builder SetMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasMessageExtension = true; result.messageExtension_ = builderForValue.Build(); return this; } public Builder MergeMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasMessageExtension && result.messageExtension_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { result.messageExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.messageExtension_).MergeFrom(value).BuildPartial(); @@ -18155,6 +19718,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearMessageExtension() { + PrepareBuilder(); result.hasMessageExtension = false; result.messageExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; return this; @@ -18169,18 +19733,21 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.hasDynamicMessageExtension = true; result.dynamicMessageExtension_ = value; return this; } public Builder SetDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); result.hasDynamicMessageExtension = true; result.dynamicMessageExtension_ = builderForValue.Build(); return this; } public Builder MergeDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); if (result.hasDynamicMessageExtension && result.dynamicMessageExtension_ != global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance) { result.dynamicMessageExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.CreateBuilder(result.dynamicMessageExtension_).MergeFrom(value).BuildPartial(); @@ -18191,13 +19758,14 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder ClearDynamicMessageExtension() { + PrepareBuilder(); result.hasDynamicMessageExtension = false; result.dynamicMessageExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance; return this; } public pbc::IPopsicleList RepeatedExtensionList { - get { return result.repeatedExtension_; } + get { return PrepareBuilder().repeatedExtension_; } } public int RepeatedExtensionCount { get { return result.RepeatedExtensionCount; } @@ -18207,25 +19775,29 @@ namespace Google.ProtocolBuffers.TestProtos { } public Builder SetRepeatedExtension(int index, string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedExtension_[index] = value; return this; } public Builder AddRepeatedExtension(string value) { pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); result.repeatedExtension_.Add(value); return this; } public Builder AddRangeRepeatedExtension(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedExtension_); return this; } public Builder ClearRepeatedExtension() { + PrepareBuilder(); result.repeatedExtension_.Clear(); return this; } public pbc::IPopsicleList PackedExtensionList { - get { return result.packedExtension_; } + get { return PrepareBuilder().packedExtension_; } } public int PackedExtensionCount { get { return result.PackedExtensionCount; } @@ -18234,18 +19806,22 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetPackedExtension(index); } public Builder SetPackedExtension(int index, int value) { + PrepareBuilder(); result.packedExtension_[index] = value; return this; } public Builder AddPackedExtension(int value) { + PrepareBuilder(); result.packedExtension_.Add(value); return this; } public Builder AddRangePackedExtension(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.packedExtension_); return this; } public Builder ClearPackedExtension() { + PrepareBuilder(); result.packedExtension_.Clear(); return this; } @@ -18479,7 +20055,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(TestRepeatedScalarDifferentTagSizes prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -18489,21 +20065,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new TestRepeatedScalarDifferentTagSizes(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(TestRepeatedScalarDifferentTagSizes cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + TestRepeatedScalarDifferentTagSizes result; + + private TestRepeatedScalarDifferentTagSizes PrepareBuilder() { + if (builderIsReadOnly) { + TestRepeatedScalarDifferentTagSizes original = result; + result = new TestRepeatedScalarDifferentTagSizes(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - TestRepeatedScalarDifferentTagSizes result = new TestRepeatedScalarDifferentTagSizes(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override TestRepeatedScalarDifferentTagSizes MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new TestRepeatedScalarDifferentTagSizes(); + result = DefaultInstance ?? new TestRepeatedScalarDifferentTagSizes(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -18515,8 +20118,8 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRepeatedScalarDifferentTagSizes BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } result.repeatedFixed32_.MakeReadOnly(); result.repeatedInt32_.MakeReadOnly(); @@ -18524,9 +20127,8 @@ namespace Google.ProtocolBuffers.TestProtos { result.repeatedInt64_.MakeReadOnly(); result.repeatedFloat_.MakeReadOnly(); result.repeatedUint64_.MakeReadOnly(); - TestRepeatedScalarDifferentTagSizes returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -18540,6 +20142,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestRepeatedScalarDifferentTagSizes other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestRepeatedScalarDifferentTagSizes.DefaultInstance) return this; + PrepareBuilder(); if (other.repeatedFixed32_.Count != 0) { base.AddRange(other.repeatedFixed32_, result.repeatedFixed32_); } @@ -18567,6 +20170,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -18642,7 +20246,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedFixed32List { - get { return result.repeatedFixed32_; } + get { return PrepareBuilder().repeatedFixed32_; } } public int RepeatedFixed32Count { get { return result.RepeatedFixed32Count; } @@ -18653,26 +20257,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedFixed32(int index, uint value) { + PrepareBuilder(); result.repeatedFixed32_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedFixed32(uint value) { + PrepareBuilder(); result.repeatedFixed32_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedFixed32_); return this; } public Builder ClearRepeatedFixed32() { + PrepareBuilder(); result.repeatedFixed32_.Clear(); return this; } public pbc::IPopsicleList RepeatedInt32List { - get { return result.repeatedInt32_; } + get { return PrepareBuilder().repeatedInt32_; } } public int RepeatedInt32Count { get { return result.RepeatedInt32Count; } @@ -18681,25 +20289,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedInt32(index); } public Builder SetRepeatedInt32(int index, int value) { + PrepareBuilder(); result.repeatedInt32_[index] = value; return this; } public Builder AddRepeatedInt32(int value) { + PrepareBuilder(); result.repeatedInt32_.Add(value); return this; } public Builder AddRangeRepeatedInt32(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedInt32_); return this; } public Builder ClearRepeatedInt32() { + PrepareBuilder(); result.repeatedInt32_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedFixed64List { - get { return result.repeatedFixed64_; } + get { return PrepareBuilder().repeatedFixed64_; } } public int RepeatedFixed64Count { get { return result.RepeatedFixed64Count; } @@ -18710,26 +20322,30 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedFixed64(int index, ulong value) { + PrepareBuilder(); result.repeatedFixed64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedFixed64(ulong value) { + PrepareBuilder(); result.repeatedFixed64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedFixed64_); return this; } public Builder ClearRepeatedFixed64() { + PrepareBuilder(); result.repeatedFixed64_.Clear(); return this; } public pbc::IPopsicleList RepeatedInt64List { - get { return result.repeatedInt64_; } + get { return PrepareBuilder().repeatedInt64_; } } public int RepeatedInt64Count { get { return result.RepeatedInt64Count; } @@ -18738,24 +20354,28 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedInt64(index); } public Builder SetRepeatedInt64(int index, long value) { + PrepareBuilder(); result.repeatedInt64_[index] = value; return this; } public Builder AddRepeatedInt64(long value) { + PrepareBuilder(); result.repeatedInt64_.Add(value); return this; } public Builder AddRangeRepeatedInt64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedInt64_); return this; } public Builder ClearRepeatedInt64() { + PrepareBuilder(); result.repeatedInt64_.Clear(); return this; } public pbc::IPopsicleList RepeatedFloatList { - get { return result.repeatedFloat_; } + get { return PrepareBuilder().repeatedFloat_; } } public int RepeatedFloatCount { get { return result.RepeatedFloatCount; } @@ -18764,25 +20384,29 @@ namespace Google.ProtocolBuffers.TestProtos { return result.GetRepeatedFloat(index); } public Builder SetRepeatedFloat(int index, float value) { + PrepareBuilder(); result.repeatedFloat_[index] = value; return this; } public Builder AddRepeatedFloat(float value) { + PrepareBuilder(); result.repeatedFloat_.Add(value); return this; } public Builder AddRangeRepeatedFloat(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedFloat_); return this; } public Builder ClearRepeatedFloat() { + PrepareBuilder(); result.repeatedFloat_.Clear(); return this; } [global::System.CLSCompliant(false)] public pbc::IPopsicleList RepeatedUint64List { - get { return result.repeatedUint64_; } + get { return PrepareBuilder().repeatedUint64_; } } public int RepeatedUint64Count { get { return result.RepeatedUint64Count; } @@ -18793,20 +20417,24 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder SetRepeatedUint64(int index, ulong value) { + PrepareBuilder(); result.repeatedUint64_[index] = value; return this; } [global::System.CLSCompliant(false)] public Builder AddRepeatedUint64(ulong value) { + PrepareBuilder(); result.repeatedUint64_.Add(value); return this; } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedUint64(scg::IEnumerable values) { + PrepareBuilder(); base.AddRange(values, result.repeatedUint64_); return this; } public Builder ClearRepeatedUint64() { + PrepareBuilder(); result.repeatedUint64_.Clear(); return this; } @@ -18902,7 +20530,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(FooRequest prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -18912,21 +20540,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new FooRequest(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(FooRequest cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - FooRequest result = new FooRequest(); + bool builderIsReadOnly; + FooRequest result; + + private FooRequest PrepareBuilder() { + if (builderIsReadOnly) { + FooRequest original = result; + result = new FooRequest(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override FooRequest MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new FooRequest(); + result = DefaultInstance ?? new FooRequest(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -18938,12 +20593,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override FooRequest BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - FooRequest returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -18957,6 +20611,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(FooRequest other) { if (other == global::Google.ProtocolBuffers.TestProtos.FooRequest.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -18966,6 +20621,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -19100,7 +20756,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(FooResponse prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -19110,21 +20766,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new FooResponse(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(FooResponse cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + FooResponse result; + + private FooResponse PrepareBuilder() { + if (builderIsReadOnly) { + FooResponse original = result; + result = new FooResponse(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - FooResponse result = new FooResponse(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override FooResponse MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new FooResponse(); + result = DefaultInstance ?? new FooResponse(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -19136,12 +20819,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override FooResponse BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - FooResponse returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -19155,6 +20837,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(FooResponse other) { if (other == global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -19164,6 +20847,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -19298,7 +20982,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(BarRequest prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -19308,21 +20992,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new BarRequest(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(BarRequest cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } + + bool builderIsReadOnly; + BarRequest result; + + private BarRequest PrepareBuilder() { + if (builderIsReadOnly) { + BarRequest original = result; + result = new BarRequest(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } - BarRequest result = new BarRequest(); + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override BarRequest MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new BarRequest(); + result = DefaultInstance ?? new BarRequest(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -19334,12 +21045,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override BarRequest BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - BarRequest returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -19353,6 +21063,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(BarRequest other) { if (other == global::Google.ProtocolBuffers.TestProtos.BarRequest.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -19362,6 +21073,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; @@ -19496,7 +21208,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(BarResponse prototype) { - return (Builder) new Builder().MergeFrom(prototype); + return new Builder(prototype); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -19506,21 +21218,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder { get { return this; } } - public Builder() {} + public Builder() { + result = DefaultInstance ?? new BarResponse(); + builderIsReadOnly = result == DefaultInstance; + } + internal Builder(BarResponse cloneFrom) { + result = cloneFrom; + builderIsReadOnly = true; + } - BarResponse result = new BarResponse(); + bool builderIsReadOnly; + BarResponse result; + + private BarResponse PrepareBuilder() { + if (builderIsReadOnly) { + BarResponse original = result; + result = new BarResponse(); + builderIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } protected override BarResponse MessageBeingBuilt { - get { return result; } + get { return PrepareBuilder(); } } public override Builder Clear() { - result = new BarResponse(); + result = DefaultInstance ?? new BarResponse(); + builderIsReadOnly = true; return this; } public override Builder Clone() { - return new Builder().MergeFrom(result); + if (builderIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } } public override pbd::MessageDescriptor DescriptorForType { @@ -19532,12 +21271,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override BarResponse BuildPartial() { - if (result == null) { - throw new global::System.InvalidOperationException("build() has already been called on this Builder"); + if (builderIsReadOnly) { + return result; } - BarResponse returnMe = result; - result = null; - return returnMe; + builderIsReadOnly = true; + return result; } public override Builder MergeFrom(pb::IMessage other) { @@ -19551,6 +21289,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(BarResponse other) { if (other == global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance) return this; + PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } @@ -19560,6 +21299,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; uint tag; string field_name; From 7b6044f88865ae035f75acf742748df74181483d Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 9 Sep 2011 21:40:13 -0500 Subject: [PATCH 08/31] one more test, we are done. --- .../ReusableBuilderTest.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/ProtocolBuffers.Test/ReusableBuilderTest.cs b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs index 4184971f08..9a5e3f3699 100644 --- a/src/ProtocolBuffers.Test/ReusableBuilderTest.cs +++ b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Text; using NUnit.Framework; using Google.ProtocolBuffers.TestProtos; +using Google.ProtocolBuffers.Serialization; namespace Google.ProtocolBuffers { @@ -50,6 +51,26 @@ namespace Google.ProtocolBuffers TestAllTypes.CreateBuilder().SetOptionalBool(true).Build().ToBuilder().Clear().Build())); } + [Test] + public void BuildModifyAndRebuild() + { + TestAllTypes.Builder b1 = new TestAllTypes.Builder(); + b1.SetDefaultInt32(1); + b1.AddRepeatedInt32(2); + b1.SetOptionalForeignMessage(ForeignMessage.DefaultInstance); + + TestAllTypes m1 = b1.Build(); + + b1.SetDefaultInt32(5); + b1.AddRepeatedInt32(6); + b1.SetOptionalForeignMessage(b1.OptionalForeignMessage.ToBuilder().SetC(7)); + + TestAllTypes m2 = b1.Build(); + + Assert.AreEqual("{\"optional_foreign_message\":{},\"repeated_int32\":[2],\"default_int32\":1}", m1.ToJson()); + Assert.AreEqual("{\"optional_foreign_message\":{\"c\":7},\"repeated_int32\":[2,6],\"default_int32\":5}", m2.ToJson()); + } + [Test] public void CloneOnChangePrimitive() { From f52ec95ad50b352ed82449f9cbef48f6edd50149 Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 9 Sep 2011 21:55:02 -0500 Subject: [PATCH 09/31] revert of accidental AssemblyInfo version changes --- src/AddressBook/AddressBookProtos.cs | 20 +- src/AddressBook/Properties/AssemblyInfo.cs | 6 +- src/ProtoBench/Properties/AssemblyInfo.cs | 6 +- src/ProtoDump/Properties/AssemblyInfo.cs | 6 +- src/ProtoGen.Test/Properties/AssemblyInfo.cs | 6 +- src/ProtoGen/Properties/AssemblyInfo.cs | 6 +- src/ProtoMunge/Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- .../Properties/AssemblyInfo.cs | 6 +- .../UnitTestCSharpOptionsProtoFile.cs | 8 +- .../UnitTestCustomOptionsProtoFile.cs | 86 ++++---- .../UnitTestEmbedOptimizeForProtoFile.cs | 8 +- .../TestProtos/UnitTestEmptyProtoFile.cs | 4 +- .../UnitTestExtrasIssuesProtoFile.cs | 20 +- .../TestProtos/UnitTestGenericServices.cs | 12 +- .../TestProtos/UnitTestGoogleSizeProtoFile.cs | 26 +-- .../UnitTestGoogleSpeedProtoFile.cs | 26 +-- .../TestProtos/UnitTestImportLiteProtoFile.cs | 10 +- .../TestProtos/UnitTestImportProtoFile.cs | 10 +- .../TestProtos/UnitTestMessageSetProtoFile.cs | 30 +-- .../UnitTestNoGenericServicesProtoFile.cs | 10 +- .../UnitTestOptimizeForProtoFile.cs | 16 +- .../TestProtos/UnitTestProtoFile.cs | 186 +++++++++--------- .../TestProtos/UnitTestRpcInterop.cs | 30 +-- .../UnitTestXmlSerializerTestProtoFile.cs | 32 +-- .../DescriptorProtos/CSharpOptions.cs | 22 +-- .../DescriptorProtos/DescriptorProtoFile.cs | 94 ++++----- .../Properties/AssemblyInfo.cs | 6 +- .../TestProtos/UnitTestExtrasFullProtoFile.cs | 44 ++--- .../TestProtos/UnitTestExtrasLiteProtoFile.cs | 30 +-- .../TestProtos/UnitTestImportLiteProtoFile.cs | 10 +- .../TestProtos/UnitTestImportProtoFile.cs | 10 +- .../UnitTestLiteImportNonLiteProtoFile.cs | 8 +- .../TestProtos/UnitTestLiteProtoFile.cs | 66 +++---- .../TestProtos/UnitTestProtoFile.cs | 186 +++++++++--------- 35 files changed, 529 insertions(+), 529 deletions(-) diff --git a/src/AddressBook/AddressBookProtos.cs b/src/AddressBook/AddressBookProtos.cs index 7f3504a6e5..4d391f0fe1 100644 --- a/src/AddressBook/AddressBookProtos.cs +++ b/src/AddressBook/AddressBookProtos.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class AddressBookProtos { #region Extension registration @@ -66,7 +66,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Person : pb::GeneratedMessage { private static readonly Person defaultInstance = new Builder().BuildPartial(); private static readonly string[] _personFieldNames = new string[] { "email", "id", "name", "phone" }; @@ -94,10 +94,10 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum PhoneType { MOBILE = 0, HOME = 1, @@ -106,7 +106,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class PhoneNumber : pb::GeneratedMessage { private static readonly PhoneNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _phoneNumberFieldNames = new string[] { "number", "type" }; @@ -228,7 +228,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -532,7 +532,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -764,7 +764,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class AddressBook : pb::GeneratedMessage { private static readonly AddressBook defaultInstance = new Builder().BuildPartial(); private static readonly string[] _addressBookFieldNames = new string[] { "person" }; @@ -874,7 +874,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/AddressBook/Properties/AssemblyInfo.cs b/src/AddressBook/Properties/AssemblyInfo.cs index 34b9e47ffe..614e1b4839 100644 --- a/src/AddressBook/Properties/AssemblyInfo.cs +++ b/src/AddressBook/Properties/AssemblyInfo.cs @@ -33,7 +33,7 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.369")] +// [assembly: AssemblyVersion("2.3.0.277")] -[assembly: AssemblyVersion("2.3.0.369")] -[assembly: AssemblyFileVersion("2.3.0.369")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.0.277")] +[assembly: AssemblyFileVersion("2.3.0.277")] \ No newline at end of file diff --git a/src/ProtoBench/Properties/AssemblyInfo.cs b/src/ProtoBench/Properties/AssemblyInfo.cs index 498f8dcfb9..a5779209df 100644 --- a/src/ProtoBench/Properties/AssemblyInfo.cs +++ b/src/ProtoBench/Properties/AssemblyInfo.cs @@ -36,7 +36,7 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.369")] +// [assembly: AssemblyVersion("2.3.0.277")] -[assembly: AssemblyVersion("2.3.0.369")] -[assembly: AssemblyFileVersion("2.3.0.369")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.0.277")] +[assembly: AssemblyFileVersion("2.3.0.277")] \ No newline at end of file diff --git a/src/ProtoDump/Properties/AssemblyInfo.cs b/src/ProtoDump/Properties/AssemblyInfo.cs index e71f55407b..816d6f98c1 100644 --- a/src/ProtoDump/Properties/AssemblyInfo.cs +++ b/src/ProtoDump/Properties/AssemblyInfo.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.369")] +// [assembly: AssemblyVersion("2.3.0.277")] -[assembly: AssemblyVersion("2.3.0.369")] -[assembly: AssemblyFileVersion("2.3.0.369")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.0.277")] +[assembly: AssemblyFileVersion("2.3.0.277")] \ No newline at end of file diff --git a/src/ProtoGen.Test/Properties/AssemblyInfo.cs b/src/ProtoGen.Test/Properties/AssemblyInfo.cs index 98ab392a4b..8a64bf4bbc 100644 --- a/src/ProtoGen.Test/Properties/AssemblyInfo.cs +++ b/src/ProtoGen.Test/Properties/AssemblyInfo.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.369")] +// [assembly: AssemblyVersion("2.3.0.277")] -[assembly: AssemblyVersion("2.3.0.369")] -[assembly: AssemblyFileVersion("2.3.0.369")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.0.277")] +[assembly: AssemblyFileVersion("2.3.0.277")] \ No newline at end of file diff --git a/src/ProtoGen/Properties/AssemblyInfo.cs b/src/ProtoGen/Properties/AssemblyInfo.cs index 2e2fdae92b..1d8cc31290 100644 --- a/src/ProtoGen/Properties/AssemblyInfo.cs +++ b/src/ProtoGen/Properties/AssemblyInfo.cs @@ -33,7 +33,7 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.369")] +// [assembly: AssemblyVersion("2.3.0.277")] -[assembly: AssemblyVersion("2.3.0.369")] -[assembly: AssemblyFileVersion("2.3.0.369")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.0.277")] +[assembly: AssemblyFileVersion("2.3.0.277")] \ No newline at end of file diff --git a/src/ProtoMunge/Properties/AssemblyInfo.cs b/src/ProtoMunge/Properties/AssemblyInfo.cs index eaadf7afcc..5e62c84872 100644 --- a/src/ProtoMunge/Properties/AssemblyInfo.cs +++ b/src/ProtoMunge/Properties/AssemblyInfo.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.369")] +// [assembly: AssemblyVersion("2.3.0.277")] -[assembly: AssemblyVersion("2.3.0.369")] -[assembly: AssemblyFileVersion("2.3.0.369")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.0.277")] +[assembly: AssemblyFileVersion("2.3.0.277")] \ No newline at end of file diff --git a/src/ProtocolBuffers.Serialization/Properties/AssemblyInfo.cs b/src/ProtocolBuffers.Serialization/Properties/AssemblyInfo.cs index b6581aa4c5..fdae52b878 100644 --- a/src/ProtocolBuffers.Serialization/Properties/AssemblyInfo.cs +++ b/src/ProtocolBuffers.Serialization/Properties/AssemblyInfo.cs @@ -65,12 +65,12 @@ using System.Runtime.CompilerServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.369")] +// [assembly: AssemblyVersion("2.3.0.277")] -[assembly: AssemblyVersion("2.3.0.369")] +[assembly: AssemblyVersion("2.3.0.277")] #if !COMPACT_FRAMEWORK_35 -[assembly: AssemblyFileVersion("2.3.0.369")] +[assembly: AssemblyFileVersion("2.3.0.277")] #endif [assembly: CLSCompliant(true)] \ No newline at end of file diff --git a/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs b/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs index a324c105e9..5aa14a93a1 100644 --- a/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs +++ b/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs @@ -35,10 +35,10 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.369")] +// [assembly: AssemblyVersion("2.3.0.277")] -[assembly: AssemblyVersion("2.3.0.369")] -[assembly: AssemblyFileVersion("2.3.0.369")] +[assembly: AssemblyVersion("2.3.0.277")] +[assembly: AssemblyFileVersion("2.3.0.277")] // We don't really need CLSCompliance, but if the assembly builds with no warnings, // that means the generator is okay. diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs index 076de4ffbd..ff726d65de 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestCSharpOptionsProtoFile { #region Extension registration @@ -58,7 +58,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionsMessage : pb::GeneratedMessage { private static readonly OptionsMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionsMessageFieldNames = new string[] { "customized", "normal", "options_message" }; @@ -195,7 +195,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs index 427b1ade85..0b1be422a6 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestCustomOptionsProtoFile { #region Extension registration @@ -387,7 +387,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum MethodOpt1 { METHODOPT1_VAL1 = 1, METHODOPT1_VAL2 = 2, @@ -398,7 +398,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessageWithCustomOptions : pb::GeneratedMessage { private static readonly TestMessageWithCustomOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageWithCustomOptionsFieldNames = new string[] { "field1" }; @@ -426,10 +426,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum AnEnum { ANENUM_VAL1 = 1, ANENUM_VAL2 = 2, @@ -518,7 +518,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -653,7 +653,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CustomOptionFooRequest : pb::GeneratedMessage { private static readonly CustomOptionFooRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _customOptionFooRequestFieldNames = new string[] { }; @@ -742,7 +742,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -851,7 +851,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CustomOptionFooResponse : pb::GeneratedMessage { private static readonly CustomOptionFooResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _customOptionFooResponseFieldNames = new string[] { }; @@ -940,7 +940,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1049,7 +1049,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class DummyMessageContainingEnum : pb::GeneratedMessage { private static readonly DummyMessageContainingEnum defaultInstance = new Builder().BuildPartial(); private static readonly string[] _dummyMessageContainingEnumFieldNames = new string[] { }; @@ -1077,10 +1077,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum TestEnumType { TEST_OPTION_ENUM_TYPE1 = 22, TEST_OPTION_ENUM_TYPE2 = -23, @@ -1153,7 +1153,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1262,7 +1262,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class DummyMessageInvalidAsOptionType : pb::GeneratedMessage { private static readonly DummyMessageInvalidAsOptionType defaultInstance = new Builder().BuildPartial(); private static readonly string[] _dummyMessageInvalidAsOptionTypeFieldNames = new string[] { }; @@ -1351,7 +1351,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1460,7 +1460,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CustomOptionMinIntegerValues : pb::GeneratedMessage { private static readonly CustomOptionMinIntegerValues defaultInstance = new Builder().BuildPartial(); private static readonly string[] _customOptionMinIntegerValuesFieldNames = new string[] { }; @@ -1549,7 +1549,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1658,7 +1658,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CustomOptionMaxIntegerValues : pb::GeneratedMessage { private static readonly CustomOptionMaxIntegerValues defaultInstance = new Builder().BuildPartial(); private static readonly string[] _customOptionMaxIntegerValuesFieldNames = new string[] { }; @@ -1747,7 +1747,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1856,7 +1856,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CustomOptionOtherValues : pb::GeneratedMessage { private static readonly CustomOptionOtherValues defaultInstance = new Builder().BuildPartial(); private static readonly string[] _customOptionOtherValuesFieldNames = new string[] { }; @@ -1945,7 +1945,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -2054,7 +2054,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SettingRealsFromPositiveInts : pb::GeneratedMessage { private static readonly SettingRealsFromPositiveInts defaultInstance = new Builder().BuildPartial(); private static readonly string[] _settingRealsFromPositiveIntsFieldNames = new string[] { }; @@ -2143,7 +2143,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -2252,7 +2252,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SettingRealsFromNegativeInts : pb::GeneratedMessage { private static readonly SettingRealsFromNegativeInts defaultInstance = new Builder().BuildPartial(); private static readonly string[] _settingRealsFromNegativeIntsFieldNames = new string[] { }; @@ -2341,7 +2341,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -2450,7 +2450,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOptionType1 : pb::ExtendableMessage { private static readonly ComplexOptionType1 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOptionType1FieldNames = new string[] { "foo", "foo2", "foo3" }; @@ -2591,7 +2591,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -2776,7 +2776,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOptionType2 : pb::ExtendableMessage { private static readonly ComplexOptionType2 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOptionType2FieldNames = new string[] { "bar", "baz", "fred" }; @@ -2804,11 +2804,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOptionType4 : pb::GeneratedMessage { private static readonly ComplexOptionType4 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOptionType4FieldNames = new string[] { "waldo" }; @@ -2915,7 +2915,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3169,7 +3169,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3400,7 +3400,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOptionType3 : pb::GeneratedMessage { private static readonly ComplexOptionType3 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOptionType3FieldNames = new string[] { "complexoptiontype5", "qux" }; @@ -3428,11 +3428,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOptionType5 : pb::GeneratedMessage { private static readonly ComplexOptionType5 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOptionType5FieldNames = new string[] { "plugh" }; @@ -3537,7 +3537,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3768,7 +3768,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3950,7 +3950,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOpt6 : pb::GeneratedMessage { private static readonly ComplexOpt6 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOpt6FieldNames = new string[] { "xyzzy" }; @@ -4055,7 +4055,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -4189,7 +4189,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class VariousComplexOptions : pb::GeneratedMessage { private static readonly VariousComplexOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _variousComplexOptionsFieldNames = new string[] { }; @@ -4278,7 +4278,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs index 53f5a2b573..09ecdd63d4 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestEmbedOptimizeForProtoFile { #region Extension registration @@ -62,7 +62,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestEmbedOptimizedForSize : pb::GeneratedMessage { private static readonly TestEmbedOptimizedForSize defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testEmbedOptimizedForSizeFieldNames = new string[] { "optional_message", "repeated_message" }; @@ -191,7 +191,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmptyProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmptyProtoFile.cs index c3544f21a3..eb6c6c74aa 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmptyProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmptyProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestEmptyProtoFile { #region Extension registration diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs index 0f66e5d666..db56e8b919 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestExtrasIssuesProtoFile { #region Extension registration @@ -75,7 +75,7 @@ namespace UnitTest.Issues.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class A : pb::GeneratedMessage { private static readonly A defaultInstance = new Builder().BuildPartial(); private static readonly string[] _aFieldNames = new string[] { "_A" }; @@ -180,7 +180,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -314,7 +314,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class B : pb::GeneratedMessage { private static readonly B defaultInstance = new Builder().BuildPartial(); private static readonly string[] _bFieldNames = new string[] { "B_" }; @@ -419,7 +419,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -553,7 +553,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class AB : pb::GeneratedMessage { private static readonly AB defaultInstance = new Builder().BuildPartial(); private static readonly string[] _aBFieldNames = new string[] { "a_b" }; @@ -658,7 +658,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -792,7 +792,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NumberField : pb::GeneratedMessage { private static readonly NumberField defaultInstance = new Builder().BuildPartial(); private static readonly string[] _numberFieldFieldNames = new string[] { "_01" }; @@ -899,7 +899,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs index f21475ad43..9227c7cc40 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestGenericServices { #region Extension registration @@ -62,7 +62,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Services [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public abstract class TestGenericService : pb::IService { public abstract void Foo( pb::IRpcController controller, @@ -141,7 +141,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public class Stub : global::Google.ProtocolBuffers.TestProtos.TestGenericService { internal Stub(pb::IRpcChannel channel) { this.channel = channel; @@ -174,7 +174,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public abstract class TestGenericServiceWithCustomOptions : pb::IService { public abstract void Foo( pb::IRpcController controller, @@ -240,7 +240,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public class Stub : global::Google.ProtocolBuffers.TestProtos.TestGenericServiceWithCustomOptions { internal Stub(pb::IRpcChannel channel) { this.channel = channel; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs index 83250c1eb8..77635f2132 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestGoogleSizeProtoFile { #region Extension registration @@ -135,7 +135,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SizeMessage1 : pb::GeneratedMessage { private static readonly SizeMessage1 defaultInstance = new Builder().BuildPartial(); public static SizeMessage1 DefaultInstance { @@ -611,7 +611,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1436,7 +1436,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SizeMessage1SubMessage : pb::GeneratedMessage { private static readonly SizeMessage1SubMessage defaultInstance = new Builder().BuildPartial(); public static SizeMessage1SubMessage DefaultInstance { @@ -1702,7 +1702,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -2119,7 +2119,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SizeMessage2 : pb::GeneratedMessage { private static readonly SizeMessage2 defaultInstance = new Builder().BuildPartial(); public static SizeMessage2 DefaultInstance { @@ -2145,11 +2145,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Group1 : pb::GeneratedMessage { private static readonly Group1 defaultInstance = new Builder().BuildPartial(); public static Group1 DefaultInstance { @@ -2378,7 +2378,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3118,7 +3118,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3760,7 +3760,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SizeMessage2GroupedMessage : pb::GeneratedMessage { private static readonly SizeMessage2GroupedMessage defaultInstance = new Builder().BuildPartial(); public static SizeMessage2GroupedMessage DefaultInstance { @@ -3932,7 +3932,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs index 15a3aa49e0..918be643ec 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestGoogleSpeedProtoFile { #region Extension registration @@ -135,7 +135,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SpeedMessage1 : pb::GeneratedMessage { private static readonly SpeedMessage1 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _speedMessage1FieldNames = new string[] { "field1", "field100", "field101", "field102", "field103", "field104", "field12", "field128", "field129", "field13", "field130", "field131", "field14", "field15", "field150", "field16", "field17", "field18", "field2", "field22", "field23", "field24", "field25", "field271", "field272", "field280", "field29", "field3", "field30", "field4", "field5", "field59", "field6", "field60", "field67", "field68", "field7", "field78", "field80", "field81", "field9" }; @@ -890,7 +890,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -2070,7 +2070,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SpeedMessage1SubMessage : pb::GeneratedMessage { private static readonly SpeedMessage1SubMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _speedMessage1SubMessageFieldNames = new string[] { "field1", "field12", "field13", "field14", "field15", "field16", "field19", "field2", "field20", "field203", "field204", "field205", "field206", "field207", "field21", "field22", "field23", "field28", "field3", "field300" }; @@ -2483,7 +2483,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3102,7 +3102,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SpeedMessage2 : pb::GeneratedMessage { private static readonly SpeedMessage2 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _speedMessage2FieldNames = new string[] { "field1", "field109", "field127", "field128", "field129", "field130", "field131", "field2", "field205", "field206", "field21", "field210", "field211", "field212", "field213", "field216", "field217", "field218", "field220", "field221", "field222", "field25", "field3", "field30", "field4", "field6", "field63", "field71", "field75", "group1" }; @@ -3130,11 +3130,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Group1 : pb::GeneratedMessage { private static readonly Group1 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _group1FieldNames = new string[] { "field11", "field12", "field13", "field14", "field15", "field16", "field20", "field22", "field24", "field26", "field27", "field28", "field29", "field31", "field5", "field73" }; @@ -3503,7 +3503,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -4643,7 +4643,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5558,7 +5558,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SpeedMessage2GroupedMessage : pb::GeneratedMessage { private static readonly SpeedMessage2GroupedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _speedMessage2GroupedMessageFieldNames = new string[] { "field1", "field10", "field11", "field2", "field3", "field4", "field5", "field6", "field7", "field8", "field9" }; @@ -5823,7 +5823,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs index 4702794028..a96833bef0 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestImportLiteProtoFile { #region Extension registration @@ -29,7 +29,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum ImportEnumLite { IMPORT_LITE_FOO = 7, IMPORT_LITE_BAR = 8, @@ -41,7 +41,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ImportMessageLite : pb::GeneratedMessageLite { private static readonly ImportMessageLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _importMessageLiteFieldNames = new string[] { "d" }; @@ -155,7 +155,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs index ac745a7fbd..5749c97f88 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestImportProtoFile { #region Extension registration @@ -57,7 +57,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum ImportEnum { IMPORT_FOO = 7, IMPORT_BAR = 8, @@ -69,7 +69,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ImportMessage : pb::GeneratedMessage { private static readonly ImportMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _importMessageFieldNames = new string[] { "d" }; @@ -174,7 +174,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs index 9302d5ac07..8a6bb58929 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestMessageSetProtoFile { #region Extension registration @@ -101,7 +101,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessageSet : pb::ExtendableMessage { private static readonly TestMessageSet defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageSetFieldNames = new string[] { }; @@ -194,7 +194,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -304,7 +304,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessageSetContainer : pb::GeneratedMessage { private static readonly TestMessageSetContainer defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageSetContainerFieldNames = new string[] { "message_set" }; @@ -409,7 +409,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -566,7 +566,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessageSetExtension1 : pb::GeneratedMessage { private static readonly TestMessageSetExtension1 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageSetExtension1FieldNames = new string[] { "i" }; @@ -673,7 +673,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -807,7 +807,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessageSetExtension2 : pb::GeneratedMessage { private static readonly TestMessageSetExtension2 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageSetExtension2FieldNames = new string[] { "str" }; @@ -914,7 +914,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1049,7 +1049,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RawMessageSet : pb::GeneratedMessage { private static readonly RawMessageSet defaultInstance = new Builder().BuildPartial(); private static readonly string[] _rawMessageSetFieldNames = new string[] { "item" }; @@ -1077,11 +1077,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Item : pb::GeneratedMessage { private static readonly Item defaultInstance = new Builder().BuildPartial(); private static readonly string[] _itemFieldNames = new string[] { "message", "type_id" }; @@ -1204,7 +1204,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1447,7 +1447,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs index 6b6aa7e2a4..74d6af60eb 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestNoGenericServicesProtoFile { #region Extension registration @@ -69,7 +69,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum TestEnum { FOO = 1, } @@ -79,7 +79,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessage : pb::ExtendableMessage { private static readonly TestMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageFieldNames = new string[] { "a" }; @@ -188,7 +188,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs index c1ab93ff8c..c7153abc4c 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestOptimizeForProtoFile { #region Extension registration @@ -83,7 +83,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestOptimizedForSize : pb::ExtendableMessage { private static readonly TestOptimizedForSize defaultInstance = new Builder().BuildPartial(); public static TestOptimizedForSize DefaultInstance { @@ -169,7 +169,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -270,7 +270,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequiredOptimizedForSize : pb::GeneratedMessage { private static readonly TestRequiredOptimizedForSize defaultInstance = new Builder().BuildPartial(); public static TestRequiredOptimizedForSize DefaultInstance { @@ -342,7 +342,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -407,7 +407,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestOptionalOptimizedForSize : pb::GeneratedMessage { private static readonly TestOptionalOptimizedForSize defaultInstance = new Builder().BuildPartial(); public static TestOptionalOptimizedForSize DefaultInstance { @@ -479,7 +479,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs index f46ec30148..d8824d49a4 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestProtoFile { #region Extension registration @@ -1086,7 +1086,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum ForeignEnum { FOREIGN_FOO = 4, FOREIGN_BAR = 5, @@ -1094,7 +1094,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum TestEnumWithDupValue { FOO1 = 1, BAR1 = 2, @@ -1104,7 +1104,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum TestSparseEnum { SPARSE_A = 123, SPARSE_B = 62374, @@ -1120,7 +1120,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllTypes : pb::GeneratedMessage { private static readonly TestAllTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllTypesFieldNames = new string[] { "default_bool", "default_bytes", "default_cord", "default_double", "default_fixed32", "default_fixed64", "default_float", "default_foreign_enum", "default_import_enum", "default_int32", "default_int64", "default_nested_enum", "default_sfixed32", "default_sfixed64", "default_sint32", "default_sint64", "default_string", "default_string_piece", "default_uint32", "default_uint64", "optional_bool", "optional_bytes", "optional_cord", "optional_double", "optional_fixed32", "optional_fixed64", "optional_float", "optional_foreign_enum", "optional_foreign_message", "optional_import_enum", "optional_import_message", "optional_int32", "optional_int64", "optional_nested_enum", "optional_nested_message", "optional_sfixed32", "optional_sfixed64", "optional_sint32", "optional_sint64", "optional_string", "optional_string_piece", "optional_uint32", "optional_uint64", "optionalgroup", "repeated_bool", "repeated_bytes", "repeated_cord", "repeated_double", "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_foreign_enum", "repeated_foreign_message", "repeated_import_enum", "repeated_import_message", "repeated_int32", "repeated_int64", "repeated_nested_enum", "repeated_nested_message", "repeated_sfixed32", "repeated_sfixed64", "repeated_sint32", "repeated_sint64", "repeated_string", "repeated_string_piece", "repeated_uint32", "repeated_uint64", "repeatedgroup" }; @@ -1148,10 +1148,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum NestedEnum { FOO = 1, BAR = 2, @@ -1160,7 +1160,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NestedMessage : pb::GeneratedMessage { private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _nestedMessageFieldNames = new string[] { "bb" }; @@ -1265,7 +1265,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1399,7 +1399,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup : pb::GeneratedMessage { private static readonly OptionalGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupFieldNames = new string[] { "a" }; @@ -1504,7 +1504,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1638,7 +1638,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup : pb::GeneratedMessage { private static readonly RepeatedGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupFieldNames = new string[] { "a" }; @@ -1743,7 +1743,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3186,7 +3186,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5494,7 +5494,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDeprecatedFields : pb::GeneratedMessage { private static readonly TestDeprecatedFields defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDeprecatedFieldsFieldNames = new string[] { "deprecated_int32" }; @@ -5599,7 +5599,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5733,7 +5733,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ForeignMessage : pb::GeneratedMessage { private static readonly ForeignMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _foreignMessageFieldNames = new string[] { "c" }; @@ -5838,7 +5838,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5972,7 +5972,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllExtensions : pb::ExtendableMessage { private static readonly TestAllExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllExtensionsFieldNames = new string[] { }; @@ -6065,7 +6065,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6175,7 +6175,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup_extension : pb::GeneratedMessage { private static readonly OptionalGroup_extension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupExtensionFieldNames = new string[] { "a" }; @@ -6280,7 +6280,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6414,7 +6414,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup_extension : pb::GeneratedMessage { private static readonly RepeatedGroup_extension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupExtensionFieldNames = new string[] { "a" }; @@ -6519,7 +6519,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6653,7 +6653,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestNestedExtension : pb::GeneratedMessage { private static readonly TestNestedExtension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testNestedExtensionFieldNames = new string[] { }; @@ -6744,7 +6744,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6853,7 +6853,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequired : pb::GeneratedMessage { private static readonly TestRequired defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRequiredFieldNames = new string[] { "a", "b", "c", "dummy10", "dummy11", "dummy12", "dummy13", "dummy14", "dummy15", "dummy16", "dummy17", "dummy18", "dummy19", "dummy2", "dummy20", "dummy21", "dummy22", "dummy23", "dummy24", "dummy25", "dummy26", "dummy27", "dummy28", "dummy29", "dummy30", "dummy31", "dummy32", "dummy4", "dummy5", "dummy6", "dummy7", "dummy8", "dummy9" }; @@ -7477,7 +7477,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -8411,7 +8411,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequiredForeign : pb::GeneratedMessage { private static readonly TestRequiredForeign defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRequiredForeignFieldNames = new string[] { "dummy", "optional_message", "repeated_message" }; @@ -8556,7 +8556,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -8784,7 +8784,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestForeignNested : pb::GeneratedMessage { private static readonly TestForeignNested defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testForeignNestedFieldNames = new string[] { "foreign_nested" }; @@ -8889,7 +8889,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9046,7 +9046,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestEmptyMessage : pb::GeneratedMessage { private static readonly TestEmptyMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testEmptyMessageFieldNames = new string[] { }; @@ -9135,7 +9135,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9244,7 +9244,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestEmptyMessageWithExtensions : pb::ExtendableMessage { private static readonly TestEmptyMessageWithExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testEmptyMessageWithExtensionsFieldNames = new string[] { }; @@ -9337,7 +9337,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9447,7 +9447,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMultipleExtensionRanges : pb::ExtendableMessage { private static readonly TestMultipleExtensionRanges defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMultipleExtensionRangesFieldNames = new string[] { }; @@ -9542,7 +9542,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9652,7 +9652,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestReallyLargeTagNumber : pb::GeneratedMessage { private static readonly TestReallyLargeTagNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testReallyLargeTagNumberFieldNames = new string[] { "a", "bb" }; @@ -9773,7 +9773,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9932,7 +9932,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRecursiveMessage : pb::GeneratedMessage { private static readonly TestRecursiveMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRecursiveMessageFieldNames = new string[] { "a", "i" }; @@ -10053,7 +10053,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -10235,7 +10235,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMutualRecursionA : pb::GeneratedMessage { private static readonly TestMutualRecursionA defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMutualRecursionAFieldNames = new string[] { "bb" }; @@ -10340,7 +10340,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -10497,7 +10497,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMutualRecursionB : pb::GeneratedMessage { private static readonly TestMutualRecursionB defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMutualRecursionBFieldNames = new string[] { "a", "optional_int32" }; @@ -10618,7 +10618,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -10800,7 +10800,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDupFieldNumber : pb::GeneratedMessage { private static readonly TestDupFieldNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDupFieldNumberFieldNames = new string[] { "a", "bar", "foo" }; @@ -10828,11 +10828,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Foo : pb::GeneratedMessage { private static readonly Foo defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooFieldNames = new string[] { "a" }; @@ -10937,7 +10937,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -11071,7 +11071,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Bar : pb::GeneratedMessage { private static readonly Bar defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barFieldNames = new string[] { "a" }; @@ -11176,7 +11176,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -11423,7 +11423,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -11653,7 +11653,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestNestedMessageHasBits : pb::GeneratedMessage { private static readonly TestNestedMessageHasBits defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testNestedMessageHasBitsFieldNames = new string[] { "optional_nested_message" }; @@ -11681,11 +11681,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NestedMessage : pb::GeneratedMessage { private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _nestedMessageFieldNames = new string[] { "nestedmessage_repeated_foreignmessage", "nestedmessage_repeated_int32" }; @@ -11815,7 +11815,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -12086,7 +12086,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -12243,7 +12243,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestCamelCaseFieldNames : pb::GeneratedMessage { private static readonly TestCamelCaseFieldNames defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testCamelCaseFieldNamesFieldNames = new string[] { "CordField", "EnumField", "MessageField", "PrimitiveField", "RepeatedCordField", "RepeatedEnumField", "RepeatedMessageField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedStringPieceField", "StringField", "StringPieceField" }; @@ -12563,7 +12563,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -13089,7 +13089,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestFieldOrderings : pb::ExtendableMessage { private static readonly TestFieldOrderings defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testFieldOrderingsFieldNames = new string[] { "my_float", "my_int", "my_string" }; @@ -13231,7 +13231,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -13417,7 +13417,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestExtremeDefaultValues : pb::GeneratedMessage { private static readonly TestExtremeDefaultValues defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testExtremeDefaultValuesFieldNames = new string[] { "escaped_bytes", "inf_double", "inf_float", "large_float", "large_uint32", "large_uint64", "nan_double", "nan_float", "neg_inf_double", "neg_inf_float", "negative_float", "negative_one_float", "one_float", "small_float", "small_int32", "small_int64", "small_negative_float", "utf8_string", "zero_float" }; @@ -13812,7 +13812,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -14402,7 +14402,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OneString : pb::GeneratedMessage { private static readonly OneString defaultInstance = new Builder().BuildPartial(); private static readonly string[] _oneStringFieldNames = new string[] { "data" }; @@ -14507,7 +14507,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -14642,7 +14642,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OneBytes : pb::GeneratedMessage { private static readonly OneBytes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _oneBytesFieldNames = new string[] { "data" }; @@ -14747,7 +14747,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -14882,7 +14882,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedTypes : pb::GeneratedMessage { private static readonly TestPackedTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedTypesFieldNames = new string[] { "packed_bool", "packed_double", "packed_enum", "packed_fixed32", "packed_fixed64", "packed_float", "packed_int32", "packed_int64", "packed_sfixed32", "packed_sfixed64", "packed_sint32", "packed_sint64", "packed_uint32", "packed_uint64" }; @@ -15344,7 +15344,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -15972,7 +15972,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedTypes : pb::GeneratedMessage { private static readonly TestUnpackedTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedTypesFieldNames = new string[] { "unpacked_bool", "unpacked_double", "unpacked_enum", "unpacked_fixed32", "unpacked_fixed64", "unpacked_float", "unpacked_int32", "unpacked_int64", "unpacked_sfixed32", "unpacked_sfixed64", "unpacked_sint32", "unpacked_sint64", "unpacked_uint32", "unpacked_uint64" }; @@ -16379,7 +16379,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -17007,7 +17007,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedExtensions : pb::ExtendableMessage { private static readonly TestPackedExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedExtensionsFieldNames = new string[] { }; @@ -17100,7 +17100,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -17210,7 +17210,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedExtensions : pb::ExtendableMessage { private static readonly TestUnpackedExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedExtensionsFieldNames = new string[] { }; @@ -17303,7 +17303,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -17413,7 +17413,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDynamicExtensions : pb::GeneratedMessage { private static readonly TestDynamicExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDynamicExtensionsFieldNames = new string[] { "dynamic_enum_extension", "dynamic_message_extension", "enum_extension", "message_extension", "packed_extension", "repeated_extension", "scalar_extension" }; @@ -17441,10 +17441,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum DynamicEnumType { DYNAMIC_FOO = 2200, DYNAMIC_BAR = 2201, @@ -17453,7 +17453,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class DynamicMessageType : pb::GeneratedMessage { private static readonly DynamicMessageType defaultInstance = new Builder().BuildPartial(); private static readonly string[] _dynamicMessageTypeFieldNames = new string[] { "dynamic_field" }; @@ -17558,7 +17558,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -17888,7 +17888,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -18257,7 +18257,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::GeneratedMessage { private static readonly TestRepeatedScalarDifferentTagSizes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRepeatedScalarDifferentTagSizesFieldNames = new string[] { "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_int32", "repeated_int64", "repeated_uint64" }; @@ -18484,7 +18484,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -18818,7 +18818,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FooRequest : pb::GeneratedMessage { private static readonly FooRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooRequestFieldNames = new string[] { }; @@ -18907,7 +18907,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -19016,7 +19016,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FooResponse : pb::GeneratedMessage { private static readonly FooResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooResponseFieldNames = new string[] { }; @@ -19105,7 +19105,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -19214,7 +19214,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class BarRequest : pb::GeneratedMessage { private static readonly BarRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barRequestFieldNames = new string[] { }; @@ -19303,7 +19303,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -19412,7 +19412,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class BarResponse : pb::GeneratedMessage { private static readonly BarResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barResponseFieldNames = new string[] { }; @@ -19501,7 +19501,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs index 55d1fdacb0..ae309fa706 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestRpcInterop { #region Extension registration @@ -81,7 +81,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SearchRequest : pb::GeneratedMessage { private static readonly SearchRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _searchRequestFieldNames = new string[] { "Criteria" }; @@ -193,7 +193,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -338,7 +338,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SearchResponse : pb::GeneratedMessage { private static readonly SearchResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _searchResponseFieldNames = new string[] { "results" }; @@ -366,11 +366,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ResultItem : pb::GeneratedMessage { private static readonly ResultItem defaultInstance = new Builder().BuildPartial(); private static readonly string[] _resultItemFieldNames = new string[] { "name", "url" }; @@ -492,7 +492,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -739,7 +739,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -894,7 +894,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RefineSearchRequest : pb::GeneratedMessage { private static readonly RefineSearchRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _refineSearchRequestFieldNames = new string[] { "Criteria", "previous_results" }; @@ -1024,7 +1024,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1220,7 +1220,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Services [global::System.Runtime.InteropServices.GuidAttribute("a65f0925-fd11-4f94-b166-89ac4f027205")] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public partial interface ISearchService { [global::System.Runtime.InteropServices.DispId(5)] global::Google.ProtocolBuffers.TestProtos.SearchResponse Search(global::Google.ProtocolBuffers.TestProtos.SearchRequest searchRequest); @@ -1230,7 +1230,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.CLSCompliant(false)] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public partial class SearchService : ISearchService, pb::IRpcDispatch, global::System.IDisposable { private readonly bool dispose; private readonly pb::IRpcDispatch dispatch; @@ -1260,7 +1260,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.CLSCompliant(false)] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public partial class Dispatch : pb::IRpcDispatch, global::System.IDisposable { private readonly bool dispose; private readonly ISearchService implementation; @@ -1288,7 +1288,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.CLSCompliant(false)] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public partial class ServerStub : pb::IRpcServerStub, global::System.IDisposable { private readonly bool dispose; private readonly pb::IRpcDispatch implementation; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs index c9f5ebdfeb..3d818a6082 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestXmlSerializerTestProtoFile { #region Extension registration @@ -124,7 +124,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum EnumOptions { ONE = 0, TWO = 1, @@ -136,7 +136,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestXmlChild : pb::GeneratedMessage { private static readonly TestXmlChild defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testXmlChildFieldNames = new string[] { "binary", "options" }; @@ -266,7 +266,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -445,7 +445,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestXmlNoFields : pb::GeneratedMessage { private static readonly TestXmlNoFields defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testXmlNoFieldsFieldNames = new string[] { }; @@ -534,7 +534,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -643,7 +643,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestXmlRescursive : pb::GeneratedMessage { private static readonly TestXmlRescursive defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testXmlRescursiveFieldNames = new string[] { "child" }; @@ -748,7 +748,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -905,7 +905,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestXmlMessage : pb::ExtendableMessage { private static readonly TestXmlMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testXmlMessageFieldNames = new string[] { "child", "children", "number", "numbers", "text", "textlines", "valid" }; @@ -933,11 +933,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Children : pb::GeneratedMessage { private static readonly Children defaultInstance = new Builder().BuildPartial(); private static readonly string[] _childrenFieldNames = new string[] { "binary", "options" }; @@ -1067,7 +1067,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1443,7 +1443,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1794,7 +1794,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestXmlExtension : pb::GeneratedMessage { private static readonly TestXmlExtension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testXmlExtensionFieldNames = new string[] { "number" }; @@ -1900,7 +1900,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs index 98fb3dfe91..853b0e7d09 100644 --- a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs +++ b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class CSharpOptions { #region Extension registration @@ -110,7 +110,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum CSharpServiceType { NONE = 0, GENERIC = 1, @@ -123,7 +123,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CSharpFileOptions : pb::GeneratedMessage { private static readonly CSharpFileOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _cSharpFileOptionsFieldNames = new string[] { "cls_compliance", "code_contracts", "expand_namespace_directories", "file_extension", "ignore_google_protobuf", "multiple_files", "namespace", "nest_classes", "output_directory", "public_classes", "service_generator_type", "umbrella_classname", "umbrella_namespace" }; @@ -420,7 +420,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -867,7 +867,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CSharpFieldOptions : pb::GeneratedMessage { private static readonly CSharpFieldOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _cSharpFieldOptionsFieldNames = new string[] { "property_name" }; @@ -972,7 +972,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1107,7 +1107,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CSharpServiceOptions : pb::GeneratedMessage { private static readonly CSharpServiceOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _cSharpServiceOptionsFieldNames = new string[] { "interface_id" }; @@ -1212,7 +1212,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1347,7 +1347,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CSharpMethodOptions : pb::GeneratedMessage { private static readonly CSharpMethodOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _cSharpMethodOptionsFieldNames = new string[] { "dispatch_id" }; @@ -1452,7 +1452,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs index 78c37ead33..5b48cde198 100644 --- a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs +++ b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class DescriptorProtoFile { #region Extension registration @@ -231,7 +231,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FileDescriptorSet : pb::GeneratedMessage { private static readonly FileDescriptorSet defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fileDescriptorSetFieldNames = new string[] { "file" }; @@ -341,7 +341,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -496,7 +496,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FileDescriptorProto : pb::GeneratedMessage { private static readonly FileDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fileDescriptorProtoFieldNames = new string[] { "dependency", "enum_type", "extension", "message_type", "name", "options", "package", "service" }; @@ -743,7 +743,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1172,7 +1172,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class DescriptorProto : pb::GeneratedMessage { private static readonly DescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _descriptorProtoFieldNames = new string[] { "enum_type", "extension", "extension_range", "field", "name", "nested_type", "options" }; @@ -1200,11 +1200,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ExtensionRange : pb::GeneratedMessage { private static readonly ExtensionRange defaultInstance = new Builder().BuildPartial(); private static readonly string[] _extensionRangeFieldNames = new string[] { "end", "start" }; @@ -1325,7 +1325,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1686,7 +1686,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -2099,7 +2099,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FieldDescriptorProto : pb::GeneratedMessage { private static readonly FieldDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fieldDescriptorProtoFieldNames = new string[] { "default_value", "extendee", "label", "name", "number", "options", "type", "type_name" }; @@ -2127,10 +2127,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum Type { TYPE_DOUBLE = 1, TYPE_FLOAT = 2, @@ -2153,7 +2153,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum Label { LABEL_OPTIONAL = 1, LABEL_REQUIRED = 2, @@ -2358,7 +2358,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -2710,7 +2710,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class EnumDescriptorProto : pb::GeneratedMessage { private static readonly EnumDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _enumDescriptorProtoFieldNames = new string[] { "name", "options", "value" }; @@ -2855,7 +2855,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3084,7 +3084,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class EnumValueDescriptorProto : pb::GeneratedMessage { private static readonly EnumValueDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _enumValueDescriptorProtoFieldNames = new string[] { "name", "number", "options" }; @@ -3224,7 +3224,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3432,7 +3432,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ServiceDescriptorProto : pb::GeneratedMessage { private static readonly ServiceDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _serviceDescriptorProtoFieldNames = new string[] { "method", "name", "options" }; @@ -3577,7 +3577,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3806,7 +3806,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class MethodDescriptorProto : pb::GeneratedMessage { private static readonly MethodDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _methodDescriptorProtoFieldNames = new string[] { "input_type", "name", "options", "output_type" }; @@ -3962,7 +3962,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -4197,7 +4197,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FileOptions : pb::ExtendableMessage { private static readonly FileOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fileOptionsFieldNames = new string[] { "cc_generic_services", "java_generic_services", "java_multiple_files", "java_outer_classname", "java_package", "optimize_for", "py_generic_services", "uninterpreted_option" }; @@ -4225,10 +4225,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum OptimizeMode { SPEED = 1, CODE_SIZE = 2, @@ -4439,7 +4439,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -4780,7 +4780,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class MessageOptions : pb::ExtendableMessage { private static readonly MessageOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _messageOptionsFieldNames = new string[] { "message_set_wire_format", "no_standard_descriptor_accessor", "uninterpreted_option" }; @@ -4926,7 +4926,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5132,7 +5132,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FieldOptions : pb::ExtendableMessage { private static readonly FieldOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fieldOptionsFieldNames = new string[] { "ctype", "deprecated", "experimental_map_key", "packed", "uninterpreted_option" }; @@ -5160,10 +5160,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum CType { STRING = 0, CORD = 1, @@ -5326,7 +5326,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5591,7 +5591,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class EnumOptions : pb::ExtendableMessage { private static readonly EnumOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _enumOptionsFieldNames = new string[] { "uninterpreted_option" }; @@ -5705,7 +5705,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5861,7 +5861,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class EnumValueOptions : pb::ExtendableMessage { private static readonly EnumValueOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _enumValueOptionsFieldNames = new string[] { "uninterpreted_option" }; @@ -5975,7 +5975,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6131,7 +6131,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ServiceOptions : pb::ExtendableMessage { private static readonly ServiceOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _serviceOptionsFieldNames = new string[] { "uninterpreted_option" }; @@ -6245,7 +6245,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6401,7 +6401,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class MethodOptions : pb::ExtendableMessage { private static readonly MethodOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _methodOptionsFieldNames = new string[] { "uninterpreted_option" }; @@ -6515,7 +6515,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6671,7 +6671,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class UninterpretedOption : pb::GeneratedMessage { private static readonly UninterpretedOption defaultInstance = new Builder().BuildPartial(); private static readonly string[] _uninterpretedOptionFieldNames = new string[] { "double_value", "identifier_value", "name", "negative_int_value", "positive_int_value", "string_value" }; @@ -6699,11 +6699,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NamePart : pb::GeneratedMessage { private static readonly NamePart defaultInstance = new Builder().BuildPartial(); private static readonly string[] _namePartFieldNames = new string[] { "is_extension", "name_part" }; @@ -6826,7 +6826,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -7153,7 +7153,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffers/Properties/AssemblyInfo.cs b/src/ProtocolBuffers/Properties/AssemblyInfo.cs index b6581aa4c5..fdae52b878 100644 --- a/src/ProtocolBuffers/Properties/AssemblyInfo.cs +++ b/src/ProtocolBuffers/Properties/AssemblyInfo.cs @@ -65,12 +65,12 @@ using System.Runtime.CompilerServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.369")] +// [assembly: AssemblyVersion("2.3.0.277")] -[assembly: AssemblyVersion("2.3.0.369")] +[assembly: AssemblyVersion("2.3.0.277")] #if !COMPACT_FRAMEWORK_35 -[assembly: AssemblyFileVersion("2.3.0.369")] +[assembly: AssemblyFileVersion("2.3.0.277")] #endif [assembly: CLSCompliant(true)] \ No newline at end of file diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs index 523ad93730..a9ee77724b 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestExtrasFullProtoFile { #region Extension registration @@ -126,7 +126,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestInteropPerson : pb::ExtendableMessage { private static readonly TestInteropPerson defaultInstance = new Builder().BuildPartial(); public static TestInteropPerson DefaultInstance { @@ -152,10 +152,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum PhoneType { MOBILE = 0, HOME = 1, @@ -164,7 +164,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class PhoneNumber : pb::GeneratedMessage { private static readonly PhoneNumber defaultInstance = new Builder().BuildPartial(); public static PhoneNumber DefaultInstance { @@ -246,7 +246,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -330,7 +330,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Addresses : pb::GeneratedMessage { private static readonly Addresses defaultInstance = new Builder().BuildPartial(); public static Addresses DefaultInstance { @@ -443,7 +443,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -692,7 +692,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -900,7 +900,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestInteropEmployeeId : pb::GeneratedMessage { private static readonly TestInteropEmployeeId defaultInstance = new Builder().BuildPartial(); public static TestInteropEmployeeId DefaultInstance { @@ -972,7 +972,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1038,7 +1038,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMissingFieldsA : pb::GeneratedMessage { private static readonly TestMissingFieldsA defaultInstance = new Builder().BuildPartial(); public static TestMissingFieldsA DefaultInstance { @@ -1064,11 +1064,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SubA : pb::GeneratedMessage { private static readonly SubA defaultInstance = new Builder().BuildPartial(); public static SubA DefaultInstance { @@ -1152,7 +1152,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1326,7 +1326,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1465,7 +1465,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMissingFieldsB : pb::GeneratedMessage { private static readonly TestMissingFieldsB defaultInstance = new Builder().BuildPartial(); public static TestMissingFieldsB DefaultInstance { @@ -1491,11 +1491,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SubB : pb::GeneratedMessage { private static readonly SubB defaultInstance = new Builder().BuildPartial(); public static SubB DefaultInstance { @@ -1569,7 +1569,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1725,7 +1725,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs index d268954b16..bc214e2565 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestExtrasLiteProtoFile { #region Extension registration @@ -44,7 +44,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum ExtraEnum { DEFAULT = 10, EXLITE_FOO = 7, @@ -57,7 +57,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequiredLite : pb::GeneratedMessageLite { private static readonly TestRequiredLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRequiredLiteFieldNames = new string[] { "d", "en" }; @@ -192,7 +192,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -337,7 +337,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestInteropPersonLite : pb::ExtendableMessageLite { private static readonly TestInteropPersonLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testInteropPersonLiteFieldNames = new string[] { "addresses", "codes", "email", "id", "name", "phone" }; @@ -357,10 +357,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum PhoneType { MOBILE = 0, HOME = 1, @@ -369,7 +369,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class PhoneNumber : pb::GeneratedMessageLite { private static readonly PhoneNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _phoneNumberFieldNames = new string[] { "number", "type" }; @@ -503,7 +503,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -649,7 +649,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Addresses : pb::GeneratedMessageLite { private static readonly Addresses defaultInstance = new Builder().BuildPartial(); private static readonly string[] _addressesFieldNames = new string[] { "address", "address2", "city", "state", "zip" }; @@ -844,7 +844,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -1295,7 +1295,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -1591,7 +1591,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestInteropEmployeeIdLite : pb::GeneratedMessageLite { private static readonly TestInteropEmployeeIdLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testInteropEmployeeIdLiteFieldNames = new string[] { "number" }; @@ -1706,7 +1706,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs index 4702794028..a96833bef0 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestImportLiteProtoFile { #region Extension registration @@ -29,7 +29,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum ImportEnumLite { IMPORT_LITE_FOO = 7, IMPORT_LITE_BAR = 8, @@ -41,7 +41,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ImportMessageLite : pb::GeneratedMessageLite { private static readonly ImportMessageLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _importMessageLiteFieldNames = new string[] { "d" }; @@ -155,7 +155,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs index ac745a7fbd..5749c97f88 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestImportProtoFile { #region Extension registration @@ -57,7 +57,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum ImportEnum { IMPORT_FOO = 7, IMPORT_BAR = 8, @@ -69,7 +69,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ImportMessage : pb::GeneratedMessage { private static readonly ImportMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _importMessageFieldNames = new string[] { "d" }; @@ -174,7 +174,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs index f20647ee7c..7c2836cdb3 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestLiteImportNonLiteProtoFile { #region Extension registration @@ -30,7 +30,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestLiteImportsNonlite : pb::GeneratedMessageLite { private static readonly TestLiteImportsNonlite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testLiteImportsNonliteFieldNames = new string[] { "message" }; @@ -144,7 +144,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs index cd09860072..78bed7e204 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestLiteProtoFile { #region Extension registration @@ -1214,7 +1214,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum ForeignEnumLite { FOREIGN_LITE_FOO = 4, FOREIGN_LITE_BAR = 5, @@ -1226,7 +1226,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllTypesLite : pb::GeneratedMessageLite { private static readonly TestAllTypesLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllTypesLiteFieldNames = new string[] { "default_bool", "default_bytes", "default_cord", "default_double", "default_fixed32", "default_fixed64", "default_float", "default_foreign_enum", "default_import_enum", "default_int32", "default_int64", "default_nested_enum", "default_sfixed32", "default_sfixed64", "default_sint32", "default_sint64", "default_string", "default_string_piece", "default_uint32", "default_uint64", "optional_bool", "optional_bytes", "optional_cord", "optional_double", "optional_fixed32", "optional_fixed64", "optional_float", "optional_foreign_enum", "optional_foreign_message", "optional_import_enum", "optional_import_message", "optional_int32", "optional_int64", "optional_nested_enum", "optional_nested_message", "optional_sfixed32", "optional_sfixed64", "optional_sint32", "optional_sint64", "optional_string", "optional_string_piece", "optional_uint32", "optional_uint64", "optionalgroup", "repeated_bool", "repeated_bytes", "repeated_cord", "repeated_double", "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_foreign_enum", "repeated_foreign_message", "repeated_import_enum", "repeated_import_message", "repeated_int32", "repeated_int64", "repeated_nested_enum", "repeated_nested_message", "repeated_sfixed32", "repeated_sfixed64", "repeated_sint32", "repeated_sint64", "repeated_string", "repeated_string_piece", "repeated_uint32", "repeated_uint64", "repeatedgroup" }; @@ -1246,10 +1246,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum NestedEnum { FOO = 1, BAR = 2, @@ -1258,7 +1258,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NestedMessage : pb::GeneratedMessageLite { private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _nestedMessageFieldNames = new string[] { "bb" }; @@ -1372,7 +1372,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -1488,7 +1488,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup : pb::GeneratedMessageLite { private static readonly OptionalGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupFieldNames = new string[] { "a" }; @@ -1602,7 +1602,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -1718,7 +1718,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup : pb::GeneratedMessageLite { private static readonly RepeatedGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupFieldNames = new string[] { "a" }; @@ -1832,7 +1832,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -3547,7 +3547,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -5789,7 +5789,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ForeignMessageLite : pb::GeneratedMessageLite { private static readonly ForeignMessageLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _foreignMessageLiteFieldNames = new string[] { "c" }; @@ -5903,7 +5903,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -6019,7 +6019,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedTypesLite : pb::GeneratedMessageLite { private static readonly TestPackedTypesLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedTypesLiteFieldNames = new string[] { "packed_bool", "packed_double", "packed_enum", "packed_fixed32", "packed_fixed64", "packed_float", "packed_int32", "packed_int64", "packed_sfixed32", "packed_sfixed64", "packed_sint32", "packed_sint64", "packed_uint32", "packed_uint64" }; @@ -6571,7 +6571,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -7173,7 +7173,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedTypesLite : pb::GeneratedMessageLite { private static readonly TestUnpackedTypesLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedTypesLiteFieldNames = new string[] { "unpacked_bool", "unpacked_double", "unpacked_enum", "unpacked_fixed32", "unpacked_fixed64", "unpacked_float", "unpacked_int32", "unpacked_int64", "unpacked_sfixed32", "unpacked_sfixed64", "unpacked_sint32", "unpacked_sint64", "unpacked_uint32", "unpacked_uint64" }; @@ -7670,7 +7670,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -8272,7 +8272,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllExtensionsLite : pb::ExtendableMessageLite { private static readonly TestAllExtensionsLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllExtensionsLiteFieldNames = new string[] { }; @@ -8374,7 +8374,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -8466,7 +8466,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup_extension_lite : pb::GeneratedMessageLite { private static readonly OptionalGroup_extension_lite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupExtensionLiteFieldNames = new string[] { "a" }; @@ -8580,7 +8580,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -8696,7 +8696,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup_extension_lite : pb::GeneratedMessageLite { private static readonly RepeatedGroup_extension_lite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupExtensionLiteFieldNames = new string[] { "a" }; @@ -8810,7 +8810,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -8926,7 +8926,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedExtensionsLite : pb::ExtendableMessageLite { private static readonly TestPackedExtensionsLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedExtensionsLiteFieldNames = new string[] { }; @@ -9028,7 +9028,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -9120,7 +9120,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedExtensionsLite : pb::ExtendableMessageLite { private static readonly TestUnpackedExtensionsLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedExtensionsLiteFieldNames = new string[] { }; @@ -9222,7 +9222,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -9314,7 +9314,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestNestedExtensionLite : pb::GeneratedMessageLite { private static readonly TestNestedExtensionLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testNestedExtensionLiteFieldNames = new string[] { }; @@ -9411,7 +9411,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } @@ -9502,7 +9502,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDeprecatedLite : pb::GeneratedMessageLite { private static readonly TestDeprecatedLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDeprecatedLiteFieldNames = new string[] { "deprecated_field" }; @@ -9616,7 +9616,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilderLite { protected override Builder ThisBuilder { get { return this; } diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs index f46ec30148..d8824d49a4 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs @@ -1,4 +1,4 @@ -// Generated by ProtoGen, Version=2.3.0.369, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +// Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! #pragma warning disable 1591 #region Designer generated code @@ -10,7 +10,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static partial class UnitTestProtoFile { #region Extension registration @@ -1086,7 +1086,7 @@ namespace Google.ProtocolBuffers.TestProtos { } #region Enums [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum ForeignEnum { FOREIGN_FOO = 4, FOREIGN_BAR = 5, @@ -1094,7 +1094,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum TestEnumWithDupValue { FOO1 = 1, BAR1 = 2, @@ -1104,7 +1104,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum TestSparseEnum { SPARSE_A = 123, SPARSE_B = 62374, @@ -1120,7 +1120,7 @@ namespace Google.ProtocolBuffers.TestProtos { #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllTypes : pb::GeneratedMessage { private static readonly TestAllTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllTypesFieldNames = new string[] { "default_bool", "default_bytes", "default_cord", "default_double", "default_fixed32", "default_fixed64", "default_float", "default_foreign_enum", "default_import_enum", "default_int32", "default_int64", "default_nested_enum", "default_sfixed32", "default_sfixed64", "default_sint32", "default_sint64", "default_string", "default_string_piece", "default_uint32", "default_uint64", "optional_bool", "optional_bytes", "optional_cord", "optional_double", "optional_fixed32", "optional_fixed64", "optional_float", "optional_foreign_enum", "optional_foreign_message", "optional_import_enum", "optional_import_message", "optional_int32", "optional_int64", "optional_nested_enum", "optional_nested_message", "optional_sfixed32", "optional_sfixed64", "optional_sint32", "optional_sint64", "optional_string", "optional_string_piece", "optional_uint32", "optional_uint64", "optionalgroup", "repeated_bool", "repeated_bytes", "repeated_cord", "repeated_double", "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_foreign_enum", "repeated_foreign_message", "repeated_import_enum", "repeated_import_message", "repeated_int32", "repeated_int64", "repeated_nested_enum", "repeated_nested_message", "repeated_sfixed32", "repeated_sfixed64", "repeated_sint32", "repeated_sint64", "repeated_string", "repeated_string_piece", "repeated_uint32", "repeated_uint64", "repeatedgroup" }; @@ -1148,10 +1148,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum NestedEnum { FOO = 1, BAR = 2, @@ -1160,7 +1160,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NestedMessage : pb::GeneratedMessage { private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _nestedMessageFieldNames = new string[] { "bb" }; @@ -1265,7 +1265,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1399,7 +1399,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup : pb::GeneratedMessage { private static readonly OptionalGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupFieldNames = new string[] { "a" }; @@ -1504,7 +1504,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -1638,7 +1638,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup : pb::GeneratedMessage { private static readonly RepeatedGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupFieldNames = new string[] { "a" }; @@ -1743,7 +1743,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -3186,7 +3186,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5494,7 +5494,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDeprecatedFields : pb::GeneratedMessage { private static readonly TestDeprecatedFields defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDeprecatedFieldsFieldNames = new string[] { "deprecated_int32" }; @@ -5599,7 +5599,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5733,7 +5733,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ForeignMessage : pb::GeneratedMessage { private static readonly ForeignMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _foreignMessageFieldNames = new string[] { "c" }; @@ -5838,7 +5838,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -5972,7 +5972,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllExtensions : pb::ExtendableMessage { private static readonly TestAllExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllExtensionsFieldNames = new string[] { }; @@ -6065,7 +6065,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6175,7 +6175,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup_extension : pb::GeneratedMessage { private static readonly OptionalGroup_extension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupExtensionFieldNames = new string[] { "a" }; @@ -6280,7 +6280,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6414,7 +6414,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup_extension : pb::GeneratedMessage { private static readonly RepeatedGroup_extension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupExtensionFieldNames = new string[] { "a" }; @@ -6519,7 +6519,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6653,7 +6653,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestNestedExtension : pb::GeneratedMessage { private static readonly TestNestedExtension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testNestedExtensionFieldNames = new string[] { }; @@ -6744,7 +6744,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -6853,7 +6853,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequired : pb::GeneratedMessage { private static readonly TestRequired defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRequiredFieldNames = new string[] { "a", "b", "c", "dummy10", "dummy11", "dummy12", "dummy13", "dummy14", "dummy15", "dummy16", "dummy17", "dummy18", "dummy19", "dummy2", "dummy20", "dummy21", "dummy22", "dummy23", "dummy24", "dummy25", "dummy26", "dummy27", "dummy28", "dummy29", "dummy30", "dummy31", "dummy32", "dummy4", "dummy5", "dummy6", "dummy7", "dummy8", "dummy9" }; @@ -7477,7 +7477,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -8411,7 +8411,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequiredForeign : pb::GeneratedMessage { private static readonly TestRequiredForeign defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRequiredForeignFieldNames = new string[] { "dummy", "optional_message", "repeated_message" }; @@ -8556,7 +8556,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -8784,7 +8784,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestForeignNested : pb::GeneratedMessage { private static readonly TestForeignNested defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testForeignNestedFieldNames = new string[] { "foreign_nested" }; @@ -8889,7 +8889,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9046,7 +9046,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestEmptyMessage : pb::GeneratedMessage { private static readonly TestEmptyMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testEmptyMessageFieldNames = new string[] { }; @@ -9135,7 +9135,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9244,7 +9244,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestEmptyMessageWithExtensions : pb::ExtendableMessage { private static readonly TestEmptyMessageWithExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testEmptyMessageWithExtensionsFieldNames = new string[] { }; @@ -9337,7 +9337,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9447,7 +9447,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMultipleExtensionRanges : pb::ExtendableMessage { private static readonly TestMultipleExtensionRanges defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMultipleExtensionRangesFieldNames = new string[] { }; @@ -9542,7 +9542,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9652,7 +9652,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestReallyLargeTagNumber : pb::GeneratedMessage { private static readonly TestReallyLargeTagNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testReallyLargeTagNumberFieldNames = new string[] { "a", "bb" }; @@ -9773,7 +9773,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -9932,7 +9932,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRecursiveMessage : pb::GeneratedMessage { private static readonly TestRecursiveMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRecursiveMessageFieldNames = new string[] { "a", "i" }; @@ -10053,7 +10053,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -10235,7 +10235,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMutualRecursionA : pb::GeneratedMessage { private static readonly TestMutualRecursionA defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMutualRecursionAFieldNames = new string[] { "bb" }; @@ -10340,7 +10340,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -10497,7 +10497,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMutualRecursionB : pb::GeneratedMessage { private static readonly TestMutualRecursionB defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMutualRecursionBFieldNames = new string[] { "a", "optional_int32" }; @@ -10618,7 +10618,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -10800,7 +10800,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDupFieldNumber : pb::GeneratedMessage { private static readonly TestDupFieldNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDupFieldNumberFieldNames = new string[] { "a", "bar", "foo" }; @@ -10828,11 +10828,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Foo : pb::GeneratedMessage { private static readonly Foo defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooFieldNames = new string[] { "a" }; @@ -10937,7 +10937,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -11071,7 +11071,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Bar : pb::GeneratedMessage { private static readonly Bar defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barFieldNames = new string[] { "a" }; @@ -11176,7 +11176,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -11423,7 +11423,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -11653,7 +11653,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestNestedMessageHasBits : pb::GeneratedMessage { private static readonly TestNestedMessageHasBits defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testNestedMessageHasBitsFieldNames = new string[] { "optional_nested_message" }; @@ -11681,11 +11681,11 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NestedMessage : pb::GeneratedMessage { private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _nestedMessageFieldNames = new string[] { "nestedmessage_repeated_foreignmessage", "nestedmessage_repeated_int32" }; @@ -11815,7 +11815,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -12086,7 +12086,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -12243,7 +12243,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestCamelCaseFieldNames : pb::GeneratedMessage { private static readonly TestCamelCaseFieldNames defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testCamelCaseFieldNamesFieldNames = new string[] { "CordField", "EnumField", "MessageField", "PrimitiveField", "RepeatedCordField", "RepeatedEnumField", "RepeatedMessageField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedStringPieceField", "StringField", "StringPieceField" }; @@ -12563,7 +12563,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -13089,7 +13089,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestFieldOrderings : pb::ExtendableMessage { private static readonly TestFieldOrderings defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testFieldOrderingsFieldNames = new string[] { "my_float", "my_int", "my_string" }; @@ -13231,7 +13231,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -13417,7 +13417,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestExtremeDefaultValues : pb::GeneratedMessage { private static readonly TestExtremeDefaultValues defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testExtremeDefaultValuesFieldNames = new string[] { "escaped_bytes", "inf_double", "inf_float", "large_float", "large_uint32", "large_uint64", "nan_double", "nan_float", "neg_inf_double", "neg_inf_float", "negative_float", "negative_one_float", "one_float", "small_float", "small_int32", "small_int64", "small_negative_float", "utf8_string", "zero_float" }; @@ -13812,7 +13812,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -14402,7 +14402,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OneString : pb::GeneratedMessage { private static readonly OneString defaultInstance = new Builder().BuildPartial(); private static readonly string[] _oneStringFieldNames = new string[] { "data" }; @@ -14507,7 +14507,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -14642,7 +14642,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OneBytes : pb::GeneratedMessage { private static readonly OneBytes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _oneBytesFieldNames = new string[] { "data" }; @@ -14747,7 +14747,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -14882,7 +14882,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedTypes : pb::GeneratedMessage { private static readonly TestPackedTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedTypesFieldNames = new string[] { "packed_bool", "packed_double", "packed_enum", "packed_fixed32", "packed_fixed64", "packed_float", "packed_int32", "packed_int64", "packed_sfixed32", "packed_sfixed64", "packed_sint32", "packed_sint64", "packed_uint32", "packed_uint64" }; @@ -15344,7 +15344,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -15972,7 +15972,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedTypes : pb::GeneratedMessage { private static readonly TestUnpackedTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedTypesFieldNames = new string[] { "unpacked_bool", "unpacked_double", "unpacked_enum", "unpacked_fixed32", "unpacked_fixed64", "unpacked_float", "unpacked_int32", "unpacked_int64", "unpacked_sfixed32", "unpacked_sfixed64", "unpacked_sint32", "unpacked_sint64", "unpacked_uint32", "unpacked_uint64" }; @@ -16379,7 +16379,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -17007,7 +17007,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedExtensions : pb::ExtendableMessage { private static readonly TestPackedExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedExtensionsFieldNames = new string[] { }; @@ -17100,7 +17100,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -17210,7 +17210,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedExtensions : pb::ExtendableMessage { private static readonly TestUnpackedExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedExtensionsFieldNames = new string[] { }; @@ -17303,7 +17303,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::ExtendableBuilder { protected override Builder ThisBuilder { get { return this; } @@ -17413,7 +17413,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDynamicExtensions : pb::GeneratedMessage { private static readonly TestDynamicExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDynamicExtensionsFieldNames = new string[] { "dynamic_enum_extension", "dynamic_message_extension", "enum_extension", "message_extension", "packed_extension", "repeated_extension", "scalar_extension" }; @@ -17441,10 +17441,10 @@ namespace Google.ProtocolBuffers.TestProtos { #region Nested types [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public static class Types { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public enum DynamicEnumType { DYNAMIC_FOO = 2200, DYNAMIC_BAR = 2201, @@ -17453,7 +17453,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class DynamicMessageType : pb::GeneratedMessage { private static readonly DynamicMessageType defaultInstance = new Builder().BuildPartial(); private static readonly string[] _dynamicMessageTypeFieldNames = new string[] { "dynamic_field" }; @@ -17558,7 +17558,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -17888,7 +17888,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -18257,7 +18257,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::GeneratedMessage { private static readonly TestRepeatedScalarDifferentTagSizes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRepeatedScalarDifferentTagSizesFieldNames = new string[] { "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_int32", "repeated_int64", "repeated_uint64" }; @@ -18484,7 +18484,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -18818,7 +18818,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FooRequest : pb::GeneratedMessage { private static readonly FooRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooRequestFieldNames = new string[] { }; @@ -18907,7 +18907,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -19016,7 +19016,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FooResponse : pb::GeneratedMessage { private static readonly FooResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooResponseFieldNames = new string[] { }; @@ -19105,7 +19105,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -19214,7 +19214,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class BarRequest : pb::GeneratedMessage { private static readonly BarRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barRequestFieldNames = new string[] { }; @@ -19303,7 +19303,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } @@ -19412,7 +19412,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class BarResponse : pb::GeneratedMessage { private static readonly BarResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barResponseFieldNames = new string[] { }; @@ -19501,7 +19501,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.369")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { get { return this; } From c86b504409f0b1b57764fd42376de28b13968a8f Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 9 Sep 2011 22:16:08 -0500 Subject: [PATCH 10/31] Missing braces :) --- src/ProtocolBuffers.Serialization/JsonFormatWriter.cs | 4 +++- src/ProtocolBuffers.Serialization/XmlFormatWriter.cs | 6 +++++- src/ProtocolBuffers/CodedOutputStream.cs | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs b/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs index f387f39d16..15e08e0522 100644 --- a/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs +++ b/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs @@ -246,8 +246,10 @@ namespace Google.ProtocolBuffers.Serialization { if (disposing) { - while(_counter.Count > 1) + while (_counter.Count > 1) + { WriteMessageEnd(); + } } base.Dispose(disposing); diff --git a/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs b/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs index 79f403dfad..3c5cb3ab16 100644 --- a/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs +++ b/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs @@ -78,8 +78,10 @@ namespace Google.ProtocolBuffers.Serialization { if (disposing) { - while(_messageOpenCount > 0) + while (_messageOpenCount > 0) + { WriteMessageEnd(); + } _output.Close(); } @@ -163,7 +165,9 @@ namespace Google.ProtocolBuffers.Serialization public override void WriteMessageEnd() { if (_messageOpenCount <= 0) + { throw new InvalidOperationException(); + } _output.WriteEndElement(); _output.Flush(); diff --git a/src/ProtocolBuffers/CodedOutputStream.cs b/src/ProtocolBuffers/CodedOutputStream.cs index 560719afa3..37c60387c8 100644 --- a/src/ProtocolBuffers/CodedOutputStream.cs +++ b/src/ProtocolBuffers/CodedOutputStream.cs @@ -131,7 +131,9 @@ namespace Google.ProtocolBuffers if (output != null) { if (position > 0) + { Flush(); + } output.Dispose(); } } From 2a1f0bd44078abb6271091657cde9a1d7dba99e0 Mon Sep 17 00:00:00 2001 From: csharptest Date: Thu, 15 Sep 2011 18:16:15 -0500 Subject: [PATCH 11/31] Added a few more tests to ensure XxxxList { get; } clones readonly builder --- src/ProtocolBuffers.Test/ReusableBuilderTest.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/ProtocolBuffers.Test/ReusableBuilderTest.cs b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs index 9a5e3f3699..2f81a8144f 100644 --- a/src/ProtocolBuffers.Test/ReusableBuilderTest.cs +++ b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs @@ -89,6 +89,15 @@ namespace Google.ProtocolBuffers Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); } + [Test] + public void CloneOnGetRepeatedBoolList() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + GC.KeepAlive(builder.RepeatedBoolList); + Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + [Test] public void CloneOnChangeMessage() { @@ -108,11 +117,11 @@ namespace Google.ProtocolBuffers } [Test] - public void CloneOnAddRepeatedForeignMessage() + public void CloneOnGetRepeatedForeignMessageList() { TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); - builder.AddRepeatedForeignMessage(ForeignMessage.DefaultInstance); + GC.KeepAlive(builder.RepeatedForeignMessageList); Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); } @@ -126,11 +135,11 @@ namespace Google.ProtocolBuffers } [Test] - public void CloneOnAddRepeatedForeignEnum() + public void CloneOnGetRepeatedForeignEnumList() { TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); - builder.AddRepeatedForeignEnum(ForeignEnum.FOREIGN_BAR); + GC.KeepAlive(builder.RepeatedForeignEnumList); Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); } From 03b85d8b2060e6aed6d0a3471ba155c24faf3628 Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Fri, 16 Sep 2011 08:36:57 -0700 Subject: [PATCH 12/31] Remove XML documentation output in test project. It causes errors to show up in ReSharper. --- src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj index 95ab0b9c63..4d0cff4449 100644 --- a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj +++ b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj @@ -45,7 +45,8 @@ prompt 4 AllRules.ruleset - bin\Debug\Google.ProtocolBuffers.Test.XML + + true 1591 @@ -57,7 +58,8 @@ prompt 4 AllRules.ruleset - bin\Release\Google.ProtocolBuffers.Test.XML + + true 1591 From 2cf6e1b07749b98ff0191a51fa76f1fb3d970724 Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 16 Sep 2011 10:55:10 -0500 Subject: [PATCH 13/31] Last change for http support, adding a simple reader for query strings and/or url-encoded form data to support restful apis. Also exposed the mime to reader and mime to writer via dictionaries in the MessageFormatOptions structure. --- .../Http/FormUrlEncodedReader.cs | 162 ++++++++++++++++++ .../Http/MessageFormatFactory.cs | 110 +++++------- .../Http/MessageFormatOptions.cs | 85 +++++++++ .../ProtocolBuffers.Serialization.csproj | 1 + .../ProtocolBuffers.Test.csproj | 1 + .../TestMimeMessageFormats.cs | 39 +++++ .../TestReaderForUrlEncoded.cs | 84 +++++++++ 7 files changed, 411 insertions(+), 71 deletions(-) create mode 100644 src/ProtocolBuffers.Serialization/Http/FormUrlEncodedReader.cs create mode 100644 src/ProtocolBuffers.Test/TestReaderForUrlEncoded.cs diff --git a/src/ProtocolBuffers.Serialization/Http/FormUrlEncodedReader.cs b/src/ProtocolBuffers.Serialization/Http/FormUrlEncodedReader.cs new file mode 100644 index 0000000000..508d76a941 --- /dev/null +++ b/src/ProtocolBuffers.Serialization/Http/FormUrlEncodedReader.cs @@ -0,0 +1,162 @@ +using System; +using System.IO; +using System.Text; + +namespace Google.ProtocolBuffers.Serialization.Http +{ + /// + /// Allows reading messages from a name/value dictionary + /// + public class FormUrlEncodedReader : AbstractTextReader + { + private readonly TextReader _input; + private string _fieldName, _fieldValue; + private bool _ready; + + /// + /// Creates a dictionary reader from an enumeration of KeyValuePair data, like an IDictionary + /// + FormUrlEncodedReader(TextReader input) + { + _input = input; + int ch = input.Peek(); + if (ch == '?') + { + input.Read(); + } + _ready = ReadNext(); + } + + #region CreateInstance overloads + /// + /// Constructs a FormUrlEncodedReader to parse form data, or url query text into a message. + /// + public static FormUrlEncodedReader CreateInstance(Stream stream) + { + return new FormUrlEncodedReader(new StreamReader(stream, Encoding.UTF8, false)); + } + + /// + /// Constructs a FormUrlEncodedReader to parse form data, or url query text into a message. + /// + public static FormUrlEncodedReader CreateInstance(byte[] bytes) + { + return new FormUrlEncodedReader(new StreamReader(new MemoryStream(bytes, false), Encoding.UTF8, false)); + } + + /// + /// Constructs a FormUrlEncodedReader to parse form data, or url query text into a message. + /// + public static FormUrlEncodedReader CreateInstance(string text) + { + return new FormUrlEncodedReader(new StringReader(text)); + } + + /// + /// Constructs a FormUrlEncodedReader to parse form data, or url query text into a message. + /// + public static FormUrlEncodedReader CreateInstance(TextReader input) + { + return new FormUrlEncodedReader(input); + } + #endregion + + private bool ReadNext() + { + StringBuilder field = new StringBuilder(32); + StringBuilder value = new StringBuilder(64); + int ch; + while (-1 != (ch = _input.Read()) && ch != '=' && ch != '&') + { + field.Append((char)ch); + } + + if (ch != -1 && ch != '&') + { + while (-1 != (ch = _input.Read()) && ch != '&') + { + value.Append((char)ch); + } + } + + _fieldName = field.ToString(); + _fieldValue = Uri.UnescapeDataString(value.Replace('+', ' ').ToString()); + + return !String.IsNullOrEmpty(_fieldName); + } + + /// + /// No-op + /// + public override void ReadMessageStart() + { } + + /// + /// No-op + /// + public override void ReadMessageEnd() + { } + + /// + /// Merges the contents of stream into the provided message builder + /// + public override TBuilder Merge(TBuilder builder, ExtensionRegistry registry) + { + builder.WeakMergeFrom(this, registry); + return builder; + } + + /// + /// Causes the reader to skip past this field + /// + protected override void Skip() + { + _ready = ReadNext(); + } + + /// + /// Peeks at the next field in the input stream and returns what information is available. + /// + /// + /// This may be called multiple times without actually reading the field. Only after the field + /// is either read, or skipped, should PeekNext return a different value. + /// + protected override bool PeekNext(out string field) + { + field = _ready ? _fieldName : null; + return field != null; + } + + /// + /// Returns true if it was able to read a String from the input + /// + protected override bool ReadAsText(ref string value, Type typeInfo) + { + if (_ready) + { + value = _fieldValue; + _ready = ReadNext(); + return true; + } + return false; + } + + /// + /// It's unlikely this will work for anything but text data as bytes UTF8 are transformed to text and back to bytes + /// + protected override ByteString DecodeBytes(string bytes) + { return ByteString.CopyFromUtf8(bytes); } + + /// + /// Not Supported + /// + public override bool ReadGroup(IBuilderLite value, ExtensionRegistry registry) + { throw new NotSupportedException(); } + + /// + /// Not Supported + /// + protected override bool ReadMessage(IBuilderLite builder, ExtensionRegistry registry) + { throw new NotSupportedException(); } + } +} \ No newline at end of file diff --git a/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs b/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs index 2ee7eb4de4..8d389f07de 100644 --- a/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs +++ b/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs @@ -19,27 +19,14 @@ namespace Google.ProtocolBuffers.Serialization.Http /// The ICodedInputStream that can be given to the IBuilder.MergeFrom(...) method public static ICodedInputStream CreateInputStream(MessageFormatOptions options, string contentType, Stream input) { - FormatType inputType = ContentTypeToFormat(contentType, options.DefaultContentType); + ICodedInputStream codedInput = ContentTypeToInputStream(contentType, options, input); - ICodedInputStream codedInput; - if (inputType == FormatType.ProtoBuffer) + if (codedInput is XmlFormatReader) { - codedInput = CodedInputStream.CreateInstance(input); - } - else if (inputType == FormatType.Json) - { - JsonFormatReader reader = JsonFormatReader.CreateInstance(input); - codedInput = reader; - } - else if (inputType == FormatType.Xml) - { - XmlFormatReader reader = XmlFormatReader.CreateInstance(input); + XmlFormatReader reader = (XmlFormatReader)codedInput; reader.RootElementName = options.XmlReaderRootElementName; reader.Options = options.XmlReaderOptions; - codedInput = reader; } - else - throw new NotSupportedException(); return codedInput; } @@ -69,30 +56,20 @@ namespace Google.ProtocolBuffers.Serialization.Http /// If you do not dispose of ICodedOutputStream some formats may yield incomplete output public static ICodedOutputStream CreateOutputStream(MessageFormatOptions options, string contentType, Stream output) { - FormatType outputType = ContentTypeToFormat(contentType, options.DefaultContentType); + ICodedOutputStream codedOutput = ContentTypeToOutputStream(contentType, options, output); - ICodedOutputStream codedOutput; - if (outputType == FormatType.ProtoBuffer) - { - codedOutput = CodedOutputStream.CreateInstance(output); - } - else if (outputType == FormatType.Json) + if (codedOutput is JsonFormatWriter) { - JsonFormatWriter writer = JsonFormatWriter.CreateInstance(output); + JsonFormatWriter writer = (JsonFormatWriter)codedOutput; if (options.FormattedOutput) { writer.Formatted(); } - codedOutput = writer; } - else if (outputType == FormatType.Xml) + else if (codedOutput is XmlFormatWriter) { - XmlFormatWriter writer; - if (!options.FormattedOutput) - { - writer = XmlFormatWriter.CreateInstance(output); - } - else + XmlFormatWriter writer = (XmlFormatWriter)codedOutput; + if (options.FormattedOutput) { XmlWriterSettings settings = new XmlWriterSettings() { @@ -104,14 +81,12 @@ namespace Google.ProtocolBuffers.Serialization.Http IndentChars = " ", NewLineChars = Environment.NewLine, }; - writer = XmlFormatWriter.CreateInstance(XmlWriter.Create(output, settings)); + // Don't know how else to change xml writer options? + codedOutput = writer = XmlFormatWriter.CreateInstance(XmlWriter.Create(output, settings)); } writer.RootElementName = options.XmlWriterRootElementName; writer.Options = options.XmlWriterOptions; - codedOutput = writer; } - else - throw new NotSupportedException(); return codedOutput; } @@ -137,46 +112,39 @@ namespace Google.ProtocolBuffers.Serialization.Http codedOutput.WriteMessageEnd(); } - enum FormatType { ProtoBuffer, Json, Xml }; + private static ICodedInputStream ContentTypeToInputStream(string contentType, MessageFormatOptions options, Stream input) + { + contentType = (contentType ?? String.Empty).Split(';')[0].Trim(); - private static FormatType ContentTypeToFormat(string contentType, string defaultType) + Converter factory; + if(!options.MimeInputTypesReadOnly.TryGetValue(contentType, out factory) || factory == null) + { + if(String.IsNullOrEmpty(options.DefaultContentType) || + !options.MimeInputTypesReadOnly.TryGetValue(options.DefaultContentType, out factory) || factory == null) + { + throw new ArgumentOutOfRangeException("contentType"); + } + } + + return factory(input); + } + + private static ICodedOutputStream ContentTypeToOutputStream(string contentType, MessageFormatOptions options, Stream output) { - switch ((contentType ?? String.Empty).Split(';')[0].Trim().ToLower()) + contentType = (contentType ?? String.Empty).Split(';')[0].Trim(); + + Converter factory; + if (!options.MimeOutputTypesReadOnly.TryGetValue(contentType, out factory) || factory == null) { - case "application/json": - case "application/x-json": - case "application/x-javascript": - case "text/javascript": - case "text/x-javascript": - case "text/x-json": - case "text/json": - { - return FormatType.Json; - } - - case "text/xml": - case "application/xml": - { - return FormatType.Xml; - } - - case "application/binary": - case "application/x-protobuf": - case "application/vnd.google.protobuf": - { - return FormatType.ProtoBuffer; - } - - case "": - case null: - if (!String.IsNullOrEmpty(defaultType)) - { - return ContentTypeToFormat(defaultType, null); - } - break; + if (String.IsNullOrEmpty(options.DefaultContentType) || + !options.MimeOutputTypesReadOnly.TryGetValue(options.DefaultContentType, out factory) || factory == null) + { + throw new ArgumentOutOfRangeException("contentType"); + } } - throw new ArgumentOutOfRangeException("contentType"); + return factory(output); } + } } \ No newline at end of file diff --git a/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs b/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs index 02f2ea4656..4ee18891ef 100644 --- a/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs +++ b/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs @@ -1,4 +1,7 @@ using System; +using System.IO; +using System.Collections.Generic; +using Google.ProtocolBuffers.Collections; namespace Google.ProtocolBuffers.Serialization.Http { @@ -22,10 +25,92 @@ namespace Google.ProtocolBuffers.Serialization.Http /// public const string ContentTypeJson = "application/json"; + /// The mime type for query strings and x-www-form-urlencoded content + /// This mime type is input-only + public const string ContentFormUrlEncoded = "application/x-www-form-urlencoded"; + + /// + /// Default mime-type handling for input + /// + private static readonly IDictionary> MimeInputDefaults = + new ReadOnlyDictionary>( + new Dictionary>(StringComparer.OrdinalIgnoreCase) + { + {"application/json", JsonFormatReader.CreateInstance}, + {"application/x-json", JsonFormatReader.CreateInstance}, + {"application/x-javascript", JsonFormatReader.CreateInstance}, + {"text/javascript", JsonFormatReader.CreateInstance}, + {"text/x-javascript", JsonFormatReader.CreateInstance}, + {"text/x-json", JsonFormatReader.CreateInstance}, + {"text/json", JsonFormatReader.CreateInstance}, + {"text/xml", XmlFormatReader.CreateInstance}, + {"application/xml", XmlFormatReader.CreateInstance}, + {"application/binary", CodedInputStream.CreateInstance}, + {"application/x-protobuf", CodedInputStream.CreateInstance}, + {"application/vnd.google.protobuf", CodedInputStream.CreateInstance}, + {"application/x-www-form-urlencoded", FormUrlEncodedReader.CreateInstance}, + } + ); + + /// + /// Default mime-type handling for output + /// + private static readonly IDictionary> MimeOutputDefaults = + new ReadOnlyDictionary>( + new Dictionary>(StringComparer.OrdinalIgnoreCase) + { + {"application/json", JsonFormatWriter.CreateInstance}, + {"application/x-json", JsonFormatWriter.CreateInstance}, + {"application/x-javascript", JsonFormatWriter.CreateInstance}, + {"text/javascript", JsonFormatWriter.CreateInstance}, + {"text/x-javascript", JsonFormatWriter.CreateInstance}, + {"text/x-json", JsonFormatWriter.CreateInstance}, + {"text/json", JsonFormatWriter.CreateInstance}, + {"text/xml", XmlFormatWriter.CreateInstance}, + {"application/xml", XmlFormatWriter.CreateInstance}, + {"application/binary", CodedOutputStream.CreateInstance}, + {"application/x-protobuf", CodedOutputStream.CreateInstance}, + {"application/vnd.google.protobuf", CodedOutputStream.CreateInstance}, + } + ); + + + + private string _defaultContentType; private string _xmlReaderRootElementName; private string _xmlWriterRootElementName; private ExtensionRegistry _extensionRegistry; + private Dictionary> _mimeInputTypes; + private Dictionary> _mimeOutputTypes; + + /// Provides access to modify the mime-type input stream construction + public IDictionary> MimeInputTypes + { + get + { + return _mimeInputTypes ?? + (_mimeInputTypes = new Dictionary>( + MimeInputDefaults, StringComparer.OrdinalIgnoreCase)); + } + } + + /// Provides access to modify the mime-type input stream construction + public IDictionary> MimeOutputTypes + { + get + { + return _mimeOutputTypes ?? + (_mimeOutputTypes = new Dictionary>( + MimeOutputDefaults, StringComparer.OrdinalIgnoreCase)); + } + } + + internal IDictionary> MimeInputTypesReadOnly + { get { return _mimeInputTypes ?? MimeInputDefaults; } } + + internal IDictionary> MimeOutputTypesReadOnly + { get { return _mimeOutputTypes ?? MimeOutputDefaults; } } /// /// The default content type to use if the input type is null or empty. If this diff --git a/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.csproj b/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.csproj index fdbbe50326..972fb149b5 100644 --- a/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.csproj +++ b/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.csproj @@ -98,6 +98,7 @@ + diff --git a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj index 549fe88c4f..e640462c07 100644 --- a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj +++ b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj @@ -92,6 +92,7 @@ + diff --git a/src/ProtocolBuffers.Test/TestMimeMessageFormats.cs b/src/ProtocolBuffers.Test/TestMimeMessageFormats.cs index 6f4b7e0f3d..0ed8d381c9 100644 --- a/src/ProtocolBuffers.Test/TestMimeMessageFormats.cs +++ b/src/ProtocolBuffers.Test/TestMimeMessageFormats.cs @@ -221,5 +221,44 @@ namespace Google.ProtocolBuffers Assert.AreEqual("\r\n a\r\n 1\r\n", Encoding.UTF8.GetString(ms.ToArray())); } + + [Test] + public void TestReadCustomMimeTypes() + { + var options = new MessageFormatOptions(); + //Remove existing mime-type mappings + options.MimeInputTypes.Clear(); + //Add our own + options.MimeInputTypes.Add("-custom-XML-mime-type-", XmlFormatReader.CreateInstance); + Assert.AreEqual(1, options.MimeInputTypes.Count); + + Stream xmlStream = new MemoryStream(Encoding.ASCII.GetBytes( + TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build().ToXml() + )); + + TestXmlMessage msg = new TestXmlMessage.Builder().MergeFrom( + options, "-custom-XML-mime-type-", xmlStream) + .Build(); + Assert.AreEqual("a", msg.Text); + Assert.AreEqual(1, msg.Number); + } + + [Test] + public void TestWriteToCustomType() + { + var options = new MessageFormatOptions(); + //Remove existing mime-type mappings + options.MimeOutputTypes.Clear(); + //Add our own + options.MimeOutputTypes.Add("-custom-XML-mime-type-", XmlFormatWriter.CreateInstance); + + Assert.AreEqual(1, options.MimeOutputTypes.Count); + + MemoryStream ms = new MemoryStream(); + TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build() + .WriteTo(options, "-custom-XML-mime-type-", ms); + + Assert.AreEqual("a1", Encoding.UTF8.GetString(ms.ToArray())); + } } } \ No newline at end of file diff --git a/src/ProtocolBuffers.Test/TestReaderForUrlEncoded.cs b/src/ProtocolBuffers.Test/TestReaderForUrlEncoded.cs new file mode 100644 index 0000000000..7861e9860a --- /dev/null +++ b/src/ProtocolBuffers.Test/TestReaderForUrlEncoded.cs @@ -0,0 +1,84 @@ +using System; +using System.IO; +using System.Text; +using NUnit.Framework; +using Google.ProtocolBuffers.TestProtos; +using Google.ProtocolBuffers.Serialization.Http; + +namespace Google.ProtocolBuffers +{ + [TestFixture] + public class TestReaderForUrlEncoded + { + [Test] + public void Example_FromQueryString() + { + Uri sampleUri = new Uri("http://sample.com/Path/File.ext?text=two+three%20four&valid=true&numbers=1&numbers=2", UriKind.Absolute); + + ICodedInputStream input = FormUrlEncodedReader.CreateInstance(sampleUri.Query); + + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + builder.MergeFrom(input); + + TestXmlMessage message = builder.Build(); + Assert.AreEqual(true, message.Valid); + Assert.AreEqual("two three four", message.Text); + Assert.AreEqual(2, message.NumbersCount); + Assert.AreEqual(1, message.NumbersList[0]); + Assert.AreEqual(2, message.NumbersList[1]); + } + + [Test] + public void Example_FromFormData() + { + Stream rawPost = new MemoryStream(Encoding.UTF8.GetBytes("text=two+three%20four&valid=true&numbers=1&numbers=2"), false); + + ICodedInputStream input = FormUrlEncodedReader.CreateInstance(rawPost); + + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + builder.MergeFrom(input); + + TestXmlMessage message = builder.Build(); + Assert.AreEqual(true, message.Valid); + Assert.AreEqual("two three four", message.Text); + Assert.AreEqual(2, message.NumbersCount); + Assert.AreEqual(1, message.NumbersList[0]); + Assert.AreEqual(2, message.NumbersList[1]); + } + + [Test] + public void TestEmptyValues() + { + ICodedInputStream input = FormUrlEncodedReader.CreateInstance("valid=true&text=&numbers=1"); + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + builder.MergeFrom(input); + + Assert.IsTrue(builder.Valid); + Assert.IsTrue(builder.HasText); + Assert.AreEqual("", builder.Text); + Assert.AreEqual(1, builder.NumbersCount); + Assert.AreEqual(1, builder.NumbersList[0]); + } + + [Test] + public void TestNoValue() + { + ICodedInputStream input = FormUrlEncodedReader.CreateInstance("valid=true&text&numbers=1"); + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + builder.MergeFrom(input); + + Assert.IsTrue(builder.Valid); + Assert.IsTrue(builder.HasText); + Assert.AreEqual("", builder.Text); + Assert.AreEqual(1, builder.NumbersCount); + Assert.AreEqual(1, builder.NumbersList[0]); + } + + [Test, ExpectedException(typeof(NotSupportedException))] + public void FormUrlEncodedReaderDoesNotSupportChildren() + { + ICodedInputStream input = FormUrlEncodedReader.CreateInstance("child=uh0"); + TestXmlMessage.CreateBuilder().MergeFrom(input); + } + } +} From 4ecebd8b4a34c1f902176395024185f1724cb2eb Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 16 Sep 2011 12:21:00 -0500 Subject: [PATCH 14/31] Tests and fixes for double-enumeration on AddRange and adding of null to PopsicleList --- src/AddressBook/AddressBookProtos.cs | 8 +- src/ProtoGen/RepeatedEnumFieldGenerator.cs | 4 +- src/ProtoGen/RepeatedMessageFieldGenerator.cs | 4 +- .../RepeatedPrimitiveFieldGenerator.cs | 4 +- .../Collections/PopsicleListTest.cs | 59 ++++ .../GeneratedBuilderTest.cs | 123 ++++++++ .../ProtocolBuffers.Test.csproj | 1 + .../UnitTestEmbedOptimizeForProtoFile.cs | 4 +- .../TestProtos/UnitTestGoogleSizeProtoFile.cs | 16 +- .../UnitTestGoogleSpeedProtoFile.cs | 32 +- .../TestProtos/UnitTestMessageSetProtoFile.cs | 4 +- .../TestProtos/UnitTestProtoFile.cs | 276 +++++++++--------- .../TestProtos/UnitTestRpcInterop.cs | 12 +- .../UnitTestXmlSerializerTestProtoFile.cs | 20 +- .../Collections/PopsicleList.cs | 38 ++- .../DescriptorProtos/DescriptorProtoFile.cs | 84 +++--- src/ProtocolBuffers/GeneratedBuilder.cs | 26 -- src/ProtocolBuffers/GeneratedBuilderLite.cs | 26 -- .../TestProtos/UnitTestExtrasFullProtoFile.cs | 10 +- .../TestProtos/UnitTestExtrasLiteProtoFile.cs | 12 +- .../TestProtos/UnitTestLiteProtoFile.cs | 208 ++++++------- .../TestProtos/UnitTestProtoFile.cs | 276 +++++++++--------- 22 files changed, 703 insertions(+), 544 deletions(-) create mode 100644 src/ProtocolBuffers.Test/GeneratedBuilderTest.cs diff --git a/src/AddressBook/AddressBookProtos.cs b/src/AddressBook/AddressBookProtos.cs index 4d391f0fe1..7df3a7d479 100644 --- a/src/AddressBook/AddressBookProtos.cs +++ b/src/AddressBook/AddressBookProtos.cs @@ -593,7 +593,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { Email = other.Email; } if (other.phone_.Count != 0) { - base.AddRange(other.phone_, result.phone_); + result.phone_.Add(other.phone_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -749,7 +749,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { return this; } public Builder AddRangePhone(scg::IEnumerable values) { - base.AddRange(values, result.phone_); + result.phone_.Add(values); return this; } public Builder ClearPhone() { @@ -926,7 +926,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { public override Builder MergeFrom(AddressBook other) { if (other == global::Google.ProtocolBuffers.Examples.AddressBook.AddressBook.DefaultInstance) return this; if (other.person_.Count != 0) { - base.AddRange(other.person_, result.person_); + result.person_.Add(other.person_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -1014,7 +1014,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { return this; } public Builder AddRangePerson(scg::IEnumerable values) { - base.AddRange(values, result.person_); + result.person_.Add(values); return this; } public Builder ClearPerson() { diff --git a/src/ProtoGen/RepeatedEnumFieldGenerator.cs b/src/ProtoGen/RepeatedEnumFieldGenerator.cs index 5880390b99..339e81813d 100644 --- a/src/ProtoGen/RepeatedEnumFieldGenerator.cs +++ b/src/ProtoGen/RepeatedEnumFieldGenerator.cs @@ -88,7 +88,7 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName); - writer.WriteLine(" base.AddRange(values, result.{0}_);", Name); + writer.WriteLine(" result.{0}_.Add(values);", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine("public Builder Clear{0}() {{", PropertyName); @@ -100,7 +100,7 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateMergingCode(TextGenerator writer) { writer.WriteLine("if (other.{0}_.Count != 0) {{", Name); - writer.WriteLine(" base.AddRange(other.{0}_, result.{0}_);", Name); + writer.WriteLine(" result.{0}_.Add(other.{0}_);", Name); writer.WriteLine("}"); } diff --git a/src/ProtoGen/RepeatedMessageFieldGenerator.cs b/src/ProtoGen/RepeatedMessageFieldGenerator.cs index bfa0763f6f..e68e77df9d 100644 --- a/src/ProtoGen/RepeatedMessageFieldGenerator.cs +++ b/src/ProtoGen/RepeatedMessageFieldGenerator.cs @@ -98,7 +98,7 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName); - writer.WriteLine(" base.AddRange(values, result.{0}_);", Name); + writer.WriteLine(" result.{0}_.Add(values);", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine("public Builder Clear{0}() {{", PropertyName); @@ -110,7 +110,7 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateMergingCode(TextGenerator writer) { writer.WriteLine("if (other.{0}_.Count != 0) {{", Name); - writer.WriteLine(" base.AddRange(other.{0}_, result.{0}_);", Name); + writer.WriteLine(" result.{0}_.Add(other.{0}_);", Name); writer.WriteLine("}"); } diff --git a/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs b/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs index 9e7f5f641f..a397375c3e 100644 --- a/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs +++ b/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs @@ -97,7 +97,7 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine("}"); AddClsComplianceCheck(writer); writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName); - writer.WriteLine(" base.AddRange(values, result.{0}_);", Name); + writer.WriteLine(" result.{0}_.Add(values);", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine("public Builder Clear{0}() {{", PropertyName); @@ -109,7 +109,7 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateMergingCode(TextGenerator writer) { writer.WriteLine("if (other.{0}_.Count != 0) {{", Name); - writer.WriteLine(" base.AddRange(other.{0}_, result.{0}_);", Name); + writer.WriteLine(" result.{0}_.Add(other.{0}_);", Name); writer.WriteLine("}"); } diff --git a/src/ProtocolBuffers.Test/Collections/PopsicleListTest.cs b/src/ProtocolBuffers.Test/Collections/PopsicleListTest.cs index c339cef632..35b13a1d63 100644 --- a/src/ProtocolBuffers.Test/Collections/PopsicleListTest.cs +++ b/src/ProtocolBuffers.Test/Collections/PopsicleListTest.cs @@ -35,6 +35,7 @@ #endregion using System; +using System.Collections.Generic; using NUnit.Framework; internal delegate void Action(); @@ -94,6 +95,64 @@ namespace Google.ProtocolBuffers.Collections Assert.IsFalse(list.IsReadOnly); } + [Test] + public void DoesNotAddNullEnumerable() + { + PopsicleList list = new PopsicleList(); + try + { + list.Add((IEnumerable)null); + } + catch (ArgumentNullException) + { return; } + + Assert.Fail("List should not allow nulls."); + } + + [Test] + public void DoesNotAddRangeWithNull() + { + PopsicleList list = new PopsicleList(); + try + { + list.Add(new[] { "a", "b", null }); + } + catch (ArgumentNullException) + { return; } + + Assert.Fail("List should not allow nulls."); + } + + [Test] + public void DoesNotAddNull() + { + PopsicleList list = new PopsicleList(); + try + { + list.Add((string)null); + } + catch (ArgumentNullException) + { return; } + + Assert.Fail("List should not allow nulls."); + } + + [Test] + public void DoesNotSetNull() + { + PopsicleList list = new PopsicleList(); + list.Add("a"); + try + { + list[0] = null; + } + catch (ArgumentNullException) + { return; } + + Assert.Fail("List should not allow nulls."); + } + + private static void AssertNotSupported(Action action) { try diff --git a/src/ProtocolBuffers.Test/GeneratedBuilderTest.cs b/src/ProtocolBuffers.Test/GeneratedBuilderTest.cs new file mode 100644 index 0000000000..b12900319e --- /dev/null +++ b/src/ProtocolBuffers.Test/GeneratedBuilderTest.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Google.ProtocolBuffers.TestProtos; +using NUnit.Framework; + +namespace Google.ProtocolBuffers +{ + [TestFixture] + public class GeneratedBuilderTest + { + class OneTimeEnumerator : IEnumerable + { + readonly T _item; + bool _enumerated; + public OneTimeEnumerator(T item) + { + _item = item; + } + public IEnumerator GetEnumerator() + { + Assert.IsFalse(_enumerated, "The collection {0} has already been enumerated", GetType()); + _enumerated = true; + yield return _item; + } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { return GetEnumerator(); } + } + + [Test] + public void DoesNotEnumerateTwiceForMessageList() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + b.AddRangeRepeatedForeignMessage( + new OneTimeEnumerator( + ForeignMessage.DefaultInstance)); + } + [Test] + public void DoesNotEnumerateTwiceForPrimitiveList() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + b.AddRangeRepeatedInt32(new OneTimeEnumerator(1)); + } + [Test] + public void DoesNotEnumerateTwiceForStringList() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + b.AddRangeRepeatedString(new OneTimeEnumerator("test")); + } + [Test] + public void DoesNotEnumerateTwiceForEnumList() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + b.AddRangeRepeatedForeignEnum(new OneTimeEnumerator(ForeignEnum.FOREIGN_BAR)); + } + + private static void AssertThrows(System.Threading.ThreadStart method) where T : Exception + { + try + { + method(); + } + catch (Exception error) + { + if (error is T) + return; + throw; + } + Assert.Fail("Expected exception of type " + typeof(T)); + } + + [Test] + public void DoesNotAddNullToMessageListByAddRange() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + AssertThrows( + () => b.AddRangeRepeatedForeignMessage(new ForeignMessage[] { null }) + ); + } + [Test] + public void DoesNotAddNullToMessageListByAdd() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + AssertThrows( + () => b.AddRepeatedForeignMessage((ForeignMessage)null) + ); + } + [Test] + public void DoesNotAddNullToMessageListBySet() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + b.AddRepeatedForeignMessage(ForeignMessage.DefaultInstance); + AssertThrows( + () => b.SetRepeatedForeignMessage(0, (ForeignMessage)null) + ); + } + [Test] + public void DoesNotAddNullToStringListByAddRange() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + AssertThrows( + () => b.AddRangeRepeatedString(new String[] { null }) + ); + } + [Test] + public void DoesNotAddNullToStringListByAdd() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + AssertThrows( + () => b.AddRepeatedString(null) + ); + } + [Test] + public void DoesNotAddNullToStringListBySet() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + b.AddRepeatedString("one"); + AssertThrows( + () => b.SetRepeatedString(0, null) + ); + } + } +} diff --git a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj index 95ab0b9c63..f87546f8f6 100644 --- a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj +++ b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj @@ -97,6 +97,7 @@ + diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs index 09ecdd63d4..a15488c33a 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs @@ -246,7 +246,7 @@ namespace Google.ProtocolBuffers.TestProtos { MergeOptionalMessage(other.OptionalMessage); } if (other.repeatedMessage_.Count != 0) { - base.AddRange(other.repeatedMessage_, result.repeatedMessage_); + result.repeatedMessage_.Add(other.repeatedMessage_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -379,7 +379,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedMessage(scg::IEnumerable values) { - base.AddRange(values, result.repeatedMessage_); + result.repeatedMessage_.Add(values); return this; } public Builder ClearRepeatedMessage() { diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs index 77635f2132..df2a9a53a6 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs @@ -877,7 +877,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeField5(scg::IEnumerable values) { - base.AddRange(values, result.field5_); + result.field5_.Add(values); return this; } public Builder ClearField5() { @@ -2515,7 +2515,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeField14(scg::IEnumerable values) { - base.AddRange(values, result.field14_); + result.field14_.Add(values); return this; } public Builder ClearField14() { @@ -2656,7 +2656,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeField22(scg::IEnumerable values) { - base.AddRange(values, result.field22_); + result.field22_.Add(values); return this; } public Builder ClearField22() { @@ -2682,7 +2682,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeField73(scg::IEnumerable values) { - base.AddRange(values, result.field73_); + result.field73_.Add(values); return this; } public Builder ClearField73() { @@ -3591,7 +3591,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeGroup1(scg::IEnumerable values) { - base.AddRange(values, result.group1_); + result.group1_.Add(values); return this; } public Builder ClearGroup1() { @@ -3619,7 +3619,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeField128(scg::IEnumerable values) { - base.AddRange(values, result.field128_); + result.field128_.Add(values); return this; } public Builder ClearField128() { @@ -3665,7 +3665,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeField127(scg::IEnumerable values) { - base.AddRange(values, result.field127_); + result.field127_.Add(values); return this; } public Builder ClearField127() { @@ -3709,7 +3709,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeField130(scg::IEnumerable values) { - base.AddRange(values, result.field130_); + result.field130_.Add(values); return this; } public Builder ClearField130() { diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs index 918be643ec..3305da4059 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs @@ -975,7 +975,7 @@ namespace Google.ProtocolBuffers.TestProtos { Field4 = other.Field4; } if (other.field5_.Count != 0) { - base.AddRange(other.field5_, result.field5_); + result.field5_.Add(other.field5_); } if (other.HasField59) { Field59 = other.Field59; @@ -1511,7 +1511,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeField5(scg::IEnumerable values) { - base.AddRange(values, result.field5_); + result.field5_.Add(values); return this; } public Builder ClearField5() { @@ -3569,7 +3569,7 @@ namespace Google.ProtocolBuffers.TestProtos { Field13 = other.Field13; } if (other.field14_.Count != 0) { - base.AddRange(other.field14_, result.field14_); + result.field14_.Add(other.field14_); } if (other.HasField15) { Field15 = other.Field15; @@ -3590,10 +3590,10 @@ namespace Google.ProtocolBuffers.TestProtos { Field16 = other.Field16; } if (other.field22_.Count != 0) { - base.AddRange(other.field22_, result.field22_); + result.field22_.Add(other.field22_); } if (other.field73_.Count != 0) { - base.AddRange(other.field73_, result.field73_); + result.field73_.Add(other.field73_); } if (other.HasField20) { Field20 = other.Field20; @@ -3820,7 +3820,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeField14(scg::IEnumerable values) { - base.AddRange(values, result.field14_); + result.field14_.Add(values); return this; } public Builder ClearField14() { @@ -3961,7 +3961,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeField22(scg::IEnumerable values) { - base.AddRange(values, result.field22_); + result.field22_.Add(values); return this; } public Builder ClearField22() { @@ -3987,7 +3987,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeField73(scg::IEnumerable values) { - base.AddRange(values, result.field73_); + result.field73_.Add(values); return this; } public Builder ClearField73() { @@ -4764,22 +4764,22 @@ namespace Google.ProtocolBuffers.TestProtos { Field63 = other.Field63; } if (other.group1_.Count != 0) { - base.AddRange(other.group1_, result.group1_); + result.group1_.Add(other.group1_); } if (other.field128_.Count != 0) { - base.AddRange(other.field128_, result.field128_); + result.field128_.Add(other.field128_); } if (other.HasField131) { Field131 = other.Field131; } if (other.field127_.Count != 0) { - base.AddRange(other.field127_, result.field127_); + result.field127_.Add(other.field127_); } if (other.HasField129) { Field129 = other.Field129; } if (other.field130_.Count != 0) { - base.AddRange(other.field130_, result.field130_); + result.field130_.Add(other.field130_); } if (other.HasField205) { Field205 = other.Field205; @@ -5389,7 +5389,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeGroup1(scg::IEnumerable values) { - base.AddRange(values, result.group1_); + result.group1_.Add(values); return this; } public Builder ClearGroup1() { @@ -5417,7 +5417,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeField128(scg::IEnumerable values) { - base.AddRange(values, result.field128_); + result.field128_.Add(values); return this; } public Builder ClearField128() { @@ -5463,7 +5463,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeField127(scg::IEnumerable values) { - base.AddRange(values, result.field127_); + result.field127_.Add(values); return this; } public Builder ClearField127() { @@ -5507,7 +5507,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeField130(scg::IEnumerable values) { - base.AddRange(values, result.field130_); + result.field130_.Add(values); return this; } public Builder ClearField130() { diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs index 8a6bb58929..34de1a98b3 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs @@ -1499,7 +1499,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(RawMessageSet other) { if (other == global::Google.ProtocolBuffers.TestProtos.RawMessageSet.DefaultInstance) return this; if (other.item_.Count != 0) { - base.AddRange(other.item_, result.item_); + result.item_.Add(other.item_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -1587,7 +1587,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeItem(scg::IEnumerable values) { - base.AddRange(values, result.item_); + result.item_.Add(values); return this; } public Builder ClearItem() { diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs index d8824d49a4..49efaecdce 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs @@ -3333,76 +3333,76 @@ namespace Google.ProtocolBuffers.TestProtos { OptionalCord = other.OptionalCord; } if (other.repeatedInt32_.Count != 0) { - base.AddRange(other.repeatedInt32_, result.repeatedInt32_); + result.repeatedInt32_.Add(other.repeatedInt32_); } if (other.repeatedInt64_.Count != 0) { - base.AddRange(other.repeatedInt64_, result.repeatedInt64_); + result.repeatedInt64_.Add(other.repeatedInt64_); } if (other.repeatedUint32_.Count != 0) { - base.AddRange(other.repeatedUint32_, result.repeatedUint32_); + result.repeatedUint32_.Add(other.repeatedUint32_); } if (other.repeatedUint64_.Count != 0) { - base.AddRange(other.repeatedUint64_, result.repeatedUint64_); + result.repeatedUint64_.Add(other.repeatedUint64_); } if (other.repeatedSint32_.Count != 0) { - base.AddRange(other.repeatedSint32_, result.repeatedSint32_); + result.repeatedSint32_.Add(other.repeatedSint32_); } if (other.repeatedSint64_.Count != 0) { - base.AddRange(other.repeatedSint64_, result.repeatedSint64_); + result.repeatedSint64_.Add(other.repeatedSint64_); } if (other.repeatedFixed32_.Count != 0) { - base.AddRange(other.repeatedFixed32_, result.repeatedFixed32_); + result.repeatedFixed32_.Add(other.repeatedFixed32_); } if (other.repeatedFixed64_.Count != 0) { - base.AddRange(other.repeatedFixed64_, result.repeatedFixed64_); + result.repeatedFixed64_.Add(other.repeatedFixed64_); } if (other.repeatedSfixed32_.Count != 0) { - base.AddRange(other.repeatedSfixed32_, result.repeatedSfixed32_); + result.repeatedSfixed32_.Add(other.repeatedSfixed32_); } if (other.repeatedSfixed64_.Count != 0) { - base.AddRange(other.repeatedSfixed64_, result.repeatedSfixed64_); + result.repeatedSfixed64_.Add(other.repeatedSfixed64_); } if (other.repeatedFloat_.Count != 0) { - base.AddRange(other.repeatedFloat_, result.repeatedFloat_); + result.repeatedFloat_.Add(other.repeatedFloat_); } if (other.repeatedDouble_.Count != 0) { - base.AddRange(other.repeatedDouble_, result.repeatedDouble_); + result.repeatedDouble_.Add(other.repeatedDouble_); } if (other.repeatedBool_.Count != 0) { - base.AddRange(other.repeatedBool_, result.repeatedBool_); + result.repeatedBool_.Add(other.repeatedBool_); } if (other.repeatedString_.Count != 0) { - base.AddRange(other.repeatedString_, result.repeatedString_); + result.repeatedString_.Add(other.repeatedString_); } if (other.repeatedBytes_.Count != 0) { - base.AddRange(other.repeatedBytes_, result.repeatedBytes_); + result.repeatedBytes_.Add(other.repeatedBytes_); } if (other.repeatedGroup_.Count != 0) { - base.AddRange(other.repeatedGroup_, result.repeatedGroup_); + result.repeatedGroup_.Add(other.repeatedGroup_); } if (other.repeatedNestedMessage_.Count != 0) { - base.AddRange(other.repeatedNestedMessage_, result.repeatedNestedMessage_); + result.repeatedNestedMessage_.Add(other.repeatedNestedMessage_); } if (other.repeatedForeignMessage_.Count != 0) { - base.AddRange(other.repeatedForeignMessage_, result.repeatedForeignMessage_); + result.repeatedForeignMessage_.Add(other.repeatedForeignMessage_); } if (other.repeatedImportMessage_.Count != 0) { - base.AddRange(other.repeatedImportMessage_, result.repeatedImportMessage_); + result.repeatedImportMessage_.Add(other.repeatedImportMessage_); } if (other.repeatedNestedEnum_.Count != 0) { - base.AddRange(other.repeatedNestedEnum_, result.repeatedNestedEnum_); + result.repeatedNestedEnum_.Add(other.repeatedNestedEnum_); } if (other.repeatedForeignEnum_.Count != 0) { - base.AddRange(other.repeatedForeignEnum_, result.repeatedForeignEnum_); + result.repeatedForeignEnum_.Add(other.repeatedForeignEnum_); } if (other.repeatedImportEnum_.Count != 0) { - base.AddRange(other.repeatedImportEnum_, result.repeatedImportEnum_); + result.repeatedImportEnum_.Add(other.repeatedImportEnum_); } if (other.repeatedStringPiece_.Count != 0) { - base.AddRange(other.repeatedStringPiece_, result.repeatedStringPiece_); + result.repeatedStringPiece_.Add(other.repeatedStringPiece_); } if (other.repeatedCord_.Count != 0) { - base.AddRange(other.repeatedCord_, result.repeatedCord_); + result.repeatedCord_.Add(other.repeatedCord_); } if (other.HasDefaultInt32) { DefaultInt32 = other.DefaultInt32; @@ -4433,7 +4433,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedInt32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedInt32_); + result.repeatedInt32_.Add(values); return this; } public Builder ClearRepeatedInt32() { @@ -4459,7 +4459,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedInt64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedInt64_); + result.repeatedInt64_.Add(values); return this; } public Builder ClearRepeatedInt64() { @@ -4490,7 +4490,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedUint32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedUint32_); + result.repeatedUint32_.Add(values); return this; } public Builder ClearRepeatedUint32() { @@ -4521,7 +4521,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedUint64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedUint64_); + result.repeatedUint64_.Add(values); return this; } public Builder ClearRepeatedUint64() { @@ -4547,7 +4547,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedSint32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedSint32_); + result.repeatedSint32_.Add(values); return this; } public Builder ClearRepeatedSint32() { @@ -4573,7 +4573,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedSint64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedSint64_); + result.repeatedSint64_.Add(values); return this; } public Builder ClearRepeatedSint64() { @@ -4604,7 +4604,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedFixed32_); + result.repeatedFixed32_.Add(values); return this; } public Builder ClearRepeatedFixed32() { @@ -4635,7 +4635,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedFixed64_); + result.repeatedFixed64_.Add(values); return this; } public Builder ClearRepeatedFixed64() { @@ -4661,7 +4661,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedSfixed32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedSfixed32_); + result.repeatedSfixed32_.Add(values); return this; } public Builder ClearRepeatedSfixed32() { @@ -4687,7 +4687,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedSfixed64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedSfixed64_); + result.repeatedSfixed64_.Add(values); return this; } public Builder ClearRepeatedSfixed64() { @@ -4713,7 +4713,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedFloat(scg::IEnumerable values) { - base.AddRange(values, result.repeatedFloat_); + result.repeatedFloat_.Add(values); return this; } public Builder ClearRepeatedFloat() { @@ -4739,7 +4739,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedDouble(scg::IEnumerable values) { - base.AddRange(values, result.repeatedDouble_); + result.repeatedDouble_.Add(values); return this; } public Builder ClearRepeatedDouble() { @@ -4765,7 +4765,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedBool(scg::IEnumerable values) { - base.AddRange(values, result.repeatedBool_); + result.repeatedBool_.Add(values); return this; } public Builder ClearRepeatedBool() { @@ -4793,7 +4793,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedString(scg::IEnumerable values) { - base.AddRange(values, result.repeatedString_); + result.repeatedString_.Add(values); return this; } public Builder ClearRepeatedString() { @@ -4821,7 +4821,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedBytes(scg::IEnumerable values) { - base.AddRange(values, result.repeatedBytes_); + result.repeatedBytes_.Add(values); return this; } public Builder ClearRepeatedBytes() { @@ -4859,7 +4859,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedGroup(scg::IEnumerable values) { - base.AddRange(values, result.repeatedGroup_); + result.repeatedGroup_.Add(values); return this; } public Builder ClearRepeatedGroup() { @@ -4897,7 +4897,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedNestedMessage(scg::IEnumerable values) { - base.AddRange(values, result.repeatedNestedMessage_); + result.repeatedNestedMessage_.Add(values); return this; } public Builder ClearRepeatedNestedMessage() { @@ -4935,7 +4935,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedForeignMessage(scg::IEnumerable values) { - base.AddRange(values, result.repeatedForeignMessage_); + result.repeatedForeignMessage_.Add(values); return this; } public Builder ClearRepeatedForeignMessage() { @@ -4973,7 +4973,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedImportMessage(scg::IEnumerable values) { - base.AddRange(values, result.repeatedImportMessage_); + result.repeatedImportMessage_.Add(values); return this; } public Builder ClearRepeatedImportMessage() { @@ -4999,7 +4999,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedNestedEnum(scg::IEnumerable values) { - base.AddRange(values, result.repeatedNestedEnum_); + result.repeatedNestedEnum_.Add(values); return this; } public Builder ClearRepeatedNestedEnum() { @@ -5025,7 +5025,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedForeignEnum(scg::IEnumerable values) { - base.AddRange(values, result.repeatedForeignEnum_); + result.repeatedForeignEnum_.Add(values); return this; } public Builder ClearRepeatedForeignEnum() { @@ -5051,7 +5051,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedImportEnum(scg::IEnumerable values) { - base.AddRange(values, result.repeatedImportEnum_); + result.repeatedImportEnum_.Add(values); return this; } public Builder ClearRepeatedImportEnum() { @@ -5079,7 +5079,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedStringPiece(scg::IEnumerable values) { - base.AddRange(values, result.repeatedStringPiece_); + result.repeatedStringPiece_.Add(values); return this; } public Builder ClearRepeatedStringPiece() { @@ -5107,7 +5107,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedCord(scg::IEnumerable values) { - base.AddRange(values, result.repeatedCord_); + result.repeatedCord_.Add(values); return this; } public Builder ClearRepeatedCord() { @@ -8611,7 +8611,7 @@ namespace Google.ProtocolBuffers.TestProtos { MergeOptionalMessage(other.OptionalMessage); } if (other.repeatedMessage_.Count != 0) { - base.AddRange(other.repeatedMessage_, result.repeatedMessage_); + result.repeatedMessage_.Add(other.repeatedMessage_); } if (other.HasDummy) { Dummy = other.Dummy; @@ -8751,7 +8751,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedMessage(scg::IEnumerable values) { - base.AddRange(values, result.repeatedMessage_); + result.repeatedMessage_.Add(values); return this; } public Builder ClearRepeatedMessage() { @@ -11868,10 +11868,10 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(NestedMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance) return this; if (other.nestedmessageRepeatedInt32_.Count != 0) { - base.AddRange(other.nestedmessageRepeatedInt32_, result.nestedmessageRepeatedInt32_); + result.nestedmessageRepeatedInt32_.Add(other.nestedmessageRepeatedInt32_); } if (other.nestedmessageRepeatedForeignmessage_.Count != 0) { - base.AddRange(other.nestedmessageRepeatedForeignmessage_, result.nestedmessageRepeatedForeignmessage_); + result.nestedmessageRepeatedForeignmessage_.Add(other.nestedmessageRepeatedForeignmessage_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -11952,7 +11952,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeNestedmessageRepeatedInt32(scg::IEnumerable values) { - base.AddRange(values, result.nestedmessageRepeatedInt32_); + result.nestedmessageRepeatedInt32_.Add(values); return this; } public Builder ClearNestedmessageRepeatedInt32() { @@ -11990,7 +11990,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeNestedmessageRepeatedForeignmessage(scg::IEnumerable values) { - base.AddRange(values, result.nestedmessageRepeatedForeignmessage_); + result.nestedmessageRepeatedForeignmessage_.Add(values); return this; } public Builder ClearNestedmessageRepeatedForeignmessage() { @@ -12638,22 +12638,22 @@ namespace Google.ProtocolBuffers.TestProtos { CordField = other.CordField; } if (other.repeatedPrimitiveField_.Count != 0) { - base.AddRange(other.repeatedPrimitiveField_, result.repeatedPrimitiveField_); + result.repeatedPrimitiveField_.Add(other.repeatedPrimitiveField_); } if (other.repeatedStringField_.Count != 0) { - base.AddRange(other.repeatedStringField_, result.repeatedStringField_); + result.repeatedStringField_.Add(other.repeatedStringField_); } if (other.repeatedEnumField_.Count != 0) { - base.AddRange(other.repeatedEnumField_, result.repeatedEnumField_); + result.repeatedEnumField_.Add(other.repeatedEnumField_); } if (other.repeatedMessageField_.Count != 0) { - base.AddRange(other.repeatedMessageField_, result.repeatedMessageField_); + result.repeatedMessageField_.Add(other.repeatedMessageField_); } if (other.repeatedStringPieceField_.Count != 0) { - base.AddRange(other.repeatedStringPieceField_, result.repeatedStringPieceField_); + result.repeatedStringPieceField_.Add(other.repeatedStringPieceField_); } if (other.repeatedCordField_.Count != 0) { - base.AddRange(other.repeatedCordField_, result.repeatedCordField_); + result.repeatedCordField_.Add(other.repeatedCordField_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -12926,7 +12926,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedPrimitiveField(scg::IEnumerable values) { - base.AddRange(values, result.repeatedPrimitiveField_); + result.repeatedPrimitiveField_.Add(values); return this; } public Builder ClearRepeatedPrimitiveField() { @@ -12954,7 +12954,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedStringField(scg::IEnumerable values) { - base.AddRange(values, result.repeatedStringField_); + result.repeatedStringField_.Add(values); return this; } public Builder ClearRepeatedStringField() { @@ -12980,7 +12980,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedEnumField(scg::IEnumerable values) { - base.AddRange(values, result.repeatedEnumField_); + result.repeatedEnumField_.Add(values); return this; } public Builder ClearRepeatedEnumField() { @@ -13018,7 +13018,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedMessageField(scg::IEnumerable values) { - base.AddRange(values, result.repeatedMessageField_); + result.repeatedMessageField_.Add(values); return this; } public Builder ClearRepeatedMessageField() { @@ -13046,7 +13046,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedStringPieceField(scg::IEnumerable values) { - base.AddRange(values, result.repeatedStringPieceField_); + result.repeatedStringPieceField_.Add(values); return this; } public Builder ClearRepeatedStringPieceField() { @@ -13074,7 +13074,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedCordField(scg::IEnumerable values) { - base.AddRange(values, result.repeatedCordField_); + result.repeatedCordField_.Add(values); return this; } public Builder ClearRepeatedCordField() { @@ -15409,46 +15409,46 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestPackedTypes other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedTypes.DefaultInstance) return this; if (other.packedInt32_.Count != 0) { - base.AddRange(other.packedInt32_, result.packedInt32_); + result.packedInt32_.Add(other.packedInt32_); } if (other.packedInt64_.Count != 0) { - base.AddRange(other.packedInt64_, result.packedInt64_); + result.packedInt64_.Add(other.packedInt64_); } if (other.packedUint32_.Count != 0) { - base.AddRange(other.packedUint32_, result.packedUint32_); + result.packedUint32_.Add(other.packedUint32_); } if (other.packedUint64_.Count != 0) { - base.AddRange(other.packedUint64_, result.packedUint64_); + result.packedUint64_.Add(other.packedUint64_); } if (other.packedSint32_.Count != 0) { - base.AddRange(other.packedSint32_, result.packedSint32_); + result.packedSint32_.Add(other.packedSint32_); } if (other.packedSint64_.Count != 0) { - base.AddRange(other.packedSint64_, result.packedSint64_); + result.packedSint64_.Add(other.packedSint64_); } if (other.packedFixed32_.Count != 0) { - base.AddRange(other.packedFixed32_, result.packedFixed32_); + result.packedFixed32_.Add(other.packedFixed32_); } if (other.packedFixed64_.Count != 0) { - base.AddRange(other.packedFixed64_, result.packedFixed64_); + result.packedFixed64_.Add(other.packedFixed64_); } if (other.packedSfixed32_.Count != 0) { - base.AddRange(other.packedSfixed32_, result.packedSfixed32_); + result.packedSfixed32_.Add(other.packedSfixed32_); } if (other.packedSfixed64_.Count != 0) { - base.AddRange(other.packedSfixed64_, result.packedSfixed64_); + result.packedSfixed64_.Add(other.packedSfixed64_); } if (other.packedFloat_.Count != 0) { - base.AddRange(other.packedFloat_, result.packedFloat_); + result.packedFloat_.Add(other.packedFloat_); } if (other.packedDouble_.Count != 0) { - base.AddRange(other.packedDouble_, result.packedDouble_); + result.packedDouble_.Add(other.packedDouble_); } if (other.packedBool_.Count != 0) { - base.AddRange(other.packedBool_, result.packedBool_); + result.packedBool_.Add(other.packedBool_); } if (other.packedEnum_.Count != 0) { - base.AddRange(other.packedEnum_, result.packedEnum_); + result.packedEnum_.Add(other.packedEnum_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -15599,7 +15599,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedInt32(scg::IEnumerable values) { - base.AddRange(values, result.packedInt32_); + result.packedInt32_.Add(values); return this; } public Builder ClearPackedInt32() { @@ -15625,7 +15625,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedInt64(scg::IEnumerable values) { - base.AddRange(values, result.packedInt64_); + result.packedInt64_.Add(values); return this; } public Builder ClearPackedInt64() { @@ -15656,7 +15656,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangePackedUint32(scg::IEnumerable values) { - base.AddRange(values, result.packedUint32_); + result.packedUint32_.Add(values); return this; } public Builder ClearPackedUint32() { @@ -15687,7 +15687,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangePackedUint64(scg::IEnumerable values) { - base.AddRange(values, result.packedUint64_); + result.packedUint64_.Add(values); return this; } public Builder ClearPackedUint64() { @@ -15713,7 +15713,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedSint32(scg::IEnumerable values) { - base.AddRange(values, result.packedSint32_); + result.packedSint32_.Add(values); return this; } public Builder ClearPackedSint32() { @@ -15739,7 +15739,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedSint64(scg::IEnumerable values) { - base.AddRange(values, result.packedSint64_); + result.packedSint64_.Add(values); return this; } public Builder ClearPackedSint64() { @@ -15770,7 +15770,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangePackedFixed32(scg::IEnumerable values) { - base.AddRange(values, result.packedFixed32_); + result.packedFixed32_.Add(values); return this; } public Builder ClearPackedFixed32() { @@ -15801,7 +15801,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangePackedFixed64(scg::IEnumerable values) { - base.AddRange(values, result.packedFixed64_); + result.packedFixed64_.Add(values); return this; } public Builder ClearPackedFixed64() { @@ -15827,7 +15827,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedSfixed32(scg::IEnumerable values) { - base.AddRange(values, result.packedSfixed32_); + result.packedSfixed32_.Add(values); return this; } public Builder ClearPackedSfixed32() { @@ -15853,7 +15853,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedSfixed64(scg::IEnumerable values) { - base.AddRange(values, result.packedSfixed64_); + result.packedSfixed64_.Add(values); return this; } public Builder ClearPackedSfixed64() { @@ -15879,7 +15879,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedFloat(scg::IEnumerable values) { - base.AddRange(values, result.packedFloat_); + result.packedFloat_.Add(values); return this; } public Builder ClearPackedFloat() { @@ -15905,7 +15905,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedDouble(scg::IEnumerable values) { - base.AddRange(values, result.packedDouble_); + result.packedDouble_.Add(values); return this; } public Builder ClearPackedDouble() { @@ -15931,7 +15931,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedBool(scg::IEnumerable values) { - base.AddRange(values, result.packedBool_); + result.packedBool_.Add(values); return this; } public Builder ClearPackedBool() { @@ -15957,7 +15957,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedEnum(scg::IEnumerable values) { - base.AddRange(values, result.packedEnum_); + result.packedEnum_.Add(values); return this; } public Builder ClearPackedEnum() { @@ -16444,46 +16444,46 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestUnpackedTypes other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypes.DefaultInstance) return this; if (other.unpackedInt32_.Count != 0) { - base.AddRange(other.unpackedInt32_, result.unpackedInt32_); + result.unpackedInt32_.Add(other.unpackedInt32_); } if (other.unpackedInt64_.Count != 0) { - base.AddRange(other.unpackedInt64_, result.unpackedInt64_); + result.unpackedInt64_.Add(other.unpackedInt64_); } if (other.unpackedUint32_.Count != 0) { - base.AddRange(other.unpackedUint32_, result.unpackedUint32_); + result.unpackedUint32_.Add(other.unpackedUint32_); } if (other.unpackedUint64_.Count != 0) { - base.AddRange(other.unpackedUint64_, result.unpackedUint64_); + result.unpackedUint64_.Add(other.unpackedUint64_); } if (other.unpackedSint32_.Count != 0) { - base.AddRange(other.unpackedSint32_, result.unpackedSint32_); + result.unpackedSint32_.Add(other.unpackedSint32_); } if (other.unpackedSint64_.Count != 0) { - base.AddRange(other.unpackedSint64_, result.unpackedSint64_); + result.unpackedSint64_.Add(other.unpackedSint64_); } if (other.unpackedFixed32_.Count != 0) { - base.AddRange(other.unpackedFixed32_, result.unpackedFixed32_); + result.unpackedFixed32_.Add(other.unpackedFixed32_); } if (other.unpackedFixed64_.Count != 0) { - base.AddRange(other.unpackedFixed64_, result.unpackedFixed64_); + result.unpackedFixed64_.Add(other.unpackedFixed64_); } if (other.unpackedSfixed32_.Count != 0) { - base.AddRange(other.unpackedSfixed32_, result.unpackedSfixed32_); + result.unpackedSfixed32_.Add(other.unpackedSfixed32_); } if (other.unpackedSfixed64_.Count != 0) { - base.AddRange(other.unpackedSfixed64_, result.unpackedSfixed64_); + result.unpackedSfixed64_.Add(other.unpackedSfixed64_); } if (other.unpackedFloat_.Count != 0) { - base.AddRange(other.unpackedFloat_, result.unpackedFloat_); + result.unpackedFloat_.Add(other.unpackedFloat_); } if (other.unpackedDouble_.Count != 0) { - base.AddRange(other.unpackedDouble_, result.unpackedDouble_); + result.unpackedDouble_.Add(other.unpackedDouble_); } if (other.unpackedBool_.Count != 0) { - base.AddRange(other.unpackedBool_, result.unpackedBool_); + result.unpackedBool_.Add(other.unpackedBool_); } if (other.unpackedEnum_.Count != 0) { - base.AddRange(other.unpackedEnum_, result.unpackedEnum_); + result.unpackedEnum_.Add(other.unpackedEnum_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -16634,7 +16634,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedInt32(scg::IEnumerable values) { - base.AddRange(values, result.unpackedInt32_); + result.unpackedInt32_.Add(values); return this; } public Builder ClearUnpackedInt32() { @@ -16660,7 +16660,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedInt64(scg::IEnumerable values) { - base.AddRange(values, result.unpackedInt64_); + result.unpackedInt64_.Add(values); return this; } public Builder ClearUnpackedInt64() { @@ -16691,7 +16691,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedUint32(scg::IEnumerable values) { - base.AddRange(values, result.unpackedUint32_); + result.unpackedUint32_.Add(values); return this; } public Builder ClearUnpackedUint32() { @@ -16722,7 +16722,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedUint64(scg::IEnumerable values) { - base.AddRange(values, result.unpackedUint64_); + result.unpackedUint64_.Add(values); return this; } public Builder ClearUnpackedUint64() { @@ -16748,7 +16748,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedSint32(scg::IEnumerable values) { - base.AddRange(values, result.unpackedSint32_); + result.unpackedSint32_.Add(values); return this; } public Builder ClearUnpackedSint32() { @@ -16774,7 +16774,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedSint64(scg::IEnumerable values) { - base.AddRange(values, result.unpackedSint64_); + result.unpackedSint64_.Add(values); return this; } public Builder ClearUnpackedSint64() { @@ -16805,7 +16805,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedFixed32(scg::IEnumerable values) { - base.AddRange(values, result.unpackedFixed32_); + result.unpackedFixed32_.Add(values); return this; } public Builder ClearUnpackedFixed32() { @@ -16836,7 +16836,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedFixed64(scg::IEnumerable values) { - base.AddRange(values, result.unpackedFixed64_); + result.unpackedFixed64_.Add(values); return this; } public Builder ClearUnpackedFixed64() { @@ -16862,7 +16862,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedSfixed32(scg::IEnumerable values) { - base.AddRange(values, result.unpackedSfixed32_); + result.unpackedSfixed32_.Add(values); return this; } public Builder ClearUnpackedSfixed32() { @@ -16888,7 +16888,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedSfixed64(scg::IEnumerable values) { - base.AddRange(values, result.unpackedSfixed64_); + result.unpackedSfixed64_.Add(values); return this; } public Builder ClearUnpackedSfixed64() { @@ -16914,7 +16914,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedFloat(scg::IEnumerable values) { - base.AddRange(values, result.unpackedFloat_); + result.unpackedFloat_.Add(values); return this; } public Builder ClearUnpackedFloat() { @@ -16940,7 +16940,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedDouble(scg::IEnumerable values) { - base.AddRange(values, result.unpackedDouble_); + result.unpackedDouble_.Add(values); return this; } public Builder ClearUnpackedDouble() { @@ -16966,7 +16966,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedBool(scg::IEnumerable values) { - base.AddRange(values, result.unpackedBool_); + result.unpackedBool_.Add(values); return this; } public Builder ClearUnpackedBool() { @@ -16992,7 +16992,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedEnum(scg::IEnumerable values) { - base.AddRange(values, result.unpackedEnum_); + result.unpackedEnum_.Add(values); return this; } public Builder ClearUnpackedEnum() { @@ -17956,10 +17956,10 @@ namespace Google.ProtocolBuffers.TestProtos { MergeDynamicMessageExtension(other.DynamicMessageExtension); } if (other.repeatedExtension_.Count != 0) { - base.AddRange(other.repeatedExtension_, result.repeatedExtension_); + result.repeatedExtension_.Add(other.repeatedExtension_); } if (other.packedExtension_.Count != 0) { - base.AddRange(other.packedExtension_, result.packedExtension_); + result.packedExtension_.Add(other.packedExtension_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -18216,7 +18216,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedExtension(scg::IEnumerable values) { - base.AddRange(values, result.repeatedExtension_); + result.repeatedExtension_.Add(values); return this; } public Builder ClearRepeatedExtension() { @@ -18242,7 +18242,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedExtension(scg::IEnumerable values) { - base.AddRange(values, result.packedExtension_); + result.packedExtension_.Add(values); return this; } public Builder ClearPackedExtension() { @@ -18541,22 +18541,22 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestRepeatedScalarDifferentTagSizes other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestRepeatedScalarDifferentTagSizes.DefaultInstance) return this; if (other.repeatedFixed32_.Count != 0) { - base.AddRange(other.repeatedFixed32_, result.repeatedFixed32_); + result.repeatedFixed32_.Add(other.repeatedFixed32_); } if (other.repeatedInt32_.Count != 0) { - base.AddRange(other.repeatedInt32_, result.repeatedInt32_); + result.repeatedInt32_.Add(other.repeatedInt32_); } if (other.repeatedFixed64_.Count != 0) { - base.AddRange(other.repeatedFixed64_, result.repeatedFixed64_); + result.repeatedFixed64_.Add(other.repeatedFixed64_); } if (other.repeatedInt64_.Count != 0) { - base.AddRange(other.repeatedInt64_, result.repeatedInt64_); + result.repeatedInt64_.Add(other.repeatedInt64_); } if (other.repeatedFloat_.Count != 0) { - base.AddRange(other.repeatedFloat_, result.repeatedFloat_); + result.repeatedFloat_.Add(other.repeatedFloat_); } if (other.repeatedUint64_.Count != 0) { - base.AddRange(other.repeatedUint64_, result.repeatedUint64_); + result.repeatedUint64_.Add(other.repeatedUint64_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -18663,7 +18663,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedFixed32_); + result.repeatedFixed32_.Add(values); return this; } public Builder ClearRepeatedFixed32() { @@ -18689,7 +18689,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedInt32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedInt32_); + result.repeatedInt32_.Add(values); return this; } public Builder ClearRepeatedInt32() { @@ -18720,7 +18720,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedFixed64_); + result.repeatedFixed64_.Add(values); return this; } public Builder ClearRepeatedFixed64() { @@ -18746,7 +18746,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedInt64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedInt64_); + result.repeatedInt64_.Add(values); return this; } public Builder ClearRepeatedInt64() { @@ -18772,7 +18772,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedFloat(scg::IEnumerable values) { - base.AddRange(values, result.repeatedFloat_); + result.repeatedFloat_.Add(values); return this; } public Builder ClearRepeatedFloat() { @@ -18803,7 +18803,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedUint64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedUint64_); + result.repeatedUint64_.Add(values); return this; } public Builder ClearRepeatedUint64() { diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs index ae309fa706..9863025fcb 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs @@ -245,7 +245,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(SearchRequest other) { if (other == global::Google.ProtocolBuffers.TestProtos.SearchRequest.DefaultInstance) return this; if (other.criteria_.Count != 0) { - base.AddRange(other.criteria_, result.criteria_); + result.criteria_.Add(other.criteria_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -323,7 +323,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeCriteria(scg::IEnumerable values) { - base.AddRange(values, result.criteria_); + result.criteria_.Add(values); return this; } public Builder ClearCriteria() { @@ -791,7 +791,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(SearchResponse other) { if (other == global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance) return this; if (other.results_.Count != 0) { - base.AddRange(other.results_, result.results_); + result.results_.Add(other.results_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -879,7 +879,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeResults(scg::IEnumerable values) { - base.AddRange(values, result.results_); + result.results_.Add(values); return this; } public Builder ClearResults() { @@ -1076,7 +1076,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(RefineSearchRequest other) { if (other == global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest.DefaultInstance) return this; if (other.criteria_.Count != 0) { - base.AddRange(other.criteria_, result.criteria_); + result.criteria_.Add(other.criteria_); } if (other.HasPreviousResults) { MergePreviousResults(other.PreviousResults); @@ -1166,7 +1166,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeCriteria(scg::IEnumerable values) { - base.AddRange(values, result.criteria_); + result.criteria_.Add(values); return this; } public Builder ClearCriteria() { diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs index 3d818a6082..3221ba1c18 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs @@ -318,7 +318,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestXmlChild other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestXmlChild.DefaultInstance) return this; if (other.options_.Count != 0) { - base.AddRange(other.options_, result.options_); + result.options_.Add(other.options_); } if (other.HasBinary) { Binary = other.Binary; @@ -411,7 +411,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeOptions(scg::IEnumerable values) { - base.AddRange(values, result.options_); + result.options_.Add(values); return this; } public Builder ClearOptions() { @@ -1119,7 +1119,7 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(Children other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children.DefaultInstance) return this; if (other.options_.Count != 0) { - base.AddRange(other.options_, result.options_); + result.options_.Add(other.options_); } if (other.HasBinary) { Binary = other.Binary; @@ -1212,7 +1212,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeOptions(scg::IEnumerable values) { - base.AddRange(values, result.options_); + result.options_.Add(values); return this; } public Builder ClearOptions() { @@ -1500,13 +1500,13 @@ namespace Google.ProtocolBuffers.TestProtos { Number = other.Number; } if (other.numbers_.Count != 0) { - base.AddRange(other.numbers_, result.numbers_); + result.numbers_.Add(other.numbers_); } if (other.HasText) { Text = other.Text; } if (other.textlines_.Count != 0) { - base.AddRange(other.textlines_, result.textlines_); + result.textlines_.Add(other.textlines_); } if (other.HasValid) { Valid = other.Valid; @@ -1515,7 +1515,7 @@ namespace Google.ProtocolBuffers.TestProtos { MergeChild(other.Child); } if (other.children_.Count != 0) { - base.AddRange(other.children_, result.children_); + result.children_.Add(other.children_); } this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); @@ -1640,7 +1640,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeNumbers(scg::IEnumerable values) { - base.AddRange(values, result.numbers_); + result.numbers_.Add(values); return this; } public Builder ClearNumbers() { @@ -1687,7 +1687,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeTextlines(scg::IEnumerable values) { - base.AddRange(values, result.textlines_); + result.textlines_.Add(values); return this; } public Builder ClearTextlines() { @@ -1779,7 +1779,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeChildren(scg::IEnumerable values) { - base.AddRange(values, result.children_); + result.children_.Add(values); return this; } public Builder ClearChildren() { diff --git a/src/ProtocolBuffers/Collections/PopsicleList.cs b/src/ProtocolBuffers/Collections/PopsicleList.cs index dc5c5836b9..3de97f8914 100644 --- a/src/ProtocolBuffers/Collections/PopsicleList.cs +++ b/src/ProtocolBuffers/Collections/PopsicleList.cs @@ -42,6 +42,7 @@ namespace Google.ProtocolBuffers.Collections /// public sealed class PopsicleList : IPopsicleList, ICastArray { + private static readonly bool CheckForNull = default(T) == null; private static readonly T[] EmptySet = new T[0]; private List items; @@ -65,6 +66,10 @@ namespace Google.ProtocolBuffers.Collections public void Insert(int index, T item) { ValidateModification(); + if (CheckForNull) + { + ThrowHelper.ThrowIfNull(item); + } items.Insert(index, item); } @@ -87,6 +92,10 @@ namespace Google.ProtocolBuffers.Collections set { ValidateModification(); + if (CheckForNull) + { + ThrowHelper.ThrowIfNull(value); + } items[index] = value; } } @@ -94,6 +103,10 @@ namespace Google.ProtocolBuffers.Collections public void Add(T item) { ValidateModification(); + if (CheckForNull) + { + ThrowHelper.ThrowIfNull(item); + } items.Add(item); } @@ -145,15 +158,30 @@ namespace Google.ProtocolBuffers.Collections public void Add(IEnumerable collection) { - if (readOnly) + ValidateModification(); + ThrowHelper.ThrowIfNull(collection); + + if (!CheckForNull || collection is PopsicleList) { - throw new NotSupportedException("List is read-only"); + items.AddRange(collection); } - if (items == null) + else { - items = new List(); + // Assumption, it's ok to enumerate collections more than once. + if (collection is ICollection) + { + ThrowHelper.ThrowIfAnyNull(collection); + items.AddRange(collection); + } + else + { + foreach (T item in collection) + { + ThrowHelper.ThrowIfNull(item); + items.Add(item); + } + } } - items.AddRange(collection); } private void ValidateModification() diff --git a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs index 5b48cde198..326df8b7b1 100644 --- a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs +++ b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs @@ -393,7 +393,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(FileDescriptorSet other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet.DefaultInstance) return this; if (other.file_.Count != 0) { - base.AddRange(other.file_, result.file_); + result.file_.Add(other.file_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -481,7 +481,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeFile(scg::IEnumerable values) { - base.AddRange(values, result.file_); + result.file_.Add(values); return this; } public Builder ClearFile() { @@ -805,19 +805,19 @@ namespace Google.ProtocolBuffers.DescriptorProtos { Package = other.Package; } if (other.dependency_.Count != 0) { - base.AddRange(other.dependency_, result.dependency_); + result.dependency_.Add(other.dependency_); } if (other.messageType_.Count != 0) { - base.AddRange(other.messageType_, result.messageType_); + result.messageType_.Add(other.messageType_); } if (other.enumType_.Count != 0) { - base.AddRange(other.enumType_, result.enumType_); + result.enumType_.Add(other.enumType_); } if (other.service_.Count != 0) { - base.AddRange(other.service_, result.service_); + result.service_.Add(other.service_); } if (other.extension_.Count != 0) { - base.AddRange(other.extension_, result.extension_); + result.extension_.Add(other.extension_); } if (other.HasOptions) { MergeOptions(other.Options); @@ -969,7 +969,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeDependency(scg::IEnumerable values) { - base.AddRange(values, result.dependency_); + result.dependency_.Add(values); return this; } public Builder ClearDependency() { @@ -1007,7 +1007,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeMessageType(scg::IEnumerable values) { - base.AddRange(values, result.messageType_); + result.messageType_.Add(values); return this; } public Builder ClearMessageType() { @@ -1045,7 +1045,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeEnumType(scg::IEnumerable values) { - base.AddRange(values, result.enumType_); + result.enumType_.Add(values); return this; } public Builder ClearEnumType() { @@ -1083,7 +1083,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeService(scg::IEnumerable values) { - base.AddRange(values, result.service_); + result.service_.Add(values); return this; } public Builder ClearService() { @@ -1121,7 +1121,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeExtension(scg::IEnumerable values) { - base.AddRange(values, result.extension_); + result.extension_.Add(values); return this; } public Builder ClearExtension() { @@ -1745,19 +1745,19 @@ namespace Google.ProtocolBuffers.DescriptorProtos { Name = other.Name; } if (other.field_.Count != 0) { - base.AddRange(other.field_, result.field_); + result.field_.Add(other.field_); } if (other.extension_.Count != 0) { - base.AddRange(other.extension_, result.extension_); + result.extension_.Add(other.extension_); } if (other.nestedType_.Count != 0) { - base.AddRange(other.nestedType_, result.nestedType_); + result.nestedType_.Add(other.nestedType_); } if (other.enumType_.Count != 0) { - base.AddRange(other.enumType_, result.enumType_); + result.enumType_.Add(other.enumType_); } if (other.extensionRange_.Count != 0) { - base.AddRange(other.extensionRange_, result.extensionRange_); + result.extensionRange_.Add(other.extensionRange_); } if (other.HasOptions) { MergeOptions(other.Options); @@ -1896,7 +1896,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeField(scg::IEnumerable values) { - base.AddRange(values, result.field_); + result.field_.Add(values); return this; } public Builder ClearField() { @@ -1934,7 +1934,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeExtension(scg::IEnumerable values) { - base.AddRange(values, result.extension_); + result.extension_.Add(values); return this; } public Builder ClearExtension() { @@ -1972,7 +1972,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeNestedType(scg::IEnumerable values) { - base.AddRange(values, result.nestedType_); + result.nestedType_.Add(values); return this; } public Builder ClearNestedType() { @@ -2010,7 +2010,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeEnumType(scg::IEnumerable values) { - base.AddRange(values, result.enumType_); + result.enumType_.Add(values); return this; } public Builder ClearEnumType() { @@ -2048,7 +2048,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeExtensionRange(scg::IEnumerable values) { - base.AddRange(values, result.extensionRange_); + result.extensionRange_.Add(values); return this; } public Builder ClearExtensionRange() { @@ -2910,7 +2910,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { Name = other.Name; } if (other.value_.Count != 0) { - base.AddRange(other.value_, result.value_); + result.value_.Add(other.value_); } if (other.HasOptions) { MergeOptions(other.Options); @@ -3033,7 +3033,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeValue(scg::IEnumerable values) { - base.AddRange(values, result.value_); + result.value_.Add(values); return this; } public Builder ClearValue() { @@ -3632,7 +3632,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { Name = other.Name; } if (other.method_.Count != 0) { - base.AddRange(other.method_, result.method_); + result.method_.Add(other.method_); } if (other.HasOptions) { MergeOptions(other.Options); @@ -3755,7 +3755,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeMethod(scg::IEnumerable values) { - base.AddRange(values, result.method_); + result.method_.Add(values); return this; } public Builder ClearMethod() { @@ -4512,7 +4512,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { PyGenericServices = other.PyGenericServices; } if (other.uninterpretedOption_.Count != 0) { - base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); + result.uninterpretedOption_.Add(other.uninterpretedOption_); } this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); @@ -4765,7 +4765,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { - base.AddRange(values, result.uninterpretedOption_); + result.uninterpretedOption_.Add(values); return this; } public Builder ClearUninterpretedOption() { @@ -4984,7 +4984,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { NoStandardDescriptorAccessor = other.NoStandardDescriptorAccessor; } if (other.uninterpretedOption_.Count != 0) { - base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); + result.uninterpretedOption_.Add(other.uninterpretedOption_); } this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); @@ -5117,7 +5117,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { - base.AddRange(values, result.uninterpretedOption_); + result.uninterpretedOption_.Add(values); return this; } public Builder ClearUninterpretedOption() { @@ -5390,7 +5390,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { ExperimentalMapKey = other.ExperimentalMapKey; } if (other.uninterpretedOption_.Count != 0) { - base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); + result.uninterpretedOption_.Add(other.uninterpretedOption_); } this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); @@ -5576,7 +5576,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { - base.AddRange(values, result.uninterpretedOption_); + result.uninterpretedOption_.Add(values); return this; } public Builder ClearUninterpretedOption() { @@ -5757,7 +5757,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(EnumOptions other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.DefaultInstance) return this; if (other.uninterpretedOption_.Count != 0) { - base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); + result.uninterpretedOption_.Add(other.uninterpretedOption_); } this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); @@ -5846,7 +5846,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { - base.AddRange(values, result.uninterpretedOption_); + result.uninterpretedOption_.Add(values); return this; } public Builder ClearUninterpretedOption() { @@ -6027,7 +6027,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(EnumValueOptions other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.DefaultInstance) return this; if (other.uninterpretedOption_.Count != 0) { - base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); + result.uninterpretedOption_.Add(other.uninterpretedOption_); } this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); @@ -6116,7 +6116,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { - base.AddRange(values, result.uninterpretedOption_); + result.uninterpretedOption_.Add(values); return this; } public Builder ClearUninterpretedOption() { @@ -6297,7 +6297,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(ServiceOptions other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.DefaultInstance) return this; if (other.uninterpretedOption_.Count != 0) { - base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); + result.uninterpretedOption_.Add(other.uninterpretedOption_); } this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); @@ -6386,7 +6386,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { - base.AddRange(values, result.uninterpretedOption_); + result.uninterpretedOption_.Add(values); return this; } public Builder ClearUninterpretedOption() { @@ -6567,7 +6567,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(MethodOptions other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.DefaultInstance) return this; if (other.uninterpretedOption_.Count != 0) { - base.AddRange(other.uninterpretedOption_, result.uninterpretedOption_); + result.uninterpretedOption_.Add(other.uninterpretedOption_); } this.MergeExtensionFields(other); this.MergeUnknownFields(other.UnknownFields); @@ -6656,7 +6656,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { - base.AddRange(values, result.uninterpretedOption_); + result.uninterpretedOption_.Add(values); return this; } public Builder ClearUninterpretedOption() { @@ -7205,7 +7205,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public override Builder MergeFrom(UninterpretedOption other) { if (other == global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.DefaultInstance) return this; if (other.name_.Count != 0) { - base.AddRange(other.name_, result.name_); + result.name_.Add(other.name_); } if (other.HasIdentifierValue) { IdentifierValue = other.IdentifierValue; @@ -7328,7 +7328,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this; } public Builder AddRangeName(scg::IEnumerable values) { - base.AddRange(values, result.name_); + result.name_.Add(values); return this; } public Builder ClearName() { diff --git a/src/ProtocolBuffers/GeneratedBuilder.cs b/src/ProtocolBuffers/GeneratedBuilder.cs index 94948e495c..0dacce1e6a 100644 --- a/src/ProtocolBuffers/GeneratedBuilder.cs +++ b/src/ProtocolBuffers/GeneratedBuilder.cs @@ -84,32 +84,6 @@ namespace Google.ProtocolBuffers set { InternalFieldAccessors[field].SetValue(ThisBuilder, value); } } - /// - /// Adds all of the specified values to the given collection. - /// - /// Any element of the list is null - protected void AddRange(IEnumerable source, IList destination) - { - ThrowHelper.ThrowIfNull(source); - // We only need to check this for nullable types. - if (default(T) == null) - { - ThrowHelper.ThrowIfAnyNull(source); - } - List list = destination as List; - if (list != null) - { - list.AddRange(source); - } - else - { - foreach (T element in source) - { - destination.Add(element); - } - } - } - /// /// Called by derived classes to parse an unknown field. /// diff --git a/src/ProtocolBuffers/GeneratedBuilderLite.cs b/src/ProtocolBuffers/GeneratedBuilderLite.cs index cd2b8395c0..168f596acb 100644 --- a/src/ProtocolBuffers/GeneratedBuilderLite.cs +++ b/src/ProtocolBuffers/GeneratedBuilderLite.cs @@ -66,32 +66,6 @@ namespace Google.ProtocolBuffers get { return MessageBeingBuilt.IsInitialized; } } - /// - /// Adds all of the specified values to the given collection. - /// - /// Any element of the list is null - protected void AddRange(IEnumerable source, IList destination) - { - ThrowHelper.ThrowIfNull(source); - // We only need to check this for nullable types. - if (default(T) == null) - { - ThrowHelper.ThrowIfAnyNull(source); - } - List list = destination as List; - if (list != null) - { - list.AddRange(source); - } - else - { - foreach (T element in source) - { - destination.Add(element); - } - } - } - /// /// Called by derived classes to parse an unknown field. /// diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs index a9ee77724b..64d754d622 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs @@ -809,7 +809,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeCodes(scg::IEnumerable values) { - base.AddRange(values, result.codes_); + result.codes_.Add(values); return this; } public Builder ClearCodes() { @@ -847,7 +847,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePhone(scg::IEnumerable values) { - base.AddRange(values, result.phone_); + result.phone_.Add(values); return this; } public Builder ClearPhone() { @@ -885,7 +885,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeAddresses(scg::IEnumerable values) { - base.AddRange(values, result.addresses_); + result.addresses_.Add(values); return this; } public Builder ClearAddresses() { @@ -1231,7 +1231,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeValues(scg::IEnumerable values) { - base.AddRange(values, result.values_); + result.values_.Add(values); return this; } public Builder ClearValues() { @@ -1630,7 +1630,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeValues(scg::IEnumerable values) { - base.AddRange(values, result.values_); + result.values_.Add(values); return this; } public Builder ClearValues() { diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs index bc214e2565..38d6ff8b2d 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs @@ -1354,13 +1354,13 @@ namespace Google.ProtocolBuffers.TestProtos { Email = other.Email; } if (other.codes_.Count != 0) { - base.AddRange(other.codes_, result.codes_); + result.codes_.Add(other.codes_); } if (other.phone_.Count != 0) { - base.AddRange(other.phone_, result.phone_); + result.phone_.Add(other.phone_); } if (other.addresses_.Count != 0) { - base.AddRange(other.addresses_, result.addresses_); + result.addresses_.Add(other.addresses_); } this.MergeExtensionFields(other); return this; @@ -1500,7 +1500,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeCodes(scg::IEnumerable values) { - base.AddRange(values, result.codes_); + result.codes_.Add(values); return this; } public Builder ClearCodes() { @@ -1538,7 +1538,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePhone(scg::IEnumerable values) { - base.AddRange(values, result.phone_); + result.phone_.Add(values); return this; } public Builder ClearPhone() { @@ -1576,7 +1576,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeAddresses(scg::IEnumerable values) { - base.AddRange(values, result.addresses_); + result.addresses_.Add(values); return this; } public Builder ClearAddresses() { diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs index 78bed7e204..6b4e90e81c 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs @@ -3690,76 +3690,76 @@ namespace Google.ProtocolBuffers.TestProtos { OptionalCord = other.OptionalCord; } if (other.repeatedInt32_.Count != 0) { - base.AddRange(other.repeatedInt32_, result.repeatedInt32_); + result.repeatedInt32_.Add(other.repeatedInt32_); } if (other.repeatedInt64_.Count != 0) { - base.AddRange(other.repeatedInt64_, result.repeatedInt64_); + result.repeatedInt64_.Add(other.repeatedInt64_); } if (other.repeatedUint32_.Count != 0) { - base.AddRange(other.repeatedUint32_, result.repeatedUint32_); + result.repeatedUint32_.Add(other.repeatedUint32_); } if (other.repeatedUint64_.Count != 0) { - base.AddRange(other.repeatedUint64_, result.repeatedUint64_); + result.repeatedUint64_.Add(other.repeatedUint64_); } if (other.repeatedSint32_.Count != 0) { - base.AddRange(other.repeatedSint32_, result.repeatedSint32_); + result.repeatedSint32_.Add(other.repeatedSint32_); } if (other.repeatedSint64_.Count != 0) { - base.AddRange(other.repeatedSint64_, result.repeatedSint64_); + result.repeatedSint64_.Add(other.repeatedSint64_); } if (other.repeatedFixed32_.Count != 0) { - base.AddRange(other.repeatedFixed32_, result.repeatedFixed32_); + result.repeatedFixed32_.Add(other.repeatedFixed32_); } if (other.repeatedFixed64_.Count != 0) { - base.AddRange(other.repeatedFixed64_, result.repeatedFixed64_); + result.repeatedFixed64_.Add(other.repeatedFixed64_); } if (other.repeatedSfixed32_.Count != 0) { - base.AddRange(other.repeatedSfixed32_, result.repeatedSfixed32_); + result.repeatedSfixed32_.Add(other.repeatedSfixed32_); } if (other.repeatedSfixed64_.Count != 0) { - base.AddRange(other.repeatedSfixed64_, result.repeatedSfixed64_); + result.repeatedSfixed64_.Add(other.repeatedSfixed64_); } if (other.repeatedFloat_.Count != 0) { - base.AddRange(other.repeatedFloat_, result.repeatedFloat_); + result.repeatedFloat_.Add(other.repeatedFloat_); } if (other.repeatedDouble_.Count != 0) { - base.AddRange(other.repeatedDouble_, result.repeatedDouble_); + result.repeatedDouble_.Add(other.repeatedDouble_); } if (other.repeatedBool_.Count != 0) { - base.AddRange(other.repeatedBool_, result.repeatedBool_); + result.repeatedBool_.Add(other.repeatedBool_); } if (other.repeatedString_.Count != 0) { - base.AddRange(other.repeatedString_, result.repeatedString_); + result.repeatedString_.Add(other.repeatedString_); } if (other.repeatedBytes_.Count != 0) { - base.AddRange(other.repeatedBytes_, result.repeatedBytes_); + result.repeatedBytes_.Add(other.repeatedBytes_); } if (other.repeatedGroup_.Count != 0) { - base.AddRange(other.repeatedGroup_, result.repeatedGroup_); + result.repeatedGroup_.Add(other.repeatedGroup_); } if (other.repeatedNestedMessage_.Count != 0) { - base.AddRange(other.repeatedNestedMessage_, result.repeatedNestedMessage_); + result.repeatedNestedMessage_.Add(other.repeatedNestedMessage_); } if (other.repeatedForeignMessage_.Count != 0) { - base.AddRange(other.repeatedForeignMessage_, result.repeatedForeignMessage_); + result.repeatedForeignMessage_.Add(other.repeatedForeignMessage_); } if (other.repeatedImportMessage_.Count != 0) { - base.AddRange(other.repeatedImportMessage_, result.repeatedImportMessage_); + result.repeatedImportMessage_.Add(other.repeatedImportMessage_); } if (other.repeatedNestedEnum_.Count != 0) { - base.AddRange(other.repeatedNestedEnum_, result.repeatedNestedEnum_); + result.repeatedNestedEnum_.Add(other.repeatedNestedEnum_); } if (other.repeatedForeignEnum_.Count != 0) { - base.AddRange(other.repeatedForeignEnum_, result.repeatedForeignEnum_); + result.repeatedForeignEnum_.Add(other.repeatedForeignEnum_); } if (other.repeatedImportEnum_.Count != 0) { - base.AddRange(other.repeatedImportEnum_, result.repeatedImportEnum_); + result.repeatedImportEnum_.Add(other.repeatedImportEnum_); } if (other.repeatedStringPiece_.Count != 0) { - base.AddRange(other.repeatedStringPiece_, result.repeatedStringPiece_); + result.repeatedStringPiece_.Add(other.repeatedStringPiece_); } if (other.repeatedCord_.Count != 0) { - base.AddRange(other.repeatedCord_, result.repeatedCord_); + result.repeatedCord_.Add(other.repeatedCord_); } if (other.HasDefaultInt32) { DefaultInt32 = other.DefaultInt32; @@ -4728,7 +4728,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedInt32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedInt32_); + result.repeatedInt32_.Add(values); return this; } public Builder ClearRepeatedInt32() { @@ -4754,7 +4754,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedInt64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedInt64_); + result.repeatedInt64_.Add(values); return this; } public Builder ClearRepeatedInt64() { @@ -4785,7 +4785,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedUint32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedUint32_); + result.repeatedUint32_.Add(values); return this; } public Builder ClearRepeatedUint32() { @@ -4816,7 +4816,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedUint64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedUint64_); + result.repeatedUint64_.Add(values); return this; } public Builder ClearRepeatedUint64() { @@ -4842,7 +4842,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedSint32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedSint32_); + result.repeatedSint32_.Add(values); return this; } public Builder ClearRepeatedSint32() { @@ -4868,7 +4868,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedSint64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedSint64_); + result.repeatedSint64_.Add(values); return this; } public Builder ClearRepeatedSint64() { @@ -4899,7 +4899,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedFixed32_); + result.repeatedFixed32_.Add(values); return this; } public Builder ClearRepeatedFixed32() { @@ -4930,7 +4930,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedFixed64_); + result.repeatedFixed64_.Add(values); return this; } public Builder ClearRepeatedFixed64() { @@ -4956,7 +4956,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedSfixed32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedSfixed32_); + result.repeatedSfixed32_.Add(values); return this; } public Builder ClearRepeatedSfixed32() { @@ -4982,7 +4982,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedSfixed64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedSfixed64_); + result.repeatedSfixed64_.Add(values); return this; } public Builder ClearRepeatedSfixed64() { @@ -5008,7 +5008,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedFloat(scg::IEnumerable values) { - base.AddRange(values, result.repeatedFloat_); + result.repeatedFloat_.Add(values); return this; } public Builder ClearRepeatedFloat() { @@ -5034,7 +5034,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedDouble(scg::IEnumerable values) { - base.AddRange(values, result.repeatedDouble_); + result.repeatedDouble_.Add(values); return this; } public Builder ClearRepeatedDouble() { @@ -5060,7 +5060,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedBool(scg::IEnumerable values) { - base.AddRange(values, result.repeatedBool_); + result.repeatedBool_.Add(values); return this; } public Builder ClearRepeatedBool() { @@ -5088,7 +5088,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedString(scg::IEnumerable values) { - base.AddRange(values, result.repeatedString_); + result.repeatedString_.Add(values); return this; } public Builder ClearRepeatedString() { @@ -5116,7 +5116,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedBytes(scg::IEnumerable values) { - base.AddRange(values, result.repeatedBytes_); + result.repeatedBytes_.Add(values); return this; } public Builder ClearRepeatedBytes() { @@ -5154,7 +5154,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedGroup(scg::IEnumerable values) { - base.AddRange(values, result.repeatedGroup_); + result.repeatedGroup_.Add(values); return this; } public Builder ClearRepeatedGroup() { @@ -5192,7 +5192,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedNestedMessage(scg::IEnumerable values) { - base.AddRange(values, result.repeatedNestedMessage_); + result.repeatedNestedMessage_.Add(values); return this; } public Builder ClearRepeatedNestedMessage() { @@ -5230,7 +5230,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedForeignMessage(scg::IEnumerable values) { - base.AddRange(values, result.repeatedForeignMessage_); + result.repeatedForeignMessage_.Add(values); return this; } public Builder ClearRepeatedForeignMessage() { @@ -5268,7 +5268,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedImportMessage(scg::IEnumerable values) { - base.AddRange(values, result.repeatedImportMessage_); + result.repeatedImportMessage_.Add(values); return this; } public Builder ClearRepeatedImportMessage() { @@ -5294,7 +5294,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedNestedEnum(scg::IEnumerable values) { - base.AddRange(values, result.repeatedNestedEnum_); + result.repeatedNestedEnum_.Add(values); return this; } public Builder ClearRepeatedNestedEnum() { @@ -5320,7 +5320,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedForeignEnum(scg::IEnumerable values) { - base.AddRange(values, result.repeatedForeignEnum_); + result.repeatedForeignEnum_.Add(values); return this; } public Builder ClearRepeatedForeignEnum() { @@ -5346,7 +5346,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedImportEnum(scg::IEnumerable values) { - base.AddRange(values, result.repeatedImportEnum_); + result.repeatedImportEnum_.Add(values); return this; } public Builder ClearRepeatedImportEnum() { @@ -5374,7 +5374,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedStringPiece(scg::IEnumerable values) { - base.AddRange(values, result.repeatedStringPiece_); + result.repeatedStringPiece_.Add(values); return this; } public Builder ClearRepeatedStringPiece() { @@ -5402,7 +5402,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedCord(scg::IEnumerable values) { - base.AddRange(values, result.repeatedCord_); + result.repeatedCord_.Add(values); return this; } public Builder ClearRepeatedCord() { @@ -6632,46 +6632,46 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestPackedTypesLite other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedTypesLite.DefaultInstance) return this; if (other.packedInt32_.Count != 0) { - base.AddRange(other.packedInt32_, result.packedInt32_); + result.packedInt32_.Add(other.packedInt32_); } if (other.packedInt64_.Count != 0) { - base.AddRange(other.packedInt64_, result.packedInt64_); + result.packedInt64_.Add(other.packedInt64_); } if (other.packedUint32_.Count != 0) { - base.AddRange(other.packedUint32_, result.packedUint32_); + result.packedUint32_.Add(other.packedUint32_); } if (other.packedUint64_.Count != 0) { - base.AddRange(other.packedUint64_, result.packedUint64_); + result.packedUint64_.Add(other.packedUint64_); } if (other.packedSint32_.Count != 0) { - base.AddRange(other.packedSint32_, result.packedSint32_); + result.packedSint32_.Add(other.packedSint32_); } if (other.packedSint64_.Count != 0) { - base.AddRange(other.packedSint64_, result.packedSint64_); + result.packedSint64_.Add(other.packedSint64_); } if (other.packedFixed32_.Count != 0) { - base.AddRange(other.packedFixed32_, result.packedFixed32_); + result.packedFixed32_.Add(other.packedFixed32_); } if (other.packedFixed64_.Count != 0) { - base.AddRange(other.packedFixed64_, result.packedFixed64_); + result.packedFixed64_.Add(other.packedFixed64_); } if (other.packedSfixed32_.Count != 0) { - base.AddRange(other.packedSfixed32_, result.packedSfixed32_); + result.packedSfixed32_.Add(other.packedSfixed32_); } if (other.packedSfixed64_.Count != 0) { - base.AddRange(other.packedSfixed64_, result.packedSfixed64_); + result.packedSfixed64_.Add(other.packedSfixed64_); } if (other.packedFloat_.Count != 0) { - base.AddRange(other.packedFloat_, result.packedFloat_); + result.packedFloat_.Add(other.packedFloat_); } if (other.packedDouble_.Count != 0) { - base.AddRange(other.packedDouble_, result.packedDouble_); + result.packedDouble_.Add(other.packedDouble_); } if (other.packedBool_.Count != 0) { - base.AddRange(other.packedBool_, result.packedBool_); + result.packedBool_.Add(other.packedBool_); } if (other.packedEnum_.Count != 0) { - base.AddRange(other.packedEnum_, result.packedEnum_); + result.packedEnum_.Add(other.packedEnum_); } return this; } @@ -6800,7 +6800,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedInt32(scg::IEnumerable values) { - base.AddRange(values, result.packedInt32_); + result.packedInt32_.Add(values); return this; } public Builder ClearPackedInt32() { @@ -6826,7 +6826,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedInt64(scg::IEnumerable values) { - base.AddRange(values, result.packedInt64_); + result.packedInt64_.Add(values); return this; } public Builder ClearPackedInt64() { @@ -6857,7 +6857,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangePackedUint32(scg::IEnumerable values) { - base.AddRange(values, result.packedUint32_); + result.packedUint32_.Add(values); return this; } public Builder ClearPackedUint32() { @@ -6888,7 +6888,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangePackedUint64(scg::IEnumerable values) { - base.AddRange(values, result.packedUint64_); + result.packedUint64_.Add(values); return this; } public Builder ClearPackedUint64() { @@ -6914,7 +6914,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedSint32(scg::IEnumerable values) { - base.AddRange(values, result.packedSint32_); + result.packedSint32_.Add(values); return this; } public Builder ClearPackedSint32() { @@ -6940,7 +6940,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedSint64(scg::IEnumerable values) { - base.AddRange(values, result.packedSint64_); + result.packedSint64_.Add(values); return this; } public Builder ClearPackedSint64() { @@ -6971,7 +6971,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangePackedFixed32(scg::IEnumerable values) { - base.AddRange(values, result.packedFixed32_); + result.packedFixed32_.Add(values); return this; } public Builder ClearPackedFixed32() { @@ -7002,7 +7002,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangePackedFixed64(scg::IEnumerable values) { - base.AddRange(values, result.packedFixed64_); + result.packedFixed64_.Add(values); return this; } public Builder ClearPackedFixed64() { @@ -7028,7 +7028,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedSfixed32(scg::IEnumerable values) { - base.AddRange(values, result.packedSfixed32_); + result.packedSfixed32_.Add(values); return this; } public Builder ClearPackedSfixed32() { @@ -7054,7 +7054,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedSfixed64(scg::IEnumerable values) { - base.AddRange(values, result.packedSfixed64_); + result.packedSfixed64_.Add(values); return this; } public Builder ClearPackedSfixed64() { @@ -7080,7 +7080,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedFloat(scg::IEnumerable values) { - base.AddRange(values, result.packedFloat_); + result.packedFloat_.Add(values); return this; } public Builder ClearPackedFloat() { @@ -7106,7 +7106,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedDouble(scg::IEnumerable values) { - base.AddRange(values, result.packedDouble_); + result.packedDouble_.Add(values); return this; } public Builder ClearPackedDouble() { @@ -7132,7 +7132,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedBool(scg::IEnumerable values) { - base.AddRange(values, result.packedBool_); + result.packedBool_.Add(values); return this; } public Builder ClearPackedBool() { @@ -7158,7 +7158,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedEnum(scg::IEnumerable values) { - base.AddRange(values, result.packedEnum_); + result.packedEnum_.Add(values); return this; } public Builder ClearPackedEnum() { @@ -7731,46 +7731,46 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestUnpackedTypesLite other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypesLite.DefaultInstance) return this; if (other.unpackedInt32_.Count != 0) { - base.AddRange(other.unpackedInt32_, result.unpackedInt32_); + result.unpackedInt32_.Add(other.unpackedInt32_); } if (other.unpackedInt64_.Count != 0) { - base.AddRange(other.unpackedInt64_, result.unpackedInt64_); + result.unpackedInt64_.Add(other.unpackedInt64_); } if (other.unpackedUint32_.Count != 0) { - base.AddRange(other.unpackedUint32_, result.unpackedUint32_); + result.unpackedUint32_.Add(other.unpackedUint32_); } if (other.unpackedUint64_.Count != 0) { - base.AddRange(other.unpackedUint64_, result.unpackedUint64_); + result.unpackedUint64_.Add(other.unpackedUint64_); } if (other.unpackedSint32_.Count != 0) { - base.AddRange(other.unpackedSint32_, result.unpackedSint32_); + result.unpackedSint32_.Add(other.unpackedSint32_); } if (other.unpackedSint64_.Count != 0) { - base.AddRange(other.unpackedSint64_, result.unpackedSint64_); + result.unpackedSint64_.Add(other.unpackedSint64_); } if (other.unpackedFixed32_.Count != 0) { - base.AddRange(other.unpackedFixed32_, result.unpackedFixed32_); + result.unpackedFixed32_.Add(other.unpackedFixed32_); } if (other.unpackedFixed64_.Count != 0) { - base.AddRange(other.unpackedFixed64_, result.unpackedFixed64_); + result.unpackedFixed64_.Add(other.unpackedFixed64_); } if (other.unpackedSfixed32_.Count != 0) { - base.AddRange(other.unpackedSfixed32_, result.unpackedSfixed32_); + result.unpackedSfixed32_.Add(other.unpackedSfixed32_); } if (other.unpackedSfixed64_.Count != 0) { - base.AddRange(other.unpackedSfixed64_, result.unpackedSfixed64_); + result.unpackedSfixed64_.Add(other.unpackedSfixed64_); } if (other.unpackedFloat_.Count != 0) { - base.AddRange(other.unpackedFloat_, result.unpackedFloat_); + result.unpackedFloat_.Add(other.unpackedFloat_); } if (other.unpackedDouble_.Count != 0) { - base.AddRange(other.unpackedDouble_, result.unpackedDouble_); + result.unpackedDouble_.Add(other.unpackedDouble_); } if (other.unpackedBool_.Count != 0) { - base.AddRange(other.unpackedBool_, result.unpackedBool_); + result.unpackedBool_.Add(other.unpackedBool_); } if (other.unpackedEnum_.Count != 0) { - base.AddRange(other.unpackedEnum_, result.unpackedEnum_); + result.unpackedEnum_.Add(other.unpackedEnum_); } return this; } @@ -7899,7 +7899,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedInt32(scg::IEnumerable values) { - base.AddRange(values, result.unpackedInt32_); + result.unpackedInt32_.Add(values); return this; } public Builder ClearUnpackedInt32() { @@ -7925,7 +7925,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedInt64(scg::IEnumerable values) { - base.AddRange(values, result.unpackedInt64_); + result.unpackedInt64_.Add(values); return this; } public Builder ClearUnpackedInt64() { @@ -7956,7 +7956,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedUint32(scg::IEnumerable values) { - base.AddRange(values, result.unpackedUint32_); + result.unpackedUint32_.Add(values); return this; } public Builder ClearUnpackedUint32() { @@ -7987,7 +7987,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedUint64(scg::IEnumerable values) { - base.AddRange(values, result.unpackedUint64_); + result.unpackedUint64_.Add(values); return this; } public Builder ClearUnpackedUint64() { @@ -8013,7 +8013,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedSint32(scg::IEnumerable values) { - base.AddRange(values, result.unpackedSint32_); + result.unpackedSint32_.Add(values); return this; } public Builder ClearUnpackedSint32() { @@ -8039,7 +8039,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedSint64(scg::IEnumerable values) { - base.AddRange(values, result.unpackedSint64_); + result.unpackedSint64_.Add(values); return this; } public Builder ClearUnpackedSint64() { @@ -8070,7 +8070,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedFixed32(scg::IEnumerable values) { - base.AddRange(values, result.unpackedFixed32_); + result.unpackedFixed32_.Add(values); return this; } public Builder ClearUnpackedFixed32() { @@ -8101,7 +8101,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedFixed64(scg::IEnumerable values) { - base.AddRange(values, result.unpackedFixed64_); + result.unpackedFixed64_.Add(values); return this; } public Builder ClearUnpackedFixed64() { @@ -8127,7 +8127,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedSfixed32(scg::IEnumerable values) { - base.AddRange(values, result.unpackedSfixed32_); + result.unpackedSfixed32_.Add(values); return this; } public Builder ClearUnpackedSfixed32() { @@ -8153,7 +8153,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedSfixed64(scg::IEnumerable values) { - base.AddRange(values, result.unpackedSfixed64_); + result.unpackedSfixed64_.Add(values); return this; } public Builder ClearUnpackedSfixed64() { @@ -8179,7 +8179,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedFloat(scg::IEnumerable values) { - base.AddRange(values, result.unpackedFloat_); + result.unpackedFloat_.Add(values); return this; } public Builder ClearUnpackedFloat() { @@ -8205,7 +8205,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedDouble(scg::IEnumerable values) { - base.AddRange(values, result.unpackedDouble_); + result.unpackedDouble_.Add(values); return this; } public Builder ClearUnpackedDouble() { @@ -8231,7 +8231,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedBool(scg::IEnumerable values) { - base.AddRange(values, result.unpackedBool_); + result.unpackedBool_.Add(values); return this; } public Builder ClearUnpackedBool() { @@ -8257,7 +8257,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedEnum(scg::IEnumerable values) { - base.AddRange(values, result.unpackedEnum_); + result.unpackedEnum_.Add(values); return this; } public Builder ClearUnpackedEnum() { diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs index d8824d49a4..49efaecdce 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs @@ -3333,76 +3333,76 @@ namespace Google.ProtocolBuffers.TestProtos { OptionalCord = other.OptionalCord; } if (other.repeatedInt32_.Count != 0) { - base.AddRange(other.repeatedInt32_, result.repeatedInt32_); + result.repeatedInt32_.Add(other.repeatedInt32_); } if (other.repeatedInt64_.Count != 0) { - base.AddRange(other.repeatedInt64_, result.repeatedInt64_); + result.repeatedInt64_.Add(other.repeatedInt64_); } if (other.repeatedUint32_.Count != 0) { - base.AddRange(other.repeatedUint32_, result.repeatedUint32_); + result.repeatedUint32_.Add(other.repeatedUint32_); } if (other.repeatedUint64_.Count != 0) { - base.AddRange(other.repeatedUint64_, result.repeatedUint64_); + result.repeatedUint64_.Add(other.repeatedUint64_); } if (other.repeatedSint32_.Count != 0) { - base.AddRange(other.repeatedSint32_, result.repeatedSint32_); + result.repeatedSint32_.Add(other.repeatedSint32_); } if (other.repeatedSint64_.Count != 0) { - base.AddRange(other.repeatedSint64_, result.repeatedSint64_); + result.repeatedSint64_.Add(other.repeatedSint64_); } if (other.repeatedFixed32_.Count != 0) { - base.AddRange(other.repeatedFixed32_, result.repeatedFixed32_); + result.repeatedFixed32_.Add(other.repeatedFixed32_); } if (other.repeatedFixed64_.Count != 0) { - base.AddRange(other.repeatedFixed64_, result.repeatedFixed64_); + result.repeatedFixed64_.Add(other.repeatedFixed64_); } if (other.repeatedSfixed32_.Count != 0) { - base.AddRange(other.repeatedSfixed32_, result.repeatedSfixed32_); + result.repeatedSfixed32_.Add(other.repeatedSfixed32_); } if (other.repeatedSfixed64_.Count != 0) { - base.AddRange(other.repeatedSfixed64_, result.repeatedSfixed64_); + result.repeatedSfixed64_.Add(other.repeatedSfixed64_); } if (other.repeatedFloat_.Count != 0) { - base.AddRange(other.repeatedFloat_, result.repeatedFloat_); + result.repeatedFloat_.Add(other.repeatedFloat_); } if (other.repeatedDouble_.Count != 0) { - base.AddRange(other.repeatedDouble_, result.repeatedDouble_); + result.repeatedDouble_.Add(other.repeatedDouble_); } if (other.repeatedBool_.Count != 0) { - base.AddRange(other.repeatedBool_, result.repeatedBool_); + result.repeatedBool_.Add(other.repeatedBool_); } if (other.repeatedString_.Count != 0) { - base.AddRange(other.repeatedString_, result.repeatedString_); + result.repeatedString_.Add(other.repeatedString_); } if (other.repeatedBytes_.Count != 0) { - base.AddRange(other.repeatedBytes_, result.repeatedBytes_); + result.repeatedBytes_.Add(other.repeatedBytes_); } if (other.repeatedGroup_.Count != 0) { - base.AddRange(other.repeatedGroup_, result.repeatedGroup_); + result.repeatedGroup_.Add(other.repeatedGroup_); } if (other.repeatedNestedMessage_.Count != 0) { - base.AddRange(other.repeatedNestedMessage_, result.repeatedNestedMessage_); + result.repeatedNestedMessage_.Add(other.repeatedNestedMessage_); } if (other.repeatedForeignMessage_.Count != 0) { - base.AddRange(other.repeatedForeignMessage_, result.repeatedForeignMessage_); + result.repeatedForeignMessage_.Add(other.repeatedForeignMessage_); } if (other.repeatedImportMessage_.Count != 0) { - base.AddRange(other.repeatedImportMessage_, result.repeatedImportMessage_); + result.repeatedImportMessage_.Add(other.repeatedImportMessage_); } if (other.repeatedNestedEnum_.Count != 0) { - base.AddRange(other.repeatedNestedEnum_, result.repeatedNestedEnum_); + result.repeatedNestedEnum_.Add(other.repeatedNestedEnum_); } if (other.repeatedForeignEnum_.Count != 0) { - base.AddRange(other.repeatedForeignEnum_, result.repeatedForeignEnum_); + result.repeatedForeignEnum_.Add(other.repeatedForeignEnum_); } if (other.repeatedImportEnum_.Count != 0) { - base.AddRange(other.repeatedImportEnum_, result.repeatedImportEnum_); + result.repeatedImportEnum_.Add(other.repeatedImportEnum_); } if (other.repeatedStringPiece_.Count != 0) { - base.AddRange(other.repeatedStringPiece_, result.repeatedStringPiece_); + result.repeatedStringPiece_.Add(other.repeatedStringPiece_); } if (other.repeatedCord_.Count != 0) { - base.AddRange(other.repeatedCord_, result.repeatedCord_); + result.repeatedCord_.Add(other.repeatedCord_); } if (other.HasDefaultInt32) { DefaultInt32 = other.DefaultInt32; @@ -4433,7 +4433,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedInt32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedInt32_); + result.repeatedInt32_.Add(values); return this; } public Builder ClearRepeatedInt32() { @@ -4459,7 +4459,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedInt64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedInt64_); + result.repeatedInt64_.Add(values); return this; } public Builder ClearRepeatedInt64() { @@ -4490,7 +4490,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedUint32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedUint32_); + result.repeatedUint32_.Add(values); return this; } public Builder ClearRepeatedUint32() { @@ -4521,7 +4521,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedUint64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedUint64_); + result.repeatedUint64_.Add(values); return this; } public Builder ClearRepeatedUint64() { @@ -4547,7 +4547,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedSint32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedSint32_); + result.repeatedSint32_.Add(values); return this; } public Builder ClearRepeatedSint32() { @@ -4573,7 +4573,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedSint64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedSint64_); + result.repeatedSint64_.Add(values); return this; } public Builder ClearRepeatedSint64() { @@ -4604,7 +4604,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedFixed32_); + result.repeatedFixed32_.Add(values); return this; } public Builder ClearRepeatedFixed32() { @@ -4635,7 +4635,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedFixed64_); + result.repeatedFixed64_.Add(values); return this; } public Builder ClearRepeatedFixed64() { @@ -4661,7 +4661,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedSfixed32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedSfixed32_); + result.repeatedSfixed32_.Add(values); return this; } public Builder ClearRepeatedSfixed32() { @@ -4687,7 +4687,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedSfixed64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedSfixed64_); + result.repeatedSfixed64_.Add(values); return this; } public Builder ClearRepeatedSfixed64() { @@ -4713,7 +4713,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedFloat(scg::IEnumerable values) { - base.AddRange(values, result.repeatedFloat_); + result.repeatedFloat_.Add(values); return this; } public Builder ClearRepeatedFloat() { @@ -4739,7 +4739,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedDouble(scg::IEnumerable values) { - base.AddRange(values, result.repeatedDouble_); + result.repeatedDouble_.Add(values); return this; } public Builder ClearRepeatedDouble() { @@ -4765,7 +4765,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedBool(scg::IEnumerable values) { - base.AddRange(values, result.repeatedBool_); + result.repeatedBool_.Add(values); return this; } public Builder ClearRepeatedBool() { @@ -4793,7 +4793,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedString(scg::IEnumerable values) { - base.AddRange(values, result.repeatedString_); + result.repeatedString_.Add(values); return this; } public Builder ClearRepeatedString() { @@ -4821,7 +4821,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedBytes(scg::IEnumerable values) { - base.AddRange(values, result.repeatedBytes_); + result.repeatedBytes_.Add(values); return this; } public Builder ClearRepeatedBytes() { @@ -4859,7 +4859,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedGroup(scg::IEnumerable values) { - base.AddRange(values, result.repeatedGroup_); + result.repeatedGroup_.Add(values); return this; } public Builder ClearRepeatedGroup() { @@ -4897,7 +4897,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedNestedMessage(scg::IEnumerable values) { - base.AddRange(values, result.repeatedNestedMessage_); + result.repeatedNestedMessage_.Add(values); return this; } public Builder ClearRepeatedNestedMessage() { @@ -4935,7 +4935,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedForeignMessage(scg::IEnumerable values) { - base.AddRange(values, result.repeatedForeignMessage_); + result.repeatedForeignMessage_.Add(values); return this; } public Builder ClearRepeatedForeignMessage() { @@ -4973,7 +4973,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedImportMessage(scg::IEnumerable values) { - base.AddRange(values, result.repeatedImportMessage_); + result.repeatedImportMessage_.Add(values); return this; } public Builder ClearRepeatedImportMessage() { @@ -4999,7 +4999,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedNestedEnum(scg::IEnumerable values) { - base.AddRange(values, result.repeatedNestedEnum_); + result.repeatedNestedEnum_.Add(values); return this; } public Builder ClearRepeatedNestedEnum() { @@ -5025,7 +5025,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedForeignEnum(scg::IEnumerable values) { - base.AddRange(values, result.repeatedForeignEnum_); + result.repeatedForeignEnum_.Add(values); return this; } public Builder ClearRepeatedForeignEnum() { @@ -5051,7 +5051,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedImportEnum(scg::IEnumerable values) { - base.AddRange(values, result.repeatedImportEnum_); + result.repeatedImportEnum_.Add(values); return this; } public Builder ClearRepeatedImportEnum() { @@ -5079,7 +5079,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedStringPiece(scg::IEnumerable values) { - base.AddRange(values, result.repeatedStringPiece_); + result.repeatedStringPiece_.Add(values); return this; } public Builder ClearRepeatedStringPiece() { @@ -5107,7 +5107,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedCord(scg::IEnumerable values) { - base.AddRange(values, result.repeatedCord_); + result.repeatedCord_.Add(values); return this; } public Builder ClearRepeatedCord() { @@ -8611,7 +8611,7 @@ namespace Google.ProtocolBuffers.TestProtos { MergeOptionalMessage(other.OptionalMessage); } if (other.repeatedMessage_.Count != 0) { - base.AddRange(other.repeatedMessage_, result.repeatedMessage_); + result.repeatedMessage_.Add(other.repeatedMessage_); } if (other.HasDummy) { Dummy = other.Dummy; @@ -8751,7 +8751,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedMessage(scg::IEnumerable values) { - base.AddRange(values, result.repeatedMessage_); + result.repeatedMessage_.Add(values); return this; } public Builder ClearRepeatedMessage() { @@ -11868,10 +11868,10 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(NestedMessage other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance) return this; if (other.nestedmessageRepeatedInt32_.Count != 0) { - base.AddRange(other.nestedmessageRepeatedInt32_, result.nestedmessageRepeatedInt32_); + result.nestedmessageRepeatedInt32_.Add(other.nestedmessageRepeatedInt32_); } if (other.nestedmessageRepeatedForeignmessage_.Count != 0) { - base.AddRange(other.nestedmessageRepeatedForeignmessage_, result.nestedmessageRepeatedForeignmessage_); + result.nestedmessageRepeatedForeignmessage_.Add(other.nestedmessageRepeatedForeignmessage_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -11952,7 +11952,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeNestedmessageRepeatedInt32(scg::IEnumerable values) { - base.AddRange(values, result.nestedmessageRepeatedInt32_); + result.nestedmessageRepeatedInt32_.Add(values); return this; } public Builder ClearNestedmessageRepeatedInt32() { @@ -11990,7 +11990,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeNestedmessageRepeatedForeignmessage(scg::IEnumerable values) { - base.AddRange(values, result.nestedmessageRepeatedForeignmessage_); + result.nestedmessageRepeatedForeignmessage_.Add(values); return this; } public Builder ClearNestedmessageRepeatedForeignmessage() { @@ -12638,22 +12638,22 @@ namespace Google.ProtocolBuffers.TestProtos { CordField = other.CordField; } if (other.repeatedPrimitiveField_.Count != 0) { - base.AddRange(other.repeatedPrimitiveField_, result.repeatedPrimitiveField_); + result.repeatedPrimitiveField_.Add(other.repeatedPrimitiveField_); } if (other.repeatedStringField_.Count != 0) { - base.AddRange(other.repeatedStringField_, result.repeatedStringField_); + result.repeatedStringField_.Add(other.repeatedStringField_); } if (other.repeatedEnumField_.Count != 0) { - base.AddRange(other.repeatedEnumField_, result.repeatedEnumField_); + result.repeatedEnumField_.Add(other.repeatedEnumField_); } if (other.repeatedMessageField_.Count != 0) { - base.AddRange(other.repeatedMessageField_, result.repeatedMessageField_); + result.repeatedMessageField_.Add(other.repeatedMessageField_); } if (other.repeatedStringPieceField_.Count != 0) { - base.AddRange(other.repeatedStringPieceField_, result.repeatedStringPieceField_); + result.repeatedStringPieceField_.Add(other.repeatedStringPieceField_); } if (other.repeatedCordField_.Count != 0) { - base.AddRange(other.repeatedCordField_, result.repeatedCordField_); + result.repeatedCordField_.Add(other.repeatedCordField_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -12926,7 +12926,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedPrimitiveField(scg::IEnumerable values) { - base.AddRange(values, result.repeatedPrimitiveField_); + result.repeatedPrimitiveField_.Add(values); return this; } public Builder ClearRepeatedPrimitiveField() { @@ -12954,7 +12954,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedStringField(scg::IEnumerable values) { - base.AddRange(values, result.repeatedStringField_); + result.repeatedStringField_.Add(values); return this; } public Builder ClearRepeatedStringField() { @@ -12980,7 +12980,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedEnumField(scg::IEnumerable values) { - base.AddRange(values, result.repeatedEnumField_); + result.repeatedEnumField_.Add(values); return this; } public Builder ClearRepeatedEnumField() { @@ -13018,7 +13018,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedMessageField(scg::IEnumerable values) { - base.AddRange(values, result.repeatedMessageField_); + result.repeatedMessageField_.Add(values); return this; } public Builder ClearRepeatedMessageField() { @@ -13046,7 +13046,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedStringPieceField(scg::IEnumerable values) { - base.AddRange(values, result.repeatedStringPieceField_); + result.repeatedStringPieceField_.Add(values); return this; } public Builder ClearRepeatedStringPieceField() { @@ -13074,7 +13074,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedCordField(scg::IEnumerable values) { - base.AddRange(values, result.repeatedCordField_); + result.repeatedCordField_.Add(values); return this; } public Builder ClearRepeatedCordField() { @@ -15409,46 +15409,46 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestPackedTypes other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedTypes.DefaultInstance) return this; if (other.packedInt32_.Count != 0) { - base.AddRange(other.packedInt32_, result.packedInt32_); + result.packedInt32_.Add(other.packedInt32_); } if (other.packedInt64_.Count != 0) { - base.AddRange(other.packedInt64_, result.packedInt64_); + result.packedInt64_.Add(other.packedInt64_); } if (other.packedUint32_.Count != 0) { - base.AddRange(other.packedUint32_, result.packedUint32_); + result.packedUint32_.Add(other.packedUint32_); } if (other.packedUint64_.Count != 0) { - base.AddRange(other.packedUint64_, result.packedUint64_); + result.packedUint64_.Add(other.packedUint64_); } if (other.packedSint32_.Count != 0) { - base.AddRange(other.packedSint32_, result.packedSint32_); + result.packedSint32_.Add(other.packedSint32_); } if (other.packedSint64_.Count != 0) { - base.AddRange(other.packedSint64_, result.packedSint64_); + result.packedSint64_.Add(other.packedSint64_); } if (other.packedFixed32_.Count != 0) { - base.AddRange(other.packedFixed32_, result.packedFixed32_); + result.packedFixed32_.Add(other.packedFixed32_); } if (other.packedFixed64_.Count != 0) { - base.AddRange(other.packedFixed64_, result.packedFixed64_); + result.packedFixed64_.Add(other.packedFixed64_); } if (other.packedSfixed32_.Count != 0) { - base.AddRange(other.packedSfixed32_, result.packedSfixed32_); + result.packedSfixed32_.Add(other.packedSfixed32_); } if (other.packedSfixed64_.Count != 0) { - base.AddRange(other.packedSfixed64_, result.packedSfixed64_); + result.packedSfixed64_.Add(other.packedSfixed64_); } if (other.packedFloat_.Count != 0) { - base.AddRange(other.packedFloat_, result.packedFloat_); + result.packedFloat_.Add(other.packedFloat_); } if (other.packedDouble_.Count != 0) { - base.AddRange(other.packedDouble_, result.packedDouble_); + result.packedDouble_.Add(other.packedDouble_); } if (other.packedBool_.Count != 0) { - base.AddRange(other.packedBool_, result.packedBool_); + result.packedBool_.Add(other.packedBool_); } if (other.packedEnum_.Count != 0) { - base.AddRange(other.packedEnum_, result.packedEnum_); + result.packedEnum_.Add(other.packedEnum_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -15599,7 +15599,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedInt32(scg::IEnumerable values) { - base.AddRange(values, result.packedInt32_); + result.packedInt32_.Add(values); return this; } public Builder ClearPackedInt32() { @@ -15625,7 +15625,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedInt64(scg::IEnumerable values) { - base.AddRange(values, result.packedInt64_); + result.packedInt64_.Add(values); return this; } public Builder ClearPackedInt64() { @@ -15656,7 +15656,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangePackedUint32(scg::IEnumerable values) { - base.AddRange(values, result.packedUint32_); + result.packedUint32_.Add(values); return this; } public Builder ClearPackedUint32() { @@ -15687,7 +15687,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangePackedUint64(scg::IEnumerable values) { - base.AddRange(values, result.packedUint64_); + result.packedUint64_.Add(values); return this; } public Builder ClearPackedUint64() { @@ -15713,7 +15713,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedSint32(scg::IEnumerable values) { - base.AddRange(values, result.packedSint32_); + result.packedSint32_.Add(values); return this; } public Builder ClearPackedSint32() { @@ -15739,7 +15739,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedSint64(scg::IEnumerable values) { - base.AddRange(values, result.packedSint64_); + result.packedSint64_.Add(values); return this; } public Builder ClearPackedSint64() { @@ -15770,7 +15770,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangePackedFixed32(scg::IEnumerable values) { - base.AddRange(values, result.packedFixed32_); + result.packedFixed32_.Add(values); return this; } public Builder ClearPackedFixed32() { @@ -15801,7 +15801,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangePackedFixed64(scg::IEnumerable values) { - base.AddRange(values, result.packedFixed64_); + result.packedFixed64_.Add(values); return this; } public Builder ClearPackedFixed64() { @@ -15827,7 +15827,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedSfixed32(scg::IEnumerable values) { - base.AddRange(values, result.packedSfixed32_); + result.packedSfixed32_.Add(values); return this; } public Builder ClearPackedSfixed32() { @@ -15853,7 +15853,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedSfixed64(scg::IEnumerable values) { - base.AddRange(values, result.packedSfixed64_); + result.packedSfixed64_.Add(values); return this; } public Builder ClearPackedSfixed64() { @@ -15879,7 +15879,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedFloat(scg::IEnumerable values) { - base.AddRange(values, result.packedFloat_); + result.packedFloat_.Add(values); return this; } public Builder ClearPackedFloat() { @@ -15905,7 +15905,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedDouble(scg::IEnumerable values) { - base.AddRange(values, result.packedDouble_); + result.packedDouble_.Add(values); return this; } public Builder ClearPackedDouble() { @@ -15931,7 +15931,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedBool(scg::IEnumerable values) { - base.AddRange(values, result.packedBool_); + result.packedBool_.Add(values); return this; } public Builder ClearPackedBool() { @@ -15957,7 +15957,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedEnum(scg::IEnumerable values) { - base.AddRange(values, result.packedEnum_); + result.packedEnum_.Add(values); return this; } public Builder ClearPackedEnum() { @@ -16444,46 +16444,46 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestUnpackedTypes other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypes.DefaultInstance) return this; if (other.unpackedInt32_.Count != 0) { - base.AddRange(other.unpackedInt32_, result.unpackedInt32_); + result.unpackedInt32_.Add(other.unpackedInt32_); } if (other.unpackedInt64_.Count != 0) { - base.AddRange(other.unpackedInt64_, result.unpackedInt64_); + result.unpackedInt64_.Add(other.unpackedInt64_); } if (other.unpackedUint32_.Count != 0) { - base.AddRange(other.unpackedUint32_, result.unpackedUint32_); + result.unpackedUint32_.Add(other.unpackedUint32_); } if (other.unpackedUint64_.Count != 0) { - base.AddRange(other.unpackedUint64_, result.unpackedUint64_); + result.unpackedUint64_.Add(other.unpackedUint64_); } if (other.unpackedSint32_.Count != 0) { - base.AddRange(other.unpackedSint32_, result.unpackedSint32_); + result.unpackedSint32_.Add(other.unpackedSint32_); } if (other.unpackedSint64_.Count != 0) { - base.AddRange(other.unpackedSint64_, result.unpackedSint64_); + result.unpackedSint64_.Add(other.unpackedSint64_); } if (other.unpackedFixed32_.Count != 0) { - base.AddRange(other.unpackedFixed32_, result.unpackedFixed32_); + result.unpackedFixed32_.Add(other.unpackedFixed32_); } if (other.unpackedFixed64_.Count != 0) { - base.AddRange(other.unpackedFixed64_, result.unpackedFixed64_); + result.unpackedFixed64_.Add(other.unpackedFixed64_); } if (other.unpackedSfixed32_.Count != 0) { - base.AddRange(other.unpackedSfixed32_, result.unpackedSfixed32_); + result.unpackedSfixed32_.Add(other.unpackedSfixed32_); } if (other.unpackedSfixed64_.Count != 0) { - base.AddRange(other.unpackedSfixed64_, result.unpackedSfixed64_); + result.unpackedSfixed64_.Add(other.unpackedSfixed64_); } if (other.unpackedFloat_.Count != 0) { - base.AddRange(other.unpackedFloat_, result.unpackedFloat_); + result.unpackedFloat_.Add(other.unpackedFloat_); } if (other.unpackedDouble_.Count != 0) { - base.AddRange(other.unpackedDouble_, result.unpackedDouble_); + result.unpackedDouble_.Add(other.unpackedDouble_); } if (other.unpackedBool_.Count != 0) { - base.AddRange(other.unpackedBool_, result.unpackedBool_); + result.unpackedBool_.Add(other.unpackedBool_); } if (other.unpackedEnum_.Count != 0) { - base.AddRange(other.unpackedEnum_, result.unpackedEnum_); + result.unpackedEnum_.Add(other.unpackedEnum_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -16634,7 +16634,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedInt32(scg::IEnumerable values) { - base.AddRange(values, result.unpackedInt32_); + result.unpackedInt32_.Add(values); return this; } public Builder ClearUnpackedInt32() { @@ -16660,7 +16660,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedInt64(scg::IEnumerable values) { - base.AddRange(values, result.unpackedInt64_); + result.unpackedInt64_.Add(values); return this; } public Builder ClearUnpackedInt64() { @@ -16691,7 +16691,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedUint32(scg::IEnumerable values) { - base.AddRange(values, result.unpackedUint32_); + result.unpackedUint32_.Add(values); return this; } public Builder ClearUnpackedUint32() { @@ -16722,7 +16722,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedUint64(scg::IEnumerable values) { - base.AddRange(values, result.unpackedUint64_); + result.unpackedUint64_.Add(values); return this; } public Builder ClearUnpackedUint64() { @@ -16748,7 +16748,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedSint32(scg::IEnumerable values) { - base.AddRange(values, result.unpackedSint32_); + result.unpackedSint32_.Add(values); return this; } public Builder ClearUnpackedSint32() { @@ -16774,7 +16774,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedSint64(scg::IEnumerable values) { - base.AddRange(values, result.unpackedSint64_); + result.unpackedSint64_.Add(values); return this; } public Builder ClearUnpackedSint64() { @@ -16805,7 +16805,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedFixed32(scg::IEnumerable values) { - base.AddRange(values, result.unpackedFixed32_); + result.unpackedFixed32_.Add(values); return this; } public Builder ClearUnpackedFixed32() { @@ -16836,7 +16836,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeUnpackedFixed64(scg::IEnumerable values) { - base.AddRange(values, result.unpackedFixed64_); + result.unpackedFixed64_.Add(values); return this; } public Builder ClearUnpackedFixed64() { @@ -16862,7 +16862,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedSfixed32(scg::IEnumerable values) { - base.AddRange(values, result.unpackedSfixed32_); + result.unpackedSfixed32_.Add(values); return this; } public Builder ClearUnpackedSfixed32() { @@ -16888,7 +16888,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedSfixed64(scg::IEnumerable values) { - base.AddRange(values, result.unpackedSfixed64_); + result.unpackedSfixed64_.Add(values); return this; } public Builder ClearUnpackedSfixed64() { @@ -16914,7 +16914,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedFloat(scg::IEnumerable values) { - base.AddRange(values, result.unpackedFloat_); + result.unpackedFloat_.Add(values); return this; } public Builder ClearUnpackedFloat() { @@ -16940,7 +16940,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedDouble(scg::IEnumerable values) { - base.AddRange(values, result.unpackedDouble_); + result.unpackedDouble_.Add(values); return this; } public Builder ClearUnpackedDouble() { @@ -16966,7 +16966,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedBool(scg::IEnumerable values) { - base.AddRange(values, result.unpackedBool_); + result.unpackedBool_.Add(values); return this; } public Builder ClearUnpackedBool() { @@ -16992,7 +16992,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeUnpackedEnum(scg::IEnumerable values) { - base.AddRange(values, result.unpackedEnum_); + result.unpackedEnum_.Add(values); return this; } public Builder ClearUnpackedEnum() { @@ -17956,10 +17956,10 @@ namespace Google.ProtocolBuffers.TestProtos { MergeDynamicMessageExtension(other.DynamicMessageExtension); } if (other.repeatedExtension_.Count != 0) { - base.AddRange(other.repeatedExtension_, result.repeatedExtension_); + result.repeatedExtension_.Add(other.repeatedExtension_); } if (other.packedExtension_.Count != 0) { - base.AddRange(other.packedExtension_, result.packedExtension_); + result.packedExtension_.Add(other.packedExtension_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -18216,7 +18216,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedExtension(scg::IEnumerable values) { - base.AddRange(values, result.repeatedExtension_); + result.repeatedExtension_.Add(values); return this; } public Builder ClearRepeatedExtension() { @@ -18242,7 +18242,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangePackedExtension(scg::IEnumerable values) { - base.AddRange(values, result.packedExtension_); + result.packedExtension_.Add(values); return this; } public Builder ClearPackedExtension() { @@ -18541,22 +18541,22 @@ namespace Google.ProtocolBuffers.TestProtos { public override Builder MergeFrom(TestRepeatedScalarDifferentTagSizes other) { if (other == global::Google.ProtocolBuffers.TestProtos.TestRepeatedScalarDifferentTagSizes.DefaultInstance) return this; if (other.repeatedFixed32_.Count != 0) { - base.AddRange(other.repeatedFixed32_, result.repeatedFixed32_); + result.repeatedFixed32_.Add(other.repeatedFixed32_); } if (other.repeatedInt32_.Count != 0) { - base.AddRange(other.repeatedInt32_, result.repeatedInt32_); + result.repeatedInt32_.Add(other.repeatedInt32_); } if (other.repeatedFixed64_.Count != 0) { - base.AddRange(other.repeatedFixed64_, result.repeatedFixed64_); + result.repeatedFixed64_.Add(other.repeatedFixed64_); } if (other.repeatedInt64_.Count != 0) { - base.AddRange(other.repeatedInt64_, result.repeatedInt64_); + result.repeatedInt64_.Add(other.repeatedInt64_); } if (other.repeatedFloat_.Count != 0) { - base.AddRange(other.repeatedFloat_, result.repeatedFloat_); + result.repeatedFloat_.Add(other.repeatedFloat_); } if (other.repeatedUint64_.Count != 0) { - base.AddRange(other.repeatedUint64_, result.repeatedUint64_); + result.repeatedUint64_.Add(other.repeatedUint64_); } this.MergeUnknownFields(other.UnknownFields); return this; @@ -18663,7 +18663,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedFixed32_); + result.repeatedFixed32_.Add(values); return this; } public Builder ClearRepeatedFixed32() { @@ -18689,7 +18689,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedInt32(scg::IEnumerable values) { - base.AddRange(values, result.repeatedInt32_); + result.repeatedInt32_.Add(values); return this; } public Builder ClearRepeatedInt32() { @@ -18720,7 +18720,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedFixed64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedFixed64_); + result.repeatedFixed64_.Add(values); return this; } public Builder ClearRepeatedFixed64() { @@ -18746,7 +18746,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedInt64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedInt64_); + result.repeatedInt64_.Add(values); return this; } public Builder ClearRepeatedInt64() { @@ -18772,7 +18772,7 @@ namespace Google.ProtocolBuffers.TestProtos { return this; } public Builder AddRangeRepeatedFloat(scg::IEnumerable values) { - base.AddRange(values, result.repeatedFloat_); + result.repeatedFloat_.Add(values); return this; } public Builder ClearRepeatedFloat() { @@ -18803,7 +18803,7 @@ namespace Google.ProtocolBuffers.TestProtos { } [global::System.CLSCompliant(false)] public Builder AddRangeRepeatedUint64(scg::IEnumerable values) { - base.AddRange(values, result.repeatedUint64_); + result.repeatedUint64_.Add(values); return this; } public Builder ClearRepeatedUint64() { From e1e69ba3533ad4cde31bd48ebd4d29dd7540ffff Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 16 Sep 2011 12:46:38 -0500 Subject: [PATCH 15/31] Removed the NoWarn for missing comments --- src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj index 4d0cff4449..11c5bd7c9c 100644 --- a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj +++ b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj @@ -45,10 +45,7 @@ prompt 4 AllRules.ruleset - - true - 1591 pdbonly @@ -58,10 +55,7 @@ prompt 4 AllRules.ruleset - - true - 1591 From 0f838d13d2718d40c0ac9d8c1ca8a6ad718e28cb Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 16 Sep 2011 16:16:09 -0500 Subject: [PATCH 16/31] Fixed line-endings in bat/txt files --- build/Build.bat | 18 +++---- build/BuildAll.bat | 82 +++++++++++++++---------------- build/BuildSilverlight2.bat | 8 +-- build/GenerateCompletePackage.bat | 36 +++++++------- build/GenerateReleasePackage.bat | 24 ++++----- build/RunBenchmarks.bat | 8 +-- build/build35.bat | 16 +++--- license.txt | 62 +++++++++++------------ todo.txt | 16 ------ 9 files changed, 127 insertions(+), 143 deletions(-) delete mode 100644 todo.txt diff --git a/build/Build.bat b/build/Build.bat index 3269d54b83..2b246cadf8 100644 --- a/build/Build.bat +++ b/build/Build.bat @@ -1,10 +1,10 @@ -@echo off -SET BUILD_TARGET=%1 -SET BUILD_CONFIG=%2 - -IF "%BUILD_TARGET%"=="" SET BUILD_TARGET=Rebuild -IF "%BUILD_CONFIG%"=="" SET BUILD_CONFIG=Debug - -CMD.exe /Q /C "CD %~dp0 && %WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe build.csproj %3 %4 %5 %6 /t:%BUILD_TARGET% /p:BuildConfiguration=%BUILD_CONFIG% /p:Platform="Any CPU" /p:BuildTools=4.0 /toolsversion:4.0" - +@echo off +SET BUILD_TARGET=%1 +SET BUILD_CONFIG=%2 + +IF "%BUILD_TARGET%"=="" SET BUILD_TARGET=Rebuild +IF "%BUILD_CONFIG%"=="" SET BUILD_CONFIG=Debug + +CMD.exe /Q /C "CD %~dp0 && %WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe build.csproj %3 %4 %5 %6 /t:%BUILD_TARGET% /p:BuildConfiguration=%BUILD_CONFIG% /p:Platform="Any CPU" /p:BuildTools=4.0 /toolsversion:4.0" + pause \ No newline at end of file diff --git a/build/BuildAll.bat b/build/BuildAll.bat index 984fb7910a..e80ac8d909 100644 --- a/build/BuildAll.bat +++ b/build/BuildAll.bat @@ -1,42 +1,42 @@ -@ECHO OFF - -SET PREV_WORKING_DIR=%CD% -CD %~dp0 - -REM -- 3.5 Debug build, ensure this continues to work -%WINDIR%\Microsoft.NET\Framework\v3.5\MSBuild.exe build.csproj /t:Rebuild /p:BuildConfiguration=Debug /p:Platform="Any CPU" /p:BuildTools=3.5 /toolsversion:3.5" -IF ERRORLEVEL 1 GOTO ERROR - -REM -- 4.0 Debug build -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild /p:BuildConfiguration=Debug /p:Platform="Any CPU" -IF ERRORLEVEL 1 GOTO ERROR - -REM -- 4.0 Release build -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild /p:BuildConfiguration=Release /p:Platform="Any CPU" -IF ERRORLEVEL 1 GOTO ERROR - -IF EXIST "%ProgramFiles%\MSBuild\Microsoft\Silverlight\v2.0\Microsoft.Silverlight.CSharp.targets" GOTO SILVERLIGHT -IF EXIST "%ProgramFiles(x86)%\MSBuild\Microsoft\Silverlight\v2.0\Microsoft.Silverlight.CSharp.targets" GOTO SILVERLIGHT - -ECHO Unable to locate %ProgramFiles(x86)%\MSBuild\Microsoft\Silverlight\v2.0 -GOTO ERROR - -:SILVERLIGHT - -REM -- 4.0 Debug_Silverlight2 build -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild /p:BuildConfiguration=Debug_Silverlight2 /p:Platform="Any CPU" -IF ERRORLEVEL 1 GOTO ERROR - -REM -- 4.0 Release_Silverlight2 build -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild /p:BuildConfiguration=Release_Silverlight2 /p:Platform="Any CPU" -IF ERRORLEVEL 1 GOTO ERROR - -GOTO END - -:ERROR -CD %PREV_WORKING_DIR% -PAUSE - -:END -CD %PREV_WORKING_DIR% +@ECHO OFF + +SET PREV_WORKING_DIR=%CD% +CD %~dp0 + +REM -- 3.5 Debug build, ensure this continues to work +%WINDIR%\Microsoft.NET\Framework\v3.5\MSBuild.exe build.csproj /t:Rebuild /p:BuildConfiguration=Debug /p:Platform="Any CPU" /p:BuildTools=3.5 /toolsversion:3.5" +IF ERRORLEVEL 1 GOTO ERROR + +REM -- 4.0 Debug build +%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild /p:BuildConfiguration=Debug /p:Platform="Any CPU" +IF ERRORLEVEL 1 GOTO ERROR + +REM -- 4.0 Release build +%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild /p:BuildConfiguration=Release /p:Platform="Any CPU" +IF ERRORLEVEL 1 GOTO ERROR + +IF EXIST "%ProgramFiles%\MSBuild\Microsoft\Silverlight\v2.0\Microsoft.Silverlight.CSharp.targets" GOTO SILVERLIGHT +IF EXIST "%ProgramFiles(x86)%\MSBuild\Microsoft\Silverlight\v2.0\Microsoft.Silverlight.CSharp.targets" GOTO SILVERLIGHT + +ECHO Unable to locate %ProgramFiles(x86)%\MSBuild\Microsoft\Silverlight\v2.0 +GOTO ERROR + +:SILVERLIGHT + +REM -- 4.0 Debug_Silverlight2 build +%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild /p:BuildConfiguration=Debug_Silverlight2 /p:Platform="Any CPU" +IF ERRORLEVEL 1 GOTO ERROR + +REM -- 4.0 Release_Silverlight2 build +%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild /p:BuildConfiguration=Release_Silverlight2 /p:Platform="Any CPU" +IF ERRORLEVEL 1 GOTO ERROR + +GOTO END + +:ERROR +CD %PREV_WORKING_DIR% +PAUSE + +:END +CD %PREV_WORKING_DIR% SET PREV_WORKING_DIR= \ No newline at end of file diff --git a/build/BuildSilverlight2.bat b/build/BuildSilverlight2.bat index bc1dd21e97..1baccacfdf 100644 --- a/build/BuildSilverlight2.bat +++ b/build/BuildSilverlight2.bat @@ -1,5 +1,5 @@ -@echo off - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build /p:BuildConfiguration=Debug_Silverlight2 /p:Platform="Any CPU" - +@echo off + +%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Build /p:BuildConfiguration=Debug_Silverlight2 /p:Platform="Any CPU" + pause \ No newline at end of file diff --git a/build/GenerateCompletePackage.bat b/build/GenerateCompletePackage.bat index 6aa3b379ce..e281596116 100644 --- a/build/GenerateCompletePackage.bat +++ b/build/GenerateCompletePackage.bat @@ -1,19 +1,19 @@ -@ECHO OFF -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:PrepareOutputDirectory -IF ERRORLEVEL 1 GOTO END - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Debug /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% -IF ERRORLEVEL 1 GOTO END - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Debug_Silverlight2 /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% -IF ERRORLEVEL 1 GOTO END - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Release /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% -IF ERRORLEVEL 1 GOTO END - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Release_Silverlight2 /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% -IF ERRORLEVEL 1 GOTO END - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:GeneratePackage /p:PackageName=AllBinariesAndSource.zip /p:Platform="Any CPU" - +@ECHO OFF +%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:PrepareOutputDirectory +IF ERRORLEVEL 1 GOTO END + +%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Debug /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% +IF ERRORLEVEL 1 GOTO END + +%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Debug_Silverlight2 /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% +IF ERRORLEVEL 1 GOTO END + +%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Release /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% +IF ERRORLEVEL 1 GOTO END + +%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Release_Silverlight2 /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% +IF ERRORLEVEL 1 GOTO END + +%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:GeneratePackage /p:PackageName=AllBinariesAndSource.zip /p:Platform="Any CPU" + :END \ No newline at end of file diff --git a/build/GenerateReleasePackage.bat b/build/GenerateReleasePackage.bat index 921de95724..bd2a7f867f 100644 --- a/build/GenerateReleasePackage.bat +++ b/build/GenerateReleasePackage.bat @@ -1,13 +1,13 @@ -@ECHO OFF -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:PrepareOutputDirectory -IF ERRORLEVEL 1 GOTO END - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Release /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% -IF ERRORLEVEL 1 GOTO END - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Release_Silverlight2 /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% -IF ERRORLEVEL 1 GOTO END - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:GeneratePackage /p:PackageName=ReleaseBinaries.zip /p:Platform="Any CPU" - +@ECHO OFF +%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:PrepareOutputDirectory +IF ERRORLEVEL 1 GOTO END + +%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Release /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% +IF ERRORLEVEL 1 GOTO END + +%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:Rebuild;PreparePackageComponent /p:BuildConfiguration=Release_Silverlight2 /p:Platform="Any CPU" %PROTOBUF_KEY_FILE% +IF ERRORLEVEL 1 GOTO END + +%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.csproj /m /t:GeneratePackage /p:PackageName=ReleaseBinaries.zip /p:Platform="Any CPU" + :END \ No newline at end of file diff --git a/build/RunBenchmarks.bat b/build/RunBenchmarks.bat index 863eafaead..5a32f3f2b3 100644 --- a/build/RunBenchmarks.bat +++ b/build/RunBenchmarks.bat @@ -1,5 +1,5 @@ -@echo off - -%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild %~dp0\build.csproj /m /t:RunBenchmarks /p:BuildConfiguration=Release /p:Platform="Any CPU" - +@echo off + +%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild %~dp0\build.csproj /m /t:RunBenchmarks /p:BuildConfiguration=Release /p:Platform="Any CPU" + pause \ No newline at end of file diff --git a/build/build35.bat b/build/build35.bat index 87729d8f8c..02f803bd93 100644 --- a/build/build35.bat +++ b/build/build35.bat @@ -1,8 +1,8 @@ -@echo off -SET BUILD_TARGET=%1 -SET BUILD_CONFIG=%2 - -IF "%BUILD_TARGET%"=="" SET BUILD_TARGET=Rebuild -IF "%BUILD_CONFIG%"=="" SET BUILD_CONFIG=Debug - -CMD.exe /Q /C "CD %~dp0 && %WINDIR%\Microsoft.NET\Framework\v3.5\MSBuild.exe build.csproj %3 %4 %5 %6 /t:%BUILD_TARGET% /p:BuildConfiguration=%BUILD_CONFIG% /p:Platform="Any CPU" /p:BuildTools=3.5 /toolsversion:3.5" +@echo off +SET BUILD_TARGET=%1 +SET BUILD_CONFIG=%2 + +IF "%BUILD_TARGET%"=="" SET BUILD_TARGET=Rebuild +IF "%BUILD_CONFIG%"=="" SET BUILD_CONFIG=Debug + +CMD.exe /Q /C "CD %~dp0 && %WINDIR%\Microsoft.NET\Framework\v3.5\MSBuild.exe build.csproj %3 %4 %5 %6 /t:%BUILD_TARGET% /p:BuildConfiguration=%BUILD_CONFIG% /p:Platform="Any CPU" /p:BuildTools=3.5 /toolsversion:3.5" diff --git a/license.txt b/license.txt index b8e773b2e0..2715f7b89e 100644 --- a/license.txt +++ b/license.txt @@ -1,31 +1,31 @@ -Protocol Buffers - Google's data interchange format -Copyright 2008-2010 Google Inc. All rights reserved. -http://github.com/jskeet/dotnet-protobufs/ -Original C++/Java/Python code: -http://code.google.com/p/protobuf/ - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +Protocol Buffers - Google's data interchange format +Copyright 2008-2010 Google Inc. All rights reserved. +http://github.com/jskeet/dotnet-protobufs/ +Original C++/Java/Python code: +http://code.google.com/p/protobuf/ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/todo.txt b/todo.txt deleted file mode 100644 index 5256ca0898..0000000000 --- a/todo.txt +++ /dev/null @@ -1,16 +0,0 @@ -Current task list (not in order) - -- Remove multifile support -- Docs -- Clean up protogen code -- Avoid using reflection for messages which don't need it (is this - possible?) -- Bring service generation into line with Java -- Build protoc as a dll and use directly from protogen -- Check copyright is everywhere -- Work out how to unit test Silverlight code -- Reformat code -- Change generated format -- Add regions to copyright -- Build and publish binaries -- Work out why the Compact Framework 3.5 build fails under VS2010 From f0b72c744343d80b5ef029f2a48350512f9e138b Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 16 Sep 2011 16:16:55 -0500 Subject: [PATCH 17/31] Renamed readme.txt to CHANGES.txt for compatibility with main protobuf project. Updated release notes to include details about previous and pending releases. --- CHANGES.txt | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++ readme.txt | 40 ----------------------- 2 files changed, 92 insertions(+), 40 deletions(-) create mode 100644 CHANGES.txt delete mode 100644 readme.txt diff --git a/CHANGES.txt b/CHANGES.txt new file mode 100644 index 0000000000..d3e5a85a8b --- /dev/null +++ b/CHANGES.txt @@ -0,0 +1,92 @@ +=============================================================================== +Welcome to the C# port of Google Protocol Buffers, written by Jon Skeet +(skeet@pobox.com) based on the work of many talented people. + +For more information about this port, visit its homepage: +http://protobuf-csharp-port.googlecode.com + +For more information about Protocol Buffers in general, visit the project page +for the C++, Java and Python project: +http://protobuf.googlecode.com +=============================================================================== +RELEASE NOTES - Version TBD +=============================================================================== + +(PENDING MERGE) +- Issue 20: Support for decorating classes [Serializable] +- Issue 22: Reusable Builder classes +- Issue 24: Support for using Json/Xml formats with ICodedInputStream + +Features: +- Added option service_generator_type to control service generation with + NONE, GENERIC, INTERFACE, or IRPCDISPATCH +- Added interfaces IRpcDispatch and IRpcServerStub to provide for blocking + services and implementations. +- Added ProtoGen.exe command-line argument "--protoc_dir=" to specify the + location of protoc.exe. +- Extracted interfaces for ICodedInputStream and ICodedOutputStream to allow + custom implementation of writers with both speed and size optimizations. +- Addition of the "Google.ProtoBuffers.Serialization" assembly to support + reading and writing messages to/from XML, JSON, IDictionary<,> and others. +- Several performance related fixes and tweeks +- Issue 3: Add option to mark generated code with attribute +- Issue 21: Decorate fields with [deprecated=true] as [System.Obsolete] + +Fixes: +- Issue 13: Message with Field same name as message causes uncompilable .cs +- Issue 16: Does not integrate well with other tooling +- Issue 19: Support for negative enum values +- Issue 26: AddRange in GeneratedBuilder iterates twice. +- Issue 27: Remove XML documentation output from test projects to clear + warnings/errors. +- Big-endian support for float, and double on Silverlight +- Packed and Unpacked parsing allow for all repeated, as per version 2.3 +- Fix for leaving Builder a public ctor on internal classes for use with + generic "where T: new()" constraints. + +Other: +- Reformatted all code and line-endings to C# defaults +- Reworking of performance benchmarks to produce reliable results, option /v2 + +=============================================================================== +RELEASE NOTES - Version 2.3.0.277 +=============================================================================== + +Features: +- Added cls_compliance option to generate attributes indicating + non-CLS-compliance. +- Added file_extension option to control the generated output file's extension. +- Added umbrella_namespace option to place the umbrella class into a nested + namespace to address issues with proto files having the same name as a + message it contains. +- Added output_directory option to set the output path for the source file(s). +- Added ignore_google_protobuf option to avoid generating code for includes + from the google.protobuf package. +- Added the LITE framework (Google.ProtoBuffersLite.dll) and the ability to + generate code with "option optimize_for = LITE_RUNTIME;". +- Added ability to invoke protoc.exe from within ProtoGen.exe. +- Upgraded to protoc.exe (2.3) compiler. + +Fixes: +- Issue 9: Class cannot be static and sealed error +- Issue 12: default value for enumerate fields must be filled out + +Other: +- Rewrite of build using MSBbuild instead of NAnt +- Moved to NUnit Version 2.2.8.0 +- Changed to using secure .snk for releases + +=============================================================================== +RELEASE NOTES - Version 0.9.1 +=============================================================================== + +Fixes: +- issue 10: Incorrect encoding of packed fields when serialized + +=============================================================================== +RELEASE NOTES - Version 0.9.0 +=============================================================================== + +- Initial release + +=============================================================================== \ No newline at end of file diff --git a/readme.txt b/readme.txt deleted file mode 100644 index 52228845b6..0000000000 --- a/readme.txt +++ /dev/null @@ -1,40 +0,0 @@ -Welcome to the C# port of Google Protocol Buffers, written by Jon Skeet -(skeet@pobox.com) based on the work of many talented people. - -For more information about this port, visit its homepage: -http://protobuf-csharp-port.googlecode.com - -For more information about Protocol Buffers in general, visit the -project page for the C++, Java and Python project: -http://protobuf.googlecode.com - - -Release 0.9.1 -------------- - -Fix to release 0.9: - -- Include protos in binary download -- Fix issue 10: incorrect encoding of packed fields when serialized - size wasn't fetched first - - -Release 0.9 ------------ - -Due to popular demand, I have built a version of the binaries to put -on the web site. Currently these are set at assembly version 0.9, -and an assembly file version of 0.9. This should be seen as a mark -of the readiness of the release process more than the stability of -the code. As far as I'm aware, the code itself is perfectly fine: I -certainly have plans for more features particularly around making -code generation simpler, but you should feel confident about the -parsing and serialization of messages produced with this version of -the library. Of course, if you do find any problems, *please* report -them at the web site. - -Currently the downloadable release is built with the snk file which -is in the open source library. I am considering having a privately -held key so that you can check that you're building against a -"blessed" release - feedback on this (and any other aspect of the -release process) is very welcome. From aeb30d8351f33350d58e6795b16c4f861939f4e3 Mon Sep 17 00:00:00 2001 From: csharptest Date: Tue, 20 Sep 2011 13:17:03 -0500 Subject: [PATCH 18/31] changes from review --- protos/extest/unittest_extras_xmltest.proto | 44 +++++++++--------- src/ProtocolBuffers.Test/SerializableTest.cs | 48 +++++++++++++++----- src/ProtocolBuffers/CustomSerialization.cs | 22 +++++---- 3 files changed, 69 insertions(+), 45 deletions(-) diff --git a/protos/extest/unittest_extras_xmltest.proto b/protos/extest/unittest_extras_xmltest.proto index 7fc4e3a2e9..ab8088a76b 100644 --- a/protos/extest/unittest_extras_xmltest.proto +++ b/protos/extest/unittest_extras_xmltest.proto @@ -8,46 +8,44 @@ package protobuf_unittest_extra; option optimize_for = SPEED; enum EnumOptions { - ONE = 0; - TWO = 1; - THREE = 2; + ONE = 0; + TWO = 1; + THREE = 2; } -message TestXmlChild -{ - repeated EnumOptions options = 3; - optional bytes binary = 4; +message TestXmlChild { + repeated EnumOptions options = 3; + optional bytes binary = 4; } message TestXmlNoFields { } message TestXmlRescursive { - optional TestXmlRescursive child = 1; + optional TestXmlRescursive child = 1; } message TestXmlMessage { - optional int64 number = 6; - repeated int32 numbers = 2; - optional string text = 3; - repeated string textlines = 700; - optional bool valid = 5; - - optional TestXmlChild child = 1; - repeated group Children = 401 - { - repeated EnumOptions options = 3; - optional bytes binary = 4; - } - - extensions 100 to 199; + optional int64 number = 6; + repeated int32 numbers = 2; + optional string text = 3; + repeated string textlines = 700; + optional bool valid = 5; + + optional TestXmlChild child = 1; + repeated group Children = 401 { + repeated EnumOptions options = 3; + optional bytes binary = 4; + } + +extensions 100 to 199; } message TestXmlExtension { required int32 number = 1; } - + extend TestXmlMessage { optional EnumOptions extension_enum = 101; optional string extension_text = 102; diff --git a/src/ProtocolBuffers.Test/SerializableTest.cs b/src/ProtocolBuffers.Test/SerializableTest.cs index 701cfc6b0f..f1073c1e45 100644 --- a/src/ProtocolBuffers.Test/SerializableTest.cs +++ b/src/ProtocolBuffers.Test/SerializableTest.cs @@ -31,9 +31,15 @@ namespace Google.ProtocolBuffers .AddNumbers(1) .AddNumbers(2) .AddNumbers(3) - .SetChild(TestXmlChild.CreateBuilder().AddOptions(EnumOptions.ONE).SetBinary(ByteString.CopyFrom(new byte[1]))) - .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.TWO).SetBinary(ByteString.CopyFrom(new byte[2]))) - .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.THREE).SetBinary(ByteString.CopyFrom(new byte[3]))) + .SetChild(TestXmlChild.CreateBuilder() + .AddOptions(EnumOptions.ONE) + .SetBinary(ByteString.CopyFrom(new byte[1]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder() + .AddOptions(EnumOptions.TWO) + .SetBinary(ByteString.CopyFrom(new byte[2]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder() + .AddOptions(EnumOptions.THREE) + .SetBinary(ByteString.CopyFrom(new byte[3]))) .Build(); MemoryStream ms = new MemoryStream(); @@ -58,9 +64,15 @@ namespace Google.ProtocolBuffers .AddNumbers(1) .AddNumbers(2) .AddNumbers(3) - .SetChild(TestXmlChild.CreateBuilder().AddOptions(EnumOptions.ONE).SetBinary(ByteString.CopyFrom(new byte[1]))) - .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.TWO).SetBinary(ByteString.CopyFrom(new byte[2]))) - .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.THREE).SetBinary(ByteString.CopyFrom(new byte[3]))) + .SetChild(TestXmlChild.CreateBuilder() + .AddOptions(EnumOptions.ONE) + .SetBinary(ByteString.CopyFrom(new byte[1]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder() + .AddOptions(EnumOptions.TWO) + .SetBinary(ByteString.CopyFrom(new byte[2]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder() + .AddOptions(EnumOptions.THREE) + .SetBinary(ByteString.CopyFrom(new byte[3]))) .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionText, " extension text value ! ") .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionMessage, new TestXmlExtension.Builder().SetNumber(42).Build()) .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 100) @@ -97,9 +109,15 @@ namespace Google.ProtocolBuffers .AddNumbers(1) .AddNumbers(2) .AddNumbers(3) - .SetChild(TestXmlChild.CreateBuilder().AddOptions(EnumOptions.ONE).SetBinary(ByteString.CopyFrom(new byte[1]))) - .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.TWO).SetBinary(ByteString.CopyFrom(new byte[2]))) - .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.THREE).SetBinary(ByteString.CopyFrom(new byte[3]))) + .SetChild(TestXmlChild.CreateBuilder() + .AddOptions(EnumOptions.ONE) + .SetBinary(ByteString.CopyFrom(new byte[1]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder() + .AddOptions(EnumOptions.TWO) + .SetBinary(ByteString.CopyFrom(new byte[2]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder() + .AddOptions(EnumOptions.THREE) + .SetBinary(ByteString.CopyFrom(new byte[3]))) ; MemoryStream ms = new MemoryStream(); @@ -124,9 +142,15 @@ namespace Google.ProtocolBuffers .AddNumbers(1) .AddNumbers(2) .AddNumbers(3) - .SetChild(TestXmlChild.CreateBuilder().AddOptions(EnumOptions.ONE).SetBinary(ByteString.CopyFrom(new byte[1]))) - .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.TWO).SetBinary(ByteString.CopyFrom(new byte[2]))) - .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.THREE).SetBinary(ByteString.CopyFrom(new byte[3]))) + .SetChild(TestXmlChild.CreateBuilder() + .AddOptions(EnumOptions.ONE) + .SetBinary(ByteString.CopyFrom(new byte[1]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder() + .AddOptions(EnumOptions.TWO) + .SetBinary(ByteString.CopyFrom(new byte[2]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder() + .AddOptions(EnumOptions.THREE) + .SetBinary(ByteString.CopyFrom(new byte[3]))) .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionText, " extension text value ! ") .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionMessage, new TestXmlExtension.Builder().SetNumber(42).Build()) .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 100) diff --git a/src/ProtocolBuffers/CustomSerialization.cs b/src/ProtocolBuffers/CustomSerialization.cs index 940d3c80d1..5af673add8 100644 --- a/src/ProtocolBuffers/CustomSerialization.cs +++ b/src/ProtocolBuffers/CustomSerialization.cs @@ -45,7 +45,7 @@ namespace Google.ProtocolBuffers { /* * Specialized handing of *all* message types. Messages are serialized into a byte[] and stored - * into the SerializationInfo, they are then reconstituded by an IObjectReference class after + * into the SerializationInfo, and are then reconstituted by an IObjectReference class after * deserialization. IDeserializationCallback is supported on both the Builder and Message. */ [Serializable] @@ -71,22 +71,23 @@ namespace Google.ProtocolBuffers _initialized = info.GetBoolean("initialized"); } - Object IObjectReference.GetRealObject(StreamingContext context) + object IObjectReference.GetRealObject(StreamingContext context) { ExtensionRegistry registry = context.Context as ExtensionRegistry; TBuilder builder = TemplateInstance.DefaultInstanceForType.CreateBuilderForType(); builder.MergeFrom(_message, registry ?? ExtensionRegistry.Empty); - if (builder is IDeserializationCallback) + IDeserializationCallback callback = builder as IDeserializationCallback; + if(callback != null) { - ((IDeserializationCallback) builder).OnDeserialization(context); + callback.OnDeserialization(context); } TMessage message = _initialized ? builder.Build() : builder.BuildPartial(); - - if (message is IDeserializationCallback) + callback = message as IDeserializationCallback; + if (callback != null) { - ((IDeserializationCallback) message).OnDeserialization(context); + callback.OnDeserialization(context); } return message; @@ -119,15 +120,16 @@ namespace Google.ProtocolBuffers _message = (byte[])info.GetValue("message", typeof(byte[])); } - Object IObjectReference.GetRealObject(StreamingContext context) + object IObjectReference.GetRealObject(StreamingContext context) { ExtensionRegistry registry = context.Context as ExtensionRegistry; TBuilder builder = TemplateInstance.DefaultInstanceForType.CreateBuilderForType(); builder.MergeFrom(_message, registry ?? ExtensionRegistry.Empty); - if (builder is IDeserializationCallback) + IDeserializationCallback callback = builder as IDeserializationCallback; + if(callback != null) { - ((IDeserializationCallback) builder).OnDeserialization(context); + callback.OnDeserialization(context); } return builder; From e0e128bb9ac3d8263a4c5deffca4036c1f7d344d Mon Sep 17 00:00:00 2001 From: csharptest Date: Tue, 20 Sep 2011 14:24:20 -0500 Subject: [PATCH 19/31] Added comments to service interfaces, added IDisposable to service stub since it's generated --- src/ProtocolBuffers/IRpcDispatch.cs | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/ProtocolBuffers/IRpcDispatch.cs b/src/ProtocolBuffers/IRpcDispatch.cs index 1da5c80635..524838e4c3 100644 --- a/src/ProtocolBuffers/IRpcDispatch.cs +++ b/src/ProtocolBuffers/IRpcDispatch.cs @@ -34,18 +34,42 @@ #endregion +using System; + namespace Google.ProtocolBuffers { /// - /// + /// Provides an entry-point for transport listeners to call a specified method on a service /// - public interface IRpcServerStub + public interface IRpcServerStub : IDisposable { + /// + /// Calls the method identified by methodName and returns the message + /// + /// The method name on the service descriptor (case-sensitive) + /// The ICodedInputStream to deserialize the call parameter from + /// The extension registry to use when deserializing the call parameter + /// The message that was returned from the service's method IMessageLite CallMethod(string methodName, ICodedInputStream input, ExtensionRegistry registry); } + /// + /// Used to forward an invocation of a service method to a transport sender implementation + /// public interface IRpcDispatch { + /// + /// Calls the service member on the endpoint connected. This is generally done by serializing + /// the message, sending the bytes over a transport, and then deserializing the call parameter + /// to invoke the service's actual implementation via IRpcServerStub. Once the call has + /// completed the result message is serialized and returned to the originating endpoint. + /// + /// The type of the response message + /// The type of of the response builder + /// The name of the method on the service + /// The message instance provided to the service call + /// The builder used to deserialize the response + /// The resulting message of the service call TMessage CallMethod(string method, IMessageLite request, IBuilderLite response) where TMessage : IMessageLite From 22efa1a8e8c912f6f10512eea8a759409898f395 Mon Sep 17 00:00:00 2001 From: csharptest Date: Thu, 22 Sep 2011 17:53:04 -0500 Subject: [PATCH 20/31] Added a Notepad++ user-defined language syntax for protobuffer files --- protos/npp.language.xml | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 protos/npp.language.xml diff --git a/protos/npp.language.xml b/protos/npp.language.xml new file mode 100644 index 0000000000..c6122180ac --- /dev/null +++ b/protos/npp.language.xml @@ -0,0 +1,44 @@ + + + + + + + + + + [00]00 + { + } + = + 1option 1package 1import 2; 0// + message enum service extend + required optional repeated extensions to rpc returns + double float int32 int64 uint32 uint64 sint32 sint64 fixed32 fixed64 sfixed32 sfixed64 bool string bytes + + + + + + + + + + + + + + + + + + + + From 3b625064e8e40f37ec510cc4f25035a9c1554c73 Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 23 Sep 2011 10:14:14 -0500 Subject: [PATCH 21/31] One more test to ensure DefaultInstance is read-only --- src/ProtocolBuffers.Test/ReusableBuilderTest.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ProtocolBuffers.Test/ReusableBuilderTest.cs b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs index 2f81a8144f..194313cba3 100644 --- a/src/ProtocolBuffers.Test/ReusableBuilderTest.cs +++ b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; +using Google.ProtocolBuffers.Collections; using NUnit.Framework; using Google.ProtocolBuffers.TestProtos; using Google.ProtocolBuffers.Serialization; @@ -10,6 +11,15 @@ namespace Google.ProtocolBuffers [TestFixture] public class ReusableBuilderTest { + [Test] + public void TestModifyDefaultInstance() + { + //verify that the default instance has correctly been marked as read-only + Assert.AreEqual(typeof(PopsicleList), TestAllTypes.DefaultInstance.RepeatedBoolList.GetType()); + PopsicleList list = (PopsicleList)TestAllTypes.DefaultInstance.RepeatedBoolList; + Assert.IsTrue(list.IsReadOnly); + } + [Test] public void TestUnmodifiedDefaultInstance() { From 8bd88ea8072c704777e4ba024707ce3614dd2d03 Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 23 Sep 2011 11:08:29 -0500 Subject: [PATCH 22/31] Added unit test to repro issue 28 --- protos/extest/unittest_issues.proto | 9 +++++++++ src/ProtocolBuffers.Test/ReusableBuilderTest.cs | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/protos/extest/unittest_issues.proto b/protos/extest/unittest_issues.proto index 459e58f865..21b5566efd 100644 --- a/protos/extest/unittest_issues.proto +++ b/protos/extest/unittest_issues.proto @@ -86,3 +86,12 @@ message NumberField { optional int32 _01 = 1; } +// Issue 28: Circular message dependencies result in null defaults for DefaultInstance + +message MyMessageAReferenceB { + required MyMessageBReferenceA value = 1; +} + +message MyMessageBReferenceA { + required MyMessageAReferenceB value = 1; +} diff --git a/src/ProtocolBuffers.Test/ReusableBuilderTest.cs b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs index 194313cba3..58d643ede7 100644 --- a/src/ProtocolBuffers.Test/ReusableBuilderTest.cs +++ b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs @@ -1,16 +1,29 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Text; using Google.ProtocolBuffers.Collections; using NUnit.Framework; using Google.ProtocolBuffers.TestProtos; using Google.ProtocolBuffers.Serialization; +using UnitTest.Issues.TestProtos; namespace Google.ProtocolBuffers { [TestFixture] public class ReusableBuilderTest { + [Test, Description("Issue 28: Circular message dependencies result in null defaults for DefaultInstance")] + public void EnsureStaticCicularReference() + { + MyMessageAReferenceB ab = MyMessageAReferenceB.DefaultInstance; + Assert.IsNotNull(ab); + Assert.IsNotNull(ab.Value); + MyMessageBReferenceA ba = MyMessageBReferenceA.DefaultInstance; + Assert.IsNotNull(ba); + Assert.IsNotNull(ba.Value); + } + [Test] public void TestModifyDefaultInstance() { From dc24b605e356dbfda692e952807b404cccf245bc Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 23 Sep 2011 11:13:41 -0500 Subject: [PATCH 23/31] Generator changes to fix circular reference issues in static ctor --- src/ProtoGen/MessageFieldGenerator.cs | 6 +-- src/ProtoGen/MessageGenerator.cs | 45 +++++++++++-------- src/ProtoGen/RepeatedEnumFieldGenerator.cs | 2 +- src/ProtoGen/RepeatedMessageFieldGenerator.cs | 2 +- .../RepeatedPrimitiveFieldGenerator.cs | 2 +- 5 files changed, 32 insertions(+), 25 deletions(-) diff --git a/src/ProtoGen/MessageFieldGenerator.cs b/src/ProtoGen/MessageFieldGenerator.cs index fab0f29e49..a515060ef1 100644 --- a/src/ProtoGen/MessageFieldGenerator.cs +++ b/src/ProtoGen/MessageFieldGenerator.cs @@ -48,12 +48,12 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateMembers(TextGenerator writer) { writer.WriteLine("private bool has{0};", PropertyName); - writer.WriteLine("private {0} {1}_ = {2};", TypeName, Name, DefaultValue); + writer.WriteLine("private {0} {1}_;", TypeName, Name); writer.WriteLine("public bool Has{0} {{", PropertyName); writer.WriteLine(" get {{ return has{0}; }}", PropertyName); writer.WriteLine("}"); writer.WriteLine("public {0} {1} {{", TypeName, PropertyName); - writer.WriteLine(" get {{ return {0}_; }}", Name); + writer.WriteLine(" get {{ return {0}_ ?? {1}; }}", Name, DefaultValue); writer.WriteLine("}"); } @@ -96,7 +96,7 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine("public Builder Clear{0}() {{", PropertyName); writer.WriteLine(" PrepareBuilder();"); writer.WriteLine(" result.has{0} = false;", PropertyName); - writer.WriteLine(" result.{0}_ = {1};", Name, DefaultValue); + writer.WriteLine(" result.{0}_ = null;", Name); writer.WriteLine(" return this;"); writer.WriteLine("}"); } diff --git a/src/ProtoGen/MessageGenerator.cs b/src/ProtoGen/MessageGenerator.cs index f191da4fff..ce1213376c 100644 --- a/src/ProtoGen/MessageGenerator.cs +++ b/src/ProtoGen/MessageGenerator.cs @@ -178,7 +178,7 @@ namespace Google.ProtocolBuffers.ProtoGen RuntimeSuffix); writer.Indent(); // Must call BuildPartial() to make sure all lists are made read-only - writer.WriteLine("private static readonly {0} defaultInstance = new Builder().BuildPartial();", ClassName); + writer.WriteLine("private static readonly {0} defaultInstance = new {0}().MakeReadOnly();", ClassName); if (OptimizeSpeed) { @@ -199,7 +199,7 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine("}"); writer.WriteLine(); writer.WriteLine("public override {0} DefaultInstanceForType {{", ClassName); - writer.WriteLine(" get { return defaultInstance; }"); + writer.WriteLine(" get { return DefaultInstance; }"); writer.WriteLine("}"); writer.WriteLine(); writer.WriteLine("protected override {0} ThisMessage {{", ClassName); @@ -547,6 +547,17 @@ namespace Google.ProtocolBuffers.ProtoGen private void GenerateBuilder(TextGenerator writer) { + writer.WriteLine("private {0} MakeReadOnly() {{", ClassName); + writer.Indent(); + foreach (FieldDescriptor field in Descriptor.Fields) + { + CreateFieldGenerator(field).GenerateBuildingCode(writer); + } + writer.WriteLine("return this;"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("public static Builder CreateBuilder() { return new Builder(); }"); writer.WriteLine("public override Builder ToBuilder() { return CreateBuilder(this); }"); writer.WriteLine("public override Builder CreateBuilderForType() { return new Builder(); }"); @@ -585,23 +596,23 @@ namespace Google.ProtocolBuffers.ProtoGen //default constructor writer.WriteLine("public Builder() {"); //Durring static initialization of message, DefaultInstance is expected to return null. - writer.WriteLine(" result = DefaultInstance ?? new {0}();", ClassName); - writer.WriteLine(" builderIsReadOnly = result == DefaultInstance;"); + writer.WriteLine(" result = DefaultInstance;"); + writer.WriteLine(" resultIsReadOnly = true;"); writer.WriteLine("}"); //clone constructor writer.WriteLine("internal Builder({0} cloneFrom) {{", ClassName); writer.WriteLine(" result = cloneFrom;"); - writer.WriteLine(" builderIsReadOnly = true;"); + writer.WriteLine(" resultIsReadOnly = true;"); writer.WriteLine("}"); writer.WriteLine(); - writer.WriteLine("bool builderIsReadOnly;"); - writer.WriteLine("{0} result;", ClassName); + writer.WriteLine("private bool resultIsReadOnly;"); + writer.WriteLine("private {0} result;", ClassName); writer.WriteLine(); writer.WriteLine("private {0} PrepareBuilder() {{", ClassName); - writer.WriteLine(" if (builderIsReadOnly) {"); + writer.WriteLine(" if (resultIsReadOnly) {"); writer.WriteLine(" {0} original = result;", ClassName); writer.WriteLine(" result = new {0}();", ClassName); - writer.WriteLine(" builderIsReadOnly = false;"); + writer.WriteLine(" resultIsReadOnly = false;"); writer.WriteLine(" MergeFrom(original);"); writer.WriteLine(" }"); writer.WriteLine(" return result;"); @@ -617,13 +628,13 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine(); //Not actually expecting that DefaultInstance would ever be null here; however, we will ensure it does not break writer.WriteLine("public override Builder Clear() {"); - writer.WriteLine(" result = DefaultInstance ?? new {0}();", ClassName); - writer.WriteLine(" builderIsReadOnly = true;"); + writer.WriteLine(" result = DefaultInstance;", ClassName); + writer.WriteLine(" resultIsReadOnly = true;"); writer.WriteLine(" return this;"); writer.WriteLine("}"); writer.WriteLine(); writer.WriteLine("public override Builder Clone() {"); - writer.WriteLine(" if (builderIsReadOnly) {"); + writer.WriteLine(" if (resultIsReadOnly) {"); writer.WriteLine(" return new Builder(result);"); writer.WriteLine(" } else {"); writer.WriteLine(" return new Builder().MergeFrom(result);"); @@ -644,15 +655,11 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine("public override {0} BuildPartial() {{", ClassName); writer.Indent(); - writer.WriteLine("if (builderIsReadOnly) {"); + writer.WriteLine("if (resultIsReadOnly) {"); writer.WriteLine(" return result;"); writer.WriteLine("}"); - foreach (FieldDescriptor field in Descriptor.Fields) - { - CreateFieldGenerator(field).GenerateBuildingCode(writer); - } - writer.WriteLine("builderIsReadOnly = true;"); - writer.WriteLine("return result;"); + writer.WriteLine("resultIsReadOnly = true;"); + writer.WriteLine("return result.MakeReadOnly();"); writer.Outdent(); writer.WriteLine("}"); writer.WriteLine(); diff --git a/src/ProtoGen/RepeatedEnumFieldGenerator.cs b/src/ProtoGen/RepeatedEnumFieldGenerator.cs index ae1ed2408f..c7b4f29334 100644 --- a/src/ProtoGen/RepeatedEnumFieldGenerator.cs +++ b/src/ProtoGen/RepeatedEnumFieldGenerator.cs @@ -110,7 +110,7 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateBuildingCode(TextGenerator writer) { - writer.WriteLine("result.{0}_.MakeReadOnly();", Name); + writer.WriteLine("{0}_.MakeReadOnly();", Name); } public void GenerateParsingCode(TextGenerator writer) diff --git a/src/ProtoGen/RepeatedMessageFieldGenerator.cs b/src/ProtoGen/RepeatedMessageFieldGenerator.cs index c184b34554..f91895c978 100644 --- a/src/ProtoGen/RepeatedMessageFieldGenerator.cs +++ b/src/ProtoGen/RepeatedMessageFieldGenerator.cs @@ -122,7 +122,7 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateBuildingCode(TextGenerator writer) { - writer.WriteLine("result.{0}_.MakeReadOnly();", Name); + writer.WriteLine("{0}_.MakeReadOnly();", Name); } public void GenerateParsingCode(TextGenerator writer) diff --git a/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs b/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs index 3bbcff52bf..88b1bca7ac 100644 --- a/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs +++ b/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs @@ -119,7 +119,7 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateBuildingCode(TextGenerator writer) { - writer.WriteLine("result.{0}_.MakeReadOnly();", Name); + writer.WriteLine("{0}_.MakeReadOnly();", Name); } public void GenerateParsingCode(TextGenerator writer) From a314d4c9fa70c2b22bae02fa22a5dc2dba1db067 Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 23 Sep 2011 11:14:01 -0500 Subject: [PATCH 24/31] Regenerated code with changes --- src/AddressBook/AddressBookProtos.cs | 106 +- .../UnitTestCSharpOptionsProtoFile.cs | 34 +- .../UnitTestCustomOptionsProtoFile.cs | 596 +++--- .../UnitTestEmbedOptimizeForProtoFile.cs | 42 +- .../UnitTestExtrasIssuesProtoFile.cs | 757 +++++++- .../TestProtos/UnitTestGoogleSizeProtoFile.cs | 198 +- .../UnitTestGoogleSpeedProtoFile.cs | 198 +- .../TestProtos/UnitTestImportLiteProtoFile.cs | 34 +- .../TestProtos/UnitTestImportProtoFile.cs | 34 +- .../TestProtos/UnitTestMessageSetProtoFile.cs | 212 ++- .../UnitTestNoGenericServicesProtoFile.cs | 34 +- .../UnitTestOptimizeForProtoFile.cs | 114 +- .../TestProtos/UnitTestProtoFile.cs | 1622 +++++++++-------- .../TestProtos/UnitTestRpcInterop.cs | 148 +- .../UnitTestXmlSerializerTestProtoFile.cs | 226 ++- .../DescriptorProtos/CSharpOptions.cs | 136 +- .../DescriptorProtos/DescriptorProtoFile.cs | 696 +++---- .../TestProtos/UnitTestExtrasFullProtoFile.cs | 294 +-- .../TestProtos/UnitTestExtrasLiteProtoFile.cs | 176 +- .../TestProtos/UnitTestImportLiteProtoFile.cs | 34 +- .../TestProtos/UnitTestImportProtoFile.cs | 34 +- .../UnitTestLiteImportNonLiteProtoFile.cs | 40 +- .../TestProtos/UnitTestLiteProtoFile.cs | 604 +++--- .../TestProtos/UnitTestProtoFile.cs | 1622 +++++++++-------- 24 files changed, 4687 insertions(+), 3304 deletions(-) diff --git a/src/AddressBook/AddressBookProtos.cs b/src/AddressBook/AddressBookProtos.cs index 8bb19df6c3..92d41ac67c 100644 --- a/src/AddressBook/AddressBookProtos.cs +++ b/src/AddressBook/AddressBookProtos.cs @@ -68,7 +68,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Person : pb::GeneratedMessage { - private static readonly Person defaultInstance = new Builder().BuildPartial(); + private static readonly Person defaultInstance = new Person().MakeReadOnly(); private static readonly string[] _personFieldNames = new string[] { "email", "id", "name", "phone" }; private static readonly uint[] _personFieldTags = new uint[] { 26, 16, 10, 34 }; public static Person DefaultInstance { @@ -76,7 +76,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public override Person DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override Person ThisMessage { @@ -108,7 +108,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class PhoneNumber : pb::GeneratedMessage { - private static readonly PhoneNumber defaultInstance = new Builder().BuildPartial(); + private static readonly PhoneNumber defaultInstance = new PhoneNumber().MakeReadOnly(); private static readonly string[] _phoneNumberFieldNames = new string[] { "number", "type" }; private static readonly uint[] _phoneNumberFieldTags = new uint[] { 10, 16 }; public static PhoneNumber DefaultInstance { @@ -116,7 +116,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public override PhoneNumber DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override PhoneNumber ThisMessage { @@ -219,6 +219,10 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { public static PhoneNumber ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private PhoneNumber MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -234,22 +238,22 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { get { return this; } } public Builder() { - result = DefaultInstance ?? new PhoneNumber(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(PhoneNumber cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - PhoneNumber result; + private bool resultIsReadOnly; + private PhoneNumber result; private PhoneNumber PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { PhoneNumber original = result; result = new PhoneNumber(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -264,13 +268,13 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public override Builder Clear() { - result = DefaultInstance ?? new PhoneNumber(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -286,11 +290,11 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public override PhoneNumber BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -555,6 +559,11 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { public static Person ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private Person MakeReadOnly() { + phone_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -570,22 +579,22 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { get { return this; } } public Builder() { - result = DefaultInstance ?? new Person(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(Person cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - Person result; + private bool resultIsReadOnly; + private Person result; private Person PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { Person original = result; result = new Person(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -600,13 +609,13 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public override Builder Clear() { - result = DefaultInstance ?? new Person(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -622,12 +631,11 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public override Person BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.phone_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -838,7 +846,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class AddressBook : pb::GeneratedMessage { - private static readonly AddressBook defaultInstance = new Builder().BuildPartial(); + private static readonly AddressBook defaultInstance = new AddressBook().MakeReadOnly(); private static readonly string[] _addressBookFieldNames = new string[] { "person" }; private static readonly uint[] _addressBookFieldTags = new uint[] { 10 }; public static AddressBook DefaultInstance { @@ -846,7 +854,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public override AddressBook DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override AddressBook ThisMessage { @@ -937,6 +945,11 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { public static AddressBook ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private AddressBook MakeReadOnly() { + person_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -952,22 +965,22 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { get { return this; } } public Builder() { - result = DefaultInstance ?? new AddressBook(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(AddressBook cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - AddressBook result; + private bool resultIsReadOnly; + private AddressBook result; private AddressBook PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { AddressBook original = result; result = new AddressBook(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -982,13 +995,13 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public override Builder Clear() { - result = DefaultInstance ?? new AddressBook(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1004,12 +1017,11 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public override AddressBook BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.person_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs index 215b9b4fd2..e6b39f4dff 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs @@ -60,7 +60,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionsMessage : pb::GeneratedMessage { - private static readonly OptionsMessage defaultInstance = new Builder().BuildPartial(); + private static readonly OptionsMessage defaultInstance = new OptionsMessage().MakeReadOnly(); private static readonly string[] _optionsMessageFieldNames = new string[] { "customized", "normal", "options_message" }; private static readonly uint[] _optionsMessageFieldTags = new uint[] { 26, 10, 18 }; public static OptionsMessage DefaultInstance { @@ -68,7 +68,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionsMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override OptionsMessage ThisMessage { @@ -186,6 +186,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static OptionsMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private OptionsMessage MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -201,22 +205,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new OptionsMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(OptionsMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - OptionsMessage result; + private bool resultIsReadOnly; + private OptionsMessage result; private OptionsMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { OptionsMessage original = result; result = new OptionsMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -231,13 +235,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new OptionsMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -253,11 +257,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionsMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs index bc29da2640..c030e0eaa4 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs @@ -400,7 +400,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessageWithCustomOptions : pb::GeneratedMessage { - private static readonly TestMessageWithCustomOptions defaultInstance = new Builder().BuildPartial(); + private static readonly TestMessageWithCustomOptions defaultInstance = new TestMessageWithCustomOptions().MakeReadOnly(); private static readonly string[] _testMessageWithCustomOptionsFieldNames = new string[] { "field1" }; private static readonly uint[] _testMessageWithCustomOptionsFieldTags = new uint[] { 10 }; public static TestMessageWithCustomOptions DefaultInstance { @@ -408,7 +408,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMessageWithCustomOptions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestMessageWithCustomOptions ThisMessage { @@ -509,6 +509,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestMessageWithCustomOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestMessageWithCustomOptions MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -524,22 +528,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestMessageWithCustomOptions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestMessageWithCustomOptions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestMessageWithCustomOptions result; + private bool resultIsReadOnly; + private TestMessageWithCustomOptions result; private TestMessageWithCustomOptions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestMessageWithCustomOptions original = result; result = new TestMessageWithCustomOptions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -554,13 +558,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestMessageWithCustomOptions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -576,11 +580,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMessageWithCustomOptions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -685,7 +689,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CustomOptionFooRequest : pb::GeneratedMessage { - private static readonly CustomOptionFooRequest defaultInstance = new Builder().BuildPartial(); + private static readonly CustomOptionFooRequest defaultInstance = new CustomOptionFooRequest().MakeReadOnly(); private static readonly string[] _customOptionFooRequestFieldNames = new string[] { }; private static readonly uint[] _customOptionFooRequestFieldTags = new uint[] { }; public static CustomOptionFooRequest DefaultInstance { @@ -693,7 +697,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override CustomOptionFooRequest DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override CustomOptionFooRequest ThisMessage { @@ -763,6 +767,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static CustomOptionFooRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private CustomOptionFooRequest MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -778,22 +786,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new CustomOptionFooRequest(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(CustomOptionFooRequest cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - CustomOptionFooRequest result; + private bool resultIsReadOnly; + private CustomOptionFooRequest result; private CustomOptionFooRequest PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { CustomOptionFooRequest original = result; result = new CustomOptionFooRequest(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -808,13 +816,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new CustomOptionFooRequest(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -830,11 +838,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override CustomOptionFooRequest BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -911,7 +919,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CustomOptionFooResponse : pb::GeneratedMessage { - private static readonly CustomOptionFooResponse defaultInstance = new Builder().BuildPartial(); + private static readonly CustomOptionFooResponse defaultInstance = new CustomOptionFooResponse().MakeReadOnly(); private static readonly string[] _customOptionFooResponseFieldNames = new string[] { }; private static readonly uint[] _customOptionFooResponseFieldTags = new uint[] { }; public static CustomOptionFooResponse DefaultInstance { @@ -919,7 +927,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override CustomOptionFooResponse DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override CustomOptionFooResponse ThisMessage { @@ -989,6 +997,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static CustomOptionFooResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private CustomOptionFooResponse MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1004,22 +1016,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new CustomOptionFooResponse(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(CustomOptionFooResponse cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - CustomOptionFooResponse result; + private bool resultIsReadOnly; + private CustomOptionFooResponse result; private CustomOptionFooResponse PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { CustomOptionFooResponse original = result; result = new CustomOptionFooResponse(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1034,13 +1046,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new CustomOptionFooResponse(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1056,11 +1068,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override CustomOptionFooResponse BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1137,7 +1149,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class DummyMessageContainingEnum : pb::GeneratedMessage { - private static readonly DummyMessageContainingEnum defaultInstance = new Builder().BuildPartial(); + private static readonly DummyMessageContainingEnum defaultInstance = new DummyMessageContainingEnum().MakeReadOnly(); private static readonly string[] _dummyMessageContainingEnumFieldNames = new string[] { }; private static readonly uint[] _dummyMessageContainingEnumFieldTags = new uint[] { }; public static DummyMessageContainingEnum DefaultInstance { @@ -1145,7 +1157,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override DummyMessageContainingEnum DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override DummyMessageContainingEnum ThisMessage { @@ -1230,6 +1242,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static DummyMessageContainingEnum ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private DummyMessageContainingEnum MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1245,22 +1261,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new DummyMessageContainingEnum(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(DummyMessageContainingEnum cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - DummyMessageContainingEnum result; + private bool resultIsReadOnly; + private DummyMessageContainingEnum result; private DummyMessageContainingEnum PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { DummyMessageContainingEnum original = result; result = new DummyMessageContainingEnum(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1275,13 +1291,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new DummyMessageContainingEnum(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1297,11 +1313,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override DummyMessageContainingEnum BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1378,7 +1394,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class DummyMessageInvalidAsOptionType : pb::GeneratedMessage { - private static readonly DummyMessageInvalidAsOptionType defaultInstance = new Builder().BuildPartial(); + private static readonly DummyMessageInvalidAsOptionType defaultInstance = new DummyMessageInvalidAsOptionType().MakeReadOnly(); private static readonly string[] _dummyMessageInvalidAsOptionTypeFieldNames = new string[] { }; private static readonly uint[] _dummyMessageInvalidAsOptionTypeFieldTags = new uint[] { }; public static DummyMessageInvalidAsOptionType DefaultInstance { @@ -1386,7 +1402,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override DummyMessageInvalidAsOptionType DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override DummyMessageInvalidAsOptionType ThisMessage { @@ -1456,6 +1472,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static DummyMessageInvalidAsOptionType ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private DummyMessageInvalidAsOptionType MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1471,22 +1491,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new DummyMessageInvalidAsOptionType(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(DummyMessageInvalidAsOptionType cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - DummyMessageInvalidAsOptionType result; + private bool resultIsReadOnly; + private DummyMessageInvalidAsOptionType result; private DummyMessageInvalidAsOptionType PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { DummyMessageInvalidAsOptionType original = result; result = new DummyMessageInvalidAsOptionType(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1501,13 +1521,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new DummyMessageInvalidAsOptionType(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1523,11 +1543,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override DummyMessageInvalidAsOptionType BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1604,7 +1624,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CustomOptionMinIntegerValues : pb::GeneratedMessage { - private static readonly CustomOptionMinIntegerValues defaultInstance = new Builder().BuildPartial(); + private static readonly CustomOptionMinIntegerValues defaultInstance = new CustomOptionMinIntegerValues().MakeReadOnly(); private static readonly string[] _customOptionMinIntegerValuesFieldNames = new string[] { }; private static readonly uint[] _customOptionMinIntegerValuesFieldTags = new uint[] { }; public static CustomOptionMinIntegerValues DefaultInstance { @@ -1612,7 +1632,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override CustomOptionMinIntegerValues DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override CustomOptionMinIntegerValues ThisMessage { @@ -1682,6 +1702,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static CustomOptionMinIntegerValues ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private CustomOptionMinIntegerValues MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1697,22 +1721,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new CustomOptionMinIntegerValues(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(CustomOptionMinIntegerValues cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - CustomOptionMinIntegerValues result; + private bool resultIsReadOnly; + private CustomOptionMinIntegerValues result; private CustomOptionMinIntegerValues PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { CustomOptionMinIntegerValues original = result; result = new CustomOptionMinIntegerValues(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1727,13 +1751,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new CustomOptionMinIntegerValues(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1749,11 +1773,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override CustomOptionMinIntegerValues BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1830,7 +1854,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CustomOptionMaxIntegerValues : pb::GeneratedMessage { - private static readonly CustomOptionMaxIntegerValues defaultInstance = new Builder().BuildPartial(); + private static readonly CustomOptionMaxIntegerValues defaultInstance = new CustomOptionMaxIntegerValues().MakeReadOnly(); private static readonly string[] _customOptionMaxIntegerValuesFieldNames = new string[] { }; private static readonly uint[] _customOptionMaxIntegerValuesFieldTags = new uint[] { }; public static CustomOptionMaxIntegerValues DefaultInstance { @@ -1838,7 +1862,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override CustomOptionMaxIntegerValues DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override CustomOptionMaxIntegerValues ThisMessage { @@ -1908,6 +1932,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static CustomOptionMaxIntegerValues ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private CustomOptionMaxIntegerValues MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1923,22 +1951,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new CustomOptionMaxIntegerValues(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(CustomOptionMaxIntegerValues cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - CustomOptionMaxIntegerValues result; + private bool resultIsReadOnly; + private CustomOptionMaxIntegerValues result; private CustomOptionMaxIntegerValues PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { CustomOptionMaxIntegerValues original = result; result = new CustomOptionMaxIntegerValues(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1953,13 +1981,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new CustomOptionMaxIntegerValues(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1975,11 +2003,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override CustomOptionMaxIntegerValues BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -2056,7 +2084,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CustomOptionOtherValues : pb::GeneratedMessage { - private static readonly CustomOptionOtherValues defaultInstance = new Builder().BuildPartial(); + private static readonly CustomOptionOtherValues defaultInstance = new CustomOptionOtherValues().MakeReadOnly(); private static readonly string[] _customOptionOtherValuesFieldNames = new string[] { }; private static readonly uint[] _customOptionOtherValuesFieldTags = new uint[] { }; public static CustomOptionOtherValues DefaultInstance { @@ -2064,7 +2092,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override CustomOptionOtherValues DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override CustomOptionOtherValues ThisMessage { @@ -2134,6 +2162,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static CustomOptionOtherValues ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private CustomOptionOtherValues MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -2149,22 +2181,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new CustomOptionOtherValues(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(CustomOptionOtherValues cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - CustomOptionOtherValues result; + private bool resultIsReadOnly; + private CustomOptionOtherValues result; private CustomOptionOtherValues PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { CustomOptionOtherValues original = result; result = new CustomOptionOtherValues(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -2179,13 +2211,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new CustomOptionOtherValues(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -2201,11 +2233,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override CustomOptionOtherValues BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -2282,7 +2314,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SettingRealsFromPositiveInts : pb::GeneratedMessage { - private static readonly SettingRealsFromPositiveInts defaultInstance = new Builder().BuildPartial(); + private static readonly SettingRealsFromPositiveInts defaultInstance = new SettingRealsFromPositiveInts().MakeReadOnly(); private static readonly string[] _settingRealsFromPositiveIntsFieldNames = new string[] { }; private static readonly uint[] _settingRealsFromPositiveIntsFieldTags = new uint[] { }; public static SettingRealsFromPositiveInts DefaultInstance { @@ -2290,7 +2322,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SettingRealsFromPositiveInts DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override SettingRealsFromPositiveInts ThisMessage { @@ -2360,6 +2392,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static SettingRealsFromPositiveInts ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private SettingRealsFromPositiveInts MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -2375,22 +2411,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new SettingRealsFromPositiveInts(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(SettingRealsFromPositiveInts cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - SettingRealsFromPositiveInts result; + private bool resultIsReadOnly; + private SettingRealsFromPositiveInts result; private SettingRealsFromPositiveInts PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { SettingRealsFromPositiveInts original = result; result = new SettingRealsFromPositiveInts(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -2405,13 +2441,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new SettingRealsFromPositiveInts(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -2427,11 +2463,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SettingRealsFromPositiveInts BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -2508,7 +2544,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SettingRealsFromNegativeInts : pb::GeneratedMessage { - private static readonly SettingRealsFromNegativeInts defaultInstance = new Builder().BuildPartial(); + private static readonly SettingRealsFromNegativeInts defaultInstance = new SettingRealsFromNegativeInts().MakeReadOnly(); private static readonly string[] _settingRealsFromNegativeIntsFieldNames = new string[] { }; private static readonly uint[] _settingRealsFromNegativeIntsFieldTags = new uint[] { }; public static SettingRealsFromNegativeInts DefaultInstance { @@ -2516,7 +2552,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SettingRealsFromNegativeInts DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override SettingRealsFromNegativeInts ThisMessage { @@ -2586,6 +2622,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static SettingRealsFromNegativeInts ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private SettingRealsFromNegativeInts MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -2601,22 +2641,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new SettingRealsFromNegativeInts(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(SettingRealsFromNegativeInts cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - SettingRealsFromNegativeInts result; + private bool resultIsReadOnly; + private SettingRealsFromNegativeInts result; private SettingRealsFromNegativeInts PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { SettingRealsFromNegativeInts original = result; result = new SettingRealsFromNegativeInts(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -2631,13 +2671,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new SettingRealsFromNegativeInts(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -2653,11 +2693,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SettingRealsFromNegativeInts BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -2734,7 +2774,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOptionType1 : pb::ExtendableMessage { - private static readonly ComplexOptionType1 defaultInstance = new Builder().BuildPartial(); + private static readonly ComplexOptionType1 defaultInstance = new ComplexOptionType1().MakeReadOnly(); private static readonly string[] _complexOptionType1FieldNames = new string[] { "foo", "foo2", "foo3" }; private static readonly uint[] _complexOptionType1FieldTags = new uint[] { 8, 16, 24 }; public static ComplexOptionType1 DefaultInstance { @@ -2742,7 +2782,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOptionType1 DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override ComplexOptionType1 ThisMessage { @@ -2864,6 +2904,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static ComplexOptionType1 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private ComplexOptionType1 MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -2879,22 +2923,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new ComplexOptionType1(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(ComplexOptionType1 cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - ComplexOptionType1 result; + private bool resultIsReadOnly; + private ComplexOptionType1 result; private ComplexOptionType1 PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { ComplexOptionType1 original = result; result = new ComplexOptionType1(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -2909,13 +2953,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new ComplexOptionType1(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -2931,11 +2975,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOptionType1 BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -3094,7 +3138,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOptionType2 : pb::ExtendableMessage { - private static readonly ComplexOptionType2 defaultInstance = new Builder().BuildPartial(); + private static readonly ComplexOptionType2 defaultInstance = new ComplexOptionType2().MakeReadOnly(); private static readonly string[] _complexOptionType2FieldNames = new string[] { "bar", "baz", "fred" }; private static readonly uint[] _complexOptionType2FieldTags = new uint[] { 10, 16, 26 }; public static ComplexOptionType2 DefaultInstance { @@ -3102,7 +3146,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOptionType2 DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override ComplexOptionType2 ThisMessage { @@ -3126,7 +3170,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOptionType4 : pb::GeneratedMessage { - private static readonly ComplexOptionType4 defaultInstance = new Builder().BuildPartial(); + private static readonly ComplexOptionType4 defaultInstance = new ComplexOptionType4().MakeReadOnly(); private static readonly string[] _complexOptionType4FieldNames = new string[] { "waldo" }; private static readonly uint[] _complexOptionType4FieldTags = new uint[] { 8 }; public static ComplexOptionType4 DefaultInstance { @@ -3134,7 +3178,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOptionType4 DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override ComplexOptionType4 ThisMessage { @@ -3222,6 +3266,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static ComplexOptionType4 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private ComplexOptionType4 MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -3237,22 +3285,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new ComplexOptionType4(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(ComplexOptionType4 cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - ComplexOptionType4 result; + private bool resultIsReadOnly; + private ComplexOptionType4 result; private ComplexOptionType4 PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { ComplexOptionType4 original = result; result = new ComplexOptionType4(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -3267,13 +3315,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new ComplexOptionType4(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -3289,11 +3337,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOptionType4 BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -3398,12 +3446,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int BarFieldNumber = 1; private bool hasBar; - private global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1 bar_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1 bar_; public bool HasBar { get { return hasBar; } } public global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1 Bar { - get { return bar_; } + get { return bar_ ?? global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.DefaultInstance; } } public const int BazFieldNumber = 2; @@ -3418,12 +3466,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int FredFieldNumber = 3; private bool hasFred; - private global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4 fred_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4 fred_; public bool HasFred { get { return hasFred; } } public global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4 Fred { - get { return fred_; } + get { return fred_ ?? global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.DefaultInstance; } } public override bool IsInitialized { @@ -3506,6 +3554,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static ComplexOptionType2 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private ComplexOptionType2 MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -3521,22 +3573,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new ComplexOptionType2(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(ComplexOptionType2 cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - ComplexOptionType2 result; + private bool resultIsReadOnly; + private ComplexOptionType2 result; private ComplexOptionType2 PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { ComplexOptionType2 original = result; result = new ComplexOptionType2(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -3551,13 +3603,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new ComplexOptionType2(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -3573,11 +3625,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOptionType2 BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -3713,7 +3765,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearBar() { PrepareBuilder(); result.hasBar = false; - result.bar_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.DefaultInstance; + result.bar_ = null; return this; } @@ -3773,7 +3825,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearFred() { PrepareBuilder(); result.hasFred = false; - result.fred_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.DefaultInstance; + result.fred_ = null; return this; } } @@ -3786,7 +3838,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOptionType3 : pb::GeneratedMessage { - private static readonly ComplexOptionType3 defaultInstance = new Builder().BuildPartial(); + private static readonly ComplexOptionType3 defaultInstance = new ComplexOptionType3().MakeReadOnly(); private static readonly string[] _complexOptionType3FieldNames = new string[] { "complexoptiontype5", "qux" }; private static readonly uint[] _complexOptionType3FieldTags = new uint[] { 19, 8 }; public static ComplexOptionType3 DefaultInstance { @@ -3794,7 +3846,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOptionType3 DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override ComplexOptionType3 ThisMessage { @@ -3818,7 +3870,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOptionType5 : pb::GeneratedMessage { - private static readonly ComplexOptionType5 defaultInstance = new Builder().BuildPartial(); + private static readonly ComplexOptionType5 defaultInstance = new ComplexOptionType5().MakeReadOnly(); private static readonly string[] _complexOptionType5FieldNames = new string[] { "plugh" }; private static readonly uint[] _complexOptionType5FieldTags = new uint[] { 24 }; public static ComplexOptionType5 DefaultInstance { @@ -3826,7 +3878,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOptionType5 DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override ComplexOptionType5 ThisMessage { @@ -3912,6 +3964,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static ComplexOptionType5 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private ComplexOptionType5 MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -3927,22 +3983,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new ComplexOptionType5(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(ComplexOptionType5 cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - ComplexOptionType5 result; + private bool resultIsReadOnly; + private ComplexOptionType5 result; private ComplexOptionType5 PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { ComplexOptionType5 original = result; result = new ComplexOptionType5(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -3957,13 +4013,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new ComplexOptionType5(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -3979,11 +4035,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOptionType5 BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -4098,12 +4154,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int ComplexOptionType5FieldNumber = 2; private bool hasComplexOptionType5; - private global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5 complexOptionType5_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5 complexOptionType5_; public bool HasComplexOptionType5 { get { return hasComplexOptionType5; } } public global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5 ComplexOptionType5 { - get { return complexOptionType5_; } + get { return complexOptionType5_ ?? global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.DefaultInstance; } } public override bool IsInitialized { @@ -4173,6 +4229,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static ComplexOptionType3 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private ComplexOptionType3 MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -4188,22 +4248,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new ComplexOptionType3(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(ComplexOptionType3 cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - ComplexOptionType3 result; + private bool resultIsReadOnly; + private ComplexOptionType3 result; private ComplexOptionType3 PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { ComplexOptionType3 original = result; result = new ComplexOptionType3(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -4218,13 +4278,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new ComplexOptionType3(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -4240,11 +4300,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOptionType3 BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -4387,7 +4447,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearComplexOptionType5() { PrepareBuilder(); result.hasComplexOptionType5 = false; - result.complexOptionType5_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.DefaultInstance; + result.complexOptionType5_ = null; return this; } } @@ -4400,7 +4460,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOpt6 : pb::GeneratedMessage { - private static readonly ComplexOpt6 defaultInstance = new Builder().BuildPartial(); + private static readonly ComplexOpt6 defaultInstance = new ComplexOpt6().MakeReadOnly(); private static readonly string[] _complexOpt6FieldNames = new string[] { "xyzzy" }; private static readonly uint[] _complexOpt6FieldTags = new uint[] { 60751608 }; public static ComplexOpt6 DefaultInstance { @@ -4408,7 +4468,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOpt6 DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override ComplexOpt6 ThisMessage { @@ -4494,6 +4554,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static ComplexOpt6 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private ComplexOpt6 MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -4509,22 +4573,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new ComplexOpt6(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(ComplexOpt6 cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - ComplexOpt6 result; + private bool resultIsReadOnly; + private ComplexOpt6 result; private ComplexOpt6 PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { ComplexOpt6 original = result; result = new ComplexOpt6(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -4539,13 +4603,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new ComplexOpt6(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -4561,11 +4625,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ComplexOpt6 BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -4669,7 +4733,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class VariousComplexOptions : pb::GeneratedMessage { - private static readonly VariousComplexOptions defaultInstance = new Builder().BuildPartial(); + private static readonly VariousComplexOptions defaultInstance = new VariousComplexOptions().MakeReadOnly(); private static readonly string[] _variousComplexOptionsFieldNames = new string[] { }; private static readonly uint[] _variousComplexOptionsFieldTags = new uint[] { }; public static VariousComplexOptions DefaultInstance { @@ -4677,7 +4741,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override VariousComplexOptions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override VariousComplexOptions ThisMessage { @@ -4747,6 +4811,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static VariousComplexOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private VariousComplexOptions MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -4762,22 +4830,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new VariousComplexOptions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(VariousComplexOptions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - VariousComplexOptions result; + private bool resultIsReadOnly; + private VariousComplexOptions result; private VariousComplexOptions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { VariousComplexOptions original = result; result = new VariousComplexOptions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -4792,13 +4860,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new VariousComplexOptions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -4814,11 +4882,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override VariousComplexOptions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs index 466cce7327..47df973905 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs @@ -64,7 +64,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestEmbedOptimizedForSize : pb::GeneratedMessage { - private static readonly TestEmbedOptimizedForSize defaultInstance = new Builder().BuildPartial(); + private static readonly TestEmbedOptimizedForSize defaultInstance = new TestEmbedOptimizedForSize().MakeReadOnly(); private static readonly string[] _testEmbedOptimizedForSizeFieldNames = new string[] { "optional_message", "repeated_message" }; private static readonly uint[] _testEmbedOptimizedForSizeFieldTags = new uint[] { 10, 18 }; public static TestEmbedOptimizedForSize DefaultInstance { @@ -72,7 +72,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestEmbedOptimizedForSize DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestEmbedOptimizedForSize ThisMessage { @@ -89,12 +89,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int OptionalMessageFieldNumber = 1; private bool hasOptionalMessage; - private global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize optionalMessage_; public bool HasOptionalMessage { get { return hasOptionalMessage; } } public global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize OptionalMessage { - get { return optionalMessage_; } + get { return optionalMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance; } } public const int RepeatedMessageFieldNumber = 2; @@ -182,6 +182,11 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestEmbedOptimizedForSize ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestEmbedOptimizedForSize MakeReadOnly() { + repeatedMessage_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -197,22 +202,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestEmbedOptimizedForSize(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestEmbedOptimizedForSize cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestEmbedOptimizedForSize result; + private bool resultIsReadOnly; + private TestEmbedOptimizedForSize result; private TestEmbedOptimizedForSize PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestEmbedOptimizedForSize original = result; result = new TestEmbedOptimizedForSize(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -227,13 +232,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestEmbedOptimizedForSize(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -249,12 +254,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestEmbedOptimizedForSize BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.repeatedMessage_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -377,7 +381,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearOptionalMessage() { PrepareBuilder(); result.hasOptionalMessage = false; - result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance; + result.optionalMessage_ = null; return this; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs index 7791759a2a..29d784bafa 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs @@ -26,6 +26,10 @@ namespace UnitTest.Issues.TestProtos { internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_AB__FieldAccessorTable; internal static pbd::MessageDescriptor internal__static_unittest_issues_NumberField__Descriptor; internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_NumberField__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_issues_MyMessageAReferenceB__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_MyMessageAReferenceB__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_issues_MyMessageBReferenceA__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_MyMessageBReferenceA__FieldAccessorTable; #endregion #region Descriptor public static pbd::FileDescriptor Descriptor { @@ -38,9 +42,12 @@ namespace UnitTest.Issues.TestProtos { "ChxleHRlc3QvdW5pdHRlc3RfaXNzdWVzLnByb3RvEg91bml0dGVzdF9pc3N1" + "ZXMaJGdvb2dsZS9wcm90b2J1Zi9jc2hhcnBfb3B0aW9ucy5wcm90byIPCgFB" + "EgoKAl9BGAEgASgFIg8KAUISCgoCQl8YASABKAUiEQoCQUISCwoDYV9iGAEg" + - "ASgFIhoKC051bWJlckZpZWxkEgsKA18wMRgBIAEoBUJASAHCPjsKGlVuaXRU" + - "ZXN0Lklzc3Vlcy5UZXN0UHJvdG9zEh1Vbml0VGVzdEV4dHJhc0lzc3Vlc1By" + - "b3RvRmlsZQ=="); + "ASgFIhoKC051bWJlckZpZWxkEgsKA18wMRgBIAEoBSJMChRNeU1lc3NhZ2VB" + + "UmVmZXJlbmNlQhI0CgV2YWx1ZRgBIAIoCzIlLnVuaXR0ZXN0X2lzc3Vlcy5N" + + "eU1lc3NhZ2VCUmVmZXJlbmNlQSJMChRNeU1lc3NhZ2VCUmVmZXJlbmNlQRI0" + + "CgV2YWx1ZRgBIAIoCzIlLnVuaXR0ZXN0X2lzc3Vlcy5NeU1lc3NhZ2VBUmVm" + + "ZXJlbmNlQkJASAHCPjsKGlVuaXRUZXN0Lklzc3Vlcy5UZXN0UHJvdG9zEh1V" + + "bml0VGVzdEV4dHJhc0lzc3Vlc1Byb3RvRmlsZQ=="); pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { descriptor = root; internal__static_unittest_issues_A__Descriptor = Descriptor.MessageTypes[0]; @@ -59,6 +66,14 @@ namespace UnitTest.Issues.TestProtos { internal__static_unittest_issues_NumberField__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_NumberField__Descriptor, new string[] { "_01", }); + internal__static_unittest_issues_MyMessageAReferenceB__Descriptor = Descriptor.MessageTypes[4]; + internal__static_unittest_issues_MyMessageAReferenceB__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_MyMessageAReferenceB__Descriptor, + new string[] { "Value", }); + internal__static_unittest_issues_MyMessageBReferenceA__Descriptor = Descriptor.MessageTypes[5]; + internal__static_unittest_issues_MyMessageBReferenceA__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_MyMessageBReferenceA__Descriptor, + new string[] { "Value", }); pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); RegisterAllExtensions(registry); global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); @@ -77,7 +92,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class A : pb::GeneratedMessage { - private static readonly A defaultInstance = new Builder().BuildPartial(); + private static readonly A defaultInstance = new A().MakeReadOnly(); private static readonly string[] _aFieldNames = new string[] { "_A" }; private static readonly uint[] _aFieldTags = new uint[] { 8 }; public static A DefaultInstance { @@ -85,7 +100,7 @@ namespace UnitTest.Issues.TestProtos { } public override A DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override A ThisMessage { @@ -171,6 +186,10 @@ namespace UnitTest.Issues.TestProtos { public static A ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private A MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -186,22 +205,22 @@ namespace UnitTest.Issues.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new A(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(A cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - A result; + private bool resultIsReadOnly; + private A result; private A PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { A original = result; result = new A(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -216,13 +235,13 @@ namespace UnitTest.Issues.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new A(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -238,11 +257,11 @@ namespace UnitTest.Issues.TestProtos { } public override A BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -346,7 +365,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class B : pb::GeneratedMessage { - private static readonly B defaultInstance = new Builder().BuildPartial(); + private static readonly B defaultInstance = new B().MakeReadOnly(); private static readonly string[] _bFieldNames = new string[] { "B_" }; private static readonly uint[] _bFieldTags = new uint[] { 8 }; public static B DefaultInstance { @@ -354,7 +373,7 @@ namespace UnitTest.Issues.TestProtos { } public override B DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override B ThisMessage { @@ -440,6 +459,10 @@ namespace UnitTest.Issues.TestProtos { public static B ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private B MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -455,22 +478,22 @@ namespace UnitTest.Issues.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new B(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(B cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - B result; + private bool resultIsReadOnly; + private B result; private B PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { B original = result; result = new B(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -485,13 +508,13 @@ namespace UnitTest.Issues.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new B(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -507,11 +530,11 @@ namespace UnitTest.Issues.TestProtos { } public override B BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -615,7 +638,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class AB : pb::GeneratedMessage { - private static readonly AB defaultInstance = new Builder().BuildPartial(); + private static readonly AB defaultInstance = new AB().MakeReadOnly(); private static readonly string[] _aBFieldNames = new string[] { "a_b" }; private static readonly uint[] _aBFieldTags = new uint[] { 8 }; public static AB DefaultInstance { @@ -623,7 +646,7 @@ namespace UnitTest.Issues.TestProtos { } public override AB DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override AB ThisMessage { @@ -709,6 +732,10 @@ namespace UnitTest.Issues.TestProtos { public static AB ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private AB MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -724,22 +751,22 @@ namespace UnitTest.Issues.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new AB(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(AB cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - AB result; + private bool resultIsReadOnly; + private AB result; private AB PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { AB original = result; result = new AB(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -754,13 +781,13 @@ namespace UnitTest.Issues.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new AB(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -776,11 +803,11 @@ namespace UnitTest.Issues.TestProtos { } public override AB BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -884,7 +911,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NumberField : pb::GeneratedMessage { - private static readonly NumberField defaultInstance = new Builder().BuildPartial(); + private static readonly NumberField defaultInstance = new NumberField().MakeReadOnly(); private static readonly string[] _numberFieldFieldNames = new string[] { "_01" }; private static readonly uint[] _numberFieldFieldTags = new uint[] { 8 }; public static NumberField DefaultInstance { @@ -892,7 +919,7 @@ namespace UnitTest.Issues.TestProtos { } public override NumberField DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override NumberField ThisMessage { @@ -980,6 +1007,10 @@ namespace UnitTest.Issues.TestProtos { public static NumberField ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private NumberField MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -995,22 +1026,22 @@ namespace UnitTest.Issues.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new NumberField(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(NumberField cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - NumberField result; + private bool resultIsReadOnly; + private NumberField result; private NumberField PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { NumberField original = result; result = new NumberField(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1025,13 +1056,13 @@ namespace UnitTest.Issues.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new NumberField(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1047,11 +1078,11 @@ namespace UnitTest.Issues.TestProtos { } public override NumberField BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1153,6 +1184,606 @@ namespace UnitTest.Issues.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + public sealed partial class MyMessageAReferenceB : pb::GeneratedMessage { + private static readonly MyMessageAReferenceB defaultInstance = new MyMessageAReferenceB().MakeReadOnly(); + private static readonly string[] _myMessageAReferenceBFieldNames = new string[] { "value" }; + private static readonly uint[] _myMessageAReferenceBFieldTags = new uint[] { 10 }; + public static MyMessageAReferenceB DefaultInstance { + get { return defaultInstance; } + } + + public override MyMessageAReferenceB DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override MyMessageAReferenceB ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_MyMessageAReferenceB__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_MyMessageAReferenceB__FieldAccessorTable; } + } + + public const int ValueFieldNumber = 1; + private bool hasValue; + private global::UnitTest.Issues.TestProtos.MyMessageBReferenceA value_; + public bool HasValue { + get { return hasValue; } + } + public global::UnitTest.Issues.TestProtos.MyMessageBReferenceA Value { + get { return value_ ?? global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.DefaultInstance; } + } + + public override bool IsInitialized { + get { + if (!hasValue) return false; + if (!Value.IsInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + int size = SerializedSize; + string[] field_names = _myMessageAReferenceBFieldNames; + if (hasValue) { + output.WriteMessage(1, field_names[0], Value); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasValue) { + size += pb::CodedOutputStream.ComputeMessageSize(1, Value); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static MyMessageAReferenceB ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static MyMessageAReferenceB ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static MyMessageAReferenceB ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static MyMessageAReferenceB ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static MyMessageAReferenceB ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static MyMessageAReferenceB ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static MyMessageAReferenceB ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static MyMessageAReferenceB ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static MyMessageAReferenceB ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static MyMessageAReferenceB ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private MyMessageAReferenceB MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(MyMessageAReferenceB prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(MyMessageAReferenceB cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private MyMessageAReferenceB result; + + private MyMessageAReferenceB PrepareBuilder() { + if (resultIsReadOnly) { + MyMessageAReferenceB original = result; + result = new MyMessageAReferenceB(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override MyMessageAReferenceB MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.Descriptor; } + } + + public override MyMessageAReferenceB DefaultInstanceForType { + get { return global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.DefaultInstance; } + } + + public override MyMessageAReferenceB BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is MyMessageAReferenceB) { + return MergeFrom((MyMessageAReferenceB) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(MyMessageAReferenceB other) { + if (other == global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasValue) { + MergeValue(other.Value); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_myMessageAReferenceBFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _myMessageAReferenceBFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.Builder subBuilder = global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.CreateBuilder(); + if (result.hasValue) { + subBuilder.MergeFrom(Value); + } + input.ReadMessage(subBuilder, extensionRegistry); + Value = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasValue { + get { return result.hasValue; } + } + public global::UnitTest.Issues.TestProtos.MyMessageBReferenceA Value { + get { return result.Value; } + set { SetValue(value); } + } + public Builder SetValue(global::UnitTest.Issues.TestProtos.MyMessageBReferenceA value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasValue = true; + result.value_ = value; + return this; + } + public Builder SetValue(global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasValue = true; + result.value_ = builderForValue.Build(); + return this; + } + public Builder MergeValue(global::UnitTest.Issues.TestProtos.MyMessageBReferenceA value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasValue && + result.value_ != global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.DefaultInstance) { + result.value_ = global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.CreateBuilder(result.value_).MergeFrom(value).BuildPartial(); + } else { + result.value_ = value; + } + result.hasValue = true; + return this; + } + public Builder ClearValue() { + PrepareBuilder(); + result.hasValue = false; + result.value_ = null; + return this; + } + } + static MyMessageAReferenceB() { + object.ReferenceEquals(global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + public sealed partial class MyMessageBReferenceA : pb::GeneratedMessage { + private static readonly MyMessageBReferenceA defaultInstance = new MyMessageBReferenceA().MakeReadOnly(); + private static readonly string[] _myMessageBReferenceAFieldNames = new string[] { "value" }; + private static readonly uint[] _myMessageBReferenceAFieldTags = new uint[] { 10 }; + public static MyMessageBReferenceA DefaultInstance { + get { return defaultInstance; } + } + + public override MyMessageBReferenceA DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override MyMessageBReferenceA ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_MyMessageBReferenceA__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_MyMessageBReferenceA__FieldAccessorTable; } + } + + public const int ValueFieldNumber = 1; + private bool hasValue; + private global::UnitTest.Issues.TestProtos.MyMessageAReferenceB value_; + public bool HasValue { + get { return hasValue; } + } + public global::UnitTest.Issues.TestProtos.MyMessageAReferenceB Value { + get { return value_ ?? global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.DefaultInstance; } + } + + public override bool IsInitialized { + get { + if (!hasValue) return false; + if (!Value.IsInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + int size = SerializedSize; + string[] field_names = _myMessageBReferenceAFieldNames; + if (hasValue) { + output.WriteMessage(1, field_names[0], Value); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasValue) { + size += pb::CodedOutputStream.ComputeMessageSize(1, Value); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static MyMessageBReferenceA ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static MyMessageBReferenceA ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static MyMessageBReferenceA ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static MyMessageBReferenceA ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static MyMessageBReferenceA ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static MyMessageBReferenceA ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static MyMessageBReferenceA ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static MyMessageBReferenceA ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static MyMessageBReferenceA ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static MyMessageBReferenceA ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private MyMessageBReferenceA MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(MyMessageBReferenceA prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(MyMessageBReferenceA cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private MyMessageBReferenceA result; + + private MyMessageBReferenceA PrepareBuilder() { + if (resultIsReadOnly) { + MyMessageBReferenceA original = result; + result = new MyMessageBReferenceA(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override MyMessageBReferenceA MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.Descriptor; } + } + + public override MyMessageBReferenceA DefaultInstanceForType { + get { return global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.DefaultInstance; } + } + + public override MyMessageBReferenceA BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is MyMessageBReferenceA) { + return MergeFrom((MyMessageBReferenceA) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(MyMessageBReferenceA other) { + if (other == global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasValue) { + MergeValue(other.Value); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_myMessageBReferenceAFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _myMessageBReferenceAFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.Builder subBuilder = global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.CreateBuilder(); + if (result.hasValue) { + subBuilder.MergeFrom(Value); + } + input.ReadMessage(subBuilder, extensionRegistry); + Value = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasValue { + get { return result.hasValue; } + } + public global::UnitTest.Issues.TestProtos.MyMessageAReferenceB Value { + get { return result.Value; } + set { SetValue(value); } + } + public Builder SetValue(global::UnitTest.Issues.TestProtos.MyMessageAReferenceB value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasValue = true; + result.value_ = value; + return this; + } + public Builder SetValue(global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasValue = true; + result.value_ = builderForValue.Build(); + return this; + } + public Builder MergeValue(global::UnitTest.Issues.TestProtos.MyMessageAReferenceB value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasValue && + result.value_ != global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.DefaultInstance) { + result.value_ = global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.CreateBuilder(result.value_).MergeFrom(value).BuildPartial(); + } else { + result.value_ = value; + } + result.hasValue = true; + return this; + } + public Builder ClearValue() { + PrepareBuilder(); + result.hasValue = false; + result.value_ = null; + return this; + } + } + static MyMessageBReferenceA() { + object.ReferenceEquals(global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.Descriptor, null); + } + } + #endregion } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs index 64046eebf5..05925a23c2 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs @@ -137,13 +137,13 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SizeMessage1 : pb::GeneratedMessage { - private static readonly SizeMessage1 defaultInstance = new Builder().BuildPartial(); + private static readonly SizeMessage1 defaultInstance = new SizeMessage1().MakeReadOnly(); public static SizeMessage1 DefaultInstance { get { return defaultInstance; } } public override SizeMessage1 DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override SizeMessage1 ThisMessage { @@ -504,12 +504,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int Field15FieldNumber = 15; private bool hasField15; - private global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage field15_ = global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage field15_; public bool HasField15 { get { return hasField15; } } public global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage Field15 { - get { return field15_; } + get { return field15_ ?? global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage.DefaultInstance; } } public const int Field78FieldNumber = 78; @@ -602,6 +602,11 @@ namespace Google.ProtocolBuffers.TestProtos { public static SizeMessage1 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private SizeMessage1 MakeReadOnly() { + field5_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -617,22 +622,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new SizeMessage1(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(SizeMessage1 cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - SizeMessage1 result; + private bool resultIsReadOnly; + private SizeMessage1 result; private SizeMessage1 PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { SizeMessage1 original = result; result = new SizeMessage1(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -647,13 +652,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new SizeMessage1(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -669,12 +674,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SizeMessage1 BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.field5_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } @@ -1416,7 +1420,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearField15() { PrepareBuilder(); result.hasField15 = false; - result.field15_ = global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage.DefaultInstance; + result.field15_ = null; return this; } @@ -1550,13 +1554,13 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SizeMessage1SubMessage : pb::GeneratedMessage { - private static readonly SizeMessage1SubMessage defaultInstance = new Builder().BuildPartial(); + private static readonly SizeMessage1SubMessage defaultInstance = new SizeMessage1SubMessage().MakeReadOnly(); public static SizeMessage1SubMessage DefaultInstance { get { return defaultInstance; } } public override SizeMessage1SubMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override SizeMessage1SubMessage ThisMessage { @@ -1805,6 +1809,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static SizeMessage1SubMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private SizeMessage1SubMessage MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1820,22 +1828,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new SizeMessage1SubMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(SizeMessage1SubMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - SizeMessage1SubMessage result; + private bool resultIsReadOnly; + private SizeMessage1SubMessage result; private SizeMessage1SubMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { SizeMessage1SubMessage original = result; result = new SizeMessage1SubMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1850,13 +1858,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new SizeMessage1SubMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1872,11 +1880,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SizeMessage1SubMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } @@ -2299,13 +2307,13 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SizeMessage2 : pb::GeneratedMessage { - private static readonly SizeMessage2 defaultInstance = new Builder().BuildPartial(); + private static readonly SizeMessage2 defaultInstance = new SizeMessage2().MakeReadOnly(); public static SizeMessage2 DefaultInstance { get { return defaultInstance; } } public override SizeMessage2 DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override SizeMessage2 ThisMessage { @@ -2329,13 +2337,13 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Group1 : pb::GeneratedMessage { - private static readonly Group1 defaultInstance = new Builder().BuildPartial(); + private static readonly Group1 defaultInstance = new Group1().MakeReadOnly(); public static Group1 DefaultInstance { get { return defaultInstance; } } public override Group1 DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override Group1 ThisMessage { @@ -2509,12 +2517,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int Field31FieldNumber = 31; private bool hasField31; - private global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage field31_ = global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage field31_; public bool HasField31 { get { return hasField31; } } public global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage Field31 { - get { return field31_; } + get { return field31_ ?? global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage.DefaultInstance; } } public static Group1 ParseFrom(pb::ByteString data) { @@ -2547,6 +2555,13 @@ namespace Google.ProtocolBuffers.TestProtos { public static Group1 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private Group1 MakeReadOnly() { + field14_.MakeReadOnly(); + field22_.MakeReadOnly(); + field73_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -2562,22 +2577,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new Group1(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(Group1 cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - Group1 result; + private bool resultIsReadOnly; + private Group1 result; private Group1 PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { Group1 original = result; result = new Group1(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -2592,13 +2607,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new Group1(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -2614,14 +2629,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Group1 BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.field14_.MakeReadOnly(); - result.field22_.MakeReadOnly(); - result.field73_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } @@ -3003,7 +3015,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearField31() { PrepareBuilder(); result.hasField31 = false; - result.field31_ = global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage.DefaultInstance; + result.field31_ = null; return this; } } @@ -3353,6 +3365,14 @@ namespace Google.ProtocolBuffers.TestProtos { public static SizeMessage2 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private SizeMessage2 MakeReadOnly() { + group1_.MakeReadOnly(); + field128_.MakeReadOnly(); + field127_.MakeReadOnly(); + field130_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -3368,22 +3388,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new SizeMessage2(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(SizeMessage2 cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - SizeMessage2 result; + private bool resultIsReadOnly; + private SizeMessage2 result; private SizeMessage2 PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { SizeMessage2 original = result; result = new SizeMessage2(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -3398,13 +3418,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new SizeMessage2(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -3420,15 +3440,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SizeMessage2 BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.group1_.MakeReadOnly(); - result.field128_.MakeReadOnly(); - result.field127_.MakeReadOnly(); - result.field130_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } @@ -4102,13 +4118,13 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SizeMessage2GroupedMessage : pb::GeneratedMessage { - private static readonly SizeMessage2GroupedMessage defaultInstance = new Builder().BuildPartial(); + private static readonly SizeMessage2GroupedMessage defaultInstance = new SizeMessage2GroupedMessage().MakeReadOnly(); public static SizeMessage2GroupedMessage DefaultInstance { get { return defaultInstance; } } public override SizeMessage2GroupedMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override SizeMessage2GroupedMessage ThisMessage { @@ -4263,6 +4279,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static SizeMessage2GroupedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private SizeMessage2GroupedMessage MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -4278,22 +4298,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new SizeMessage2GroupedMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(SizeMessage2GroupedMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - SizeMessage2GroupedMessage result; + private bool resultIsReadOnly; + private SizeMessage2GroupedMessage result; private SizeMessage2GroupedMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { SizeMessage2GroupedMessage original = result; result = new SizeMessage2GroupedMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -4308,13 +4328,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new SizeMessage2GroupedMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -4330,11 +4350,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SizeMessage2GroupedMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs index 379a86f9a5..5b70d22e65 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs @@ -137,7 +137,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SpeedMessage1 : pb::GeneratedMessage { - private static readonly SpeedMessage1 defaultInstance = new Builder().BuildPartial(); + private static readonly SpeedMessage1 defaultInstance = new SpeedMessage1().MakeReadOnly(); private static readonly string[] _speedMessage1FieldNames = new string[] { "field1", "field100", "field101", "field102", "field103", "field104", "field12", "field128", "field129", "field13", "field130", "field131", "field14", "field15", "field150", "field16", "field17", "field18", "field2", "field22", "field23", "field24", "field25", "field271", "field272", "field280", "field29", "field3", "field30", "field4", "field5", "field59", "field6", "field60", "field67", "field68", "field7", "field78", "field80", "field81", "field9" }; private static readonly uint[] _speedMessage1FieldTags = new uint[] { 10, 800, 808, 818, 826, 832, 96, 1024, 1034, 104, 1040, 1048, 112, 122, 1200, 128, 136, 146, 16, 176, 184, 192, 200, 2168, 2176, 2240, 232, 24, 240, 34, 41, 472, 48, 480, 536, 544, 58, 624, 640, 648, 74 }; public static SpeedMessage1 DefaultInstance { @@ -145,7 +145,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SpeedMessage1 DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override SpeedMessage1 ThisMessage { @@ -506,12 +506,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int Field15FieldNumber = 15; private bool hasField15; - private global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage field15_ = global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage field15_; public bool HasField15 { get { return hasField15; } } public global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage Field15 { - get { return field15_; } + get { return field15_ ?? global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.DefaultInstance; } } public const int Field78FieldNumber = 78; @@ -881,6 +881,11 @@ namespace Google.ProtocolBuffers.TestProtos { public static SpeedMessage1 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private SpeedMessage1 MakeReadOnly() { + field5_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -896,22 +901,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new SpeedMessage1(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(SpeedMessage1 cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - SpeedMessage1 result; + private bool resultIsReadOnly; + private SpeedMessage1 result; private SpeedMessage1 PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { SpeedMessage1 original = result; result = new SpeedMessage1(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -926,13 +931,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new SpeedMessage1(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -948,12 +953,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SpeedMessage1 BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.field5_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -2052,7 +2056,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearField15() { PrepareBuilder(); result.hasField15 = false; - result.field15_ = global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.DefaultInstance; + result.field15_ = null; return this; } @@ -2186,7 +2190,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SpeedMessage1SubMessage : pb::GeneratedMessage { - private static readonly SpeedMessage1SubMessage defaultInstance = new Builder().BuildPartial(); + private static readonly SpeedMessage1SubMessage defaultInstance = new SpeedMessage1SubMessage().MakeReadOnly(); private static readonly string[] _speedMessage1SubMessageFieldNames = new string[] { "field1", "field12", "field13", "field14", "field15", "field16", "field19", "field2", "field20", "field203", "field204", "field205", "field206", "field207", "field21", "field22", "field23", "field28", "field3", "field300" }; private static readonly uint[] _speedMessage1SubMessageFieldTags = new uint[] { 8, 96, 104, 112, 122, 128, 152, 16, 160, 1629, 1632, 1642, 1648, 1656, 169, 176, 184, 224, 24, 2400 }; public static SpeedMessage1SubMessage DefaultInstance { @@ -2194,7 +2198,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SpeedMessage1SubMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override SpeedMessage1SubMessage ThisMessage { @@ -2588,6 +2592,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static SpeedMessage1SubMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private SpeedMessage1SubMessage MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -2603,22 +2611,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new SpeedMessage1SubMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(SpeedMessage1SubMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - SpeedMessage1SubMessage result; + private bool resultIsReadOnly; + private SpeedMessage1SubMessage result; private SpeedMessage1SubMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { SpeedMessage1SubMessage original = result; result = new SpeedMessage1SubMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -2633,13 +2641,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new SpeedMessage1SubMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -2655,11 +2663,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SpeedMessage1SubMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -3286,7 +3294,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SpeedMessage2 : pb::GeneratedMessage { - private static readonly SpeedMessage2 defaultInstance = new Builder().BuildPartial(); + private static readonly SpeedMessage2 defaultInstance = new SpeedMessage2().MakeReadOnly(); private static readonly string[] _speedMessage2FieldNames = new string[] { "field1", "field109", "field127", "field128", "field129", "field130", "field131", "field2", "field205", "field206", "field21", "field210", "field211", "field212", "field213", "field216", "field217", "field218", "field220", "field221", "field222", "field25", "field3", "field30", "field4", "field6", "field63", "field71", "field75", "group1" }; private static readonly uint[] _speedMessage2FieldTags = new uint[] { 10, 872, 1018, 1026, 1032, 1040, 1048, 18, 1640, 1648, 168, 1680, 1688, 1696, 1704, 1728, 1736, 1744, 1760, 1768, 1781, 205, 24, 240, 32, 50, 504, 568, 600, 83 }; public static SpeedMessage2 DefaultInstance { @@ -3294,7 +3302,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SpeedMessage2 DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override SpeedMessage2 ThisMessage { @@ -3318,7 +3326,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Group1 : pb::GeneratedMessage { - private static readonly Group1 defaultInstance = new Builder().BuildPartial(); + private static readonly Group1 defaultInstance = new Group1().MakeReadOnly(); private static readonly string[] _group1FieldNames = new string[] { "field11", "field12", "field13", "field14", "field15", "field16", "field20", "field22", "field24", "field26", "field27", "field28", "field29", "field31", "field5", "field73" }; private static readonly uint[] _group1FieldTags = new uint[] { 93, 98, 106, 114, 120, 130, 160, 178, 194, 213, 218, 224, 234, 250, 40, 584 }; public static Group1 DefaultInstance { @@ -3326,7 +3334,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Group1 DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override Group1 ThisMessage { @@ -3500,12 +3508,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int Field31FieldNumber = 31; private bool hasField31; - private global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage field31_ = global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage field31_; public bool HasField31 { get { return hasField31; } } public global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage Field31 { - get { return field31_; } + get { return field31_ ?? global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.DefaultInstance; } } public override bool IsInitialized { @@ -3676,6 +3684,13 @@ namespace Google.ProtocolBuffers.TestProtos { public static Group1 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private Group1 MakeReadOnly() { + field14_.MakeReadOnly(); + field22_.MakeReadOnly(); + field73_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -3691,22 +3706,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new Group1(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(Group1 cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - Group1 result; + private bool resultIsReadOnly; + private Group1 result; private Group1 PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { Group1 original = result; result = new Group1(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -3721,13 +3736,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new Group1(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -3743,14 +3758,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Group1 BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.field14_.MakeReadOnly(); - result.field22_.MakeReadOnly(); - result.field73_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -4314,7 +4326,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearField31() { PrepareBuilder(); result.hasField31 = false; - result.field31_ = global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.DefaultInstance; + result.field31_ = null; return this; } } @@ -4884,6 +4896,14 @@ namespace Google.ProtocolBuffers.TestProtos { public static SpeedMessage2 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private SpeedMessage2 MakeReadOnly() { + group1_.MakeReadOnly(); + field128_.MakeReadOnly(); + field127_.MakeReadOnly(); + field130_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -4899,22 +4919,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new SpeedMessage2(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(SpeedMessage2 cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - SpeedMessage2 result; + private bool resultIsReadOnly; + private SpeedMessage2 result; private SpeedMessage2 PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { SpeedMessage2 original = result; result = new SpeedMessage2(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -4929,13 +4949,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new SpeedMessage2(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -4951,15 +4971,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SpeedMessage2 BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.group1_.MakeReadOnly(); - result.field128_.MakeReadOnly(); - result.field127_.MakeReadOnly(); - result.field130_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -5908,7 +5924,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SpeedMessage2GroupedMessage : pb::GeneratedMessage { - private static readonly SpeedMessage2GroupedMessage defaultInstance = new Builder().BuildPartial(); + private static readonly SpeedMessage2GroupedMessage defaultInstance = new SpeedMessage2GroupedMessage().MakeReadOnly(); private static readonly string[] _speedMessage2GroupedMessageFieldNames = new string[] { "field1", "field10", "field11", "field2", "field3", "field4", "field5", "field6", "field7", "field8", "field9" }; private static readonly uint[] _speedMessage2GroupedMessageFieldTags = new uint[] { 13, 85, 88, 21, 29, 32, 40, 48, 56, 69, 72 }; public static SpeedMessage2GroupedMessage DefaultInstance { @@ -5916,7 +5932,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SpeedMessage2GroupedMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override SpeedMessage2GroupedMessage ThisMessage { @@ -6162,6 +6178,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static SpeedMessage2GroupedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private SpeedMessage2GroupedMessage MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -6177,22 +6197,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new SpeedMessage2GroupedMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(SpeedMessage2GroupedMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - SpeedMessage2GroupedMessage result; + private bool resultIsReadOnly; + private SpeedMessage2GroupedMessage result; private SpeedMessage2GroupedMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { SpeedMessage2GroupedMessage original = result; result = new SpeedMessage2GroupedMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -6207,13 +6227,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new SpeedMessage2GroupedMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -6229,11 +6249,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SpeedMessage2GroupedMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs index 0df40f4248..3eb3062ce0 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs @@ -43,7 +43,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ImportMessageLite : pb::GeneratedMessageLite { - private static readonly ImportMessageLite defaultInstance = new Builder().BuildPartial(); + private static readonly ImportMessageLite defaultInstance = new ImportMessageLite().MakeReadOnly(); private static readonly string[] _importMessageLiteFieldNames = new string[] { "d" }; private static readonly uint[] _importMessageLiteFieldTags = new uint[] { 8 }; public static ImportMessageLite DefaultInstance { @@ -51,7 +51,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ImportMessageLite DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override ImportMessageLite ThisMessage { @@ -146,6 +146,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static ImportMessageLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private ImportMessageLite MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -161,22 +165,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new ImportMessageLite(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(ImportMessageLite cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - ImportMessageLite result; + private bool resultIsReadOnly; + private ImportMessageLite result; private ImportMessageLite PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { ImportMessageLite original = result; result = new ImportMessageLite(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -191,13 +195,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new ImportMessageLite(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -209,11 +213,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ImportMessageLite BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs index 75e746a840..6f7f59d5c1 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs @@ -71,7 +71,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ImportMessage : pb::GeneratedMessage { - private static readonly ImportMessage defaultInstance = new Builder().BuildPartial(); + private static readonly ImportMessage defaultInstance = new ImportMessage().MakeReadOnly(); private static readonly string[] _importMessageFieldNames = new string[] { "d" }; private static readonly uint[] _importMessageFieldTags = new uint[] { 8 }; public static ImportMessage DefaultInstance { @@ -79,7 +79,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ImportMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override ImportMessage ThisMessage { @@ -165,6 +165,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static ImportMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private ImportMessage MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -180,22 +184,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new ImportMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(ImportMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - ImportMessage result; + private bool resultIsReadOnly; + private ImportMessage result; private ImportMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { ImportMessage original = result; result = new ImportMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -210,13 +214,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new ImportMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -232,11 +236,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ImportMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs index f51b2f424e..333cb7affb 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs @@ -103,7 +103,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessageSet : pb::ExtendableMessage { - private static readonly TestMessageSet defaultInstance = new Builder().BuildPartial(); + private static readonly TestMessageSet defaultInstance = new TestMessageSet().MakeReadOnly(); private static readonly string[] _testMessageSetFieldNames = new string[] { }; private static readonly uint[] _testMessageSetFieldTags = new uint[] { }; public static TestMessageSet DefaultInstance { @@ -111,7 +111,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMessageSet DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestMessageSet ThisMessage { @@ -185,6 +185,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestMessageSet ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestMessageSet MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -200,22 +204,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestMessageSet(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestMessageSet cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestMessageSet result; + private bool resultIsReadOnly; + private TestMessageSet result; private TestMessageSet PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestMessageSet original = result; result = new TestMessageSet(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -230,13 +234,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestMessageSet(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -252,11 +256,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMessageSet BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -334,7 +338,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessageSetContainer : pb::GeneratedMessage { - private static readonly TestMessageSetContainer defaultInstance = new Builder().BuildPartial(); + private static readonly TestMessageSetContainer defaultInstance = new TestMessageSetContainer().MakeReadOnly(); private static readonly string[] _testMessageSetContainerFieldNames = new string[] { "message_set" }; private static readonly uint[] _testMessageSetContainerFieldTags = new uint[] { 10 }; public static TestMessageSetContainer DefaultInstance { @@ -342,7 +346,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMessageSetContainer DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestMessageSetContainer ThisMessage { @@ -359,12 +363,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int MessageSetFieldNumber = 1; private bool hasMessageSet; - private global::Google.ProtocolBuffers.TestProtos.TestMessageSet messageSet_ = global::Google.ProtocolBuffers.TestProtos.TestMessageSet.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestMessageSet messageSet_; public bool HasMessageSet { get { return hasMessageSet; } } public global::Google.ProtocolBuffers.TestProtos.TestMessageSet MessageSet { - get { return messageSet_; } + get { return messageSet_ ?? global::Google.ProtocolBuffers.TestProtos.TestMessageSet.DefaultInstance; } } public override bool IsInitialized { @@ -428,6 +432,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestMessageSetContainer ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestMessageSetContainer MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -443,22 +451,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestMessageSetContainer(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestMessageSetContainer cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestMessageSetContainer result; + private bool resultIsReadOnly; + private TestMessageSetContainer result; private TestMessageSetContainer PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestMessageSetContainer original = result; result = new TestMessageSetContainer(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -473,13 +481,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestMessageSetContainer(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -495,11 +503,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMessageSetContainer BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -615,7 +623,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearMessageSet() { PrepareBuilder(); result.hasMessageSet = false; - result.messageSet_ = global::Google.ProtocolBuffers.TestProtos.TestMessageSet.DefaultInstance; + result.messageSet_ = null; return this; } } @@ -628,7 +636,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessageSetExtension1 : pb::GeneratedMessage { - private static readonly TestMessageSetExtension1 defaultInstance = new Builder().BuildPartial(); + private static readonly TestMessageSetExtension1 defaultInstance = new TestMessageSetExtension1().MakeReadOnly(); private static readonly string[] _testMessageSetExtension1FieldNames = new string[] { "i" }; private static readonly uint[] _testMessageSetExtension1FieldTags = new uint[] { 120 }; public static TestMessageSetExtension1 DefaultInstance { @@ -636,7 +644,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMessageSetExtension1 DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestMessageSetExtension1 ThisMessage { @@ -724,6 +732,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestMessageSetExtension1 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestMessageSetExtension1 MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -739,22 +751,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestMessageSetExtension1(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestMessageSetExtension1 cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestMessageSetExtension1 result; + private bool resultIsReadOnly; + private TestMessageSetExtension1 result; private TestMessageSetExtension1 PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestMessageSetExtension1 original = result; result = new TestMessageSetExtension1(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -769,13 +781,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestMessageSetExtension1(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -791,11 +803,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMessageSetExtension1 BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -899,7 +911,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessageSetExtension2 : pb::GeneratedMessage { - private static readonly TestMessageSetExtension2 defaultInstance = new Builder().BuildPartial(); + private static readonly TestMessageSetExtension2 defaultInstance = new TestMessageSetExtension2().MakeReadOnly(); private static readonly string[] _testMessageSetExtension2FieldNames = new string[] { "str" }; private static readonly uint[] _testMessageSetExtension2FieldTags = new uint[] { 202 }; public static TestMessageSetExtension2 DefaultInstance { @@ -907,7 +919,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMessageSetExtension2 DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestMessageSetExtension2 ThisMessage { @@ -995,6 +1007,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestMessageSetExtension2 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestMessageSetExtension2 MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1010,22 +1026,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestMessageSetExtension2(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestMessageSetExtension2 cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestMessageSetExtension2 result; + private bool resultIsReadOnly; + private TestMessageSetExtension2 result; private TestMessageSetExtension2 PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestMessageSetExtension2 original = result; result = new TestMessageSetExtension2(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1040,13 +1056,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestMessageSetExtension2(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1062,11 +1078,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMessageSetExtension2 BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1171,7 +1187,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RawMessageSet : pb::GeneratedMessage { - private static readonly RawMessageSet defaultInstance = new Builder().BuildPartial(); + private static readonly RawMessageSet defaultInstance = new RawMessageSet().MakeReadOnly(); private static readonly string[] _rawMessageSetFieldNames = new string[] { "item" }; private static readonly uint[] _rawMessageSetFieldTags = new uint[] { 11 }; public static RawMessageSet DefaultInstance { @@ -1179,7 +1195,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RawMessageSet DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override RawMessageSet ThisMessage { @@ -1203,7 +1219,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Item : pb::GeneratedMessage { - private static readonly Item defaultInstance = new Builder().BuildPartial(); + private static readonly Item defaultInstance = new Item().MakeReadOnly(); private static readonly string[] _itemFieldNames = new string[] { "message", "type_id" }; private static readonly uint[] _itemFieldTags = new uint[] { 26, 16 }; public static Item DefaultInstance { @@ -1211,7 +1227,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Item DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override Item ThisMessage { @@ -1315,6 +1331,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static Item ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private Item MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1330,22 +1350,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new Item(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(Item cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - Item result; + private bool resultIsReadOnly; + private Item result; private Item PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { Item original = result; result = new Item(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1360,13 +1380,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new Item(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1382,11 +1402,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Item BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1590,6 +1610,11 @@ namespace Google.ProtocolBuffers.TestProtos { public static RawMessageSet ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private RawMessageSet MakeReadOnly() { + item_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1605,22 +1630,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new RawMessageSet(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(RawMessageSet cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - RawMessageSet result; + private bool resultIsReadOnly; + private RawMessageSet result; private RawMessageSet PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { RawMessageSet original = result; result = new RawMessageSet(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1635,13 +1660,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new RawMessageSet(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1657,12 +1682,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RawMessageSet BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.item_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs index ca401926e3..3d607c81af 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs @@ -81,7 +81,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessage : pb::ExtendableMessage { - private static readonly TestMessage defaultInstance = new Builder().BuildPartial(); + private static readonly TestMessage defaultInstance = new TestMessage().MakeReadOnly(); private static readonly string[] _testMessageFieldNames = new string[] { "a" }; private static readonly uint[] _testMessageFieldTags = new uint[] { 8 }; public static TestMessage DefaultInstance { @@ -89,7 +89,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { } public override TestMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestMessage ThisMessage { @@ -179,6 +179,10 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { public static TestMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestMessage MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -194,22 +198,22 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestMessage result; + private bool resultIsReadOnly; + private TestMessage result; private TestMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestMessage original = result; result = new TestMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -224,13 +228,13 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { } public override Builder Clear() { - result = DefaultInstance ?? new TestMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -246,11 +250,11 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { } public override TestMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs index 967d549adf..b3c24e390b 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs @@ -85,13 +85,13 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestOptimizedForSize : pb::ExtendableMessage { - private static readonly TestOptimizedForSize defaultInstance = new Builder().BuildPartial(); + private static readonly TestOptimizedForSize defaultInstance = new TestOptimizedForSize().MakeReadOnly(); public static TestOptimizedForSize DefaultInstance { get { return defaultInstance; } } public override TestOptimizedForSize DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestOptimizedForSize ThisMessage { @@ -122,12 +122,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int MsgFieldNumber = 19; private bool hasMsg; - private global::Google.ProtocolBuffers.TestProtos.ForeignMessage msg_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessage msg_; public bool HasMsg { get { return hasMsg; } } public global::Google.ProtocolBuffers.TestProtos.ForeignMessage Msg { - get { return msg_; } + get { return msg_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } } public static TestOptimizedForSize ParseFrom(pb::ByteString data) { @@ -160,6 +160,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestOptimizedForSize ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestOptimizedForSize MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -175,22 +179,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestOptimizedForSize(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestOptimizedForSize cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestOptimizedForSize result; + private bool resultIsReadOnly; + private TestOptimizedForSize result; private TestOptimizedForSize PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestOptimizedForSize original = result; result = new TestOptimizedForSize(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -205,13 +209,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestOptimizedForSize(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -227,11 +231,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestOptimizedForSize BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } @@ -291,7 +295,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearMsg() { PrepareBuilder(); result.hasMsg = false; - result.msg_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; + result.msg_ = null; return this; } } @@ -304,13 +308,13 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequiredOptimizedForSize : pb::GeneratedMessage { - private static readonly TestRequiredOptimizedForSize defaultInstance = new Builder().BuildPartial(); + private static readonly TestRequiredOptimizedForSize defaultInstance = new TestRequiredOptimizedForSize().MakeReadOnly(); public static TestRequiredOptimizedForSize DefaultInstance { get { return defaultInstance; } } public override TestRequiredOptimizedForSize DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestRequiredOptimizedForSize ThisMessage { @@ -365,6 +369,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestRequiredOptimizedForSize ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestRequiredOptimizedForSize MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -380,22 +388,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestRequiredOptimizedForSize(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestRequiredOptimizedForSize cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestRequiredOptimizedForSize result; + private bool resultIsReadOnly; + private TestRequiredOptimizedForSize result; private TestRequiredOptimizedForSize PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestRequiredOptimizedForSize original = result; result = new TestRequiredOptimizedForSize(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -410,13 +418,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestRequiredOptimizedForSize(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -432,11 +440,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRequiredOptimizedForSize BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } @@ -469,13 +477,13 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestOptionalOptimizedForSize : pb::GeneratedMessage { - private static readonly TestOptionalOptimizedForSize defaultInstance = new Builder().BuildPartial(); + private static readonly TestOptionalOptimizedForSize defaultInstance = new TestOptionalOptimizedForSize().MakeReadOnly(); public static TestOptionalOptimizedForSize DefaultInstance { get { return defaultInstance; } } public override TestOptionalOptimizedForSize DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestOptionalOptimizedForSize ThisMessage { @@ -492,12 +500,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int OFieldNumber = 1; private bool hasO; - private global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize o_ = global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize o_; public bool HasO { get { return hasO; } } public global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize O { - get { return o_; } + get { return o_ ?? global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.DefaultInstance; } } public static TestOptionalOptimizedForSize ParseFrom(pb::ByteString data) { @@ -530,6 +538,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestOptionalOptimizedForSize ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestOptionalOptimizedForSize MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -545,22 +557,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestOptionalOptimizedForSize(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestOptionalOptimizedForSize cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestOptionalOptimizedForSize result; + private bool resultIsReadOnly; + private TestOptionalOptimizedForSize result; private TestOptionalOptimizedForSize PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestOptionalOptimizedForSize original = result; result = new TestOptionalOptimizedForSize(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -575,13 +587,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestOptionalOptimizedForSize(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -597,11 +609,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestOptionalOptimizedForSize BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } @@ -641,7 +653,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearO() { PrepareBuilder(); result.hasO = false; - result.o_ = global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.DefaultInstance; + result.o_ = null; return this; } } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs index aeea673d57..0c66d4bc5f 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs @@ -1122,7 +1122,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllTypes : pb::GeneratedMessage { - private static readonly TestAllTypes defaultInstance = new Builder().BuildPartial(); + private static readonly TestAllTypes defaultInstance = new TestAllTypes().MakeReadOnly(); private static readonly string[] _testAllTypesFieldNames = new string[] { "default_bool", "default_bytes", "default_cord", "default_double", "default_fixed32", "default_fixed64", "default_float", "default_foreign_enum", "default_import_enum", "default_int32", "default_int64", "default_nested_enum", "default_sfixed32", "default_sfixed64", "default_sint32", "default_sint64", "default_string", "default_string_piece", "default_uint32", "default_uint64", "optional_bool", "optional_bytes", "optional_cord", "optional_double", "optional_fixed32", "optional_fixed64", "optional_float", "optional_foreign_enum", "optional_foreign_message", "optional_import_enum", "optional_import_message", "optional_int32", "optional_int64", "optional_nested_enum", "optional_nested_message", "optional_sfixed32", "optional_sfixed64", "optional_sint32", "optional_sint64", "optional_string", "optional_string_piece", "optional_uint32", "optional_uint64", "optionalgroup", "repeated_bool", "repeated_bytes", "repeated_cord", "repeated_double", "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_foreign_enum", "repeated_foreign_message", "repeated_import_enum", "repeated_import_message", "repeated_int32", "repeated_int64", "repeated_nested_enum", "repeated_nested_message", "repeated_sfixed32", "repeated_sfixed64", "repeated_sint32", "repeated_sint64", "repeated_string", "repeated_string_piece", "repeated_uint32", "repeated_uint64", "repeatedgroup" }; private static readonly uint[] _testAllTypesFieldTags = new uint[] { 584, 602, 682, 577, 541, 545, 573, 656, 664, 488, 496, 648, 557, 561, 520, 528, 594, 674, 504, 512, 104, 122, 202, 97, 61, 65, 93, 176, 154, 184, 162, 8, 16, 168, 146, 77, 81, 40, 48, 114, 194, 24, 32, 131, 344, 362, 442, 337, 301, 305, 333, 416, 394, 424, 402, 248, 256, 408, 386, 317, 321, 280, 288, 354, 434, 264, 272, 371 }; public static TestAllTypes DefaultInstance { @@ -1130,7 +1130,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllTypes DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestAllTypes ThisMessage { @@ -1162,7 +1162,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NestedMessage : pb::GeneratedMessage { - private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); + private static readonly NestedMessage defaultInstance = new NestedMessage().MakeReadOnly(); private static readonly string[] _nestedMessageFieldNames = new string[] { "bb" }; private static readonly uint[] _nestedMessageFieldTags = new uint[] { 8 }; public static NestedMessage DefaultInstance { @@ -1170,7 +1170,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override NestedMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override NestedMessage ThisMessage { @@ -1256,6 +1256,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static NestedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private NestedMessage MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1271,22 +1275,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new NestedMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(NestedMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - NestedMessage result; + private bool resultIsReadOnly; + private NestedMessage result; private NestedMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { NestedMessage original = result; result = new NestedMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1301,13 +1305,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new NestedMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1323,11 +1327,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override NestedMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1431,7 +1435,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup : pb::GeneratedMessage { - private static readonly OptionalGroup defaultInstance = new Builder().BuildPartial(); + private static readonly OptionalGroup defaultInstance = new OptionalGroup().MakeReadOnly(); private static readonly string[] _optionalGroupFieldNames = new string[] { "a" }; private static readonly uint[] _optionalGroupFieldTags = new uint[] { 136 }; public static OptionalGroup DefaultInstance { @@ -1439,7 +1443,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override OptionalGroup ThisMessage { @@ -1525,6 +1529,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static OptionalGroup ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private OptionalGroup MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1540,22 +1548,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new OptionalGroup(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(OptionalGroup cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - OptionalGroup result; + private bool resultIsReadOnly; + private OptionalGroup result; private OptionalGroup PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { OptionalGroup original = result; result = new OptionalGroup(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1570,13 +1578,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new OptionalGroup(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1592,11 +1600,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1700,7 +1708,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup : pb::GeneratedMessage { - private static readonly RepeatedGroup defaultInstance = new Builder().BuildPartial(); + private static readonly RepeatedGroup defaultInstance = new RepeatedGroup().MakeReadOnly(); private static readonly string[] _repeatedGroupFieldNames = new string[] { "a" }; private static readonly uint[] _repeatedGroupFieldTags = new uint[] { 376 }; public static RepeatedGroup DefaultInstance { @@ -1708,7 +1716,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override RepeatedGroup ThisMessage { @@ -1794,6 +1802,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static RepeatedGroup ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private RepeatedGroup MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1809,22 +1821,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new RepeatedGroup(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(RepeatedGroup cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - RepeatedGroup result; + private bool resultIsReadOnly; + private RepeatedGroup result; private RepeatedGroup PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { RepeatedGroup original = result; result = new RepeatedGroup(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1839,13 +1851,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new RepeatedGroup(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1861,11 +1873,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -2124,42 +2136,42 @@ namespace Google.ProtocolBuffers.TestProtos { public const int OptionalGroupFieldNumber = 16; private bool hasOptionalGroup; - private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup optionalGroup_; public bool HasOptionalGroup { get { return hasOptionalGroup; } } public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup OptionalGroup { - get { return optionalGroup_; } + get { return optionalGroup_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance; } } public const int OptionalNestedMessageFieldNumber = 18; private bool hasOptionalNestedMessage; - private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage optionalNestedMessage_; public bool HasOptionalNestedMessage { get { return hasOptionalNestedMessage; } } public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage OptionalNestedMessage { - get { return optionalNestedMessage_; } + get { return optionalNestedMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; } } public const int OptionalForeignMessageFieldNumber = 19; private bool hasOptionalForeignMessage; - private global::Google.ProtocolBuffers.TestProtos.ForeignMessage optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessage optionalForeignMessage_; public bool HasOptionalForeignMessage { get { return hasOptionalForeignMessage; } } public global::Google.ProtocolBuffers.TestProtos.ForeignMessage OptionalForeignMessage { - get { return optionalForeignMessage_; } + get { return optionalForeignMessage_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } } public const int OptionalImportMessageFieldNumber = 20; private bool hasOptionalImportMessage; - private global::Google.ProtocolBuffers.TestProtos.ImportMessage optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.ImportMessage optionalImportMessage_; public bool HasOptionalImportMessage { get { return hasOptionalImportMessage; } } public global::Google.ProtocolBuffers.TestProtos.ImportMessage OptionalImportMessage { - get { return optionalImportMessage_; } + get { return optionalImportMessage_ ?? global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; } } public const int OptionalNestedEnumFieldNumber = 21; @@ -3267,6 +3279,34 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestAllTypes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestAllTypes MakeReadOnly() { + repeatedInt32_.MakeReadOnly(); + repeatedInt64_.MakeReadOnly(); + repeatedUint32_.MakeReadOnly(); + repeatedUint64_.MakeReadOnly(); + repeatedSint32_.MakeReadOnly(); + repeatedSint64_.MakeReadOnly(); + repeatedFixed32_.MakeReadOnly(); + repeatedFixed64_.MakeReadOnly(); + repeatedSfixed32_.MakeReadOnly(); + repeatedSfixed64_.MakeReadOnly(); + repeatedFloat_.MakeReadOnly(); + repeatedDouble_.MakeReadOnly(); + repeatedBool_.MakeReadOnly(); + repeatedString_.MakeReadOnly(); + repeatedBytes_.MakeReadOnly(); + repeatedGroup_.MakeReadOnly(); + repeatedNestedMessage_.MakeReadOnly(); + repeatedForeignMessage_.MakeReadOnly(); + repeatedImportMessage_.MakeReadOnly(); + repeatedNestedEnum_.MakeReadOnly(); + repeatedForeignEnum_.MakeReadOnly(); + repeatedImportEnum_.MakeReadOnly(); + repeatedStringPiece_.MakeReadOnly(); + repeatedCord_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -3282,22 +3322,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestAllTypes(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestAllTypes cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestAllTypes result; + private bool resultIsReadOnly; + private TestAllTypes result; private TestAllTypes PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestAllTypes original = result; result = new TestAllTypes(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -3312,13 +3352,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestAllTypes(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -3334,35 +3374,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllTypes BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.repeatedInt32_.MakeReadOnly(); - result.repeatedInt64_.MakeReadOnly(); - result.repeatedUint32_.MakeReadOnly(); - result.repeatedUint64_.MakeReadOnly(); - result.repeatedSint32_.MakeReadOnly(); - result.repeatedSint64_.MakeReadOnly(); - result.repeatedFixed32_.MakeReadOnly(); - result.repeatedFixed64_.MakeReadOnly(); - result.repeatedSfixed32_.MakeReadOnly(); - result.repeatedSfixed64_.MakeReadOnly(); - result.repeatedFloat_.MakeReadOnly(); - result.repeatedDouble_.MakeReadOnly(); - result.repeatedBool_.MakeReadOnly(); - result.repeatedString_.MakeReadOnly(); - result.repeatedBytes_.MakeReadOnly(); - result.repeatedGroup_.MakeReadOnly(); - result.repeatedNestedMessage_.MakeReadOnly(); - result.repeatedForeignMessage_.MakeReadOnly(); - result.repeatedImportMessage_.MakeReadOnly(); - result.repeatedNestedEnum_.MakeReadOnly(); - result.repeatedForeignEnum_.MakeReadOnly(); - result.repeatedImportEnum_.MakeReadOnly(); - result.repeatedStringPiece_.MakeReadOnly(); - result.repeatedCord_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -4363,7 +4379,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearOptionalGroup() { PrepareBuilder(); result.hasOptionalGroup = false; - result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance; + result.optionalGroup_ = null; return this; } @@ -4403,7 +4419,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearOptionalNestedMessage() { PrepareBuilder(); result.hasOptionalNestedMessage = false; - result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; + result.optionalNestedMessage_ = null; return this; } @@ -4443,7 +4459,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearOptionalForeignMessage() { PrepareBuilder(); result.hasOptionalForeignMessage = false; - result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; + result.optionalForeignMessage_ = null; return this; } @@ -4483,7 +4499,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearOptionalImportMessage() { PrepareBuilder(); result.hasOptionalImportMessage = false; - result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; + result.optionalImportMessage_ = null; return this; } @@ -5814,7 +5830,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDeprecatedFields : pb::GeneratedMessage { - private static readonly TestDeprecatedFields defaultInstance = new Builder().BuildPartial(); + private static readonly TestDeprecatedFields defaultInstance = new TestDeprecatedFields().MakeReadOnly(); private static readonly string[] _testDeprecatedFieldsFieldNames = new string[] { "deprecated_int32" }; private static readonly uint[] _testDeprecatedFieldsFieldTags = new uint[] { 8 }; public static TestDeprecatedFields DefaultInstance { @@ -5822,7 +5838,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDeprecatedFields DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestDeprecatedFields ThisMessage { @@ -5908,6 +5924,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestDeprecatedFields ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestDeprecatedFields MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -5923,22 +5943,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestDeprecatedFields(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestDeprecatedFields cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestDeprecatedFields result; + private bool resultIsReadOnly; + private TestDeprecatedFields result; private TestDeprecatedFields PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestDeprecatedFields original = result; result = new TestDeprecatedFields(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -5953,13 +5973,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestDeprecatedFields(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -5975,11 +5995,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDeprecatedFields BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -6083,7 +6103,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ForeignMessage : pb::GeneratedMessage { - private static readonly ForeignMessage defaultInstance = new Builder().BuildPartial(); + private static readonly ForeignMessage defaultInstance = new ForeignMessage().MakeReadOnly(); private static readonly string[] _foreignMessageFieldNames = new string[] { "c" }; private static readonly uint[] _foreignMessageFieldTags = new uint[] { 8 }; public static ForeignMessage DefaultInstance { @@ -6091,7 +6111,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ForeignMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override ForeignMessage ThisMessage { @@ -6177,6 +6197,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static ForeignMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private ForeignMessage MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -6192,22 +6216,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new ForeignMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(ForeignMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - ForeignMessage result; + private bool resultIsReadOnly; + private ForeignMessage result; private ForeignMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { ForeignMessage original = result; result = new ForeignMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -6222,13 +6246,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new ForeignMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -6244,11 +6268,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ForeignMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -6352,7 +6376,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllExtensions : pb::ExtendableMessage { - private static readonly TestAllExtensions defaultInstance = new Builder().BuildPartial(); + private static readonly TestAllExtensions defaultInstance = new TestAllExtensions().MakeReadOnly(); private static readonly string[] _testAllExtensionsFieldNames = new string[] { }; private static readonly uint[] _testAllExtensionsFieldTags = new uint[] { }; public static TestAllExtensions DefaultInstance { @@ -6360,7 +6384,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllExtensions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestAllExtensions ThisMessage { @@ -6434,6 +6458,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestAllExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestAllExtensions MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -6449,22 +6477,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestAllExtensions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestAllExtensions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestAllExtensions result; + private bool resultIsReadOnly; + private TestAllExtensions result; private TestAllExtensions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestAllExtensions original = result; result = new TestAllExtensions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -6479,13 +6507,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestAllExtensions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -6501,11 +6529,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllExtensions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -6583,7 +6611,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup_extension : pb::GeneratedMessage { - private static readonly OptionalGroup_extension defaultInstance = new Builder().BuildPartial(); + private static readonly OptionalGroup_extension defaultInstance = new OptionalGroup_extension().MakeReadOnly(); private static readonly string[] _optionalGroupExtensionFieldNames = new string[] { "a" }; private static readonly uint[] _optionalGroupExtensionFieldTags = new uint[] { 136 }; public static OptionalGroup_extension DefaultInstance { @@ -6591,7 +6619,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup_extension DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override OptionalGroup_extension ThisMessage { @@ -6677,6 +6705,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static OptionalGroup_extension ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private OptionalGroup_extension MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -6692,22 +6724,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new OptionalGroup_extension(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(OptionalGroup_extension cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - OptionalGroup_extension result; + private bool resultIsReadOnly; + private OptionalGroup_extension result; private OptionalGroup_extension PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { OptionalGroup_extension original = result; result = new OptionalGroup_extension(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -6722,13 +6754,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new OptionalGroup_extension(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -6744,11 +6776,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup_extension BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -6852,7 +6884,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup_extension : pb::GeneratedMessage { - private static readonly RepeatedGroup_extension defaultInstance = new Builder().BuildPartial(); + private static readonly RepeatedGroup_extension defaultInstance = new RepeatedGroup_extension().MakeReadOnly(); private static readonly string[] _repeatedGroupExtensionFieldNames = new string[] { "a" }; private static readonly uint[] _repeatedGroupExtensionFieldTags = new uint[] { 376 }; public static RepeatedGroup_extension DefaultInstance { @@ -6860,7 +6892,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup_extension DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override RepeatedGroup_extension ThisMessage { @@ -6946,6 +6978,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static RepeatedGroup_extension ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private RepeatedGroup_extension MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -6961,22 +6997,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new RepeatedGroup_extension(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(RepeatedGroup_extension cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - RepeatedGroup_extension result; + private bool resultIsReadOnly; + private RepeatedGroup_extension result; private RepeatedGroup_extension PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { RepeatedGroup_extension original = result; result = new RepeatedGroup_extension(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -6991,13 +7027,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new RepeatedGroup_extension(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -7013,11 +7049,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup_extension BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -7121,7 +7157,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestNestedExtension : pb::GeneratedMessage { - private static readonly TestNestedExtension defaultInstance = new Builder().BuildPartial(); + private static readonly TestNestedExtension defaultInstance = new TestNestedExtension().MakeReadOnly(); private static readonly string[] _testNestedExtensionFieldNames = new string[] { }; private static readonly uint[] _testNestedExtensionFieldTags = new uint[] { }; public static TestNestedExtension DefaultInstance { @@ -7129,7 +7165,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestNestedExtension DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestNestedExtension ThisMessage { @@ -7201,6 +7237,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestNestedExtension ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestNestedExtension MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -7216,22 +7256,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestNestedExtension(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestNestedExtension cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestNestedExtension result; + private bool resultIsReadOnly; + private TestNestedExtension result; private TestNestedExtension PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestNestedExtension original = result; result = new TestNestedExtension(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -7246,13 +7286,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestNestedExtension(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -7268,11 +7308,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestNestedExtension BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -7349,7 +7389,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequired : pb::GeneratedMessage { - private static readonly TestRequired defaultInstance = new Builder().BuildPartial(); + private static readonly TestRequired defaultInstance = new TestRequired().MakeReadOnly(); private static readonly string[] _testRequiredFieldNames = new string[] { "a", "b", "c", "dummy10", "dummy11", "dummy12", "dummy13", "dummy14", "dummy15", "dummy16", "dummy17", "dummy18", "dummy19", "dummy2", "dummy20", "dummy21", "dummy22", "dummy23", "dummy24", "dummy25", "dummy26", "dummy27", "dummy28", "dummy29", "dummy30", "dummy31", "dummy32", "dummy4", "dummy5", "dummy6", "dummy7", "dummy8", "dummy9" }; private static readonly uint[] _testRequiredFieldTags = new uint[] { 8, 24, 264, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 16, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 32, 40, 48, 56, 64, 72 }; public static TestRequired DefaultInstance { @@ -7357,7 +7397,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRequired DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestRequired ThisMessage { @@ -7962,6 +8002,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestRequired ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestRequired MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -7977,22 +8021,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestRequired(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestRequired cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestRequired result; + private bool resultIsReadOnly; + private TestRequired result; private TestRequired PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestRequired original = result; result = new TestRequired(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -8007,13 +8051,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestRequired(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -8029,11 +8073,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRequired BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -9001,7 +9045,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequiredForeign : pb::GeneratedMessage { - private static readonly TestRequiredForeign defaultInstance = new Builder().BuildPartial(); + private static readonly TestRequiredForeign defaultInstance = new TestRequiredForeign().MakeReadOnly(); private static readonly string[] _testRequiredForeignFieldNames = new string[] { "dummy", "optional_message", "repeated_message" }; private static readonly uint[] _testRequiredForeignFieldTags = new uint[] { 24, 10, 18 }; public static TestRequiredForeign DefaultInstance { @@ -9009,7 +9053,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRequiredForeign DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestRequiredForeign ThisMessage { @@ -9026,12 +9070,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int OptionalMessageFieldNumber = 1; private bool hasOptionalMessage; - private global::Google.ProtocolBuffers.TestProtos.TestRequired optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestRequired optionalMessage_; public bool HasOptionalMessage { get { return hasOptionalMessage; } } public global::Google.ProtocolBuffers.TestProtos.TestRequired OptionalMessage { - get { return optionalMessage_; } + get { return optionalMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance; } } public const int RepeatedMessageFieldNumber = 2; @@ -9135,6 +9179,11 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestRequiredForeign ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestRequiredForeign MakeReadOnly() { + repeatedMessage_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -9150,22 +9199,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestRequiredForeign(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestRequiredForeign cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestRequiredForeign result; + private bool resultIsReadOnly; + private TestRequiredForeign result; private TestRequiredForeign PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestRequiredForeign original = result; result = new TestRequiredForeign(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -9180,13 +9229,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestRequiredForeign(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -9202,12 +9251,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRequiredForeign BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.repeatedMessage_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -9337,7 +9385,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearOptionalMessage() { PrepareBuilder(); result.hasOptionalMessage = false; - result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance; + result.optionalMessage_ = null; return this; } @@ -9414,7 +9462,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestForeignNested : pb::GeneratedMessage { - private static readonly TestForeignNested defaultInstance = new Builder().BuildPartial(); + private static readonly TestForeignNested defaultInstance = new TestForeignNested().MakeReadOnly(); private static readonly string[] _testForeignNestedFieldNames = new string[] { "foreign_nested" }; private static readonly uint[] _testForeignNestedFieldTags = new uint[] { 10 }; public static TestForeignNested DefaultInstance { @@ -9422,7 +9470,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestForeignNested DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestForeignNested ThisMessage { @@ -9439,12 +9487,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int ForeignNestedFieldNumber = 1; private bool hasForeignNested; - private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage foreignNested_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage foreignNested_; public bool HasForeignNested { get { return hasForeignNested; } } public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage ForeignNested { - get { return foreignNested_; } + get { return foreignNested_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; } } public override bool IsInitialized { @@ -9508,6 +9556,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestForeignNested ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestForeignNested MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -9523,22 +9575,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestForeignNested(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestForeignNested cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestForeignNested result; + private bool resultIsReadOnly; + private TestForeignNested result; private TestForeignNested PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestForeignNested original = result; result = new TestForeignNested(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -9553,13 +9605,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestForeignNested(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -9575,11 +9627,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestForeignNested BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -9695,7 +9747,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearForeignNested() { PrepareBuilder(); result.hasForeignNested = false; - result.foreignNested_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; + result.foreignNested_ = null; return this; } } @@ -9708,7 +9760,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestEmptyMessage : pb::GeneratedMessage { - private static readonly TestEmptyMessage defaultInstance = new Builder().BuildPartial(); + private static readonly TestEmptyMessage defaultInstance = new TestEmptyMessage().MakeReadOnly(); private static readonly string[] _testEmptyMessageFieldNames = new string[] { }; private static readonly uint[] _testEmptyMessageFieldTags = new uint[] { }; public static TestEmptyMessage DefaultInstance { @@ -9716,7 +9768,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestEmptyMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestEmptyMessage ThisMessage { @@ -9786,6 +9838,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestEmptyMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestEmptyMessage MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -9801,22 +9857,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestEmptyMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestEmptyMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestEmptyMessage result; + private bool resultIsReadOnly; + private TestEmptyMessage result; private TestEmptyMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestEmptyMessage original = result; result = new TestEmptyMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -9831,13 +9887,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestEmptyMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -9853,11 +9909,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestEmptyMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -9934,7 +9990,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestEmptyMessageWithExtensions : pb::ExtendableMessage { - private static readonly TestEmptyMessageWithExtensions defaultInstance = new Builder().BuildPartial(); + private static readonly TestEmptyMessageWithExtensions defaultInstance = new TestEmptyMessageWithExtensions().MakeReadOnly(); private static readonly string[] _testEmptyMessageWithExtensionsFieldNames = new string[] { }; private static readonly uint[] _testEmptyMessageWithExtensionsFieldTags = new uint[] { }; public static TestEmptyMessageWithExtensions DefaultInstance { @@ -9942,7 +9998,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestEmptyMessageWithExtensions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestEmptyMessageWithExtensions ThisMessage { @@ -10016,6 +10072,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestEmptyMessageWithExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestEmptyMessageWithExtensions MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -10031,22 +10091,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestEmptyMessageWithExtensions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestEmptyMessageWithExtensions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestEmptyMessageWithExtensions result; + private bool resultIsReadOnly; + private TestEmptyMessageWithExtensions result; private TestEmptyMessageWithExtensions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestEmptyMessageWithExtensions original = result; result = new TestEmptyMessageWithExtensions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -10061,13 +10121,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestEmptyMessageWithExtensions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -10083,11 +10143,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestEmptyMessageWithExtensions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -10165,7 +10225,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMultipleExtensionRanges : pb::ExtendableMessage { - private static readonly TestMultipleExtensionRanges defaultInstance = new Builder().BuildPartial(); + private static readonly TestMultipleExtensionRanges defaultInstance = new TestMultipleExtensionRanges().MakeReadOnly(); private static readonly string[] _testMultipleExtensionRangesFieldNames = new string[] { }; private static readonly uint[] _testMultipleExtensionRangesFieldTags = new uint[] { }; public static TestMultipleExtensionRanges DefaultInstance { @@ -10173,7 +10233,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMultipleExtensionRanges DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestMultipleExtensionRanges ThisMessage { @@ -10249,6 +10309,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestMultipleExtensionRanges ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestMultipleExtensionRanges MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -10264,22 +10328,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestMultipleExtensionRanges(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestMultipleExtensionRanges cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestMultipleExtensionRanges result; + private bool resultIsReadOnly; + private TestMultipleExtensionRanges result; private TestMultipleExtensionRanges PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestMultipleExtensionRanges original = result; result = new TestMultipleExtensionRanges(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -10294,13 +10358,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestMultipleExtensionRanges(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -10316,11 +10380,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMultipleExtensionRanges BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -10398,7 +10462,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestReallyLargeTagNumber : pb::GeneratedMessage { - private static readonly TestReallyLargeTagNumber defaultInstance = new Builder().BuildPartial(); + private static readonly TestReallyLargeTagNumber defaultInstance = new TestReallyLargeTagNumber().MakeReadOnly(); private static readonly string[] _testReallyLargeTagNumberFieldNames = new string[] { "a", "bb" }; private static readonly uint[] _testReallyLargeTagNumberFieldTags = new uint[] { 8, 2147483640 }; public static TestReallyLargeTagNumber DefaultInstance { @@ -10406,7 +10470,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestReallyLargeTagNumber DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestReallyLargeTagNumber ThisMessage { @@ -10508,6 +10572,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestReallyLargeTagNumber ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestReallyLargeTagNumber MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -10523,22 +10591,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestReallyLargeTagNumber(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestReallyLargeTagNumber cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestReallyLargeTagNumber result; + private bool resultIsReadOnly; + private TestReallyLargeTagNumber result; private TestReallyLargeTagNumber PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestReallyLargeTagNumber original = result; result = new TestReallyLargeTagNumber(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -10553,13 +10621,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestReallyLargeTagNumber(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -10575,11 +10643,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestReallyLargeTagNumber BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -10710,7 +10778,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRecursiveMessage : pb::GeneratedMessage { - private static readonly TestRecursiveMessage defaultInstance = new Builder().BuildPartial(); + private static readonly TestRecursiveMessage defaultInstance = new TestRecursiveMessage().MakeReadOnly(); private static readonly string[] _testRecursiveMessageFieldNames = new string[] { "a", "i" }; private static readonly uint[] _testRecursiveMessageFieldTags = new uint[] { 10, 16 }; public static TestRecursiveMessage DefaultInstance { @@ -10718,7 +10786,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRecursiveMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestRecursiveMessage ThisMessage { @@ -10735,12 +10803,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int AFieldNumber = 1; private bool hasA; - private global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage a_ = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage a_; public bool HasA { get { return hasA; } } public global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage A { - get { return a_; } + get { return a_ ?? global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance; } } public const int IFieldNumber = 2; @@ -10820,6 +10888,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestRecursiveMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestRecursiveMessage MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -10835,22 +10907,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestRecursiveMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestRecursiveMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestRecursiveMessage result; + private bool resultIsReadOnly; + private TestRecursiveMessage result; private TestRecursiveMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestRecursiveMessage original = result; result = new TestRecursiveMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -10865,13 +10937,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestRecursiveMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -10887,11 +10959,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRecursiveMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -11014,7 +11086,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearA() { PrepareBuilder(); result.hasA = false; - result.a_ = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance; + result.a_ = null; return this; } @@ -11047,7 +11119,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMutualRecursionA : pb::GeneratedMessage { - private static readonly TestMutualRecursionA defaultInstance = new Builder().BuildPartial(); + private static readonly TestMutualRecursionA defaultInstance = new TestMutualRecursionA().MakeReadOnly(); private static readonly string[] _testMutualRecursionAFieldNames = new string[] { "bb" }; private static readonly uint[] _testMutualRecursionAFieldTags = new uint[] { 10 }; public static TestMutualRecursionA DefaultInstance { @@ -11055,7 +11127,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMutualRecursionA DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestMutualRecursionA ThisMessage { @@ -11072,12 +11144,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int BbFieldNumber = 1; private bool hasBb; - private global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB bb_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB bb_; public bool HasBb { get { return hasBb; } } public global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB Bb { - get { return bb_; } + get { return bb_ ?? global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance; } } public override bool IsInitialized { @@ -11141,6 +11213,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestMutualRecursionA ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestMutualRecursionA MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -11156,22 +11232,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestMutualRecursionA(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestMutualRecursionA cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestMutualRecursionA result; + private bool resultIsReadOnly; + private TestMutualRecursionA result; private TestMutualRecursionA PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestMutualRecursionA original = result; result = new TestMutualRecursionA(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -11186,13 +11262,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestMutualRecursionA(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -11208,11 +11284,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMutualRecursionA BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -11328,7 +11404,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearBb() { PrepareBuilder(); result.hasBb = false; - result.bb_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance; + result.bb_ = null; return this; } } @@ -11341,7 +11417,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMutualRecursionB : pb::GeneratedMessage { - private static readonly TestMutualRecursionB defaultInstance = new Builder().BuildPartial(); + private static readonly TestMutualRecursionB defaultInstance = new TestMutualRecursionB().MakeReadOnly(); private static readonly string[] _testMutualRecursionBFieldNames = new string[] { "a", "optional_int32" }; private static readonly uint[] _testMutualRecursionBFieldTags = new uint[] { 10, 16 }; public static TestMutualRecursionB DefaultInstance { @@ -11349,7 +11425,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMutualRecursionB DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestMutualRecursionB ThisMessage { @@ -11366,12 +11442,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int AFieldNumber = 1; private bool hasA; - private global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA a_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA a_; public bool HasA { get { return hasA; } } public global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA A { - get { return a_; } + get { return a_ ?? global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance; } } public const int OptionalInt32FieldNumber = 2; @@ -11451,6 +11527,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestMutualRecursionB ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestMutualRecursionB MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -11466,22 +11546,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestMutualRecursionB(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestMutualRecursionB cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestMutualRecursionB result; + private bool resultIsReadOnly; + private TestMutualRecursionB result; private TestMutualRecursionB PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestMutualRecursionB original = result; result = new TestMutualRecursionB(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -11496,13 +11576,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestMutualRecursionB(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -11518,11 +11598,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMutualRecursionB BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -11645,7 +11725,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearA() { PrepareBuilder(); result.hasA = false; - result.a_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance; + result.a_ = null; return this; } @@ -11678,7 +11758,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDupFieldNumber : pb::GeneratedMessage { - private static readonly TestDupFieldNumber defaultInstance = new Builder().BuildPartial(); + private static readonly TestDupFieldNumber defaultInstance = new TestDupFieldNumber().MakeReadOnly(); private static readonly string[] _testDupFieldNumberFieldNames = new string[] { "a", "bar", "foo" }; private static readonly uint[] _testDupFieldNumberFieldTags = new uint[] { 8, 27, 19 }; public static TestDupFieldNumber DefaultInstance { @@ -11686,7 +11766,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDupFieldNumber DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestDupFieldNumber ThisMessage { @@ -11710,7 +11790,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Foo : pb::GeneratedMessage { - private static readonly Foo defaultInstance = new Builder().BuildPartial(); + private static readonly Foo defaultInstance = new Foo().MakeReadOnly(); private static readonly string[] _fooFieldNames = new string[] { "a" }; private static readonly uint[] _fooFieldTags = new uint[] { 8 }; public static Foo DefaultInstance { @@ -11718,7 +11798,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Foo DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override Foo ThisMessage { @@ -11804,6 +11884,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static Foo ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private Foo MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -11819,22 +11903,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new Foo(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(Foo cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - Foo result; + private bool resultIsReadOnly; + private Foo result; private Foo PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { Foo original = result; result = new Foo(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -11849,13 +11933,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new Foo(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -11871,11 +11955,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Foo BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -11979,7 +12063,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Bar : pb::GeneratedMessage { - private static readonly Bar defaultInstance = new Builder().BuildPartial(); + private static readonly Bar defaultInstance = new Bar().MakeReadOnly(); private static readonly string[] _barFieldNames = new string[] { "a" }; private static readonly uint[] _barFieldTags = new uint[] { 8 }; public static Bar DefaultInstance { @@ -11987,7 +12071,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Bar DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override Bar ThisMessage { @@ -12073,6 +12157,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static Bar ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private Bar MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -12088,22 +12176,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new Bar(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(Bar cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - Bar result; + private bool resultIsReadOnly; + private Bar result; private Bar PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { Bar original = result; result = new Bar(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -12118,13 +12206,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new Bar(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -12140,11 +12228,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Bar BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -12259,22 +12347,22 @@ namespace Google.ProtocolBuffers.TestProtos { public const int FooFieldNumber = 2; private bool hasFoo; - private global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo foo_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo foo_; public bool HasFoo { get { return hasFoo; } } public global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo Foo { - get { return foo_; } + get { return foo_ ?? global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance; } } public const int BarFieldNumber = 3; private bool hasBar; - private global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar bar_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar bar_; public bool HasBar { get { return hasBar; } } public global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar Bar { - get { return bar_; } + get { return bar_ ?? global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance; } } public override bool IsInitialized { @@ -12350,6 +12438,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestDupFieldNumber ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestDupFieldNumber MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -12365,22 +12457,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestDupFieldNumber(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestDupFieldNumber cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestDupFieldNumber result; + private bool resultIsReadOnly; + private TestDupFieldNumber result; private TestDupFieldNumber PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestDupFieldNumber original = result; result = new TestDupFieldNumber(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -12395,13 +12487,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestDupFieldNumber(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -12417,11 +12509,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDupFieldNumber BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -12576,7 +12668,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearFoo() { PrepareBuilder(); result.hasFoo = false; - result.foo_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance; + result.foo_ = null; return this; } @@ -12616,7 +12708,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearBar() { PrepareBuilder(); result.hasBar = false; - result.bar_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance; + result.bar_ = null; return this; } } @@ -12629,7 +12721,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestNestedMessageHasBits : pb::GeneratedMessage { - private static readonly TestNestedMessageHasBits defaultInstance = new Builder().BuildPartial(); + private static readonly TestNestedMessageHasBits defaultInstance = new TestNestedMessageHasBits().MakeReadOnly(); private static readonly string[] _testNestedMessageHasBitsFieldNames = new string[] { "optional_nested_message" }; private static readonly uint[] _testNestedMessageHasBitsFieldTags = new uint[] { 10 }; public static TestNestedMessageHasBits DefaultInstance { @@ -12637,7 +12729,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestNestedMessageHasBits DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestNestedMessageHasBits ThisMessage { @@ -12661,7 +12753,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NestedMessage : pb::GeneratedMessage { - private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); + private static readonly NestedMessage defaultInstance = new NestedMessage().MakeReadOnly(); private static readonly string[] _nestedMessageFieldNames = new string[] { "nestedmessage_repeated_foreignmessage", "nestedmessage_repeated_int32" }; private static readonly uint[] _nestedMessageFieldTags = new uint[] { 18, 8 }; public static NestedMessage DefaultInstance { @@ -12669,7 +12761,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override NestedMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override NestedMessage ThisMessage { @@ -12780,6 +12872,12 @@ namespace Google.ProtocolBuffers.TestProtos { public static NestedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private NestedMessage MakeReadOnly() { + nestedmessageRepeatedInt32_.MakeReadOnly(); + nestedmessageRepeatedForeignmessage_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -12795,22 +12893,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new NestedMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(NestedMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - NestedMessage result; + private bool resultIsReadOnly; + private NestedMessage result; private NestedMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { NestedMessage original = result; result = new NestedMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -12825,13 +12923,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new NestedMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -12847,13 +12945,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override NestedMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.nestedmessageRepeatedInt32_.MakeReadOnly(); - result.nestedmessageRepeatedForeignmessage_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -13020,12 +13116,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int OptionalNestedMessageFieldNumber = 1; private bool hasOptionalNestedMessage; - private global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage optionalNestedMessage_; public bool HasOptionalNestedMessage { get { return hasOptionalNestedMessage; } } public global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage OptionalNestedMessage { - get { return optionalNestedMessage_; } + get { return optionalNestedMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance; } } public override bool IsInitialized { @@ -13089,6 +13185,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestNestedMessageHasBits ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestNestedMessageHasBits MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -13104,22 +13204,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestNestedMessageHasBits(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestNestedMessageHasBits cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestNestedMessageHasBits result; + private bool resultIsReadOnly; + private TestNestedMessageHasBits result; private TestNestedMessageHasBits PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestNestedMessageHasBits original = result; result = new TestNestedMessageHasBits(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -13134,13 +13234,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestNestedMessageHasBits(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -13156,11 +13256,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestNestedMessageHasBits BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -13276,7 +13376,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearOptionalNestedMessage() { PrepareBuilder(); result.hasOptionalNestedMessage = false; - result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance; + result.optionalNestedMessage_ = null; return this; } } @@ -13289,7 +13389,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestCamelCaseFieldNames : pb::GeneratedMessage { - private static readonly TestCamelCaseFieldNames defaultInstance = new Builder().BuildPartial(); + private static readonly TestCamelCaseFieldNames defaultInstance = new TestCamelCaseFieldNames().MakeReadOnly(); private static readonly string[] _testCamelCaseFieldNamesFieldNames = new string[] { "CordField", "EnumField", "MessageField", "PrimitiveField", "RepeatedCordField", "RepeatedEnumField", "RepeatedMessageField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedStringPieceField", "StringField", "StringPieceField" }; private static readonly uint[] _testCamelCaseFieldNamesFieldTags = new uint[] { 50, 24, 34, 8, 98, 72, 82, 56, 66, 90, 18, 42 }; public static TestCamelCaseFieldNames DefaultInstance { @@ -13297,7 +13397,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestCamelCaseFieldNames DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestCamelCaseFieldNames ThisMessage { @@ -13344,12 +13444,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int MessageFieldFieldNumber = 4; private bool hasMessageField; - private global::Google.ProtocolBuffers.TestProtos.ForeignMessage messageField_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessage messageField_; public bool HasMessageField { get { return hasMessageField; } } public global::Google.ProtocolBuffers.TestProtos.ForeignMessage MessageField { - get { return messageField_; } + get { return messageField_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } } public const int StringPieceFieldFieldNumber = 5; @@ -13598,6 +13698,16 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestCamelCaseFieldNames ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestCamelCaseFieldNames MakeReadOnly() { + repeatedPrimitiveField_.MakeReadOnly(); + repeatedStringField_.MakeReadOnly(); + repeatedEnumField_.MakeReadOnly(); + repeatedMessageField_.MakeReadOnly(); + repeatedStringPieceField_.MakeReadOnly(); + repeatedCordField_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -13613,22 +13723,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestCamelCaseFieldNames(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestCamelCaseFieldNames cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestCamelCaseFieldNames result; + private bool resultIsReadOnly; + private TestCamelCaseFieldNames result; private TestCamelCaseFieldNames PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestCamelCaseFieldNames original = result; result = new TestCamelCaseFieldNames(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -13643,13 +13753,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestCamelCaseFieldNames(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -13665,17 +13775,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestCamelCaseFieldNames BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.repeatedPrimitiveField_.MakeReadOnly(); - result.repeatedStringField_.MakeReadOnly(); - result.repeatedEnumField_.MakeReadOnly(); - result.repeatedMessageField_.MakeReadOnly(); - result.repeatedStringPieceField_.MakeReadOnly(); - result.repeatedCordField_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -13948,7 +14052,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearMessageField() { PrepareBuilder(); result.hasMessageField = false; - result.messageField_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; + result.messageField_ = null; return this; } @@ -14203,7 +14307,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestFieldOrderings : pb::ExtendableMessage { - private static readonly TestFieldOrderings defaultInstance = new Builder().BuildPartial(); + private static readonly TestFieldOrderings defaultInstance = new TestFieldOrderings().MakeReadOnly(); private static readonly string[] _testFieldOrderingsFieldNames = new string[] { "my_float", "my_int", "my_string" }; private static readonly uint[] _testFieldOrderingsFieldTags = new uint[] { 813, 8, 90 }; public static TestFieldOrderings DefaultInstance { @@ -14211,7 +14315,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestFieldOrderings DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestFieldOrderings ThisMessage { @@ -14334,6 +14438,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestFieldOrderings ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestFieldOrderings MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -14349,22 +14457,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestFieldOrderings(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestFieldOrderings cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestFieldOrderings result; + private bool resultIsReadOnly; + private TestFieldOrderings result; private TestFieldOrderings PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestFieldOrderings original = result; result = new TestFieldOrderings(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -14379,13 +14487,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestFieldOrderings(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -14401,11 +14509,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestFieldOrderings BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -14565,7 +14673,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestExtremeDefaultValues : pb::GeneratedMessage { - private static readonly TestExtremeDefaultValues defaultInstance = new Builder().BuildPartial(); + private static readonly TestExtremeDefaultValues defaultInstance = new TestExtremeDefaultValues().MakeReadOnly(); private static readonly string[] _testExtremeDefaultValuesFieldNames = new string[] { "escaped_bytes", "inf_double", "inf_float", "large_float", "large_uint32", "large_uint64", "nan_double", "nan_float", "neg_inf_double", "neg_inf_float", "negative_float", "negative_one_float", "one_float", "small_float", "small_int32", "small_int64", "small_negative_float", "utf8_string", "zero_float" }; private static readonly uint[] _testExtremeDefaultValuesFieldTags = new uint[] { 10, 113, 141, 101, 16, 24, 129, 157, 121, 149, 93, 85, 69, 77, 32, 40, 109, 50, 61 }; public static TestExtremeDefaultValues DefaultInstance { @@ -14573,7 +14681,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestExtremeDefaultValues DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestExtremeDefaultValues ThisMessage { @@ -14949,6 +15057,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestExtremeDefaultValues ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestExtremeDefaultValues MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -14964,22 +15076,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestExtremeDefaultValues(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestExtremeDefaultValues cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestExtremeDefaultValues result; + private bool resultIsReadOnly; + private TestExtremeDefaultValues result; private TestExtremeDefaultValues PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestExtremeDefaultValues original = result; result = new TestExtremeDefaultValues(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -14994,13 +15106,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestExtremeDefaultValues(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -15016,11 +15128,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestExtremeDefaultValues BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -15616,7 +15728,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OneString : pb::GeneratedMessage { - private static readonly OneString defaultInstance = new Builder().BuildPartial(); + private static readonly OneString defaultInstance = new OneString().MakeReadOnly(); private static readonly string[] _oneStringFieldNames = new string[] { "data" }; private static readonly uint[] _oneStringFieldTags = new uint[] { 10 }; public static OneString DefaultInstance { @@ -15624,7 +15736,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OneString DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override OneString ThisMessage { @@ -15710,6 +15822,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static OneString ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private OneString MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -15725,22 +15841,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new OneString(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(OneString cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - OneString result; + private bool resultIsReadOnly; + private OneString result; private OneString PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { OneString original = result; result = new OneString(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -15755,13 +15871,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new OneString(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -15777,11 +15893,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OneString BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -15886,7 +16002,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OneBytes : pb::GeneratedMessage { - private static readonly OneBytes defaultInstance = new Builder().BuildPartial(); + private static readonly OneBytes defaultInstance = new OneBytes().MakeReadOnly(); private static readonly string[] _oneBytesFieldNames = new string[] { "data" }; private static readonly uint[] _oneBytesFieldTags = new uint[] { 10 }; public static OneBytes DefaultInstance { @@ -15894,7 +16010,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OneBytes DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override OneBytes ThisMessage { @@ -15980,6 +16096,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static OneBytes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private OneBytes MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -15995,22 +16115,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new OneBytes(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(OneBytes cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - OneBytes result; + private bool resultIsReadOnly; + private OneBytes result; private OneBytes PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { OneBytes original = result; result = new OneBytes(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -16025,13 +16145,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new OneBytes(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -16047,11 +16167,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OneBytes BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -16156,7 +16276,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedTypes : pb::GeneratedMessage { - private static readonly TestPackedTypes defaultInstance = new Builder().BuildPartial(); + private static readonly TestPackedTypes defaultInstance = new TestPackedTypes().MakeReadOnly(); private static readonly string[] _testPackedTypesFieldNames = new string[] { "packed_bool", "packed_double", "packed_enum", "packed_fixed32", "packed_fixed64", "packed_float", "packed_int32", "packed_int64", "packed_sfixed32", "packed_sfixed64", "packed_sint32", "packed_sint64", "packed_uint32", "packed_uint64" }; private static readonly uint[] _testPackedTypesFieldTags = new uint[] { 818, 810, 826, 770, 778, 802, 722, 730, 786, 794, 754, 762, 738, 746 }; public static TestPackedTypes DefaultInstance { @@ -16164,7 +16284,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedTypes DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestPackedTypes ThisMessage { @@ -16607,6 +16727,24 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestPackedTypes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestPackedTypes MakeReadOnly() { + packedInt32_.MakeReadOnly(); + packedInt64_.MakeReadOnly(); + packedUint32_.MakeReadOnly(); + packedUint64_.MakeReadOnly(); + packedSint32_.MakeReadOnly(); + packedSint64_.MakeReadOnly(); + packedFixed32_.MakeReadOnly(); + packedFixed64_.MakeReadOnly(); + packedSfixed32_.MakeReadOnly(); + packedSfixed64_.MakeReadOnly(); + packedFloat_.MakeReadOnly(); + packedDouble_.MakeReadOnly(); + packedBool_.MakeReadOnly(); + packedEnum_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -16622,22 +16760,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestPackedTypes(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestPackedTypes cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestPackedTypes result; + private bool resultIsReadOnly; + private TestPackedTypes result; private TestPackedTypes PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestPackedTypes original = result; result = new TestPackedTypes(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -16652,13 +16790,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestPackedTypes(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -16674,25 +16812,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedTypes BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.packedInt32_.MakeReadOnly(); - result.packedInt64_.MakeReadOnly(); - result.packedUint32_.MakeReadOnly(); - result.packedUint64_.MakeReadOnly(); - result.packedSint32_.MakeReadOnly(); - result.packedSint64_.MakeReadOnly(); - result.packedFixed32_.MakeReadOnly(); - result.packedFixed64_.MakeReadOnly(); - result.packedSfixed32_.MakeReadOnly(); - result.packedSfixed64_.MakeReadOnly(); - result.packedFloat_.MakeReadOnly(); - result.packedDouble_.MakeReadOnly(); - result.packedBool_.MakeReadOnly(); - result.packedEnum_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -17330,7 +17454,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedTypes : pb::GeneratedMessage { - private static readonly TestUnpackedTypes defaultInstance = new Builder().BuildPartial(); + private static readonly TestUnpackedTypes defaultInstance = new TestUnpackedTypes().MakeReadOnly(); private static readonly string[] _testUnpackedTypesFieldNames = new string[] { "unpacked_bool", "unpacked_double", "unpacked_enum", "unpacked_fixed32", "unpacked_fixed64", "unpacked_float", "unpacked_int32", "unpacked_int64", "unpacked_sfixed32", "unpacked_sfixed64", "unpacked_sint32", "unpacked_sint64", "unpacked_uint32", "unpacked_uint64" }; private static readonly uint[] _testUnpackedTypesFieldTags = new uint[] { 816, 809, 824, 773, 777, 805, 720, 728, 789, 793, 752, 760, 736, 744 }; public static TestUnpackedTypes DefaultInstance { @@ -17338,7 +17462,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedTypes DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestUnpackedTypes ThisMessage { @@ -17726,6 +17850,24 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestUnpackedTypes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestUnpackedTypes MakeReadOnly() { + unpackedInt32_.MakeReadOnly(); + unpackedInt64_.MakeReadOnly(); + unpackedUint32_.MakeReadOnly(); + unpackedUint64_.MakeReadOnly(); + unpackedSint32_.MakeReadOnly(); + unpackedSint64_.MakeReadOnly(); + unpackedFixed32_.MakeReadOnly(); + unpackedFixed64_.MakeReadOnly(); + unpackedSfixed32_.MakeReadOnly(); + unpackedSfixed64_.MakeReadOnly(); + unpackedFloat_.MakeReadOnly(); + unpackedDouble_.MakeReadOnly(); + unpackedBool_.MakeReadOnly(); + unpackedEnum_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -17741,22 +17883,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestUnpackedTypes(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestUnpackedTypes cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestUnpackedTypes result; + private bool resultIsReadOnly; + private TestUnpackedTypes result; private TestUnpackedTypes PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestUnpackedTypes original = result; result = new TestUnpackedTypes(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -17771,13 +17913,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestUnpackedTypes(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -17793,25 +17935,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedTypes BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.unpackedInt32_.MakeReadOnly(); - result.unpackedInt64_.MakeReadOnly(); - result.unpackedUint32_.MakeReadOnly(); - result.unpackedUint64_.MakeReadOnly(); - result.unpackedSint32_.MakeReadOnly(); - result.unpackedSint64_.MakeReadOnly(); - result.unpackedFixed32_.MakeReadOnly(); - result.unpackedFixed64_.MakeReadOnly(); - result.unpackedSfixed32_.MakeReadOnly(); - result.unpackedSfixed64_.MakeReadOnly(); - result.unpackedFloat_.MakeReadOnly(); - result.unpackedDouble_.MakeReadOnly(); - result.unpackedBool_.MakeReadOnly(); - result.unpackedEnum_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -18449,7 +18577,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedExtensions : pb::ExtendableMessage { - private static readonly TestPackedExtensions defaultInstance = new Builder().BuildPartial(); + private static readonly TestPackedExtensions defaultInstance = new TestPackedExtensions().MakeReadOnly(); private static readonly string[] _testPackedExtensionsFieldNames = new string[] { }; private static readonly uint[] _testPackedExtensionsFieldTags = new uint[] { }; public static TestPackedExtensions DefaultInstance { @@ -18457,7 +18585,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedExtensions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestPackedExtensions ThisMessage { @@ -18531,6 +18659,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestPackedExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestPackedExtensions MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -18546,22 +18678,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestPackedExtensions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestPackedExtensions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestPackedExtensions result; + private bool resultIsReadOnly; + private TestPackedExtensions result; private TestPackedExtensions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestPackedExtensions original = result; result = new TestPackedExtensions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -18576,13 +18708,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestPackedExtensions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -18598,11 +18730,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedExtensions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -18680,7 +18812,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedExtensions : pb::ExtendableMessage { - private static readonly TestUnpackedExtensions defaultInstance = new Builder().BuildPartial(); + private static readonly TestUnpackedExtensions defaultInstance = new TestUnpackedExtensions().MakeReadOnly(); private static readonly string[] _testUnpackedExtensionsFieldNames = new string[] { }; private static readonly uint[] _testUnpackedExtensionsFieldTags = new uint[] { }; public static TestUnpackedExtensions DefaultInstance { @@ -18688,7 +18820,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedExtensions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestUnpackedExtensions ThisMessage { @@ -18762,6 +18894,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestUnpackedExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestUnpackedExtensions MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -18777,22 +18913,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestUnpackedExtensions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestUnpackedExtensions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestUnpackedExtensions result; + private bool resultIsReadOnly; + private TestUnpackedExtensions result; private TestUnpackedExtensions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestUnpackedExtensions original = result; result = new TestUnpackedExtensions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -18807,13 +18943,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestUnpackedExtensions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -18829,11 +18965,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedExtensions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -18911,7 +19047,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDynamicExtensions : pb::GeneratedMessage { - private static readonly TestDynamicExtensions defaultInstance = new Builder().BuildPartial(); + private static readonly TestDynamicExtensions defaultInstance = new TestDynamicExtensions().MakeReadOnly(); private static readonly string[] _testDynamicExtensionsFieldNames = new string[] { "dynamic_enum_extension", "dynamic_message_extension", "enum_extension", "message_extension", "packed_extension", "repeated_extension", "scalar_extension" }; private static readonly uint[] _testDynamicExtensionsFieldTags = new uint[] { 16016, 16034, 16008, 16026, 16050, 16042, 16005 }; public static TestDynamicExtensions DefaultInstance { @@ -18919,7 +19055,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDynamicExtensions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestDynamicExtensions ThisMessage { @@ -18951,7 +19087,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class DynamicMessageType : pb::GeneratedMessage { - private static readonly DynamicMessageType defaultInstance = new Builder().BuildPartial(); + private static readonly DynamicMessageType defaultInstance = new DynamicMessageType().MakeReadOnly(); private static readonly string[] _dynamicMessageTypeFieldNames = new string[] { "dynamic_field" }; private static readonly uint[] _dynamicMessageTypeFieldTags = new uint[] { 16800 }; public static DynamicMessageType DefaultInstance { @@ -18959,7 +19095,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override DynamicMessageType DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override DynamicMessageType ThisMessage { @@ -19045,6 +19181,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static DynamicMessageType ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private DynamicMessageType MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -19060,22 +19200,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new DynamicMessageType(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(DynamicMessageType cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - DynamicMessageType result; + private bool resultIsReadOnly; + private DynamicMessageType result; private DynamicMessageType PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { DynamicMessageType original = result; result = new DynamicMessageType(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -19090,13 +19230,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new DynamicMessageType(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -19112,11 +19252,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override DynamicMessageType BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -19252,22 +19392,22 @@ namespace Google.ProtocolBuffers.TestProtos { public const int MessageExtensionFieldNumber = 2003; private bool hasMessageExtension; - private global::Google.ProtocolBuffers.TestProtos.ForeignMessage messageExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessage messageExtension_; public bool HasMessageExtension { get { return hasMessageExtension; } } public global::Google.ProtocolBuffers.TestProtos.ForeignMessage MessageExtension { - get { return messageExtension_; } + get { return messageExtension_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } } public const int DynamicMessageExtensionFieldNumber = 2004; private bool hasDynamicMessageExtension; - private global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType dynamicMessageExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType dynamicMessageExtension_; public bool HasDynamicMessageExtension { get { return hasDynamicMessageExtension; } } public global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType DynamicMessageExtension { - get { return dynamicMessageExtension_; } + get { return dynamicMessageExtension_ ?? global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance; } } public const int RepeatedExtensionFieldNumber = 2005; @@ -19405,6 +19545,12 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestDynamicExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestDynamicExtensions MakeReadOnly() { + repeatedExtension_.MakeReadOnly(); + packedExtension_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -19420,22 +19566,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestDynamicExtensions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestDynamicExtensions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestDynamicExtensions result; + private bool resultIsReadOnly; + private TestDynamicExtensions result; private TestDynamicExtensions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestDynamicExtensions original = result; result = new TestDynamicExtensions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -19450,13 +19596,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestDynamicExtensions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -19472,13 +19618,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDynamicExtensions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.repeatedExtension_.MakeReadOnly(); - result.packedExtension_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -19720,7 +19864,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearMessageExtension() { PrepareBuilder(); result.hasMessageExtension = false; - result.messageExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; + result.messageExtension_ = null; return this; } @@ -19760,7 +19904,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearDynamicMessageExtension() { PrepareBuilder(); result.hasDynamicMessageExtension = false; - result.dynamicMessageExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance; + result.dynamicMessageExtension_ = null; return this; } @@ -19835,7 +19979,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::GeneratedMessage { - private static readonly TestRepeatedScalarDifferentTagSizes defaultInstance = new Builder().BuildPartial(); + private static readonly TestRepeatedScalarDifferentTagSizes defaultInstance = new TestRepeatedScalarDifferentTagSizes().MakeReadOnly(); private static readonly string[] _testRepeatedScalarDifferentTagSizesFieldNames = new string[] { "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_int32", "repeated_int64", "repeated_uint64" }; private static readonly uint[] _testRepeatedScalarDifferentTagSizesFieldTags = new uint[] { 101, 16369, 2097141, 104, 16376, 2097144 }; public static TestRepeatedScalarDifferentTagSizes DefaultInstance { @@ -19843,7 +19987,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRepeatedScalarDifferentTagSizes DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestRepeatedScalarDifferentTagSizes ThisMessage { @@ -20051,6 +20195,16 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestRepeatedScalarDifferentTagSizes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestRepeatedScalarDifferentTagSizes MakeReadOnly() { + repeatedFixed32_.MakeReadOnly(); + repeatedInt32_.MakeReadOnly(); + repeatedFixed64_.MakeReadOnly(); + repeatedInt64_.MakeReadOnly(); + repeatedFloat_.MakeReadOnly(); + repeatedUint64_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -20066,22 +20220,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestRepeatedScalarDifferentTagSizes(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestRepeatedScalarDifferentTagSizes cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestRepeatedScalarDifferentTagSizes result; + private bool resultIsReadOnly; + private TestRepeatedScalarDifferentTagSizes result; private TestRepeatedScalarDifferentTagSizes PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestRepeatedScalarDifferentTagSizes original = result; result = new TestRepeatedScalarDifferentTagSizes(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -20096,13 +20250,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestRepeatedScalarDifferentTagSizes(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -20118,17 +20272,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRepeatedScalarDifferentTagSizes BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.repeatedFixed32_.MakeReadOnly(); - result.repeatedInt32_.MakeReadOnly(); - result.repeatedFixed64_.MakeReadOnly(); - result.repeatedInt64_.MakeReadOnly(); - result.repeatedFloat_.MakeReadOnly(); - result.repeatedUint64_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -20448,7 +20596,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FooRequest : pb::GeneratedMessage { - private static readonly FooRequest defaultInstance = new Builder().BuildPartial(); + private static readonly FooRequest defaultInstance = new FooRequest().MakeReadOnly(); private static readonly string[] _fooRequestFieldNames = new string[] { }; private static readonly uint[] _fooRequestFieldTags = new uint[] { }; public static FooRequest DefaultInstance { @@ -20456,7 +20604,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override FooRequest DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override FooRequest ThisMessage { @@ -20526,6 +20674,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static FooRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private FooRequest MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -20541,22 +20693,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new FooRequest(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(FooRequest cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - FooRequest result; + private bool resultIsReadOnly; + private FooRequest result; private FooRequest PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { FooRequest original = result; result = new FooRequest(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -20571,13 +20723,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new FooRequest(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -20593,11 +20745,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override FooRequest BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -20674,7 +20826,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FooResponse : pb::GeneratedMessage { - private static readonly FooResponse defaultInstance = new Builder().BuildPartial(); + private static readonly FooResponse defaultInstance = new FooResponse().MakeReadOnly(); private static readonly string[] _fooResponseFieldNames = new string[] { }; private static readonly uint[] _fooResponseFieldTags = new uint[] { }; public static FooResponse DefaultInstance { @@ -20682,7 +20834,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override FooResponse DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override FooResponse ThisMessage { @@ -20752,6 +20904,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static FooResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private FooResponse MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -20767,22 +20923,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new FooResponse(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(FooResponse cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - FooResponse result; + private bool resultIsReadOnly; + private FooResponse result; private FooResponse PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { FooResponse original = result; result = new FooResponse(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -20797,13 +20953,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new FooResponse(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -20819,11 +20975,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override FooResponse BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -20900,7 +21056,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class BarRequest : pb::GeneratedMessage { - private static readonly BarRequest defaultInstance = new Builder().BuildPartial(); + private static readonly BarRequest defaultInstance = new BarRequest().MakeReadOnly(); private static readonly string[] _barRequestFieldNames = new string[] { }; private static readonly uint[] _barRequestFieldTags = new uint[] { }; public static BarRequest DefaultInstance { @@ -20908,7 +21064,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override BarRequest DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override BarRequest ThisMessage { @@ -20978,6 +21134,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static BarRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private BarRequest MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -20993,22 +21153,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new BarRequest(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(BarRequest cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - BarRequest result; + private bool resultIsReadOnly; + private BarRequest result; private BarRequest PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { BarRequest original = result; result = new BarRequest(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -21023,13 +21183,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new BarRequest(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -21045,11 +21205,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override BarRequest BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -21126,7 +21286,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class BarResponse : pb::GeneratedMessage { - private static readonly BarResponse defaultInstance = new Builder().BuildPartial(); + private static readonly BarResponse defaultInstance = new BarResponse().MakeReadOnly(); private static readonly string[] _barResponseFieldNames = new string[] { }; private static readonly uint[] _barResponseFieldTags = new uint[] { }; public static BarResponse DefaultInstance { @@ -21134,7 +21294,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override BarResponse DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override BarResponse ThisMessage { @@ -21204,6 +21364,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static BarResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private BarResponse MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -21219,22 +21383,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new BarResponse(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(BarResponse cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - BarResponse result; + private bool resultIsReadOnly; + private BarResponse result; private BarResponse PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { BarResponse original = result; result = new BarResponse(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -21249,13 +21413,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new BarResponse(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -21271,11 +21435,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override BarResponse BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs index 3c5e9307d1..c85403f003 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs @@ -83,7 +83,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SearchRequest : pb::GeneratedMessage { - private static readonly SearchRequest defaultInstance = new Builder().BuildPartial(); + private static readonly SearchRequest defaultInstance = new SearchRequest().MakeReadOnly(); private static readonly string[] _searchRequestFieldNames = new string[] { "Criteria" }; private static readonly uint[] _searchRequestFieldTags = new uint[] { 10 }; public static SearchRequest DefaultInstance { @@ -91,7 +91,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SearchRequest DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override SearchRequest ThisMessage { @@ -184,6 +184,11 @@ namespace Google.ProtocolBuffers.TestProtos { public static SearchRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private SearchRequest MakeReadOnly() { + criteria_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -199,22 +204,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new SearchRequest(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(SearchRequest cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - SearchRequest result; + private bool resultIsReadOnly; + private SearchRequest result; private SearchRequest PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { SearchRequest original = result; result = new SearchRequest(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -229,13 +234,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new SearchRequest(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -251,12 +256,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SearchRequest BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.criteria_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -372,7 +376,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SearchResponse : pb::GeneratedMessage { - private static readonly SearchResponse defaultInstance = new Builder().BuildPartial(); + private static readonly SearchResponse defaultInstance = new SearchResponse().MakeReadOnly(); private static readonly string[] _searchResponseFieldNames = new string[] { "results" }; private static readonly uint[] _searchResponseFieldTags = new uint[] { 10 }; public static SearchResponse DefaultInstance { @@ -380,7 +384,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SearchResponse DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override SearchResponse ThisMessage { @@ -404,7 +408,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ResultItem : pb::GeneratedMessage { - private static readonly ResultItem defaultInstance = new Builder().BuildPartial(); + private static readonly ResultItem defaultInstance = new ResultItem().MakeReadOnly(); private static readonly string[] _resultItemFieldNames = new string[] { "name", "url" }; private static readonly uint[] _resultItemFieldTags = new uint[] { 18, 10 }; public static ResultItem DefaultInstance { @@ -412,7 +416,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ResultItem DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override ResultItem ThisMessage { @@ -515,6 +519,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static ResultItem ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private ResultItem MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -530,22 +538,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new ResultItem(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(ResultItem cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - ResultItem result; + private bool resultIsReadOnly; + private ResultItem result; private ResultItem PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { ResultItem original = result; result = new ResultItem(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -560,13 +568,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new ResultItem(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -582,11 +590,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ResultItem BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -794,6 +802,11 @@ namespace Google.ProtocolBuffers.TestProtos { public static SearchResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private SearchResponse MakeReadOnly() { + results_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -809,22 +822,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new SearchResponse(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(SearchResponse cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - SearchResponse result; + private bool resultIsReadOnly; + private SearchResponse result; private SearchResponse PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { SearchResponse original = result; result = new SearchResponse(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -839,13 +852,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new SearchResponse(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -861,12 +874,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SearchResponse BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.results_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -994,7 +1006,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RefineSearchRequest : pb::GeneratedMessage { - private static readonly RefineSearchRequest defaultInstance = new Builder().BuildPartial(); + private static readonly RefineSearchRequest defaultInstance = new RefineSearchRequest().MakeReadOnly(); private static readonly string[] _refineSearchRequestFieldNames = new string[] { "Criteria", "previous_results" }; private static readonly uint[] _refineSearchRequestFieldTags = new uint[] { 10, 18 }; public static RefineSearchRequest DefaultInstance { @@ -1002,7 +1014,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RefineSearchRequest DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override RefineSearchRequest ThisMessage { @@ -1031,12 +1043,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int PreviousResultsFieldNumber = 2; private bool hasPreviousResults; - private global::Google.ProtocolBuffers.TestProtos.SearchResponse previousResults_ = global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.SearchResponse previousResults_; public bool HasPreviousResults { get { return hasPreviousResults; } } public global::Google.ProtocolBuffers.TestProtos.SearchResponse PreviousResults { - get { return previousResults_; } + get { return previousResults_ ?? global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance; } } public override bool IsInitialized { @@ -1113,6 +1125,11 @@ namespace Google.ProtocolBuffers.TestProtos { public static RefineSearchRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private RefineSearchRequest MakeReadOnly() { + criteria_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1128,22 +1145,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new RefineSearchRequest(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(RefineSearchRequest cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - RefineSearchRequest result; + private bool resultIsReadOnly; + private RefineSearchRequest result; private RefineSearchRequest PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { RefineSearchRequest original = result; result = new RefineSearchRequest(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1158,13 +1175,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new RefineSearchRequest(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1180,12 +1197,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RefineSearchRequest BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.criteria_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1340,7 +1356,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearPreviousResults() { PrepareBuilder(); result.hasPreviousResults = false; - result.previousResults_ = global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance; + result.previousResults_ = null; return this; } } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs index c0e53348c2..e87fb1c20a 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs @@ -138,7 +138,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestXmlChild : pb::GeneratedMessage { - private static readonly TestXmlChild defaultInstance = new Builder().BuildPartial(); + private static readonly TestXmlChild defaultInstance = new TestXmlChild().MakeReadOnly(); private static readonly string[] _testXmlChildFieldNames = new string[] { "binary", "options" }; private static readonly uint[] _testXmlChildFieldTags = new uint[] { 34, 24 }; public static TestXmlChild DefaultInstance { @@ -146,7 +146,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestXmlChild DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestXmlChild ThisMessage { @@ -257,6 +257,11 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestXmlChild ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestXmlChild MakeReadOnly() { + options_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -272,22 +277,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestXmlChild(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestXmlChild cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestXmlChild result; + private bool resultIsReadOnly; + private TestXmlChild result; private TestXmlChild PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestXmlChild original = result; result = new TestXmlChild(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -302,13 +307,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestXmlChild(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -324,12 +329,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestXmlChild BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.options_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -481,7 +485,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestXmlNoFields : pb::GeneratedMessage { - private static readonly TestXmlNoFields defaultInstance = new Builder().BuildPartial(); + private static readonly TestXmlNoFields defaultInstance = new TestXmlNoFields().MakeReadOnly(); private static readonly string[] _testXmlNoFieldsFieldNames = new string[] { }; private static readonly uint[] _testXmlNoFieldsFieldTags = new uint[] { }; public static TestXmlNoFields DefaultInstance { @@ -489,7 +493,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestXmlNoFields DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestXmlNoFields ThisMessage { @@ -559,6 +563,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestXmlNoFields ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestXmlNoFields MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -574,22 +582,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestXmlNoFields(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestXmlNoFields cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestXmlNoFields result; + private bool resultIsReadOnly; + private TestXmlNoFields result; private TestXmlNoFields PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestXmlNoFields original = result; result = new TestXmlNoFields(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -604,13 +612,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestXmlNoFields(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -626,11 +634,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestXmlNoFields BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -707,7 +715,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestXmlRescursive : pb::GeneratedMessage { - private static readonly TestXmlRescursive defaultInstance = new Builder().BuildPartial(); + private static readonly TestXmlRescursive defaultInstance = new TestXmlRescursive().MakeReadOnly(); private static readonly string[] _testXmlRescursiveFieldNames = new string[] { "child" }; private static readonly uint[] _testXmlRescursiveFieldTags = new uint[] { 10 }; public static TestXmlRescursive DefaultInstance { @@ -715,7 +723,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestXmlRescursive DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestXmlRescursive ThisMessage { @@ -732,12 +740,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int ChildFieldNumber = 1; private bool hasChild; - private global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive child_ = global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive child_; public bool HasChild { get { return hasChild; } } public global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive Child { - get { return child_; } + get { return child_ ?? global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.DefaultInstance; } } public override bool IsInitialized { @@ -801,6 +809,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestXmlRescursive ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestXmlRescursive MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -816,22 +828,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestXmlRescursive(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestXmlRescursive cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestXmlRescursive result; + private bool resultIsReadOnly; + private TestXmlRescursive result; private TestXmlRescursive PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestXmlRescursive original = result; result = new TestXmlRescursive(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -846,13 +858,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestXmlRescursive(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -868,11 +880,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestXmlRescursive BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -988,7 +1000,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearChild() { PrepareBuilder(); result.hasChild = false; - result.child_ = global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.DefaultInstance; + result.child_ = null; return this; } } @@ -1001,7 +1013,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestXmlMessage : pb::ExtendableMessage { - private static readonly TestXmlMessage defaultInstance = new Builder().BuildPartial(); + private static readonly TestXmlMessage defaultInstance = new TestXmlMessage().MakeReadOnly(); private static readonly string[] _testXmlMessageFieldNames = new string[] { "child", "children", "number", "numbers", "text", "textlines", "valid" }; private static readonly uint[] _testXmlMessageFieldTags = new uint[] { 10, 3211, 48, 16, 26, 5602, 40 }; public static TestXmlMessage DefaultInstance { @@ -1009,7 +1021,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestXmlMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestXmlMessage ThisMessage { @@ -1033,7 +1045,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Children : pb::GeneratedMessage { - private static readonly Children defaultInstance = new Builder().BuildPartial(); + private static readonly Children defaultInstance = new Children().MakeReadOnly(); private static readonly string[] _childrenFieldNames = new string[] { "binary", "options" }; private static readonly uint[] _childrenFieldTags = new uint[] { 34, 24 }; public static Children DefaultInstance { @@ -1041,7 +1053,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Children DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override Children ThisMessage { @@ -1152,6 +1164,11 @@ namespace Google.ProtocolBuffers.TestProtos { public static Children ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private Children MakeReadOnly() { + options_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1167,22 +1184,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new Children(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(Children cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - Children result; + private bool resultIsReadOnly; + private Children result; private Children PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { Children original = result; result = new Children(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1197,13 +1214,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new Children(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1219,12 +1236,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Children BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.options_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1431,12 +1447,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int ChildFieldNumber = 1; private bool hasChild; - private global::Google.ProtocolBuffers.TestProtos.TestXmlChild child_ = global::Google.ProtocolBuffers.TestProtos.TestXmlChild.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestXmlChild child_; public bool HasChild { get { return hasChild; } } public global::Google.ProtocolBuffers.TestProtos.TestXmlChild Child { - get { return child_; } + get { return child_ ?? global::Google.ProtocolBuffers.TestProtos.TestXmlChild.DefaultInstance; } } public const int ChildrenFieldNumber = 401; @@ -1562,6 +1578,13 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestXmlMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestXmlMessage MakeReadOnly() { + numbers_.MakeReadOnly(); + textlines_.MakeReadOnly(); + children_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1577,22 +1600,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestXmlMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestXmlMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestXmlMessage result; + private bool resultIsReadOnly; + private TestXmlMessage result; private TestXmlMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestXmlMessage original = result; result = new TestXmlMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1607,13 +1630,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestXmlMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1629,14 +1652,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestXmlMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.numbers_.MakeReadOnly(); - result.textlines_.MakeReadOnly(); - result.children_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1919,7 +1939,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearChild() { PrepareBuilder(); result.hasChild = false; - result.child_ = global::Google.ProtocolBuffers.TestProtos.TestXmlChild.DefaultInstance; + result.child_ = null; return this; } @@ -1976,7 +1996,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestXmlExtension : pb::GeneratedMessage { - private static readonly TestXmlExtension defaultInstance = new Builder().BuildPartial(); + private static readonly TestXmlExtension defaultInstance = new TestXmlExtension().MakeReadOnly(); private static readonly string[] _testXmlExtensionFieldNames = new string[] { "number" }; private static readonly uint[] _testXmlExtensionFieldTags = new uint[] { 8 }; public static TestXmlExtension DefaultInstance { @@ -1984,7 +2004,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestXmlExtension DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestXmlExtension ThisMessage { @@ -2071,6 +2091,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestXmlExtension ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestXmlExtension MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -2086,22 +2110,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestXmlExtension(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestXmlExtension cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestXmlExtension result; + private bool resultIsReadOnly; + private TestXmlExtension result; private TestXmlExtension PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestXmlExtension original = result; result = new TestXmlExtension(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -2116,13 +2140,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestXmlExtension(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -2138,11 +2162,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestXmlExtension BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { diff --git a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs index 0d9109a265..375e888820 100644 --- a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs +++ b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs @@ -125,7 +125,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CSharpFileOptions : pb::GeneratedMessage { - private static readonly CSharpFileOptions defaultInstance = new Builder().BuildPartial(); + private static readonly CSharpFileOptions defaultInstance = new CSharpFileOptions().MakeReadOnly(); private static readonly string[] _cSharpFileOptionsFieldNames = new string[] { "cls_compliance", "code_contracts", "expand_namespace_directories", "file_extension", "ignore_google_protobuf", "multiple_files", "namespace", "nest_classes", "output_directory", "public_classes", "service_generator_type", "umbrella_classname", "umbrella_namespace" }; private static readonly uint[] _cSharpFileOptionsFieldTags = new uint[] { 64, 48, 56, 1770, 1792, 32, 10, 40, 1786, 24, 1800, 18, 1778 }; public static CSharpFileOptions DefaultInstance { @@ -133,7 +133,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override CSharpFileOptions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override CSharpFileOptions ThisMessage { @@ -411,6 +411,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static CSharpFileOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private CSharpFileOptions MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -426,22 +430,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new CSharpFileOptions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(CSharpFileOptions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - CSharpFileOptions result; + private bool resultIsReadOnly; + private CSharpFileOptions result; private CSharpFileOptions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { CSharpFileOptions original = result; result = new CSharpFileOptions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -456,13 +460,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new CSharpFileOptions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -478,11 +482,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override CSharpFileOptions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -923,7 +927,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CSharpFieldOptions : pb::GeneratedMessage { - private static readonly CSharpFieldOptions defaultInstance = new Builder().BuildPartial(); + private static readonly CSharpFieldOptions defaultInstance = new CSharpFieldOptions().MakeReadOnly(); private static readonly string[] _cSharpFieldOptionsFieldNames = new string[] { "property_name" }; private static readonly uint[] _cSharpFieldOptionsFieldTags = new uint[] { 10 }; public static CSharpFieldOptions DefaultInstance { @@ -931,7 +935,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override CSharpFieldOptions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override CSharpFieldOptions ThisMessage { @@ -1017,6 +1021,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static CSharpFieldOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private CSharpFieldOptions MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1032,22 +1040,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new CSharpFieldOptions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(CSharpFieldOptions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - CSharpFieldOptions result; + private bool resultIsReadOnly; + private CSharpFieldOptions result; private CSharpFieldOptions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { CSharpFieldOptions original = result; result = new CSharpFieldOptions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1062,13 +1070,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new CSharpFieldOptions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1084,11 +1092,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override CSharpFieldOptions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1193,7 +1201,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CSharpServiceOptions : pb::GeneratedMessage { - private static readonly CSharpServiceOptions defaultInstance = new Builder().BuildPartial(); + private static readonly CSharpServiceOptions defaultInstance = new CSharpServiceOptions().MakeReadOnly(); private static readonly string[] _cSharpServiceOptionsFieldNames = new string[] { "interface_id" }; private static readonly uint[] _cSharpServiceOptionsFieldTags = new uint[] { 10 }; public static CSharpServiceOptions DefaultInstance { @@ -1201,7 +1209,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override CSharpServiceOptions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override CSharpServiceOptions ThisMessage { @@ -1287,6 +1295,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static CSharpServiceOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private CSharpServiceOptions MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1302,22 +1314,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new CSharpServiceOptions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(CSharpServiceOptions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - CSharpServiceOptions result; + private bool resultIsReadOnly; + private CSharpServiceOptions result; private CSharpServiceOptions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { CSharpServiceOptions original = result; result = new CSharpServiceOptions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1332,13 +1344,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new CSharpServiceOptions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1354,11 +1366,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override CSharpServiceOptions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1463,7 +1475,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CSharpMethodOptions : pb::GeneratedMessage { - private static readonly CSharpMethodOptions defaultInstance = new Builder().BuildPartial(); + private static readonly CSharpMethodOptions defaultInstance = new CSharpMethodOptions().MakeReadOnly(); private static readonly string[] _cSharpMethodOptionsFieldNames = new string[] { "dispatch_id" }; private static readonly uint[] _cSharpMethodOptionsFieldTags = new uint[] { 8 }; public static CSharpMethodOptions DefaultInstance { @@ -1471,7 +1483,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override CSharpMethodOptions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override CSharpMethodOptions ThisMessage { @@ -1557,6 +1569,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static CSharpMethodOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private CSharpMethodOptions MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1572,22 +1588,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new CSharpMethodOptions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(CSharpMethodOptions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - CSharpMethodOptions result; + private bool resultIsReadOnly; + private CSharpMethodOptions result; private CSharpMethodOptions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { CSharpMethodOptions original = result; result = new CSharpMethodOptions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1602,13 +1618,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new CSharpMethodOptions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1624,11 +1640,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override CSharpMethodOptions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { diff --git a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs index 631ec21fb7..82bbd01532 100644 --- a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs +++ b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs @@ -233,7 +233,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FileDescriptorSet : pb::GeneratedMessage { - private static readonly FileDescriptorSet defaultInstance = new Builder().BuildPartial(); + private static readonly FileDescriptorSet defaultInstance = new FileDescriptorSet().MakeReadOnly(); private static readonly string[] _fileDescriptorSetFieldNames = new string[] { "file" }; private static readonly uint[] _fileDescriptorSetFieldTags = new uint[] { 10 }; public static FileDescriptorSet DefaultInstance { @@ -241,7 +241,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override FileDescriptorSet DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override FileDescriptorSet ThisMessage { @@ -332,6 +332,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static FileDescriptorSet ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private FileDescriptorSet MakeReadOnly() { + file_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -347,22 +352,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new FileDescriptorSet(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(FileDescriptorSet cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - FileDescriptorSet result; + private bool resultIsReadOnly; + private FileDescriptorSet result; private FileDescriptorSet PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { FileDescriptorSet original = result; result = new FileDescriptorSet(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -377,13 +382,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new FileDescriptorSet(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -399,12 +404,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override FileDescriptorSet BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.file_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -532,7 +536,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FileDescriptorProto : pb::GeneratedMessage { - private static readonly FileDescriptorProto defaultInstance = new Builder().BuildPartial(); + private static readonly FileDescriptorProto defaultInstance = new FileDescriptorProto().MakeReadOnly(); private static readonly string[] _fileDescriptorProtoFieldNames = new string[] { "dependency", "enum_type", "extension", "message_type", "name", "options", "package", "service" }; private static readonly uint[] _fileDescriptorProtoFieldTags = new uint[] { 26, 42, 58, 34, 10, 66, 18, 50 }; public static FileDescriptorProto DefaultInstance { @@ -540,7 +544,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override FileDescriptorProto DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override FileDescriptorProto ThisMessage { @@ -637,12 +641,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public const int OptionsFieldNumber = 8; private bool hasOptions; - private global::Google.ProtocolBuffers.DescriptorProtos.FileOptions options_ = global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.DefaultInstance; + private global::Google.ProtocolBuffers.DescriptorProtos.FileOptions options_; public bool HasOptions { get { return hasOptions; } } public global::Google.ProtocolBuffers.DescriptorProtos.FileOptions Options { - get { return options_; } + get { return options_ ?? global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.DefaultInstance; } } public override bool IsInitialized { @@ -768,6 +772,15 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static FileDescriptorProto ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private FileDescriptorProto MakeReadOnly() { + dependency_.MakeReadOnly(); + messageType_.MakeReadOnly(); + enumType_.MakeReadOnly(); + service_.MakeReadOnly(); + extension_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -783,22 +796,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new FileDescriptorProto(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(FileDescriptorProto cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - FileDescriptorProto result; + private bool resultIsReadOnly; + private FileDescriptorProto result; private FileDescriptorProto PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { FileDescriptorProto original = result; result = new FileDescriptorProto(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -813,13 +826,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new FileDescriptorProto(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -835,16 +848,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override FileDescriptorProto BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.dependency_.MakeReadOnly(); - result.messageType_.MakeReadOnly(); - result.enumType_.MakeReadOnly(); - result.service_.MakeReadOnly(); - result.extension_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1259,7 +1267,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public Builder ClearOptions() { PrepareBuilder(); result.hasOptions = false; - result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.DefaultInstance; + result.options_ = null; return this; } } @@ -1272,7 +1280,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class DescriptorProto : pb::GeneratedMessage { - private static readonly DescriptorProto defaultInstance = new Builder().BuildPartial(); + private static readonly DescriptorProto defaultInstance = new DescriptorProto().MakeReadOnly(); private static readonly string[] _descriptorProtoFieldNames = new string[] { "enum_type", "extension", "extension_range", "field", "name", "nested_type", "options" }; private static readonly uint[] _descriptorProtoFieldTags = new uint[] { 34, 50, 42, 18, 10, 26, 58 }; public static DescriptorProto DefaultInstance { @@ -1280,7 +1288,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override DescriptorProto DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override DescriptorProto ThisMessage { @@ -1304,7 +1312,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ExtensionRange : pb::GeneratedMessage { - private static readonly ExtensionRange defaultInstance = new Builder().BuildPartial(); + private static readonly ExtensionRange defaultInstance = new ExtensionRange().MakeReadOnly(); private static readonly string[] _extensionRangeFieldNames = new string[] { "end", "start" }; private static readonly uint[] _extensionRangeFieldTags = new uint[] { 16, 8 }; public static ExtensionRange DefaultInstance { @@ -1312,7 +1320,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override ExtensionRange DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override ExtensionRange ThisMessage { @@ -1414,6 +1422,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static ExtensionRange ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private ExtensionRange MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1429,22 +1441,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new ExtensionRange(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(ExtensionRange cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - ExtensionRange result; + private bool resultIsReadOnly; + private ExtensionRange result; private ExtensionRange PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { ExtensionRange original = result; result = new ExtensionRange(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1459,13 +1471,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new ExtensionRange(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1481,11 +1493,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override ExtensionRange BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1687,12 +1699,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public const int OptionsFieldNumber = 7; private bool hasOptions; - private global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions options_ = global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.DefaultInstance; + private global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions options_; public bool HasOptions { get { return hasOptions; } } public global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions Options { - get { return options_; } + get { return options_ ?? global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.DefaultInstance; } } public override bool IsInitialized { @@ -1807,6 +1819,15 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static DescriptorProto ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private DescriptorProto MakeReadOnly() { + field_.MakeReadOnly(); + extension_.MakeReadOnly(); + nestedType_.MakeReadOnly(); + enumType_.MakeReadOnly(); + extensionRange_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1822,22 +1843,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new DescriptorProto(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(DescriptorProto cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - DescriptorProto result; + private bool resultIsReadOnly; + private DescriptorProto result; private DescriptorProto PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { DescriptorProto original = result; result = new DescriptorProto(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1852,13 +1873,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new DescriptorProto(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1874,16 +1895,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override DescriptorProto BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.field_.MakeReadOnly(); - result.extension_.MakeReadOnly(); - result.nestedType_.MakeReadOnly(); - result.enumType_.MakeReadOnly(); - result.extensionRange_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -2282,7 +2298,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public Builder ClearOptions() { PrepareBuilder(); result.hasOptions = false; - result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.DefaultInstance; + result.options_ = null; return this; } } @@ -2295,7 +2311,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FieldDescriptorProto : pb::GeneratedMessage { - private static readonly FieldDescriptorProto defaultInstance = new Builder().BuildPartial(); + private static readonly FieldDescriptorProto defaultInstance = new FieldDescriptorProto().MakeReadOnly(); private static readonly string[] _fieldDescriptorProtoFieldNames = new string[] { "default_value", "extendee", "label", "name", "number", "options", "type", "type_name" }; private static readonly uint[] _fieldDescriptorProtoFieldTags = new uint[] { 58, 18, 32, 10, 24, 66, 40, 50 }; public static FieldDescriptorProto DefaultInstance { @@ -2303,7 +2319,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override FieldDescriptorProto DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override FieldDescriptorProto ThisMessage { @@ -2429,12 +2445,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public const int OptionsFieldNumber = 8; private bool hasOptions; - private global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions options_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.DefaultInstance; + private global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions options_; public bool HasOptions { get { return hasOptions; } } public global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions Options { - get { return options_; } + get { return options_ ?? global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.DefaultInstance; } } public override bool IsInitialized { @@ -2543,6 +2559,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static FieldDescriptorProto ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private FieldDescriptorProto MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -2558,22 +2578,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new FieldDescriptorProto(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(FieldDescriptorProto cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - FieldDescriptorProto result; + private bool resultIsReadOnly; + private FieldDescriptorProto result; private FieldDescriptorProto PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { FieldDescriptorProto original = result; result = new FieldDescriptorProto(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -2588,13 +2608,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new FieldDescriptorProto(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -2610,11 +2630,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override FieldDescriptorProto BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -2939,7 +2959,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public Builder ClearOptions() { PrepareBuilder(); result.hasOptions = false; - result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.DefaultInstance; + result.options_ = null; return this; } } @@ -2952,7 +2972,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class EnumDescriptorProto : pb::GeneratedMessage { - private static readonly EnumDescriptorProto defaultInstance = new Builder().BuildPartial(); + private static readonly EnumDescriptorProto defaultInstance = new EnumDescriptorProto().MakeReadOnly(); private static readonly string[] _enumDescriptorProtoFieldNames = new string[] { "name", "options", "value" }; private static readonly uint[] _enumDescriptorProtoFieldTags = new uint[] { 10, 26, 18 }; public static EnumDescriptorProto DefaultInstance { @@ -2960,7 +2980,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override EnumDescriptorProto DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override EnumDescriptorProto ThisMessage { @@ -2999,12 +3019,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public const int OptionsFieldNumber = 3; private bool hasOptions; - private global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions options_ = global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.DefaultInstance; + private global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions options_; public bool HasOptions { get { return hasOptions; } } public global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions Options { - get { return options_; } + get { return options_ ?? global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.DefaultInstance; } } public override bool IsInitialized { @@ -3086,6 +3106,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static EnumDescriptorProto ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private EnumDescriptorProto MakeReadOnly() { + value_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -3101,22 +3126,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new EnumDescriptorProto(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(EnumDescriptorProto cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - EnumDescriptorProto result; + private bool resultIsReadOnly; + private EnumDescriptorProto result; private EnumDescriptorProto PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { EnumDescriptorProto original = result; result = new EnumDescriptorProto(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -3131,13 +3156,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new EnumDescriptorProto(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -3153,12 +3178,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override EnumDescriptorProto BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.value_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -3353,7 +3377,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public Builder ClearOptions() { PrepareBuilder(); result.hasOptions = false; - result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.DefaultInstance; + result.options_ = null; return this; } } @@ -3366,7 +3390,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class EnumValueDescriptorProto : pb::GeneratedMessage { - private static readonly EnumValueDescriptorProto defaultInstance = new Builder().BuildPartial(); + private static readonly EnumValueDescriptorProto defaultInstance = new EnumValueDescriptorProto().MakeReadOnly(); private static readonly string[] _enumValueDescriptorProtoFieldNames = new string[] { "name", "number", "options" }; private static readonly uint[] _enumValueDescriptorProtoFieldTags = new uint[] { 10, 16, 26 }; public static EnumValueDescriptorProto DefaultInstance { @@ -3374,7 +3398,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override EnumValueDescriptorProto DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override EnumValueDescriptorProto ThisMessage { @@ -3411,12 +3435,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public const int OptionsFieldNumber = 3; private bool hasOptions; - private global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions options_ = global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.DefaultInstance; + private global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions options_; public bool HasOptions { get { return hasOptions; } } public global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions Options { - get { return options_; } + get { return options_ ?? global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.DefaultInstance; } } public override bool IsInitialized { @@ -3495,6 +3519,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static EnumValueDescriptorProto ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private EnumValueDescriptorProto MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -3510,22 +3538,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new EnumValueDescriptorProto(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(EnumValueDescriptorProto cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - EnumValueDescriptorProto result; + private bool resultIsReadOnly; + private EnumValueDescriptorProto result; private EnumValueDescriptorProto PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { EnumValueDescriptorProto original = result; result = new EnumValueDescriptorProto(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -3540,13 +3568,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new EnumValueDescriptorProto(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -3562,11 +3590,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override EnumValueDescriptorProto BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -3737,7 +3765,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public Builder ClearOptions() { PrepareBuilder(); result.hasOptions = false; - result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.DefaultInstance; + result.options_ = null; return this; } } @@ -3750,7 +3778,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ServiceDescriptorProto : pb::GeneratedMessage { - private static readonly ServiceDescriptorProto defaultInstance = new Builder().BuildPartial(); + private static readonly ServiceDescriptorProto defaultInstance = new ServiceDescriptorProto().MakeReadOnly(); private static readonly string[] _serviceDescriptorProtoFieldNames = new string[] { "method", "name", "options" }; private static readonly uint[] _serviceDescriptorProtoFieldTags = new uint[] { 18, 10, 26 }; public static ServiceDescriptorProto DefaultInstance { @@ -3758,7 +3786,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override ServiceDescriptorProto DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override ServiceDescriptorProto ThisMessage { @@ -3797,12 +3825,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public const int OptionsFieldNumber = 3; private bool hasOptions; - private global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions options_ = global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.DefaultInstance; + private global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions options_; public bool HasOptions { get { return hasOptions; } } public global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions Options { - get { return options_; } + get { return options_ ?? global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.DefaultInstance; } } public override bool IsInitialized { @@ -3884,6 +3912,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static ServiceDescriptorProto ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private ServiceDescriptorProto MakeReadOnly() { + method_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -3899,22 +3932,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new ServiceDescriptorProto(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(ServiceDescriptorProto cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - ServiceDescriptorProto result; + private bool resultIsReadOnly; + private ServiceDescriptorProto result; private ServiceDescriptorProto PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { ServiceDescriptorProto original = result; result = new ServiceDescriptorProto(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -3929,13 +3962,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new ServiceDescriptorProto(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -3951,12 +3984,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override ServiceDescriptorProto BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.method_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -4151,7 +4183,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public Builder ClearOptions() { PrepareBuilder(); result.hasOptions = false; - result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.DefaultInstance; + result.options_ = null; return this; } } @@ -4164,7 +4196,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class MethodDescriptorProto : pb::GeneratedMessage { - private static readonly MethodDescriptorProto defaultInstance = new Builder().BuildPartial(); + private static readonly MethodDescriptorProto defaultInstance = new MethodDescriptorProto().MakeReadOnly(); private static readonly string[] _methodDescriptorProtoFieldNames = new string[] { "input_type", "name", "options", "output_type" }; private static readonly uint[] _methodDescriptorProtoFieldTags = new uint[] { 18, 10, 34, 26 }; public static MethodDescriptorProto DefaultInstance { @@ -4172,7 +4204,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override MethodDescriptorProto DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override MethodDescriptorProto ThisMessage { @@ -4219,12 +4251,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public const int OptionsFieldNumber = 4; private bool hasOptions; - private global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions options_ = global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.DefaultInstance; + private global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions options_; public bool HasOptions { get { return hasOptions; } } public global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions Options { - get { return options_; } + get { return options_ ?? global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.DefaultInstance; } } public override bool IsInitialized { @@ -4309,6 +4341,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static MethodDescriptorProto ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private MethodDescriptorProto MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -4324,22 +4360,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new MethodDescriptorProto(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(MethodDescriptorProto cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - MethodDescriptorProto result; + private bool resultIsReadOnly; + private MethodDescriptorProto result; private MethodDescriptorProto PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { MethodDescriptorProto original = result; result = new MethodDescriptorProto(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -4354,13 +4390,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new MethodDescriptorProto(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -4376,11 +4412,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override MethodDescriptorProto BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -4580,7 +4616,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public Builder ClearOptions() { PrepareBuilder(); result.hasOptions = false; - result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.DefaultInstance; + result.options_ = null; return this; } } @@ -4593,7 +4629,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FileOptions : pb::ExtendableMessage { - private static readonly FileOptions defaultInstance = new Builder().BuildPartial(); + private static readonly FileOptions defaultInstance = new FileOptions().MakeReadOnly(); private static readonly string[] _fileOptionsFieldNames = new string[] { "cc_generic_services", "java_generic_services", "java_multiple_files", "java_outer_classname", "java_package", "optimize_for", "py_generic_services", "uninterpreted_option" }; private static readonly uint[] _fileOptionsFieldTags = new uint[] { 128, 136, 80, 66, 10, 72, 144, 7994 }; public static FileOptions DefaultInstance { @@ -4601,7 +4637,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override FileOptions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override FileOptions ThisMessage { @@ -4824,6 +4860,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static FileOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private FileOptions MakeReadOnly() { + uninterpretedOption_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -4839,22 +4880,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new FileOptions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(FileOptions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - FileOptions result; + private bool resultIsReadOnly; + private FileOptions result; private FileOptions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { FileOptions original = result; result = new FileOptions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -4869,13 +4910,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new FileOptions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -4891,12 +4932,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override FileOptions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.uninterpretedOption_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -5224,7 +5264,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class MessageOptions : pb::ExtendableMessage { - private static readonly MessageOptions defaultInstance = new Builder().BuildPartial(); + private static readonly MessageOptions defaultInstance = new MessageOptions().MakeReadOnly(); private static readonly string[] _messageOptionsFieldNames = new string[] { "message_set_wire_format", "no_standard_descriptor_accessor", "uninterpreted_option" }; private static readonly uint[] _messageOptionsFieldTags = new uint[] { 8, 16, 7994 }; public static MessageOptions DefaultInstance { @@ -5232,7 +5272,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override MessageOptions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override MessageOptions ThisMessage { @@ -5359,6 +5399,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static MessageOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private MessageOptions MakeReadOnly() { + uninterpretedOption_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -5374,22 +5419,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new MessageOptions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(MessageOptions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - MessageOptions result; + private bool resultIsReadOnly; + private MessageOptions result; private MessageOptions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { MessageOptions original = result; result = new MessageOptions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -5404,13 +5449,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new MessageOptions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -5426,12 +5471,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override MessageOptions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.uninterpretedOption_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -5614,7 +5658,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FieldOptions : pb::ExtendableMessage { - private static readonly FieldOptions defaultInstance = new Builder().BuildPartial(); + private static readonly FieldOptions defaultInstance = new FieldOptions().MakeReadOnly(); private static readonly string[] _fieldOptionsFieldNames = new string[] { "ctype", "deprecated", "experimental_map_key", "packed", "uninterpreted_option" }; private static readonly uint[] _fieldOptionsFieldTags = new uint[] { 8, 24, 74, 16, 7994 }; public static FieldOptions DefaultInstance { @@ -5622,7 +5666,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override FieldOptions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override FieldOptions ThisMessage { @@ -5797,6 +5841,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static FieldOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private FieldOptions MakeReadOnly() { + uninterpretedOption_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -5812,22 +5861,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new FieldOptions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(FieldOptions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - FieldOptions result; + private bool resultIsReadOnly; + private FieldOptions result; private FieldOptions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { FieldOptions original = result; result = new FieldOptions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -5842,13 +5891,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new FieldOptions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -5864,12 +5913,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override FieldOptions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.uninterpretedOption_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -6115,7 +6163,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class EnumOptions : pb::ExtendableMessage { - private static readonly EnumOptions defaultInstance = new Builder().BuildPartial(); + private static readonly EnumOptions defaultInstance = new EnumOptions().MakeReadOnly(); private static readonly string[] _enumOptionsFieldNames = new string[] { "uninterpreted_option" }; private static readonly uint[] _enumOptionsFieldTags = new uint[] { 7994 }; public static EnumOptions DefaultInstance { @@ -6123,7 +6171,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override EnumOptions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override EnumOptions ThisMessage { @@ -6218,6 +6266,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static EnumOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private EnumOptions MakeReadOnly() { + uninterpretedOption_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -6233,22 +6286,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new EnumOptions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(EnumOptions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - EnumOptions result; + private bool resultIsReadOnly; + private EnumOptions result; private EnumOptions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { EnumOptions original = result; result = new EnumOptions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -6263,13 +6316,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new EnumOptions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -6285,12 +6338,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override EnumOptions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.uninterpretedOption_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -6419,7 +6471,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class EnumValueOptions : pb::ExtendableMessage { - private static readonly EnumValueOptions defaultInstance = new Builder().BuildPartial(); + private static readonly EnumValueOptions defaultInstance = new EnumValueOptions().MakeReadOnly(); private static readonly string[] _enumValueOptionsFieldNames = new string[] { "uninterpreted_option" }; private static readonly uint[] _enumValueOptionsFieldTags = new uint[] { 7994 }; public static EnumValueOptions DefaultInstance { @@ -6427,7 +6479,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override EnumValueOptions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override EnumValueOptions ThisMessage { @@ -6522,6 +6574,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static EnumValueOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private EnumValueOptions MakeReadOnly() { + uninterpretedOption_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -6537,22 +6594,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new EnumValueOptions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(EnumValueOptions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - EnumValueOptions result; + private bool resultIsReadOnly; + private EnumValueOptions result; private EnumValueOptions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { EnumValueOptions original = result; result = new EnumValueOptions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -6567,13 +6624,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new EnumValueOptions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -6589,12 +6646,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override EnumValueOptions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.uninterpretedOption_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -6723,7 +6779,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ServiceOptions : pb::ExtendableMessage { - private static readonly ServiceOptions defaultInstance = new Builder().BuildPartial(); + private static readonly ServiceOptions defaultInstance = new ServiceOptions().MakeReadOnly(); private static readonly string[] _serviceOptionsFieldNames = new string[] { "uninterpreted_option" }; private static readonly uint[] _serviceOptionsFieldTags = new uint[] { 7994 }; public static ServiceOptions DefaultInstance { @@ -6731,7 +6787,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override ServiceOptions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override ServiceOptions ThisMessage { @@ -6826,6 +6882,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static ServiceOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private ServiceOptions MakeReadOnly() { + uninterpretedOption_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -6841,22 +6902,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new ServiceOptions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(ServiceOptions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - ServiceOptions result; + private bool resultIsReadOnly; + private ServiceOptions result; private ServiceOptions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { ServiceOptions original = result; result = new ServiceOptions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -6871,13 +6932,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new ServiceOptions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -6893,12 +6954,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override ServiceOptions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.uninterpretedOption_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -7027,7 +7087,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class MethodOptions : pb::ExtendableMessage { - private static readonly MethodOptions defaultInstance = new Builder().BuildPartial(); + private static readonly MethodOptions defaultInstance = new MethodOptions().MakeReadOnly(); private static readonly string[] _methodOptionsFieldNames = new string[] { "uninterpreted_option" }; private static readonly uint[] _methodOptionsFieldTags = new uint[] { 7994 }; public static MethodOptions DefaultInstance { @@ -7035,7 +7095,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override MethodOptions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override MethodOptions ThisMessage { @@ -7130,6 +7190,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static MethodOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private MethodOptions MakeReadOnly() { + uninterpretedOption_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -7145,22 +7210,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new MethodOptions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(MethodOptions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - MethodOptions result; + private bool resultIsReadOnly; + private MethodOptions result; private MethodOptions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { MethodOptions original = result; result = new MethodOptions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -7175,13 +7240,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new MethodOptions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -7197,12 +7262,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override MethodOptions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.uninterpretedOption_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -7331,7 +7395,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class UninterpretedOption : pb::GeneratedMessage { - private static readonly UninterpretedOption defaultInstance = new Builder().BuildPartial(); + private static readonly UninterpretedOption defaultInstance = new UninterpretedOption().MakeReadOnly(); private static readonly string[] _uninterpretedOptionFieldNames = new string[] { "double_value", "identifier_value", "name", "negative_int_value", "positive_int_value", "string_value" }; private static readonly uint[] _uninterpretedOptionFieldTags = new uint[] { 49, 26, 18, 40, 32, 58 }; public static UninterpretedOption DefaultInstance { @@ -7339,7 +7403,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override UninterpretedOption DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override UninterpretedOption ThisMessage { @@ -7363,7 +7427,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NamePart : pb::GeneratedMessage { - private static readonly NamePart defaultInstance = new Builder().BuildPartial(); + private static readonly NamePart defaultInstance = new NamePart().MakeReadOnly(); private static readonly string[] _namePartFieldNames = new string[] { "is_extension", "name_part" }; private static readonly uint[] _namePartFieldTags = new uint[] { 16, 10 }; public static NamePart DefaultInstance { @@ -7371,7 +7435,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override NamePart DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override NamePart ThisMessage { @@ -7475,6 +7539,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static NamePart ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private NamePart MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -7490,22 +7558,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new NamePart(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(NamePart cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - NamePart result; + private bool resultIsReadOnly; + private NamePart result; private NamePart PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { NamePart original = result; result = new NamePart(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -7520,13 +7588,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new NamePart(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -7542,11 +7610,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override NamePart BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -7834,6 +7902,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public static UninterpretedOption ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private UninterpretedOption MakeReadOnly() { + name_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -7849,22 +7922,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new UninterpretedOption(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(UninterpretedOption cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - UninterpretedOption result; + private bool resultIsReadOnly; + private UninterpretedOption result; private UninterpretedOption PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { UninterpretedOption original = result; result = new UninterpretedOption(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -7879,13 +7952,13 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override Builder Clear() { - result = DefaultInstance ?? new UninterpretedOption(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -7901,12 +7974,11 @@ namespace Google.ProtocolBuffers.DescriptorProtos { } public override UninterpretedOption BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.name_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs index 563cea5ed2..5267bf369c 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs @@ -128,13 +128,13 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestInteropPerson : pb::ExtendableMessage { - private static readonly TestInteropPerson defaultInstance = new Builder().BuildPartial(); + private static readonly TestInteropPerson defaultInstance = new TestInteropPerson().MakeReadOnly(); public static TestInteropPerson DefaultInstance { get { return defaultInstance; } } public override TestInteropPerson DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestInteropPerson ThisMessage { @@ -166,13 +166,13 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class PhoneNumber : pb::GeneratedMessage { - private static readonly PhoneNumber defaultInstance = new Builder().BuildPartial(); + private static readonly PhoneNumber defaultInstance = new PhoneNumber().MakeReadOnly(); public static PhoneNumber DefaultInstance { get { return defaultInstance; } } public override PhoneNumber DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override PhoneNumber ThisMessage { @@ -237,6 +237,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static PhoneNumber ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private PhoneNumber MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -252,22 +256,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new PhoneNumber(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(PhoneNumber cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - PhoneNumber result; + private bool resultIsReadOnly; + private PhoneNumber result; private PhoneNumber PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { PhoneNumber original = result; result = new PhoneNumber(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -282,13 +286,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new PhoneNumber(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -304,11 +308,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override PhoneNumber BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } @@ -362,13 +366,13 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Addresses : pb::GeneratedMessage { - private static readonly Addresses defaultInstance = new Builder().BuildPartial(); + private static readonly Addresses defaultInstance = new Addresses().MakeReadOnly(); public static Addresses DefaultInstance { get { return defaultInstance; } } public override Addresses DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override Addresses ThisMessage { @@ -464,6 +468,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static Addresses ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private Addresses MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -479,22 +487,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new Addresses(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(Addresses cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - Addresses result; + private bool resultIsReadOnly; + private Addresses result; private Addresses PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { Addresses original = result; result = new Addresses(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -509,13 +517,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new Addresses(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -531,11 +539,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Addresses BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } @@ -749,6 +757,13 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestInteropPerson ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestInteropPerson MakeReadOnly() { + codes_.MakeReadOnly(); + phone_.MakeReadOnly(); + addresses_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -764,22 +779,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestInteropPerson(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestInteropPerson cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestInteropPerson result; + private bool resultIsReadOnly; + private TestInteropPerson result; private TestInteropPerson PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestInteropPerson original = result; result = new TestInteropPerson(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -794,13 +809,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestInteropPerson(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -816,14 +831,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestInteropPerson BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.codes_.MakeReadOnly(); - result.phone_.MakeReadOnly(); - result.addresses_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } @@ -1016,13 +1028,13 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestInteropEmployeeId : pb::GeneratedMessage { - private static readonly TestInteropEmployeeId defaultInstance = new Builder().BuildPartial(); + private static readonly TestInteropEmployeeId defaultInstance = new TestInteropEmployeeId().MakeReadOnly(); public static TestInteropEmployeeId DefaultInstance { get { return defaultInstance; } } public override TestInteropEmployeeId DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestInteropEmployeeId ThisMessage { @@ -1077,6 +1089,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestInteropEmployeeId ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestInteropEmployeeId MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1092,22 +1108,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestInteropEmployeeId(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestInteropEmployeeId cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestInteropEmployeeId result; + private bool resultIsReadOnly; + private TestInteropEmployeeId result; private TestInteropEmployeeId PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestInteropEmployeeId original = result; result = new TestInteropEmployeeId(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1122,13 +1138,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestInteropEmployeeId(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1144,11 +1160,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestInteropEmployeeId BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } @@ -1182,13 +1198,13 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMissingFieldsA : pb::GeneratedMessage { - private static readonly TestMissingFieldsA defaultInstance = new Builder().BuildPartial(); + private static readonly TestMissingFieldsA defaultInstance = new TestMissingFieldsA().MakeReadOnly(); public static TestMissingFieldsA DefaultInstance { get { return defaultInstance; } } public override TestMissingFieldsA DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestMissingFieldsA ThisMessage { @@ -1212,13 +1228,13 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SubA : pb::GeneratedMessage { - private static readonly SubA defaultInstance = new Builder().BuildPartial(); + private static readonly SubA defaultInstance = new SubA().MakeReadOnly(); public static SubA DefaultInstance { get { return defaultInstance; } } public override SubA DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override SubA ThisMessage { @@ -1285,6 +1301,11 @@ namespace Google.ProtocolBuffers.TestProtos { public static SubA ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private SubA MakeReadOnly() { + values_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1300,22 +1321,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new SubA(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(SubA cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - SubA result; + private bool resultIsReadOnly; + private SubA result; private SubA PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { SubA original = result; result = new SubA(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1330,13 +1351,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new SubA(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1352,12 +1373,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SubA BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.values_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } @@ -1453,12 +1473,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int TestAFieldNumber = 11; private bool hasTestA; - private global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA testA_ = global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA testA_; public bool HasTestA { get { return hasTestA; } } public global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA TestA { - get { return testA_; } + get { return testA_ ?? global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.DefaultInstance; } } public static TestMissingFieldsA ParseFrom(pb::ByteString data) { @@ -1491,6 +1511,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestMissingFieldsA ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestMissingFieldsA MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1506,22 +1530,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestMissingFieldsA(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestMissingFieldsA cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestMissingFieldsA result; + private bool resultIsReadOnly; + private TestMissingFieldsA result; private TestMissingFieldsA PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestMissingFieldsA original = result; result = new TestMissingFieldsA(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1536,13 +1560,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestMissingFieldsA(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1558,11 +1582,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMissingFieldsA BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } @@ -1664,7 +1688,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearTestA() { PrepareBuilder(); result.hasTestA = false; - result.testA_ = global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.DefaultInstance; + result.testA_ = null; return this; } } @@ -1677,13 +1701,13 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMissingFieldsB : pb::GeneratedMessage { - private static readonly TestMissingFieldsB defaultInstance = new Builder().BuildPartial(); + private static readonly TestMissingFieldsB defaultInstance = new TestMissingFieldsB().MakeReadOnly(); public static TestMissingFieldsB DefaultInstance { get { return defaultInstance; } } public override TestMissingFieldsB DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestMissingFieldsB ThisMessage { @@ -1707,13 +1731,13 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SubB : pb::GeneratedMessage { - private static readonly SubB defaultInstance = new Builder().BuildPartial(); + private static readonly SubB defaultInstance = new SubB().MakeReadOnly(); public static SubB DefaultInstance { get { return defaultInstance; } } public override SubB DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override SubB ThisMessage { @@ -1770,6 +1794,11 @@ namespace Google.ProtocolBuffers.TestProtos { public static SubB ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private SubB MakeReadOnly() { + values_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1785,22 +1814,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new SubB(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(SubB cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - SubB result; + private bool resultIsReadOnly; + private SubB result; private SubB PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { SubB original = result; result = new SubB(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1815,13 +1844,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new SubB(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1837,12 +1866,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override SubB BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.values_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } @@ -1918,12 +1946,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int TestBFieldNumber = 12; private bool hasTestB; - private global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB testB_ = global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB testB_; public bool HasTestB { get { return hasTestB; } } public global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB TestB { - get { return testB_; } + get { return testB_ ?? global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB.DefaultInstance; } } public static TestMissingFieldsB ParseFrom(pb::ByteString data) { @@ -1956,6 +1984,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestMissingFieldsB ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestMissingFieldsB MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1971,22 +2003,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestMissingFieldsB(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestMissingFieldsB cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestMissingFieldsB result; + private bool resultIsReadOnly; + private TestMissingFieldsB result; private TestMissingFieldsB PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestMissingFieldsB original = result; result = new TestMissingFieldsB(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -2001,13 +2033,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestMissingFieldsB(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -2023,11 +2055,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMissingFieldsB BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } @@ -2129,7 +2161,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearTestB() { PrepareBuilder(); result.hasTestB = false; - result.testB_ = global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB.DefaultInstance; + result.testB_ = null; return this; } } diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs index cbbc50db22..d070aedc6a 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs @@ -59,7 +59,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequiredLite : pb::GeneratedMessageLite { - private static readonly TestRequiredLite defaultInstance = new Builder().BuildPartial(); + private static readonly TestRequiredLite defaultInstance = new TestRequiredLite().MakeReadOnly(); private static readonly string[] _testRequiredLiteFieldNames = new string[] { "d", "en" }; private static readonly uint[] _testRequiredLiteFieldTags = new uint[] { 8, 16 }; public static TestRequiredLite DefaultInstance { @@ -67,7 +67,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRequiredLite DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestRequiredLite ThisMessage { @@ -183,6 +183,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestRequiredLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestRequiredLite MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -198,22 +202,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestRequiredLite(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestRequiredLite cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestRequiredLite result; + private bool resultIsReadOnly; + private TestRequiredLite result; private TestRequiredLite PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestRequiredLite original = result; result = new TestRequiredLite(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -228,13 +232,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestRequiredLite(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -246,11 +250,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRequiredLite BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -371,7 +375,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestInteropPersonLite : pb::ExtendableMessageLite { - private static readonly TestInteropPersonLite defaultInstance = new Builder().BuildPartial(); + private static readonly TestInteropPersonLite defaultInstance = new TestInteropPersonLite().MakeReadOnly(); private static readonly string[] _testInteropPersonLiteFieldNames = new string[] { "addresses", "codes", "email", "id", "name", "phone" }; private static readonly uint[] _testInteropPersonLiteFieldTags = new uint[] { 43, 82, 26, 16, 10, 34 }; public static TestInteropPersonLite DefaultInstance { @@ -379,7 +383,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestInteropPersonLite DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestInteropPersonLite ThisMessage { @@ -403,7 +407,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class PhoneNumber : pb::GeneratedMessageLite { - private static readonly PhoneNumber defaultInstance = new Builder().BuildPartial(); + private static readonly PhoneNumber defaultInstance = new PhoneNumber().MakeReadOnly(); private static readonly string[] _phoneNumberFieldNames = new string[] { "number", "type" }; private static readonly uint[] _phoneNumberFieldTags = new uint[] { 10, 16 }; public static PhoneNumber DefaultInstance { @@ -411,7 +415,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override PhoneNumber DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override PhoneNumber ThisMessage { @@ -526,6 +530,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static PhoneNumber ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private PhoneNumber MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -541,22 +549,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new PhoneNumber(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(PhoneNumber cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - PhoneNumber result; + private bool resultIsReadOnly; + private PhoneNumber result; private PhoneNumber PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { PhoneNumber original = result; result = new PhoneNumber(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -571,13 +579,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new PhoneNumber(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -589,11 +597,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override PhoneNumber BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -715,7 +723,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Addresses : pb::GeneratedMessageLite { - private static readonly Addresses defaultInstance = new Builder().BuildPartial(); + private static readonly Addresses defaultInstance = new Addresses().MakeReadOnly(); private static readonly string[] _addressesFieldNames = new string[] { "address", "address2", "city", "state", "zip" }; private static readonly uint[] _addressesFieldTags = new uint[] { 10, 18, 26, 34, 45 }; public static Addresses DefaultInstance { @@ -723,7 +731,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Addresses DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override Addresses ThisMessage { @@ -899,6 +907,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static Addresses ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private Addresses MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -914,22 +926,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new Addresses(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(Addresses cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - Addresses result; + private bool resultIsReadOnly; + private Addresses result; private Addresses PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { Addresses original = result; result = new Addresses(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -944,13 +956,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new Addresses(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -962,11 +974,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Addresses BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -1388,6 +1400,13 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestInteropPersonLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestInteropPersonLite MakeReadOnly() { + codes_.MakeReadOnly(); + phone_.MakeReadOnly(); + addresses_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1403,22 +1422,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestInteropPersonLite(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestInteropPersonLite cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestInteropPersonLite result; + private bool resultIsReadOnly; + private TestInteropPersonLite result; private TestInteropPersonLite PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestInteropPersonLite original = result; result = new TestInteropPersonLite(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1433,13 +1452,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestInteropPersonLite(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1451,14 +1470,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestInteropPersonLite BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.codes_.MakeReadOnly(); - result.phone_.MakeReadOnly(); - result.addresses_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -1745,7 +1761,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestInteropEmployeeIdLite : pb::GeneratedMessageLite { - private static readonly TestInteropEmployeeIdLite defaultInstance = new Builder().BuildPartial(); + private static readonly TestInteropEmployeeIdLite defaultInstance = new TestInteropEmployeeIdLite().MakeReadOnly(); private static readonly string[] _testInteropEmployeeIdLiteFieldNames = new string[] { "number" }; private static readonly uint[] _testInteropEmployeeIdLiteFieldTags = new uint[] { 10 }; public static TestInteropEmployeeIdLite DefaultInstance { @@ -1753,7 +1769,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestInteropEmployeeIdLite DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestInteropEmployeeIdLite ThisMessage { @@ -1849,6 +1865,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestInteropEmployeeIdLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestInteropEmployeeIdLite MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1864,22 +1884,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestInteropEmployeeIdLite(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestInteropEmployeeIdLite cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestInteropEmployeeIdLite result; + private bool resultIsReadOnly; + private TestInteropEmployeeIdLite result; private TestInteropEmployeeIdLite PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestInteropEmployeeIdLite original = result; result = new TestInteropEmployeeIdLite(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1894,13 +1914,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestInteropEmployeeIdLite(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1912,11 +1932,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestInteropEmployeeIdLite BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs index 0df40f4248..3eb3062ce0 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs @@ -43,7 +43,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ImportMessageLite : pb::GeneratedMessageLite { - private static readonly ImportMessageLite defaultInstance = new Builder().BuildPartial(); + private static readonly ImportMessageLite defaultInstance = new ImportMessageLite().MakeReadOnly(); private static readonly string[] _importMessageLiteFieldNames = new string[] { "d" }; private static readonly uint[] _importMessageLiteFieldTags = new uint[] { 8 }; public static ImportMessageLite DefaultInstance { @@ -51,7 +51,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ImportMessageLite DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override ImportMessageLite ThisMessage { @@ -146,6 +146,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static ImportMessageLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private ImportMessageLite MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -161,22 +165,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new ImportMessageLite(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(ImportMessageLite cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - ImportMessageLite result; + private bool resultIsReadOnly; + private ImportMessageLite result; private ImportMessageLite PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { ImportMessageLite original = result; result = new ImportMessageLite(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -191,13 +195,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new ImportMessageLite(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -209,11 +213,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ImportMessageLite BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs index 75e746a840..6f7f59d5c1 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs @@ -71,7 +71,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ImportMessage : pb::GeneratedMessage { - private static readonly ImportMessage defaultInstance = new Builder().BuildPartial(); + private static readonly ImportMessage defaultInstance = new ImportMessage().MakeReadOnly(); private static readonly string[] _importMessageFieldNames = new string[] { "d" }; private static readonly uint[] _importMessageFieldTags = new uint[] { 8 }; public static ImportMessage DefaultInstance { @@ -79,7 +79,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ImportMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override ImportMessage ThisMessage { @@ -165,6 +165,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static ImportMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private ImportMessage MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -180,22 +184,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new ImportMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(ImportMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - ImportMessage result; + private bool resultIsReadOnly; + private ImportMessage result; private ImportMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { ImportMessage original = result; result = new ImportMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -210,13 +214,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new ImportMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -232,11 +236,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ImportMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs index 5a6033a185..34ae37f9cb 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs @@ -32,7 +32,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestLiteImportsNonlite : pb::GeneratedMessageLite { - private static readonly TestLiteImportsNonlite defaultInstance = new Builder().BuildPartial(); + private static readonly TestLiteImportsNonlite defaultInstance = new TestLiteImportsNonlite().MakeReadOnly(); private static readonly string[] _testLiteImportsNonliteFieldNames = new string[] { "message" }; private static readonly uint[] _testLiteImportsNonliteFieldTags = new uint[] { 10 }; public static TestLiteImportsNonlite DefaultInstance { @@ -40,7 +40,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestLiteImportsNonlite DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestLiteImportsNonlite ThisMessage { @@ -49,12 +49,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int MessageFieldNumber = 1; private bool hasMessage; - private global::Google.ProtocolBuffers.TestProtos.TestAllTypes message_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes message_; public bool HasMessage { get { return hasMessage; } } public global::Google.ProtocolBuffers.TestProtos.TestAllTypes Message { - get { return message_; } + get { return message_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance; } } public override bool IsInitialized { @@ -135,6 +135,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestLiteImportsNonlite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestLiteImportsNonlite MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -150,22 +154,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestLiteImportsNonlite(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestLiteImportsNonlite cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestLiteImportsNonlite result; + private bool resultIsReadOnly; + private TestLiteImportsNonlite result; private TestLiteImportsNonlite PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestLiteImportsNonlite original = result; result = new TestLiteImportsNonlite(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -180,13 +184,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestLiteImportsNonlite(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -198,11 +202,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestLiteImportsNonlite BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -304,7 +308,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearMessage() { PrepareBuilder(); result.hasMessage = false; - result.message_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance; + result.message_ = null; return this; } } diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs index 2592c83333..5ad75588d7 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs @@ -1228,7 +1228,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllTypesLite : pb::GeneratedMessageLite { - private static readonly TestAllTypesLite defaultInstance = new Builder().BuildPartial(); + private static readonly TestAllTypesLite defaultInstance = new TestAllTypesLite().MakeReadOnly(); private static readonly string[] _testAllTypesLiteFieldNames = new string[] { "default_bool", "default_bytes", "default_cord", "default_double", "default_fixed32", "default_fixed64", "default_float", "default_foreign_enum", "default_import_enum", "default_int32", "default_int64", "default_nested_enum", "default_sfixed32", "default_sfixed64", "default_sint32", "default_sint64", "default_string", "default_string_piece", "default_uint32", "default_uint64", "optional_bool", "optional_bytes", "optional_cord", "optional_double", "optional_fixed32", "optional_fixed64", "optional_float", "optional_foreign_enum", "optional_foreign_message", "optional_import_enum", "optional_import_message", "optional_int32", "optional_int64", "optional_nested_enum", "optional_nested_message", "optional_sfixed32", "optional_sfixed64", "optional_sint32", "optional_sint64", "optional_string", "optional_string_piece", "optional_uint32", "optional_uint64", "optionalgroup", "repeated_bool", "repeated_bytes", "repeated_cord", "repeated_double", "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_foreign_enum", "repeated_foreign_message", "repeated_import_enum", "repeated_import_message", "repeated_int32", "repeated_int64", "repeated_nested_enum", "repeated_nested_message", "repeated_sfixed32", "repeated_sfixed64", "repeated_sint32", "repeated_sint64", "repeated_string", "repeated_string_piece", "repeated_uint32", "repeated_uint64", "repeatedgroup" }; private static readonly uint[] _testAllTypesLiteFieldTags = new uint[] { 584, 602, 682, 577, 541, 545, 573, 656, 664, 488, 496, 648, 557, 561, 520, 528, 594, 674, 504, 512, 104, 122, 202, 97, 61, 65, 93, 176, 154, 184, 162, 8, 16, 168, 146, 77, 81, 40, 48, 114, 194, 24, 32, 131, 344, 362, 442, 337, 301, 305, 333, 416, 394, 424, 402, 248, 256, 408, 386, 317, 321, 280, 288, 354, 434, 264, 272, 371 }; public static TestAllTypesLite DefaultInstance { @@ -1236,7 +1236,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllTypesLite DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestAllTypesLite ThisMessage { @@ -1260,7 +1260,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NestedMessage : pb::GeneratedMessageLite { - private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); + private static readonly NestedMessage defaultInstance = new NestedMessage().MakeReadOnly(); private static readonly string[] _nestedMessageFieldNames = new string[] { "bb" }; private static readonly uint[] _nestedMessageFieldTags = new uint[] { 8 }; public static NestedMessage DefaultInstance { @@ -1268,7 +1268,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override NestedMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override NestedMessage ThisMessage { @@ -1363,6 +1363,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static NestedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private NestedMessage MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1378,22 +1382,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new NestedMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(NestedMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - NestedMessage result; + private bool resultIsReadOnly; + private NestedMessage result; private NestedMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { NestedMessage original = result; result = new NestedMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1408,13 +1412,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new NestedMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1426,11 +1430,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override NestedMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -1520,7 +1524,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup : pb::GeneratedMessageLite { - private static readonly OptionalGroup defaultInstance = new Builder().BuildPartial(); + private static readonly OptionalGroup defaultInstance = new OptionalGroup().MakeReadOnly(); private static readonly string[] _optionalGroupFieldNames = new string[] { "a" }; private static readonly uint[] _optionalGroupFieldTags = new uint[] { 136 }; public static OptionalGroup DefaultInstance { @@ -1528,7 +1532,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override OptionalGroup ThisMessage { @@ -1623,6 +1627,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static OptionalGroup ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private OptionalGroup MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1638,22 +1646,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new OptionalGroup(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(OptionalGroup cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - OptionalGroup result; + private bool resultIsReadOnly; + private OptionalGroup result; private OptionalGroup PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { OptionalGroup original = result; result = new OptionalGroup(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1668,13 +1676,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new OptionalGroup(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1686,11 +1694,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -1780,7 +1788,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup : pb::GeneratedMessageLite { - private static readonly RepeatedGroup defaultInstance = new Builder().BuildPartial(); + private static readonly RepeatedGroup defaultInstance = new RepeatedGroup().MakeReadOnly(); private static readonly string[] _repeatedGroupFieldNames = new string[] { "a" }; private static readonly uint[] _repeatedGroupFieldTags = new uint[] { 376 }; public static RepeatedGroup DefaultInstance { @@ -1788,7 +1796,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override RepeatedGroup ThisMessage { @@ -1883,6 +1891,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static RepeatedGroup ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private RepeatedGroup MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1898,22 +1910,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new RepeatedGroup(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(RepeatedGroup cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - RepeatedGroup result; + private bool resultIsReadOnly; + private RepeatedGroup result; private RepeatedGroup PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { RepeatedGroup original = result; result = new RepeatedGroup(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1928,13 +1940,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new RepeatedGroup(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1946,11 +1958,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -2195,42 +2207,42 @@ namespace Google.ProtocolBuffers.TestProtos { public const int OptionalGroupFieldNumber = 16; private bool hasOptionalGroup; - private global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup optionalGroup_; public bool HasOptionalGroup { get { return hasOptionalGroup; } } public global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup OptionalGroup { - get { return optionalGroup_; } + get { return optionalGroup_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.DefaultInstance; } } public const int OptionalNestedMessageFieldNumber = 18; private bool hasOptionalNestedMessage; - private global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage optionalNestedMessage_; public bool HasOptionalNestedMessage { get { return hasOptionalNestedMessage; } } public global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage OptionalNestedMessage { - get { return optionalNestedMessage_; } + get { return optionalNestedMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance; } } public const int OptionalForeignMessageFieldNumber = 19; private bool hasOptionalForeignMessage; - private global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite optionalForeignMessage_; public bool HasOptionalForeignMessage { get { return hasOptionalForeignMessage; } } public global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite OptionalForeignMessage { - get { return optionalForeignMessage_; } + get { return optionalForeignMessage_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance; } } public const int OptionalImportMessageFieldNumber = 20; private bool hasOptionalImportMessage; - private global::Google.ProtocolBuffers.TestProtos.ImportMessageLite optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.ImportMessageLite optionalImportMessage_; public bool HasOptionalImportMessage { get { return hasOptionalImportMessage; } } public global::Google.ProtocolBuffers.TestProtos.ImportMessageLite OptionalImportMessage { - get { return optionalImportMessage_; } + get { return optionalImportMessage_ ?? global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance; } } public const int OptionalNestedEnumFieldNumber = 21; @@ -3628,6 +3640,34 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestAllTypesLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestAllTypesLite MakeReadOnly() { + repeatedInt32_.MakeReadOnly(); + repeatedInt64_.MakeReadOnly(); + repeatedUint32_.MakeReadOnly(); + repeatedUint64_.MakeReadOnly(); + repeatedSint32_.MakeReadOnly(); + repeatedSint64_.MakeReadOnly(); + repeatedFixed32_.MakeReadOnly(); + repeatedFixed64_.MakeReadOnly(); + repeatedSfixed32_.MakeReadOnly(); + repeatedSfixed64_.MakeReadOnly(); + repeatedFloat_.MakeReadOnly(); + repeatedDouble_.MakeReadOnly(); + repeatedBool_.MakeReadOnly(); + repeatedString_.MakeReadOnly(); + repeatedBytes_.MakeReadOnly(); + repeatedGroup_.MakeReadOnly(); + repeatedNestedMessage_.MakeReadOnly(); + repeatedForeignMessage_.MakeReadOnly(); + repeatedImportMessage_.MakeReadOnly(); + repeatedNestedEnum_.MakeReadOnly(); + repeatedForeignEnum_.MakeReadOnly(); + repeatedImportEnum_.MakeReadOnly(); + repeatedStringPiece_.MakeReadOnly(); + repeatedCord_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -3643,22 +3683,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestAllTypesLite(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestAllTypesLite cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestAllTypesLite result; + private bool resultIsReadOnly; + private TestAllTypesLite result; private TestAllTypesLite PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestAllTypesLite original = result; result = new TestAllTypesLite(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -3673,13 +3713,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestAllTypesLite(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -3691,35 +3731,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllTypesLite BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.repeatedInt32_.MakeReadOnly(); - result.repeatedInt64_.MakeReadOnly(); - result.repeatedUint32_.MakeReadOnly(); - result.repeatedUint64_.MakeReadOnly(); - result.repeatedSint32_.MakeReadOnly(); - result.repeatedSint64_.MakeReadOnly(); - result.repeatedFixed32_.MakeReadOnly(); - result.repeatedFixed64_.MakeReadOnly(); - result.repeatedSfixed32_.MakeReadOnly(); - result.repeatedSfixed64_.MakeReadOnly(); - result.repeatedFloat_.MakeReadOnly(); - result.repeatedDouble_.MakeReadOnly(); - result.repeatedBool_.MakeReadOnly(); - result.repeatedString_.MakeReadOnly(); - result.repeatedBytes_.MakeReadOnly(); - result.repeatedGroup_.MakeReadOnly(); - result.repeatedNestedMessage_.MakeReadOnly(); - result.repeatedForeignMessage_.MakeReadOnly(); - result.repeatedImportMessage_.MakeReadOnly(); - result.repeatedNestedEnum_.MakeReadOnly(); - result.repeatedForeignEnum_.MakeReadOnly(); - result.repeatedImportEnum_.MakeReadOnly(); - result.repeatedStringPiece_.MakeReadOnly(); - result.repeatedCord_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -4658,7 +4674,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearOptionalGroup() { PrepareBuilder(); result.hasOptionalGroup = false; - result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.DefaultInstance; + result.optionalGroup_ = null; return this; } @@ -4698,7 +4714,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearOptionalNestedMessage() { PrepareBuilder(); result.hasOptionalNestedMessage = false; - result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance; + result.optionalNestedMessage_ = null; return this; } @@ -4738,7 +4754,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearOptionalForeignMessage() { PrepareBuilder(); result.hasOptionalForeignMessage = false; - result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance; + result.optionalForeignMessage_ = null; return this; } @@ -4778,7 +4794,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearOptionalImportMessage() { PrepareBuilder(); result.hasOptionalImportMessage = false; - result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance; + result.optionalImportMessage_ = null; return this; } @@ -6109,7 +6125,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ForeignMessageLite : pb::GeneratedMessageLite { - private static readonly ForeignMessageLite defaultInstance = new Builder().BuildPartial(); + private static readonly ForeignMessageLite defaultInstance = new ForeignMessageLite().MakeReadOnly(); private static readonly string[] _foreignMessageLiteFieldNames = new string[] { "c" }; private static readonly uint[] _foreignMessageLiteFieldTags = new uint[] { 8 }; public static ForeignMessageLite DefaultInstance { @@ -6117,7 +6133,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ForeignMessageLite DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override ForeignMessageLite ThisMessage { @@ -6212,6 +6228,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static ForeignMessageLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private ForeignMessageLite MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -6227,22 +6247,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new ForeignMessageLite(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(ForeignMessageLite cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - ForeignMessageLite result; + private bool resultIsReadOnly; + private ForeignMessageLite result; private ForeignMessageLite PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { ForeignMessageLite original = result; result = new ForeignMessageLite(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -6257,13 +6277,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new ForeignMessageLite(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -6275,11 +6295,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ForeignMessageLite BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -6369,7 +6389,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedTypesLite : pb::GeneratedMessageLite { - private static readonly TestPackedTypesLite defaultInstance = new Builder().BuildPartial(); + private static readonly TestPackedTypesLite defaultInstance = new TestPackedTypesLite().MakeReadOnly(); private static readonly string[] _testPackedTypesLiteFieldNames = new string[] { "packed_bool", "packed_double", "packed_enum", "packed_fixed32", "packed_fixed64", "packed_float", "packed_int32", "packed_int64", "packed_sfixed32", "packed_sfixed64", "packed_sint32", "packed_sint64", "packed_uint32", "packed_uint64" }; private static readonly uint[] _testPackedTypesLiteFieldTags = new uint[] { 818, 810, 826, 770, 778, 802, 722, 730, 786, 794, 754, 762, 738, 746 }; public static TestPackedTypesLite DefaultInstance { @@ -6377,7 +6397,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedTypesLite DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestPackedTypesLite ThisMessage { @@ -6910,6 +6930,24 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestPackedTypesLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestPackedTypesLite MakeReadOnly() { + packedInt32_.MakeReadOnly(); + packedInt64_.MakeReadOnly(); + packedUint32_.MakeReadOnly(); + packedUint64_.MakeReadOnly(); + packedSint32_.MakeReadOnly(); + packedSint64_.MakeReadOnly(); + packedFixed32_.MakeReadOnly(); + packedFixed64_.MakeReadOnly(); + packedSfixed32_.MakeReadOnly(); + packedSfixed64_.MakeReadOnly(); + packedFloat_.MakeReadOnly(); + packedDouble_.MakeReadOnly(); + packedBool_.MakeReadOnly(); + packedEnum_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -6925,22 +6963,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestPackedTypesLite(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestPackedTypesLite cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestPackedTypesLite result; + private bool resultIsReadOnly; + private TestPackedTypesLite result; private TestPackedTypesLite PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestPackedTypesLite original = result; result = new TestPackedTypesLite(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -6955,13 +6993,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestPackedTypesLite(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -6973,25 +7011,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedTypesLite BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.packedInt32_.MakeReadOnly(); - result.packedInt64_.MakeReadOnly(); - result.packedUint32_.MakeReadOnly(); - result.packedUint64_.MakeReadOnly(); - result.packedSint32_.MakeReadOnly(); - result.packedSint64_.MakeReadOnly(); - result.packedFixed32_.MakeReadOnly(); - result.packedFixed64_.MakeReadOnly(); - result.packedSfixed32_.MakeReadOnly(); - result.packedSfixed64_.MakeReadOnly(); - result.packedFloat_.MakeReadOnly(); - result.packedDouble_.MakeReadOnly(); - result.packedBool_.MakeReadOnly(); - result.packedEnum_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -7607,7 +7631,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedTypesLite : pb::GeneratedMessageLite { - private static readonly TestUnpackedTypesLite defaultInstance = new Builder().BuildPartial(); + private static readonly TestUnpackedTypesLite defaultInstance = new TestUnpackedTypesLite().MakeReadOnly(); private static readonly string[] _testUnpackedTypesLiteFieldNames = new string[] { "unpacked_bool", "unpacked_double", "unpacked_enum", "unpacked_fixed32", "unpacked_fixed64", "unpacked_float", "unpacked_int32", "unpacked_int64", "unpacked_sfixed32", "unpacked_sfixed64", "unpacked_sint32", "unpacked_sint64", "unpacked_uint32", "unpacked_uint64" }; private static readonly uint[] _testUnpackedTypesLiteFieldTags = new uint[] { 816, 809, 824, 773, 777, 805, 720, 728, 789, 793, 752, 760, 736, 744 }; public static TestUnpackedTypesLite DefaultInstance { @@ -7615,7 +7639,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedTypesLite DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestUnpackedTypesLite ThisMessage { @@ -8093,6 +8117,24 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestUnpackedTypesLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestUnpackedTypesLite MakeReadOnly() { + unpackedInt32_.MakeReadOnly(); + unpackedInt64_.MakeReadOnly(); + unpackedUint32_.MakeReadOnly(); + unpackedUint64_.MakeReadOnly(); + unpackedSint32_.MakeReadOnly(); + unpackedSint64_.MakeReadOnly(); + unpackedFixed32_.MakeReadOnly(); + unpackedFixed64_.MakeReadOnly(); + unpackedSfixed32_.MakeReadOnly(); + unpackedSfixed64_.MakeReadOnly(); + unpackedFloat_.MakeReadOnly(); + unpackedDouble_.MakeReadOnly(); + unpackedBool_.MakeReadOnly(); + unpackedEnum_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -8108,22 +8150,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestUnpackedTypesLite(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestUnpackedTypesLite cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestUnpackedTypesLite result; + private bool resultIsReadOnly; + private TestUnpackedTypesLite result; private TestUnpackedTypesLite PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestUnpackedTypesLite original = result; result = new TestUnpackedTypesLite(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -8138,13 +8180,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestUnpackedTypesLite(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -8156,25 +8198,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedTypesLite BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.unpackedInt32_.MakeReadOnly(); - result.unpackedInt64_.MakeReadOnly(); - result.unpackedUint32_.MakeReadOnly(); - result.unpackedUint64_.MakeReadOnly(); - result.unpackedSint32_.MakeReadOnly(); - result.unpackedSint64_.MakeReadOnly(); - result.unpackedFixed32_.MakeReadOnly(); - result.unpackedFixed64_.MakeReadOnly(); - result.unpackedSfixed32_.MakeReadOnly(); - result.unpackedSfixed64_.MakeReadOnly(); - result.unpackedFloat_.MakeReadOnly(); - result.unpackedDouble_.MakeReadOnly(); - result.unpackedBool_.MakeReadOnly(); - result.unpackedEnum_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -8790,7 +8818,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllExtensionsLite : pb::ExtendableMessageLite { - private static readonly TestAllExtensionsLite defaultInstance = new Builder().BuildPartial(); + private static readonly TestAllExtensionsLite defaultInstance = new TestAllExtensionsLite().MakeReadOnly(); private static readonly string[] _testAllExtensionsLiteFieldNames = new string[] { }; private static readonly uint[] _testAllExtensionsLiteFieldTags = new uint[] { }; public static TestAllExtensionsLite DefaultInstance { @@ -8798,7 +8826,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllExtensionsLite DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestAllExtensionsLite ThisMessage { @@ -8881,6 +8909,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestAllExtensionsLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestAllExtensionsLite MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -8896,22 +8928,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestAllExtensionsLite(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestAllExtensionsLite cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestAllExtensionsLite result; + private bool resultIsReadOnly; + private TestAllExtensionsLite result; private TestAllExtensionsLite PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestAllExtensionsLite original = result; result = new TestAllExtensionsLite(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -8926,13 +8958,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestAllExtensionsLite(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -8944,11 +8976,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllExtensionsLite BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -9012,7 +9044,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup_extension_lite : pb::GeneratedMessageLite { - private static readonly OptionalGroup_extension_lite defaultInstance = new Builder().BuildPartial(); + private static readonly OptionalGroup_extension_lite defaultInstance = new OptionalGroup_extension_lite().MakeReadOnly(); private static readonly string[] _optionalGroupExtensionLiteFieldNames = new string[] { "a" }; private static readonly uint[] _optionalGroupExtensionLiteFieldTags = new uint[] { 136 }; public static OptionalGroup_extension_lite DefaultInstance { @@ -9020,7 +9052,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup_extension_lite DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override OptionalGroup_extension_lite ThisMessage { @@ -9115,6 +9147,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static OptionalGroup_extension_lite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private OptionalGroup_extension_lite MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -9130,22 +9166,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new OptionalGroup_extension_lite(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(OptionalGroup_extension_lite cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - OptionalGroup_extension_lite result; + private bool resultIsReadOnly; + private OptionalGroup_extension_lite result; private OptionalGroup_extension_lite PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { OptionalGroup_extension_lite original = result; result = new OptionalGroup_extension_lite(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -9160,13 +9196,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new OptionalGroup_extension_lite(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -9178,11 +9214,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup_extension_lite BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -9272,7 +9308,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup_extension_lite : pb::GeneratedMessageLite { - private static readonly RepeatedGroup_extension_lite defaultInstance = new Builder().BuildPartial(); + private static readonly RepeatedGroup_extension_lite defaultInstance = new RepeatedGroup_extension_lite().MakeReadOnly(); private static readonly string[] _repeatedGroupExtensionLiteFieldNames = new string[] { "a" }; private static readonly uint[] _repeatedGroupExtensionLiteFieldTags = new uint[] { 376 }; public static RepeatedGroup_extension_lite DefaultInstance { @@ -9280,7 +9316,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup_extension_lite DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override RepeatedGroup_extension_lite ThisMessage { @@ -9375,6 +9411,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static RepeatedGroup_extension_lite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private RepeatedGroup_extension_lite MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -9390,22 +9430,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new RepeatedGroup_extension_lite(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(RepeatedGroup_extension_lite cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - RepeatedGroup_extension_lite result; + private bool resultIsReadOnly; + private RepeatedGroup_extension_lite result; private RepeatedGroup_extension_lite PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { RepeatedGroup_extension_lite original = result; result = new RepeatedGroup_extension_lite(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -9420,13 +9460,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new RepeatedGroup_extension_lite(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -9438,11 +9478,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup_extension_lite BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -9532,7 +9572,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedExtensionsLite : pb::ExtendableMessageLite { - private static readonly TestPackedExtensionsLite defaultInstance = new Builder().BuildPartial(); + private static readonly TestPackedExtensionsLite defaultInstance = new TestPackedExtensionsLite().MakeReadOnly(); private static readonly string[] _testPackedExtensionsLiteFieldNames = new string[] { }; private static readonly uint[] _testPackedExtensionsLiteFieldTags = new uint[] { }; public static TestPackedExtensionsLite DefaultInstance { @@ -9540,7 +9580,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedExtensionsLite DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestPackedExtensionsLite ThisMessage { @@ -9623,6 +9663,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestPackedExtensionsLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestPackedExtensionsLite MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -9638,22 +9682,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestPackedExtensionsLite(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestPackedExtensionsLite cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestPackedExtensionsLite result; + private bool resultIsReadOnly; + private TestPackedExtensionsLite result; private TestPackedExtensionsLite PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestPackedExtensionsLite original = result; result = new TestPackedExtensionsLite(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -9668,13 +9712,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestPackedExtensionsLite(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -9686,11 +9730,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedExtensionsLite BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -9754,7 +9798,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedExtensionsLite : pb::ExtendableMessageLite { - private static readonly TestUnpackedExtensionsLite defaultInstance = new Builder().BuildPartial(); + private static readonly TestUnpackedExtensionsLite defaultInstance = new TestUnpackedExtensionsLite().MakeReadOnly(); private static readonly string[] _testUnpackedExtensionsLiteFieldNames = new string[] { }; private static readonly uint[] _testUnpackedExtensionsLiteFieldTags = new uint[] { }; public static TestUnpackedExtensionsLite DefaultInstance { @@ -9762,7 +9806,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedExtensionsLite DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestUnpackedExtensionsLite ThisMessage { @@ -9845,6 +9889,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestUnpackedExtensionsLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestUnpackedExtensionsLite MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -9860,22 +9908,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestUnpackedExtensionsLite(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestUnpackedExtensionsLite cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestUnpackedExtensionsLite result; + private bool resultIsReadOnly; + private TestUnpackedExtensionsLite result; private TestUnpackedExtensionsLite PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestUnpackedExtensionsLite original = result; result = new TestUnpackedExtensionsLite(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -9890,13 +9938,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestUnpackedExtensionsLite(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -9908,11 +9956,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedExtensionsLite BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -9976,7 +10024,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestNestedExtensionLite : pb::GeneratedMessageLite { - private static readonly TestNestedExtensionLite defaultInstance = new Builder().BuildPartial(); + private static readonly TestNestedExtensionLite defaultInstance = new TestNestedExtensionLite().MakeReadOnly(); private static readonly string[] _testNestedExtensionLiteFieldNames = new string[] { }; private static readonly uint[] _testNestedExtensionLiteFieldTags = new uint[] { }; public static TestNestedExtensionLite DefaultInstance { @@ -9984,7 +10032,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestNestedExtensionLite DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestNestedExtensionLite ThisMessage { @@ -10062,6 +10110,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestNestedExtensionLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestNestedExtensionLite MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -10077,22 +10129,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestNestedExtensionLite(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestNestedExtensionLite cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestNestedExtensionLite result; + private bool resultIsReadOnly; + private TestNestedExtensionLite result; private TestNestedExtensionLite PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestNestedExtensionLite original = result; result = new TestNestedExtensionLite(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -10107,13 +10159,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestNestedExtensionLite(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -10125,11 +10177,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestNestedExtensionLite BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { @@ -10192,7 +10244,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDeprecatedLite : pb::GeneratedMessageLite { - private static readonly TestDeprecatedLite defaultInstance = new Builder().BuildPartial(); + private static readonly TestDeprecatedLite defaultInstance = new TestDeprecatedLite().MakeReadOnly(); private static readonly string[] _testDeprecatedLiteFieldNames = new string[] { "deprecated_field" }; private static readonly uint[] _testDeprecatedLiteFieldTags = new uint[] { 8 }; public static TestDeprecatedLite DefaultInstance { @@ -10200,7 +10252,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDeprecatedLite DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestDeprecatedLite ThisMessage { @@ -10295,6 +10347,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestDeprecatedLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestDeprecatedLite MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -10310,22 +10366,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestDeprecatedLite(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestDeprecatedLite cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestDeprecatedLite result; + private bool resultIsReadOnly; + private TestDeprecatedLite result; private TestDeprecatedLite PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestDeprecatedLite original = result; result = new TestDeprecatedLite(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -10340,13 +10396,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestDeprecatedLite(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -10358,11 +10414,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDeprecatedLite BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessageLite other) { diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs index aeea673d57..0c66d4bc5f 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs @@ -1122,7 +1122,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllTypes : pb::GeneratedMessage { - private static readonly TestAllTypes defaultInstance = new Builder().BuildPartial(); + private static readonly TestAllTypes defaultInstance = new TestAllTypes().MakeReadOnly(); private static readonly string[] _testAllTypesFieldNames = new string[] { "default_bool", "default_bytes", "default_cord", "default_double", "default_fixed32", "default_fixed64", "default_float", "default_foreign_enum", "default_import_enum", "default_int32", "default_int64", "default_nested_enum", "default_sfixed32", "default_sfixed64", "default_sint32", "default_sint64", "default_string", "default_string_piece", "default_uint32", "default_uint64", "optional_bool", "optional_bytes", "optional_cord", "optional_double", "optional_fixed32", "optional_fixed64", "optional_float", "optional_foreign_enum", "optional_foreign_message", "optional_import_enum", "optional_import_message", "optional_int32", "optional_int64", "optional_nested_enum", "optional_nested_message", "optional_sfixed32", "optional_sfixed64", "optional_sint32", "optional_sint64", "optional_string", "optional_string_piece", "optional_uint32", "optional_uint64", "optionalgroup", "repeated_bool", "repeated_bytes", "repeated_cord", "repeated_double", "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_foreign_enum", "repeated_foreign_message", "repeated_import_enum", "repeated_import_message", "repeated_int32", "repeated_int64", "repeated_nested_enum", "repeated_nested_message", "repeated_sfixed32", "repeated_sfixed64", "repeated_sint32", "repeated_sint64", "repeated_string", "repeated_string_piece", "repeated_uint32", "repeated_uint64", "repeatedgroup" }; private static readonly uint[] _testAllTypesFieldTags = new uint[] { 584, 602, 682, 577, 541, 545, 573, 656, 664, 488, 496, 648, 557, 561, 520, 528, 594, 674, 504, 512, 104, 122, 202, 97, 61, 65, 93, 176, 154, 184, 162, 8, 16, 168, 146, 77, 81, 40, 48, 114, 194, 24, 32, 131, 344, 362, 442, 337, 301, 305, 333, 416, 394, 424, 402, 248, 256, 408, 386, 317, 321, 280, 288, 354, 434, 264, 272, 371 }; public static TestAllTypes DefaultInstance { @@ -1130,7 +1130,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllTypes DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestAllTypes ThisMessage { @@ -1162,7 +1162,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NestedMessage : pb::GeneratedMessage { - private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); + private static readonly NestedMessage defaultInstance = new NestedMessage().MakeReadOnly(); private static readonly string[] _nestedMessageFieldNames = new string[] { "bb" }; private static readonly uint[] _nestedMessageFieldTags = new uint[] { 8 }; public static NestedMessage DefaultInstance { @@ -1170,7 +1170,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override NestedMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override NestedMessage ThisMessage { @@ -1256,6 +1256,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static NestedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private NestedMessage MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1271,22 +1275,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new NestedMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(NestedMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - NestedMessage result; + private bool resultIsReadOnly; + private NestedMessage result; private NestedMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { NestedMessage original = result; result = new NestedMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1301,13 +1305,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new NestedMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1323,11 +1327,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override NestedMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1431,7 +1435,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup : pb::GeneratedMessage { - private static readonly OptionalGroup defaultInstance = new Builder().BuildPartial(); + private static readonly OptionalGroup defaultInstance = new OptionalGroup().MakeReadOnly(); private static readonly string[] _optionalGroupFieldNames = new string[] { "a" }; private static readonly uint[] _optionalGroupFieldTags = new uint[] { 136 }; public static OptionalGroup DefaultInstance { @@ -1439,7 +1443,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override OptionalGroup ThisMessage { @@ -1525,6 +1529,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static OptionalGroup ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private OptionalGroup MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1540,22 +1548,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new OptionalGroup(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(OptionalGroup cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - OptionalGroup result; + private bool resultIsReadOnly; + private OptionalGroup result; private OptionalGroup PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { OptionalGroup original = result; result = new OptionalGroup(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1570,13 +1578,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new OptionalGroup(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1592,11 +1600,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -1700,7 +1708,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup : pb::GeneratedMessage { - private static readonly RepeatedGroup defaultInstance = new Builder().BuildPartial(); + private static readonly RepeatedGroup defaultInstance = new RepeatedGroup().MakeReadOnly(); private static readonly string[] _repeatedGroupFieldNames = new string[] { "a" }; private static readonly uint[] _repeatedGroupFieldTags = new uint[] { 376 }; public static RepeatedGroup DefaultInstance { @@ -1708,7 +1716,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override RepeatedGroup ThisMessage { @@ -1794,6 +1802,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static RepeatedGroup ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private RepeatedGroup MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -1809,22 +1821,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new RepeatedGroup(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(RepeatedGroup cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - RepeatedGroup result; + private bool resultIsReadOnly; + private RepeatedGroup result; private RepeatedGroup PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { RepeatedGroup original = result; result = new RepeatedGroup(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -1839,13 +1851,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new RepeatedGroup(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -1861,11 +1873,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -2124,42 +2136,42 @@ namespace Google.ProtocolBuffers.TestProtos { public const int OptionalGroupFieldNumber = 16; private bool hasOptionalGroup; - private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup optionalGroup_; public bool HasOptionalGroup { get { return hasOptionalGroup; } } public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup OptionalGroup { - get { return optionalGroup_; } + get { return optionalGroup_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance; } } public const int OptionalNestedMessageFieldNumber = 18; private bool hasOptionalNestedMessage; - private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage optionalNestedMessage_; public bool HasOptionalNestedMessage { get { return hasOptionalNestedMessage; } } public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage OptionalNestedMessage { - get { return optionalNestedMessage_; } + get { return optionalNestedMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; } } public const int OptionalForeignMessageFieldNumber = 19; private bool hasOptionalForeignMessage; - private global::Google.ProtocolBuffers.TestProtos.ForeignMessage optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessage optionalForeignMessage_; public bool HasOptionalForeignMessage { get { return hasOptionalForeignMessage; } } public global::Google.ProtocolBuffers.TestProtos.ForeignMessage OptionalForeignMessage { - get { return optionalForeignMessage_; } + get { return optionalForeignMessage_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } } public const int OptionalImportMessageFieldNumber = 20; private bool hasOptionalImportMessage; - private global::Google.ProtocolBuffers.TestProtos.ImportMessage optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.ImportMessage optionalImportMessage_; public bool HasOptionalImportMessage { get { return hasOptionalImportMessage; } } public global::Google.ProtocolBuffers.TestProtos.ImportMessage OptionalImportMessage { - get { return optionalImportMessage_; } + get { return optionalImportMessage_ ?? global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; } } public const int OptionalNestedEnumFieldNumber = 21; @@ -3267,6 +3279,34 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestAllTypes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestAllTypes MakeReadOnly() { + repeatedInt32_.MakeReadOnly(); + repeatedInt64_.MakeReadOnly(); + repeatedUint32_.MakeReadOnly(); + repeatedUint64_.MakeReadOnly(); + repeatedSint32_.MakeReadOnly(); + repeatedSint64_.MakeReadOnly(); + repeatedFixed32_.MakeReadOnly(); + repeatedFixed64_.MakeReadOnly(); + repeatedSfixed32_.MakeReadOnly(); + repeatedSfixed64_.MakeReadOnly(); + repeatedFloat_.MakeReadOnly(); + repeatedDouble_.MakeReadOnly(); + repeatedBool_.MakeReadOnly(); + repeatedString_.MakeReadOnly(); + repeatedBytes_.MakeReadOnly(); + repeatedGroup_.MakeReadOnly(); + repeatedNestedMessage_.MakeReadOnly(); + repeatedForeignMessage_.MakeReadOnly(); + repeatedImportMessage_.MakeReadOnly(); + repeatedNestedEnum_.MakeReadOnly(); + repeatedForeignEnum_.MakeReadOnly(); + repeatedImportEnum_.MakeReadOnly(); + repeatedStringPiece_.MakeReadOnly(); + repeatedCord_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -3282,22 +3322,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestAllTypes(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestAllTypes cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestAllTypes result; + private bool resultIsReadOnly; + private TestAllTypes result; private TestAllTypes PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestAllTypes original = result; result = new TestAllTypes(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -3312,13 +3352,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestAllTypes(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -3334,35 +3374,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllTypes BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.repeatedInt32_.MakeReadOnly(); - result.repeatedInt64_.MakeReadOnly(); - result.repeatedUint32_.MakeReadOnly(); - result.repeatedUint64_.MakeReadOnly(); - result.repeatedSint32_.MakeReadOnly(); - result.repeatedSint64_.MakeReadOnly(); - result.repeatedFixed32_.MakeReadOnly(); - result.repeatedFixed64_.MakeReadOnly(); - result.repeatedSfixed32_.MakeReadOnly(); - result.repeatedSfixed64_.MakeReadOnly(); - result.repeatedFloat_.MakeReadOnly(); - result.repeatedDouble_.MakeReadOnly(); - result.repeatedBool_.MakeReadOnly(); - result.repeatedString_.MakeReadOnly(); - result.repeatedBytes_.MakeReadOnly(); - result.repeatedGroup_.MakeReadOnly(); - result.repeatedNestedMessage_.MakeReadOnly(); - result.repeatedForeignMessage_.MakeReadOnly(); - result.repeatedImportMessage_.MakeReadOnly(); - result.repeatedNestedEnum_.MakeReadOnly(); - result.repeatedForeignEnum_.MakeReadOnly(); - result.repeatedImportEnum_.MakeReadOnly(); - result.repeatedStringPiece_.MakeReadOnly(); - result.repeatedCord_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -4363,7 +4379,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearOptionalGroup() { PrepareBuilder(); result.hasOptionalGroup = false; - result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance; + result.optionalGroup_ = null; return this; } @@ -4403,7 +4419,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearOptionalNestedMessage() { PrepareBuilder(); result.hasOptionalNestedMessage = false; - result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; + result.optionalNestedMessage_ = null; return this; } @@ -4443,7 +4459,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearOptionalForeignMessage() { PrepareBuilder(); result.hasOptionalForeignMessage = false; - result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; + result.optionalForeignMessage_ = null; return this; } @@ -4483,7 +4499,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearOptionalImportMessage() { PrepareBuilder(); result.hasOptionalImportMessage = false; - result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; + result.optionalImportMessage_ = null; return this; } @@ -5814,7 +5830,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDeprecatedFields : pb::GeneratedMessage { - private static readonly TestDeprecatedFields defaultInstance = new Builder().BuildPartial(); + private static readonly TestDeprecatedFields defaultInstance = new TestDeprecatedFields().MakeReadOnly(); private static readonly string[] _testDeprecatedFieldsFieldNames = new string[] { "deprecated_int32" }; private static readonly uint[] _testDeprecatedFieldsFieldTags = new uint[] { 8 }; public static TestDeprecatedFields DefaultInstance { @@ -5822,7 +5838,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDeprecatedFields DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestDeprecatedFields ThisMessage { @@ -5908,6 +5924,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestDeprecatedFields ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestDeprecatedFields MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -5923,22 +5943,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestDeprecatedFields(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestDeprecatedFields cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestDeprecatedFields result; + private bool resultIsReadOnly; + private TestDeprecatedFields result; private TestDeprecatedFields PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestDeprecatedFields original = result; result = new TestDeprecatedFields(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -5953,13 +5973,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestDeprecatedFields(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -5975,11 +5995,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDeprecatedFields BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -6083,7 +6103,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ForeignMessage : pb::GeneratedMessage { - private static readonly ForeignMessage defaultInstance = new Builder().BuildPartial(); + private static readonly ForeignMessage defaultInstance = new ForeignMessage().MakeReadOnly(); private static readonly string[] _foreignMessageFieldNames = new string[] { "c" }; private static readonly uint[] _foreignMessageFieldTags = new uint[] { 8 }; public static ForeignMessage DefaultInstance { @@ -6091,7 +6111,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ForeignMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override ForeignMessage ThisMessage { @@ -6177,6 +6197,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static ForeignMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private ForeignMessage MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -6192,22 +6216,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new ForeignMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(ForeignMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - ForeignMessage result; + private bool resultIsReadOnly; + private ForeignMessage result; private ForeignMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { ForeignMessage original = result; result = new ForeignMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -6222,13 +6246,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new ForeignMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -6244,11 +6268,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override ForeignMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -6352,7 +6376,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllExtensions : pb::ExtendableMessage { - private static readonly TestAllExtensions defaultInstance = new Builder().BuildPartial(); + private static readonly TestAllExtensions defaultInstance = new TestAllExtensions().MakeReadOnly(); private static readonly string[] _testAllExtensionsFieldNames = new string[] { }; private static readonly uint[] _testAllExtensionsFieldTags = new uint[] { }; public static TestAllExtensions DefaultInstance { @@ -6360,7 +6384,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllExtensions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestAllExtensions ThisMessage { @@ -6434,6 +6458,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestAllExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestAllExtensions MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -6449,22 +6477,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestAllExtensions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestAllExtensions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestAllExtensions result; + private bool resultIsReadOnly; + private TestAllExtensions result; private TestAllExtensions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestAllExtensions original = result; result = new TestAllExtensions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -6479,13 +6507,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestAllExtensions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -6501,11 +6529,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestAllExtensions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -6583,7 +6611,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup_extension : pb::GeneratedMessage { - private static readonly OptionalGroup_extension defaultInstance = new Builder().BuildPartial(); + private static readonly OptionalGroup_extension defaultInstance = new OptionalGroup_extension().MakeReadOnly(); private static readonly string[] _optionalGroupExtensionFieldNames = new string[] { "a" }; private static readonly uint[] _optionalGroupExtensionFieldTags = new uint[] { 136 }; public static OptionalGroup_extension DefaultInstance { @@ -6591,7 +6619,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup_extension DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override OptionalGroup_extension ThisMessage { @@ -6677,6 +6705,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static OptionalGroup_extension ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private OptionalGroup_extension MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -6692,22 +6724,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new OptionalGroup_extension(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(OptionalGroup_extension cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - OptionalGroup_extension result; + private bool resultIsReadOnly; + private OptionalGroup_extension result; private OptionalGroup_extension PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { OptionalGroup_extension original = result; result = new OptionalGroup_extension(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -6722,13 +6754,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new OptionalGroup_extension(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -6744,11 +6776,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OptionalGroup_extension BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -6852,7 +6884,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup_extension : pb::GeneratedMessage { - private static readonly RepeatedGroup_extension defaultInstance = new Builder().BuildPartial(); + private static readonly RepeatedGroup_extension defaultInstance = new RepeatedGroup_extension().MakeReadOnly(); private static readonly string[] _repeatedGroupExtensionFieldNames = new string[] { "a" }; private static readonly uint[] _repeatedGroupExtensionFieldTags = new uint[] { 376 }; public static RepeatedGroup_extension DefaultInstance { @@ -6860,7 +6892,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup_extension DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override RepeatedGroup_extension ThisMessage { @@ -6946,6 +6978,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static RepeatedGroup_extension ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private RepeatedGroup_extension MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -6961,22 +6997,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new RepeatedGroup_extension(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(RepeatedGroup_extension cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - RepeatedGroup_extension result; + private bool resultIsReadOnly; + private RepeatedGroup_extension result; private RepeatedGroup_extension PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { RepeatedGroup_extension original = result; result = new RepeatedGroup_extension(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -6991,13 +7027,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new RepeatedGroup_extension(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -7013,11 +7049,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override RepeatedGroup_extension BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -7121,7 +7157,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestNestedExtension : pb::GeneratedMessage { - private static readonly TestNestedExtension defaultInstance = new Builder().BuildPartial(); + private static readonly TestNestedExtension defaultInstance = new TestNestedExtension().MakeReadOnly(); private static readonly string[] _testNestedExtensionFieldNames = new string[] { }; private static readonly uint[] _testNestedExtensionFieldTags = new uint[] { }; public static TestNestedExtension DefaultInstance { @@ -7129,7 +7165,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestNestedExtension DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestNestedExtension ThisMessage { @@ -7201,6 +7237,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestNestedExtension ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestNestedExtension MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -7216,22 +7256,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestNestedExtension(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestNestedExtension cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestNestedExtension result; + private bool resultIsReadOnly; + private TestNestedExtension result; private TestNestedExtension PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestNestedExtension original = result; result = new TestNestedExtension(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -7246,13 +7286,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestNestedExtension(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -7268,11 +7308,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestNestedExtension BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -7349,7 +7389,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequired : pb::GeneratedMessage { - private static readonly TestRequired defaultInstance = new Builder().BuildPartial(); + private static readonly TestRequired defaultInstance = new TestRequired().MakeReadOnly(); private static readonly string[] _testRequiredFieldNames = new string[] { "a", "b", "c", "dummy10", "dummy11", "dummy12", "dummy13", "dummy14", "dummy15", "dummy16", "dummy17", "dummy18", "dummy19", "dummy2", "dummy20", "dummy21", "dummy22", "dummy23", "dummy24", "dummy25", "dummy26", "dummy27", "dummy28", "dummy29", "dummy30", "dummy31", "dummy32", "dummy4", "dummy5", "dummy6", "dummy7", "dummy8", "dummy9" }; private static readonly uint[] _testRequiredFieldTags = new uint[] { 8, 24, 264, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 16, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 32, 40, 48, 56, 64, 72 }; public static TestRequired DefaultInstance { @@ -7357,7 +7397,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRequired DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestRequired ThisMessage { @@ -7962,6 +8002,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestRequired ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestRequired MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -7977,22 +8021,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestRequired(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestRequired cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestRequired result; + private bool resultIsReadOnly; + private TestRequired result; private TestRequired PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestRequired original = result; result = new TestRequired(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -8007,13 +8051,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestRequired(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -8029,11 +8073,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRequired BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -9001,7 +9045,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequiredForeign : pb::GeneratedMessage { - private static readonly TestRequiredForeign defaultInstance = new Builder().BuildPartial(); + private static readonly TestRequiredForeign defaultInstance = new TestRequiredForeign().MakeReadOnly(); private static readonly string[] _testRequiredForeignFieldNames = new string[] { "dummy", "optional_message", "repeated_message" }; private static readonly uint[] _testRequiredForeignFieldTags = new uint[] { 24, 10, 18 }; public static TestRequiredForeign DefaultInstance { @@ -9009,7 +9053,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRequiredForeign DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestRequiredForeign ThisMessage { @@ -9026,12 +9070,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int OptionalMessageFieldNumber = 1; private bool hasOptionalMessage; - private global::Google.ProtocolBuffers.TestProtos.TestRequired optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestRequired optionalMessage_; public bool HasOptionalMessage { get { return hasOptionalMessage; } } public global::Google.ProtocolBuffers.TestProtos.TestRequired OptionalMessage { - get { return optionalMessage_; } + get { return optionalMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance; } } public const int RepeatedMessageFieldNumber = 2; @@ -9135,6 +9179,11 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestRequiredForeign ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestRequiredForeign MakeReadOnly() { + repeatedMessage_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -9150,22 +9199,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestRequiredForeign(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestRequiredForeign cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestRequiredForeign result; + private bool resultIsReadOnly; + private TestRequiredForeign result; private TestRequiredForeign PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestRequiredForeign original = result; result = new TestRequiredForeign(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -9180,13 +9229,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestRequiredForeign(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -9202,12 +9251,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRequiredForeign BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.repeatedMessage_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -9337,7 +9385,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearOptionalMessage() { PrepareBuilder(); result.hasOptionalMessage = false; - result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance; + result.optionalMessage_ = null; return this; } @@ -9414,7 +9462,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestForeignNested : pb::GeneratedMessage { - private static readonly TestForeignNested defaultInstance = new Builder().BuildPartial(); + private static readonly TestForeignNested defaultInstance = new TestForeignNested().MakeReadOnly(); private static readonly string[] _testForeignNestedFieldNames = new string[] { "foreign_nested" }; private static readonly uint[] _testForeignNestedFieldTags = new uint[] { 10 }; public static TestForeignNested DefaultInstance { @@ -9422,7 +9470,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestForeignNested DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestForeignNested ThisMessage { @@ -9439,12 +9487,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int ForeignNestedFieldNumber = 1; private bool hasForeignNested; - private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage foreignNested_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage foreignNested_; public bool HasForeignNested { get { return hasForeignNested; } } public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage ForeignNested { - get { return foreignNested_; } + get { return foreignNested_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; } } public override bool IsInitialized { @@ -9508,6 +9556,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestForeignNested ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestForeignNested MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -9523,22 +9575,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestForeignNested(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestForeignNested cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestForeignNested result; + private bool resultIsReadOnly; + private TestForeignNested result; private TestForeignNested PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestForeignNested original = result; result = new TestForeignNested(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -9553,13 +9605,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestForeignNested(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -9575,11 +9627,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestForeignNested BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -9695,7 +9747,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearForeignNested() { PrepareBuilder(); result.hasForeignNested = false; - result.foreignNested_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; + result.foreignNested_ = null; return this; } } @@ -9708,7 +9760,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestEmptyMessage : pb::GeneratedMessage { - private static readonly TestEmptyMessage defaultInstance = new Builder().BuildPartial(); + private static readonly TestEmptyMessage defaultInstance = new TestEmptyMessage().MakeReadOnly(); private static readonly string[] _testEmptyMessageFieldNames = new string[] { }; private static readonly uint[] _testEmptyMessageFieldTags = new uint[] { }; public static TestEmptyMessage DefaultInstance { @@ -9716,7 +9768,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestEmptyMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestEmptyMessage ThisMessage { @@ -9786,6 +9838,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestEmptyMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestEmptyMessage MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -9801,22 +9857,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestEmptyMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestEmptyMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestEmptyMessage result; + private bool resultIsReadOnly; + private TestEmptyMessage result; private TestEmptyMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestEmptyMessage original = result; result = new TestEmptyMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -9831,13 +9887,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestEmptyMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -9853,11 +9909,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestEmptyMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -9934,7 +9990,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestEmptyMessageWithExtensions : pb::ExtendableMessage { - private static readonly TestEmptyMessageWithExtensions defaultInstance = new Builder().BuildPartial(); + private static readonly TestEmptyMessageWithExtensions defaultInstance = new TestEmptyMessageWithExtensions().MakeReadOnly(); private static readonly string[] _testEmptyMessageWithExtensionsFieldNames = new string[] { }; private static readonly uint[] _testEmptyMessageWithExtensionsFieldTags = new uint[] { }; public static TestEmptyMessageWithExtensions DefaultInstance { @@ -9942,7 +9998,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestEmptyMessageWithExtensions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestEmptyMessageWithExtensions ThisMessage { @@ -10016,6 +10072,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestEmptyMessageWithExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestEmptyMessageWithExtensions MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -10031,22 +10091,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestEmptyMessageWithExtensions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestEmptyMessageWithExtensions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestEmptyMessageWithExtensions result; + private bool resultIsReadOnly; + private TestEmptyMessageWithExtensions result; private TestEmptyMessageWithExtensions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestEmptyMessageWithExtensions original = result; result = new TestEmptyMessageWithExtensions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -10061,13 +10121,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestEmptyMessageWithExtensions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -10083,11 +10143,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestEmptyMessageWithExtensions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -10165,7 +10225,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMultipleExtensionRanges : pb::ExtendableMessage { - private static readonly TestMultipleExtensionRanges defaultInstance = new Builder().BuildPartial(); + private static readonly TestMultipleExtensionRanges defaultInstance = new TestMultipleExtensionRanges().MakeReadOnly(); private static readonly string[] _testMultipleExtensionRangesFieldNames = new string[] { }; private static readonly uint[] _testMultipleExtensionRangesFieldTags = new uint[] { }; public static TestMultipleExtensionRanges DefaultInstance { @@ -10173,7 +10233,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMultipleExtensionRanges DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestMultipleExtensionRanges ThisMessage { @@ -10249,6 +10309,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestMultipleExtensionRanges ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestMultipleExtensionRanges MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -10264,22 +10328,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestMultipleExtensionRanges(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestMultipleExtensionRanges cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestMultipleExtensionRanges result; + private bool resultIsReadOnly; + private TestMultipleExtensionRanges result; private TestMultipleExtensionRanges PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestMultipleExtensionRanges original = result; result = new TestMultipleExtensionRanges(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -10294,13 +10358,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestMultipleExtensionRanges(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -10316,11 +10380,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMultipleExtensionRanges BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -10398,7 +10462,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestReallyLargeTagNumber : pb::GeneratedMessage { - private static readonly TestReallyLargeTagNumber defaultInstance = new Builder().BuildPartial(); + private static readonly TestReallyLargeTagNumber defaultInstance = new TestReallyLargeTagNumber().MakeReadOnly(); private static readonly string[] _testReallyLargeTagNumberFieldNames = new string[] { "a", "bb" }; private static readonly uint[] _testReallyLargeTagNumberFieldTags = new uint[] { 8, 2147483640 }; public static TestReallyLargeTagNumber DefaultInstance { @@ -10406,7 +10470,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestReallyLargeTagNumber DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestReallyLargeTagNumber ThisMessage { @@ -10508,6 +10572,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestReallyLargeTagNumber ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestReallyLargeTagNumber MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -10523,22 +10591,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestReallyLargeTagNumber(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestReallyLargeTagNumber cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestReallyLargeTagNumber result; + private bool resultIsReadOnly; + private TestReallyLargeTagNumber result; private TestReallyLargeTagNumber PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestReallyLargeTagNumber original = result; result = new TestReallyLargeTagNumber(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -10553,13 +10621,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestReallyLargeTagNumber(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -10575,11 +10643,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestReallyLargeTagNumber BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -10710,7 +10778,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRecursiveMessage : pb::GeneratedMessage { - private static readonly TestRecursiveMessage defaultInstance = new Builder().BuildPartial(); + private static readonly TestRecursiveMessage defaultInstance = new TestRecursiveMessage().MakeReadOnly(); private static readonly string[] _testRecursiveMessageFieldNames = new string[] { "a", "i" }; private static readonly uint[] _testRecursiveMessageFieldTags = new uint[] { 10, 16 }; public static TestRecursiveMessage DefaultInstance { @@ -10718,7 +10786,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRecursiveMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestRecursiveMessage ThisMessage { @@ -10735,12 +10803,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int AFieldNumber = 1; private bool hasA; - private global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage a_ = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage a_; public bool HasA { get { return hasA; } } public global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage A { - get { return a_; } + get { return a_ ?? global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance; } } public const int IFieldNumber = 2; @@ -10820,6 +10888,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestRecursiveMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestRecursiveMessage MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -10835,22 +10907,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestRecursiveMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestRecursiveMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestRecursiveMessage result; + private bool resultIsReadOnly; + private TestRecursiveMessage result; private TestRecursiveMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestRecursiveMessage original = result; result = new TestRecursiveMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -10865,13 +10937,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestRecursiveMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -10887,11 +10959,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRecursiveMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -11014,7 +11086,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearA() { PrepareBuilder(); result.hasA = false; - result.a_ = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance; + result.a_ = null; return this; } @@ -11047,7 +11119,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMutualRecursionA : pb::GeneratedMessage { - private static readonly TestMutualRecursionA defaultInstance = new Builder().BuildPartial(); + private static readonly TestMutualRecursionA defaultInstance = new TestMutualRecursionA().MakeReadOnly(); private static readonly string[] _testMutualRecursionAFieldNames = new string[] { "bb" }; private static readonly uint[] _testMutualRecursionAFieldTags = new uint[] { 10 }; public static TestMutualRecursionA DefaultInstance { @@ -11055,7 +11127,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMutualRecursionA DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestMutualRecursionA ThisMessage { @@ -11072,12 +11144,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int BbFieldNumber = 1; private bool hasBb; - private global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB bb_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB bb_; public bool HasBb { get { return hasBb; } } public global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB Bb { - get { return bb_; } + get { return bb_ ?? global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance; } } public override bool IsInitialized { @@ -11141,6 +11213,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestMutualRecursionA ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestMutualRecursionA MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -11156,22 +11232,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestMutualRecursionA(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestMutualRecursionA cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestMutualRecursionA result; + private bool resultIsReadOnly; + private TestMutualRecursionA result; private TestMutualRecursionA PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestMutualRecursionA original = result; result = new TestMutualRecursionA(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -11186,13 +11262,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestMutualRecursionA(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -11208,11 +11284,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMutualRecursionA BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -11328,7 +11404,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearBb() { PrepareBuilder(); result.hasBb = false; - result.bb_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance; + result.bb_ = null; return this; } } @@ -11341,7 +11417,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMutualRecursionB : pb::GeneratedMessage { - private static readonly TestMutualRecursionB defaultInstance = new Builder().BuildPartial(); + private static readonly TestMutualRecursionB defaultInstance = new TestMutualRecursionB().MakeReadOnly(); private static readonly string[] _testMutualRecursionBFieldNames = new string[] { "a", "optional_int32" }; private static readonly uint[] _testMutualRecursionBFieldTags = new uint[] { 10, 16 }; public static TestMutualRecursionB DefaultInstance { @@ -11349,7 +11425,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMutualRecursionB DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestMutualRecursionB ThisMessage { @@ -11366,12 +11442,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int AFieldNumber = 1; private bool hasA; - private global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA a_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA a_; public bool HasA { get { return hasA; } } public global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA A { - get { return a_; } + get { return a_ ?? global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance; } } public const int OptionalInt32FieldNumber = 2; @@ -11451,6 +11527,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestMutualRecursionB ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestMutualRecursionB MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -11466,22 +11546,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestMutualRecursionB(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestMutualRecursionB cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestMutualRecursionB result; + private bool resultIsReadOnly; + private TestMutualRecursionB result; private TestMutualRecursionB PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestMutualRecursionB original = result; result = new TestMutualRecursionB(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -11496,13 +11576,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestMutualRecursionB(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -11518,11 +11598,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestMutualRecursionB BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -11645,7 +11725,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearA() { PrepareBuilder(); result.hasA = false; - result.a_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance; + result.a_ = null; return this; } @@ -11678,7 +11758,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDupFieldNumber : pb::GeneratedMessage { - private static readonly TestDupFieldNumber defaultInstance = new Builder().BuildPartial(); + private static readonly TestDupFieldNumber defaultInstance = new TestDupFieldNumber().MakeReadOnly(); private static readonly string[] _testDupFieldNumberFieldNames = new string[] { "a", "bar", "foo" }; private static readonly uint[] _testDupFieldNumberFieldTags = new uint[] { 8, 27, 19 }; public static TestDupFieldNumber DefaultInstance { @@ -11686,7 +11766,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDupFieldNumber DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestDupFieldNumber ThisMessage { @@ -11710,7 +11790,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Foo : pb::GeneratedMessage { - private static readonly Foo defaultInstance = new Builder().BuildPartial(); + private static readonly Foo defaultInstance = new Foo().MakeReadOnly(); private static readonly string[] _fooFieldNames = new string[] { "a" }; private static readonly uint[] _fooFieldTags = new uint[] { 8 }; public static Foo DefaultInstance { @@ -11718,7 +11798,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Foo DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override Foo ThisMessage { @@ -11804,6 +11884,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static Foo ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private Foo MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -11819,22 +11903,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new Foo(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(Foo cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - Foo result; + private bool resultIsReadOnly; + private Foo result; private Foo PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { Foo original = result; result = new Foo(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -11849,13 +11933,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new Foo(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -11871,11 +11955,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Foo BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -11979,7 +12063,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Bar : pb::GeneratedMessage { - private static readonly Bar defaultInstance = new Builder().BuildPartial(); + private static readonly Bar defaultInstance = new Bar().MakeReadOnly(); private static readonly string[] _barFieldNames = new string[] { "a" }; private static readonly uint[] _barFieldTags = new uint[] { 8 }; public static Bar DefaultInstance { @@ -11987,7 +12071,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Bar DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override Bar ThisMessage { @@ -12073,6 +12157,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static Bar ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private Bar MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -12088,22 +12176,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new Bar(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(Bar cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - Bar result; + private bool resultIsReadOnly; + private Bar result; private Bar PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { Bar original = result; result = new Bar(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -12118,13 +12206,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new Bar(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -12140,11 +12228,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Bar BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -12259,22 +12347,22 @@ namespace Google.ProtocolBuffers.TestProtos { public const int FooFieldNumber = 2; private bool hasFoo; - private global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo foo_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo foo_; public bool HasFoo { get { return hasFoo; } } public global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo Foo { - get { return foo_; } + get { return foo_ ?? global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance; } } public const int BarFieldNumber = 3; private bool hasBar; - private global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar bar_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar bar_; public bool HasBar { get { return hasBar; } } public global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar Bar { - get { return bar_; } + get { return bar_ ?? global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance; } } public override bool IsInitialized { @@ -12350,6 +12438,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestDupFieldNumber ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestDupFieldNumber MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -12365,22 +12457,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestDupFieldNumber(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestDupFieldNumber cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestDupFieldNumber result; + private bool resultIsReadOnly; + private TestDupFieldNumber result; private TestDupFieldNumber PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestDupFieldNumber original = result; result = new TestDupFieldNumber(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -12395,13 +12487,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestDupFieldNumber(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -12417,11 +12509,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDupFieldNumber BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -12576,7 +12668,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearFoo() { PrepareBuilder(); result.hasFoo = false; - result.foo_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance; + result.foo_ = null; return this; } @@ -12616,7 +12708,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearBar() { PrepareBuilder(); result.hasBar = false; - result.bar_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance; + result.bar_ = null; return this; } } @@ -12629,7 +12721,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestNestedMessageHasBits : pb::GeneratedMessage { - private static readonly TestNestedMessageHasBits defaultInstance = new Builder().BuildPartial(); + private static readonly TestNestedMessageHasBits defaultInstance = new TestNestedMessageHasBits().MakeReadOnly(); private static readonly string[] _testNestedMessageHasBitsFieldNames = new string[] { "optional_nested_message" }; private static readonly uint[] _testNestedMessageHasBitsFieldTags = new uint[] { 10 }; public static TestNestedMessageHasBits DefaultInstance { @@ -12637,7 +12729,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestNestedMessageHasBits DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestNestedMessageHasBits ThisMessage { @@ -12661,7 +12753,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NestedMessage : pb::GeneratedMessage { - private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); + private static readonly NestedMessage defaultInstance = new NestedMessage().MakeReadOnly(); private static readonly string[] _nestedMessageFieldNames = new string[] { "nestedmessage_repeated_foreignmessage", "nestedmessage_repeated_int32" }; private static readonly uint[] _nestedMessageFieldTags = new uint[] { 18, 8 }; public static NestedMessage DefaultInstance { @@ -12669,7 +12761,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override NestedMessage DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override NestedMessage ThisMessage { @@ -12780,6 +12872,12 @@ namespace Google.ProtocolBuffers.TestProtos { public static NestedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private NestedMessage MakeReadOnly() { + nestedmessageRepeatedInt32_.MakeReadOnly(); + nestedmessageRepeatedForeignmessage_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -12795,22 +12893,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new NestedMessage(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(NestedMessage cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - NestedMessage result; + private bool resultIsReadOnly; + private NestedMessage result; private NestedMessage PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { NestedMessage original = result; result = new NestedMessage(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -12825,13 +12923,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new NestedMessage(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -12847,13 +12945,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override NestedMessage BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.nestedmessageRepeatedInt32_.MakeReadOnly(); - result.nestedmessageRepeatedForeignmessage_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -13020,12 +13116,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int OptionalNestedMessageFieldNumber = 1; private bool hasOptionalNestedMessage; - private global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage optionalNestedMessage_; public bool HasOptionalNestedMessage { get { return hasOptionalNestedMessage; } } public global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage OptionalNestedMessage { - get { return optionalNestedMessage_; } + get { return optionalNestedMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance; } } public override bool IsInitialized { @@ -13089,6 +13185,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestNestedMessageHasBits ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestNestedMessageHasBits MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -13104,22 +13204,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestNestedMessageHasBits(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestNestedMessageHasBits cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestNestedMessageHasBits result; + private bool resultIsReadOnly; + private TestNestedMessageHasBits result; private TestNestedMessageHasBits PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestNestedMessageHasBits original = result; result = new TestNestedMessageHasBits(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -13134,13 +13234,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestNestedMessageHasBits(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -13156,11 +13256,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestNestedMessageHasBits BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -13276,7 +13376,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearOptionalNestedMessage() { PrepareBuilder(); result.hasOptionalNestedMessage = false; - result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance; + result.optionalNestedMessage_ = null; return this; } } @@ -13289,7 +13389,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestCamelCaseFieldNames : pb::GeneratedMessage { - private static readonly TestCamelCaseFieldNames defaultInstance = new Builder().BuildPartial(); + private static readonly TestCamelCaseFieldNames defaultInstance = new TestCamelCaseFieldNames().MakeReadOnly(); private static readonly string[] _testCamelCaseFieldNamesFieldNames = new string[] { "CordField", "EnumField", "MessageField", "PrimitiveField", "RepeatedCordField", "RepeatedEnumField", "RepeatedMessageField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedStringPieceField", "StringField", "StringPieceField" }; private static readonly uint[] _testCamelCaseFieldNamesFieldTags = new uint[] { 50, 24, 34, 8, 98, 72, 82, 56, 66, 90, 18, 42 }; public static TestCamelCaseFieldNames DefaultInstance { @@ -13297,7 +13397,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestCamelCaseFieldNames DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestCamelCaseFieldNames ThisMessage { @@ -13344,12 +13444,12 @@ namespace Google.ProtocolBuffers.TestProtos { public const int MessageFieldFieldNumber = 4; private bool hasMessageField; - private global::Google.ProtocolBuffers.TestProtos.ForeignMessage messageField_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessage messageField_; public bool HasMessageField { get { return hasMessageField; } } public global::Google.ProtocolBuffers.TestProtos.ForeignMessage MessageField { - get { return messageField_; } + get { return messageField_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } } public const int StringPieceFieldFieldNumber = 5; @@ -13598,6 +13698,16 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestCamelCaseFieldNames ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestCamelCaseFieldNames MakeReadOnly() { + repeatedPrimitiveField_.MakeReadOnly(); + repeatedStringField_.MakeReadOnly(); + repeatedEnumField_.MakeReadOnly(); + repeatedMessageField_.MakeReadOnly(); + repeatedStringPieceField_.MakeReadOnly(); + repeatedCordField_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -13613,22 +13723,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestCamelCaseFieldNames(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestCamelCaseFieldNames cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestCamelCaseFieldNames result; + private bool resultIsReadOnly; + private TestCamelCaseFieldNames result; private TestCamelCaseFieldNames PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestCamelCaseFieldNames original = result; result = new TestCamelCaseFieldNames(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -13643,13 +13753,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestCamelCaseFieldNames(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -13665,17 +13775,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestCamelCaseFieldNames BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.repeatedPrimitiveField_.MakeReadOnly(); - result.repeatedStringField_.MakeReadOnly(); - result.repeatedEnumField_.MakeReadOnly(); - result.repeatedMessageField_.MakeReadOnly(); - result.repeatedStringPieceField_.MakeReadOnly(); - result.repeatedCordField_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -13948,7 +14052,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearMessageField() { PrepareBuilder(); result.hasMessageField = false; - result.messageField_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; + result.messageField_ = null; return this; } @@ -14203,7 +14307,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestFieldOrderings : pb::ExtendableMessage { - private static readonly TestFieldOrderings defaultInstance = new Builder().BuildPartial(); + private static readonly TestFieldOrderings defaultInstance = new TestFieldOrderings().MakeReadOnly(); private static readonly string[] _testFieldOrderingsFieldNames = new string[] { "my_float", "my_int", "my_string" }; private static readonly uint[] _testFieldOrderingsFieldTags = new uint[] { 813, 8, 90 }; public static TestFieldOrderings DefaultInstance { @@ -14211,7 +14315,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestFieldOrderings DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestFieldOrderings ThisMessage { @@ -14334,6 +14438,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestFieldOrderings ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestFieldOrderings MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -14349,22 +14457,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestFieldOrderings(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestFieldOrderings cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestFieldOrderings result; + private bool resultIsReadOnly; + private TestFieldOrderings result; private TestFieldOrderings PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestFieldOrderings original = result; result = new TestFieldOrderings(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -14379,13 +14487,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestFieldOrderings(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -14401,11 +14509,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestFieldOrderings BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -14565,7 +14673,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestExtremeDefaultValues : pb::GeneratedMessage { - private static readonly TestExtremeDefaultValues defaultInstance = new Builder().BuildPartial(); + private static readonly TestExtremeDefaultValues defaultInstance = new TestExtremeDefaultValues().MakeReadOnly(); private static readonly string[] _testExtremeDefaultValuesFieldNames = new string[] { "escaped_bytes", "inf_double", "inf_float", "large_float", "large_uint32", "large_uint64", "nan_double", "nan_float", "neg_inf_double", "neg_inf_float", "negative_float", "negative_one_float", "one_float", "small_float", "small_int32", "small_int64", "small_negative_float", "utf8_string", "zero_float" }; private static readonly uint[] _testExtremeDefaultValuesFieldTags = new uint[] { 10, 113, 141, 101, 16, 24, 129, 157, 121, 149, 93, 85, 69, 77, 32, 40, 109, 50, 61 }; public static TestExtremeDefaultValues DefaultInstance { @@ -14573,7 +14681,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestExtremeDefaultValues DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestExtremeDefaultValues ThisMessage { @@ -14949,6 +15057,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestExtremeDefaultValues ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestExtremeDefaultValues MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -14964,22 +15076,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestExtremeDefaultValues(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestExtremeDefaultValues cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestExtremeDefaultValues result; + private bool resultIsReadOnly; + private TestExtremeDefaultValues result; private TestExtremeDefaultValues PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestExtremeDefaultValues original = result; result = new TestExtremeDefaultValues(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -14994,13 +15106,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestExtremeDefaultValues(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -15016,11 +15128,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestExtremeDefaultValues BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -15616,7 +15728,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OneString : pb::GeneratedMessage { - private static readonly OneString defaultInstance = new Builder().BuildPartial(); + private static readonly OneString defaultInstance = new OneString().MakeReadOnly(); private static readonly string[] _oneStringFieldNames = new string[] { "data" }; private static readonly uint[] _oneStringFieldTags = new uint[] { 10 }; public static OneString DefaultInstance { @@ -15624,7 +15736,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OneString DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override OneString ThisMessage { @@ -15710,6 +15822,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static OneString ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private OneString MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -15725,22 +15841,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new OneString(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(OneString cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - OneString result; + private bool resultIsReadOnly; + private OneString result; private OneString PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { OneString original = result; result = new OneString(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -15755,13 +15871,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new OneString(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -15777,11 +15893,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OneString BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -15886,7 +16002,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OneBytes : pb::GeneratedMessage { - private static readonly OneBytes defaultInstance = new Builder().BuildPartial(); + private static readonly OneBytes defaultInstance = new OneBytes().MakeReadOnly(); private static readonly string[] _oneBytesFieldNames = new string[] { "data" }; private static readonly uint[] _oneBytesFieldTags = new uint[] { 10 }; public static OneBytes DefaultInstance { @@ -15894,7 +16010,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OneBytes DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override OneBytes ThisMessage { @@ -15980,6 +16096,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static OneBytes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private OneBytes MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -15995,22 +16115,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new OneBytes(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(OneBytes cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - OneBytes result; + private bool resultIsReadOnly; + private OneBytes result; private OneBytes PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { OneBytes original = result; result = new OneBytes(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -16025,13 +16145,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new OneBytes(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -16047,11 +16167,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override OneBytes BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -16156,7 +16276,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedTypes : pb::GeneratedMessage { - private static readonly TestPackedTypes defaultInstance = new Builder().BuildPartial(); + private static readonly TestPackedTypes defaultInstance = new TestPackedTypes().MakeReadOnly(); private static readonly string[] _testPackedTypesFieldNames = new string[] { "packed_bool", "packed_double", "packed_enum", "packed_fixed32", "packed_fixed64", "packed_float", "packed_int32", "packed_int64", "packed_sfixed32", "packed_sfixed64", "packed_sint32", "packed_sint64", "packed_uint32", "packed_uint64" }; private static readonly uint[] _testPackedTypesFieldTags = new uint[] { 818, 810, 826, 770, 778, 802, 722, 730, 786, 794, 754, 762, 738, 746 }; public static TestPackedTypes DefaultInstance { @@ -16164,7 +16284,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedTypes DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestPackedTypes ThisMessage { @@ -16607,6 +16727,24 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestPackedTypes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestPackedTypes MakeReadOnly() { + packedInt32_.MakeReadOnly(); + packedInt64_.MakeReadOnly(); + packedUint32_.MakeReadOnly(); + packedUint64_.MakeReadOnly(); + packedSint32_.MakeReadOnly(); + packedSint64_.MakeReadOnly(); + packedFixed32_.MakeReadOnly(); + packedFixed64_.MakeReadOnly(); + packedSfixed32_.MakeReadOnly(); + packedSfixed64_.MakeReadOnly(); + packedFloat_.MakeReadOnly(); + packedDouble_.MakeReadOnly(); + packedBool_.MakeReadOnly(); + packedEnum_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -16622,22 +16760,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestPackedTypes(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestPackedTypes cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestPackedTypes result; + private bool resultIsReadOnly; + private TestPackedTypes result; private TestPackedTypes PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestPackedTypes original = result; result = new TestPackedTypes(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -16652,13 +16790,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestPackedTypes(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -16674,25 +16812,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedTypes BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.packedInt32_.MakeReadOnly(); - result.packedInt64_.MakeReadOnly(); - result.packedUint32_.MakeReadOnly(); - result.packedUint64_.MakeReadOnly(); - result.packedSint32_.MakeReadOnly(); - result.packedSint64_.MakeReadOnly(); - result.packedFixed32_.MakeReadOnly(); - result.packedFixed64_.MakeReadOnly(); - result.packedSfixed32_.MakeReadOnly(); - result.packedSfixed64_.MakeReadOnly(); - result.packedFloat_.MakeReadOnly(); - result.packedDouble_.MakeReadOnly(); - result.packedBool_.MakeReadOnly(); - result.packedEnum_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -17330,7 +17454,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedTypes : pb::GeneratedMessage { - private static readonly TestUnpackedTypes defaultInstance = new Builder().BuildPartial(); + private static readonly TestUnpackedTypes defaultInstance = new TestUnpackedTypes().MakeReadOnly(); private static readonly string[] _testUnpackedTypesFieldNames = new string[] { "unpacked_bool", "unpacked_double", "unpacked_enum", "unpacked_fixed32", "unpacked_fixed64", "unpacked_float", "unpacked_int32", "unpacked_int64", "unpacked_sfixed32", "unpacked_sfixed64", "unpacked_sint32", "unpacked_sint64", "unpacked_uint32", "unpacked_uint64" }; private static readonly uint[] _testUnpackedTypesFieldTags = new uint[] { 816, 809, 824, 773, 777, 805, 720, 728, 789, 793, 752, 760, 736, 744 }; public static TestUnpackedTypes DefaultInstance { @@ -17338,7 +17462,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedTypes DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestUnpackedTypes ThisMessage { @@ -17726,6 +17850,24 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestUnpackedTypes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestUnpackedTypes MakeReadOnly() { + unpackedInt32_.MakeReadOnly(); + unpackedInt64_.MakeReadOnly(); + unpackedUint32_.MakeReadOnly(); + unpackedUint64_.MakeReadOnly(); + unpackedSint32_.MakeReadOnly(); + unpackedSint64_.MakeReadOnly(); + unpackedFixed32_.MakeReadOnly(); + unpackedFixed64_.MakeReadOnly(); + unpackedSfixed32_.MakeReadOnly(); + unpackedSfixed64_.MakeReadOnly(); + unpackedFloat_.MakeReadOnly(); + unpackedDouble_.MakeReadOnly(); + unpackedBool_.MakeReadOnly(); + unpackedEnum_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -17741,22 +17883,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestUnpackedTypes(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestUnpackedTypes cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestUnpackedTypes result; + private bool resultIsReadOnly; + private TestUnpackedTypes result; private TestUnpackedTypes PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestUnpackedTypes original = result; result = new TestUnpackedTypes(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -17771,13 +17913,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestUnpackedTypes(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -17793,25 +17935,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedTypes BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.unpackedInt32_.MakeReadOnly(); - result.unpackedInt64_.MakeReadOnly(); - result.unpackedUint32_.MakeReadOnly(); - result.unpackedUint64_.MakeReadOnly(); - result.unpackedSint32_.MakeReadOnly(); - result.unpackedSint64_.MakeReadOnly(); - result.unpackedFixed32_.MakeReadOnly(); - result.unpackedFixed64_.MakeReadOnly(); - result.unpackedSfixed32_.MakeReadOnly(); - result.unpackedSfixed64_.MakeReadOnly(); - result.unpackedFloat_.MakeReadOnly(); - result.unpackedDouble_.MakeReadOnly(); - result.unpackedBool_.MakeReadOnly(); - result.unpackedEnum_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -18449,7 +18577,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedExtensions : pb::ExtendableMessage { - private static readonly TestPackedExtensions defaultInstance = new Builder().BuildPartial(); + private static readonly TestPackedExtensions defaultInstance = new TestPackedExtensions().MakeReadOnly(); private static readonly string[] _testPackedExtensionsFieldNames = new string[] { }; private static readonly uint[] _testPackedExtensionsFieldTags = new uint[] { }; public static TestPackedExtensions DefaultInstance { @@ -18457,7 +18585,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedExtensions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestPackedExtensions ThisMessage { @@ -18531,6 +18659,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestPackedExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestPackedExtensions MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -18546,22 +18678,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestPackedExtensions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestPackedExtensions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestPackedExtensions result; + private bool resultIsReadOnly; + private TestPackedExtensions result; private TestPackedExtensions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestPackedExtensions original = result; result = new TestPackedExtensions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -18576,13 +18708,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestPackedExtensions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -18598,11 +18730,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestPackedExtensions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -18680,7 +18812,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedExtensions : pb::ExtendableMessage { - private static readonly TestUnpackedExtensions defaultInstance = new Builder().BuildPartial(); + private static readonly TestUnpackedExtensions defaultInstance = new TestUnpackedExtensions().MakeReadOnly(); private static readonly string[] _testUnpackedExtensionsFieldNames = new string[] { }; private static readonly uint[] _testUnpackedExtensionsFieldTags = new uint[] { }; public static TestUnpackedExtensions DefaultInstance { @@ -18688,7 +18820,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedExtensions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestUnpackedExtensions ThisMessage { @@ -18762,6 +18894,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestUnpackedExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestUnpackedExtensions MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -18777,22 +18913,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestUnpackedExtensions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestUnpackedExtensions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestUnpackedExtensions result; + private bool resultIsReadOnly; + private TestUnpackedExtensions result; private TestUnpackedExtensions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestUnpackedExtensions original = result; result = new TestUnpackedExtensions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -18807,13 +18943,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestUnpackedExtensions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -18829,11 +18965,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestUnpackedExtensions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -18911,7 +19047,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDynamicExtensions : pb::GeneratedMessage { - private static readonly TestDynamicExtensions defaultInstance = new Builder().BuildPartial(); + private static readonly TestDynamicExtensions defaultInstance = new TestDynamicExtensions().MakeReadOnly(); private static readonly string[] _testDynamicExtensionsFieldNames = new string[] { "dynamic_enum_extension", "dynamic_message_extension", "enum_extension", "message_extension", "packed_extension", "repeated_extension", "scalar_extension" }; private static readonly uint[] _testDynamicExtensionsFieldTags = new uint[] { 16016, 16034, 16008, 16026, 16050, 16042, 16005 }; public static TestDynamicExtensions DefaultInstance { @@ -18919,7 +19055,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDynamicExtensions DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestDynamicExtensions ThisMessage { @@ -18951,7 +19087,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class DynamicMessageType : pb::GeneratedMessage { - private static readonly DynamicMessageType defaultInstance = new Builder().BuildPartial(); + private static readonly DynamicMessageType defaultInstance = new DynamicMessageType().MakeReadOnly(); private static readonly string[] _dynamicMessageTypeFieldNames = new string[] { "dynamic_field" }; private static readonly uint[] _dynamicMessageTypeFieldTags = new uint[] { 16800 }; public static DynamicMessageType DefaultInstance { @@ -18959,7 +19095,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override DynamicMessageType DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override DynamicMessageType ThisMessage { @@ -19045,6 +19181,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static DynamicMessageType ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private DynamicMessageType MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -19060,22 +19200,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new DynamicMessageType(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(DynamicMessageType cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - DynamicMessageType result; + private bool resultIsReadOnly; + private DynamicMessageType result; private DynamicMessageType PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { DynamicMessageType original = result; result = new DynamicMessageType(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -19090,13 +19230,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new DynamicMessageType(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -19112,11 +19252,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override DynamicMessageType BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -19252,22 +19392,22 @@ namespace Google.ProtocolBuffers.TestProtos { public const int MessageExtensionFieldNumber = 2003; private bool hasMessageExtension; - private global::Google.ProtocolBuffers.TestProtos.ForeignMessage messageExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessage messageExtension_; public bool HasMessageExtension { get { return hasMessageExtension; } } public global::Google.ProtocolBuffers.TestProtos.ForeignMessage MessageExtension { - get { return messageExtension_; } + get { return messageExtension_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } } public const int DynamicMessageExtensionFieldNumber = 2004; private bool hasDynamicMessageExtension; - private global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType dynamicMessageExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance; + private global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType dynamicMessageExtension_; public bool HasDynamicMessageExtension { get { return hasDynamicMessageExtension; } } public global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType DynamicMessageExtension { - get { return dynamicMessageExtension_; } + get { return dynamicMessageExtension_ ?? global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance; } } public const int RepeatedExtensionFieldNumber = 2005; @@ -19405,6 +19545,12 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestDynamicExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestDynamicExtensions MakeReadOnly() { + repeatedExtension_.MakeReadOnly(); + packedExtension_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -19420,22 +19566,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestDynamicExtensions(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestDynamicExtensions cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestDynamicExtensions result; + private bool resultIsReadOnly; + private TestDynamicExtensions result; private TestDynamicExtensions PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestDynamicExtensions original = result; result = new TestDynamicExtensions(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -19450,13 +19596,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestDynamicExtensions(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -19472,13 +19618,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestDynamicExtensions BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.repeatedExtension_.MakeReadOnly(); - result.packedExtension_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -19720,7 +19864,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearMessageExtension() { PrepareBuilder(); result.hasMessageExtension = false; - result.messageExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; + result.messageExtension_ = null; return this; } @@ -19760,7 +19904,7 @@ namespace Google.ProtocolBuffers.TestProtos { public Builder ClearDynamicMessageExtension() { PrepareBuilder(); result.hasDynamicMessageExtension = false; - result.dynamicMessageExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance; + result.dynamicMessageExtension_ = null; return this; } @@ -19835,7 +19979,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::GeneratedMessage { - private static readonly TestRepeatedScalarDifferentTagSizes defaultInstance = new Builder().BuildPartial(); + private static readonly TestRepeatedScalarDifferentTagSizes defaultInstance = new TestRepeatedScalarDifferentTagSizes().MakeReadOnly(); private static readonly string[] _testRepeatedScalarDifferentTagSizesFieldNames = new string[] { "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_int32", "repeated_int64", "repeated_uint64" }; private static readonly uint[] _testRepeatedScalarDifferentTagSizesFieldTags = new uint[] { 101, 16369, 2097141, 104, 16376, 2097144 }; public static TestRepeatedScalarDifferentTagSizes DefaultInstance { @@ -19843,7 +19987,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRepeatedScalarDifferentTagSizes DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override TestRepeatedScalarDifferentTagSizes ThisMessage { @@ -20051,6 +20195,16 @@ namespace Google.ProtocolBuffers.TestProtos { public static TestRepeatedScalarDifferentTagSizes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private TestRepeatedScalarDifferentTagSizes MakeReadOnly() { + repeatedFixed32_.MakeReadOnly(); + repeatedInt32_.MakeReadOnly(); + repeatedFixed64_.MakeReadOnly(); + repeatedInt64_.MakeReadOnly(); + repeatedFloat_.MakeReadOnly(); + repeatedUint64_.MakeReadOnly(); + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -20066,22 +20220,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new TestRepeatedScalarDifferentTagSizes(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(TestRepeatedScalarDifferentTagSizes cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - TestRepeatedScalarDifferentTagSizes result; + private bool resultIsReadOnly; + private TestRepeatedScalarDifferentTagSizes result; private TestRepeatedScalarDifferentTagSizes PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { TestRepeatedScalarDifferentTagSizes original = result; result = new TestRepeatedScalarDifferentTagSizes(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -20096,13 +20250,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new TestRepeatedScalarDifferentTagSizes(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -20118,17 +20272,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override TestRepeatedScalarDifferentTagSizes BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - result.repeatedFixed32_.MakeReadOnly(); - result.repeatedInt32_.MakeReadOnly(); - result.repeatedFixed64_.MakeReadOnly(); - result.repeatedInt64_.MakeReadOnly(); - result.repeatedFloat_.MakeReadOnly(); - result.repeatedUint64_.MakeReadOnly(); - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -20448,7 +20596,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FooRequest : pb::GeneratedMessage { - private static readonly FooRequest defaultInstance = new Builder().BuildPartial(); + private static readonly FooRequest defaultInstance = new FooRequest().MakeReadOnly(); private static readonly string[] _fooRequestFieldNames = new string[] { }; private static readonly uint[] _fooRequestFieldTags = new uint[] { }; public static FooRequest DefaultInstance { @@ -20456,7 +20604,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override FooRequest DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override FooRequest ThisMessage { @@ -20526,6 +20674,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static FooRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private FooRequest MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -20541,22 +20693,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new FooRequest(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(FooRequest cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - FooRequest result; + private bool resultIsReadOnly; + private FooRequest result; private FooRequest PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { FooRequest original = result; result = new FooRequest(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -20571,13 +20723,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new FooRequest(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -20593,11 +20745,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override FooRequest BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -20674,7 +20826,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FooResponse : pb::GeneratedMessage { - private static readonly FooResponse defaultInstance = new Builder().BuildPartial(); + private static readonly FooResponse defaultInstance = new FooResponse().MakeReadOnly(); private static readonly string[] _fooResponseFieldNames = new string[] { }; private static readonly uint[] _fooResponseFieldTags = new uint[] { }; public static FooResponse DefaultInstance { @@ -20682,7 +20834,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override FooResponse DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override FooResponse ThisMessage { @@ -20752,6 +20904,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static FooResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private FooResponse MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -20767,22 +20923,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new FooResponse(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(FooResponse cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - FooResponse result; + private bool resultIsReadOnly; + private FooResponse result; private FooResponse PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { FooResponse original = result; result = new FooResponse(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -20797,13 +20953,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new FooResponse(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -20819,11 +20975,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override FooResponse BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -20900,7 +21056,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class BarRequest : pb::GeneratedMessage { - private static readonly BarRequest defaultInstance = new Builder().BuildPartial(); + private static readonly BarRequest defaultInstance = new BarRequest().MakeReadOnly(); private static readonly string[] _barRequestFieldNames = new string[] { }; private static readonly uint[] _barRequestFieldTags = new uint[] { }; public static BarRequest DefaultInstance { @@ -20908,7 +21064,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override BarRequest DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override BarRequest ThisMessage { @@ -20978,6 +21134,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static BarRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private BarRequest MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -20993,22 +21153,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new BarRequest(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(BarRequest cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - BarRequest result; + private bool resultIsReadOnly; + private BarRequest result; private BarRequest PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { BarRequest original = result; result = new BarRequest(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -21023,13 +21183,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new BarRequest(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -21045,11 +21205,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override BarRequest BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { @@ -21126,7 +21286,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class BarResponse : pb::GeneratedMessage { - private static readonly BarResponse defaultInstance = new Builder().BuildPartial(); + private static readonly BarResponse defaultInstance = new BarResponse().MakeReadOnly(); private static readonly string[] _barResponseFieldNames = new string[] { }; private static readonly uint[] _barResponseFieldTags = new uint[] { }; public static BarResponse DefaultInstance { @@ -21134,7 +21294,7 @@ namespace Google.ProtocolBuffers.TestProtos { } public override BarResponse DefaultInstanceForType { - get { return defaultInstance; } + get { return DefaultInstance; } } protected override BarResponse ThisMessage { @@ -21204,6 +21364,10 @@ namespace Google.ProtocolBuffers.TestProtos { public static BarResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); } + private BarResponse MakeReadOnly() { + return this; + } + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } @@ -21219,22 +21383,22 @@ namespace Google.ProtocolBuffers.TestProtos { get { return this; } } public Builder() { - result = DefaultInstance ?? new BarResponse(); - builderIsReadOnly = result == DefaultInstance; + result = DefaultInstance; + resultIsReadOnly = true; } internal Builder(BarResponse cloneFrom) { result = cloneFrom; - builderIsReadOnly = true; + resultIsReadOnly = true; } - bool builderIsReadOnly; - BarResponse result; + private bool resultIsReadOnly; + private BarResponse result; private BarResponse PrepareBuilder() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { BarResponse original = result; result = new BarResponse(); - builderIsReadOnly = false; + resultIsReadOnly = false; MergeFrom(original); } return result; @@ -21249,13 +21413,13 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder Clear() { - result = DefaultInstance ?? new BarResponse(); - builderIsReadOnly = true; + result = DefaultInstance; + resultIsReadOnly = true; return this; } public override Builder Clone() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return new Builder(result); } else { return new Builder().MergeFrom(result); @@ -21271,11 +21435,11 @@ namespace Google.ProtocolBuffers.TestProtos { } public override BarResponse BuildPartial() { - if (builderIsReadOnly) { + if (resultIsReadOnly) { return result; } - builderIsReadOnly = true; - return result; + resultIsReadOnly = true; + return result.MakeReadOnly(); } public override Builder MergeFrom(pb::IMessage other) { From 17fb8f223ede951ebd0a9185fc40a0510bceb324 Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 23 Sep 2011 11:36:39 -0500 Subject: [PATCH 25/31] Fix for public constructor on messages --- src/AddressBook/AddressBookProtos.cs | 3 ++ src/ProtoGen.Test/DependencyResolutionTest.cs | 12 +++--- src/ProtoGen/MessageGenerator.cs | 1 + .../UnitTestCSharpOptionsProtoFile.cs | 1 + .../UnitTestCustomOptionsProtoFile.cs | 17 ++++++++ .../UnitTestEmbedOptimizeForProtoFile.cs | 1 + .../UnitTestExtrasIssuesProtoFile.cs | 7 ++++ .../TestProtos/UnitTestGoogleSizeProtoFile.cs | 5 +++ .../UnitTestGoogleSpeedProtoFile.cs | 5 +++ .../TestProtos/UnitTestImportLiteProtoFile.cs | 1 + .../TestProtos/UnitTestImportProtoFile.cs | 1 + .../TestProtos/UnitTestMessageSetProtoFile.cs | 6 +++ .../UnitTestNoGenericServicesProtoFile.cs | 1 + .../UnitTestOptimizeForProtoFile.cs | 3 ++ .../TestProtos/UnitTestProtoFile.cs | 41 +++++++++++++++++++ .../TestProtos/UnitTestRpcInterop.cs | 4 ++ .../UnitTestXmlSerializerTestProtoFile.cs | 6 +++ .../DescriptorProtos/CSharpOptions.cs | 4 ++ .../DescriptorProtos/DescriptorProtoFile.cs | 18 ++++++++ .../TestProtos/UnitTestExtrasFullProtoFile.cs | 8 ++++ .../TestProtos/UnitTestExtrasLiteProtoFile.cs | 5 +++ .../TestProtos/UnitTestImportLiteProtoFile.cs | 1 + .../TestProtos/UnitTestImportProtoFile.cs | 1 + .../UnitTestLiteImportNonLiteProtoFile.cs | 1 + .../TestProtos/UnitTestLiteProtoFile.cs | 14 +++++++ .../TestProtos/UnitTestProtoFile.cs | 41 +++++++++++++++++++ 26 files changed, 202 insertions(+), 6 deletions(-) diff --git a/src/AddressBook/AddressBookProtos.cs b/src/AddressBook/AddressBookProtos.cs index cb8a2d9105..9b99452e8e 100644 --- a/src/AddressBook/AddressBookProtos.cs +++ b/src/AddressBook/AddressBookProtos.cs @@ -68,6 +68,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Person : pb::GeneratedMessage { + private Person() { } private static readonly Person defaultInstance = new Builder().BuildPartial(); private static readonly string[] _personFieldNames = new string[] { "email", "id", "name", "phone" }; private static readonly uint[] _personFieldTags = new uint[] { 26, 16, 10, 34 }; @@ -108,6 +109,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class PhoneNumber : pb::GeneratedMessage { + private PhoneNumber() { } private static readonly PhoneNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _phoneNumberFieldNames = new string[] { "number", "type" }; private static readonly uint[] _phoneNumberFieldTags = new uint[] { 10, 16 }; @@ -766,6 +768,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class AddressBook : pb::GeneratedMessage { + private AddressBook() { } private static readonly AddressBook defaultInstance = new Builder().BuildPartial(); private static readonly string[] _addressBookFieldNames = new string[] { "person" }; private static readonly uint[] _addressBookFieldTags = new uint[] { 10 }; diff --git a/src/ProtoGen.Test/DependencyResolutionTest.cs b/src/ProtoGen.Test/DependencyResolutionTest.cs index 8ac5b348af..c4422b8c90 100644 --- a/src/ProtoGen.Test/DependencyResolutionTest.cs +++ b/src/ProtoGen.Test/DependencyResolutionTest.cs @@ -52,7 +52,7 @@ namespace Google.ProtocolBuffers.ProtoGen { FileDescriptorProto first = new FileDescriptorProto.Builder {Name = "First"}.Build(); FileDescriptorProto second = new FileDescriptorProto.Builder {Name = "Second"}.Build(); - FileDescriptorSet set = new FileDescriptorSet {FileList = {first, second}}; + FileDescriptorSet set = new FileDescriptorSet.Builder { FileList = { first, second } }.Build(); IList converted = Generator.ConvertDescriptors(CSharpFileOptions.DefaultInstance, set); Assert.AreEqual(2, converted.Count); @@ -68,7 +68,7 @@ namespace Google.ProtocolBuffers.ProtoGen FileDescriptorProto first = new FileDescriptorProto.Builder {Name = "First", DependencyList = {"Second"}}.Build(); FileDescriptorProto second = new FileDescriptorProto.Builder {Name = "Second"}.Build(); - FileDescriptorSet set = new FileDescriptorSet {FileList = {first, second}}; + FileDescriptorSet set = new FileDescriptorSet.Builder { FileList = { first, second } }.Build(); IList converted = Generator.ConvertDescriptors(CSharpFileOptions.DefaultInstance, set); Assert.AreEqual(2, converted.Count); Assert.AreEqual("First", converted[0].Name); @@ -84,7 +84,7 @@ namespace Google.ProtocolBuffers.ProtoGen FileDescriptorProto first = new FileDescriptorProto.Builder {Name = "First"}.Build(); FileDescriptorProto second = new FileDescriptorProto.Builder {Name = "Second", DependencyList = {"First"}}.Build(); - FileDescriptorSet set = new FileDescriptorSet {FileList = {first, second}}; + FileDescriptorSet set = new FileDescriptorSet.Builder { FileList = { first, second } }.Build(); IList converted = Generator.ConvertDescriptors(CSharpFileOptions.DefaultInstance, set); Assert.AreEqual(2, converted.Count); Assert.AreEqual("First", converted[0].Name); @@ -101,7 +101,7 @@ namespace Google.ProtocolBuffers.ProtoGen new FileDescriptorProto.Builder {Name = "First", DependencyList = {"Second"}}.Build(); FileDescriptorProto second = new FileDescriptorProto.Builder {Name = "Second", DependencyList = {"First"}}.Build(); - FileDescriptorSet set = new FileDescriptorSet {FileList = {first, second}}; + FileDescriptorSet set = new FileDescriptorSet.Builder { FileList = { first, second } }.Build(); try { Generator.ConvertDescriptors(CSharpFileOptions.DefaultInstance, set); @@ -118,7 +118,7 @@ namespace Google.ProtocolBuffers.ProtoGen { FileDescriptorProto first = new FileDescriptorProto.Builder {Name = "First", DependencyList = {"Second"}}.Build(); - FileDescriptorSet set = new FileDescriptorSet {FileList = {first}}; + FileDescriptorSet set = new FileDescriptorSet.Builder { FileList = { first } }.Build(); try { Generator.ConvertDescriptors(CSharpFileOptions.DefaultInstance, set); @@ -135,7 +135,7 @@ namespace Google.ProtocolBuffers.ProtoGen { FileDescriptorProto first = new FileDescriptorProto.Builder {Name = "First", DependencyList = {"First"}}.Build(); - FileDescriptorSet set = new FileDescriptorSet {FileList = {first}}; + FileDescriptorSet set = new FileDescriptorSet.Builder { FileList = { first } }.Build(); try { Generator.ConvertDescriptors(CSharpFileOptions.DefaultInstance, set); diff --git a/src/ProtoGen/MessageGenerator.cs b/src/ProtoGen/MessageGenerator.cs index 83004da923..c8b2087f50 100644 --- a/src/ProtoGen/MessageGenerator.cs +++ b/src/ProtoGen/MessageGenerator.cs @@ -181,6 +181,7 @@ namespace Google.ProtocolBuffers.ProtoGen Descriptor.Proto.ExtensionRangeCount > 0 ? "Extendable" : "Generated", RuntimeSuffix); writer.Indent(); + writer.WriteLine("private {0}() {{ }}", ClassName); // Must call BuildPartial() to make sure all lists are made read-only writer.WriteLine("private static readonly {0} defaultInstance = new Builder().BuildPartial();", ClassName); diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs index 01a536d7fa..565dc1d078 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs @@ -60,6 +60,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionsMessage : pb::GeneratedMessage { + private OptionsMessage() { } private static readonly OptionsMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionsMessageFieldNames = new string[] { "customized", "normal", "options_message" }; private static readonly uint[] _optionsMessageFieldTags = new uint[] { 26, 10, 18 }; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs index 9c8abc447d..fc22c716a7 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs @@ -400,6 +400,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessageWithCustomOptions : pb::GeneratedMessage { + private TestMessageWithCustomOptions() { } private static readonly TestMessageWithCustomOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageWithCustomOptionsFieldNames = new string[] { "field1" }; private static readonly uint[] _testMessageWithCustomOptionsFieldTags = new uint[] { 10 }; @@ -655,6 +656,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CustomOptionFooRequest : pb::GeneratedMessage { + private CustomOptionFooRequest() { } private static readonly CustomOptionFooRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _customOptionFooRequestFieldNames = new string[] { }; private static readonly uint[] _customOptionFooRequestFieldTags = new uint[] { }; @@ -853,6 +855,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CustomOptionFooResponse : pb::GeneratedMessage { + private CustomOptionFooResponse() { } private static readonly CustomOptionFooResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _customOptionFooResponseFieldNames = new string[] { }; private static readonly uint[] _customOptionFooResponseFieldTags = new uint[] { }; @@ -1051,6 +1054,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class DummyMessageContainingEnum : pb::GeneratedMessage { + private DummyMessageContainingEnum() { } private static readonly DummyMessageContainingEnum defaultInstance = new Builder().BuildPartial(); private static readonly string[] _dummyMessageContainingEnumFieldNames = new string[] { }; private static readonly uint[] _dummyMessageContainingEnumFieldTags = new uint[] { }; @@ -1264,6 +1268,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class DummyMessageInvalidAsOptionType : pb::GeneratedMessage { + private DummyMessageInvalidAsOptionType() { } private static readonly DummyMessageInvalidAsOptionType defaultInstance = new Builder().BuildPartial(); private static readonly string[] _dummyMessageInvalidAsOptionTypeFieldNames = new string[] { }; private static readonly uint[] _dummyMessageInvalidAsOptionTypeFieldTags = new uint[] { }; @@ -1462,6 +1467,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CustomOptionMinIntegerValues : pb::GeneratedMessage { + private CustomOptionMinIntegerValues() { } private static readonly CustomOptionMinIntegerValues defaultInstance = new Builder().BuildPartial(); private static readonly string[] _customOptionMinIntegerValuesFieldNames = new string[] { }; private static readonly uint[] _customOptionMinIntegerValuesFieldTags = new uint[] { }; @@ -1660,6 +1666,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CustomOptionMaxIntegerValues : pb::GeneratedMessage { + private CustomOptionMaxIntegerValues() { } private static readonly CustomOptionMaxIntegerValues defaultInstance = new Builder().BuildPartial(); private static readonly string[] _customOptionMaxIntegerValuesFieldNames = new string[] { }; private static readonly uint[] _customOptionMaxIntegerValuesFieldTags = new uint[] { }; @@ -1858,6 +1865,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CustomOptionOtherValues : pb::GeneratedMessage { + private CustomOptionOtherValues() { } private static readonly CustomOptionOtherValues defaultInstance = new Builder().BuildPartial(); private static readonly string[] _customOptionOtherValuesFieldNames = new string[] { }; private static readonly uint[] _customOptionOtherValuesFieldTags = new uint[] { }; @@ -2056,6 +2064,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SettingRealsFromPositiveInts : pb::GeneratedMessage { + private SettingRealsFromPositiveInts() { } private static readonly SettingRealsFromPositiveInts defaultInstance = new Builder().BuildPartial(); private static readonly string[] _settingRealsFromPositiveIntsFieldNames = new string[] { }; private static readonly uint[] _settingRealsFromPositiveIntsFieldTags = new uint[] { }; @@ -2254,6 +2263,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SettingRealsFromNegativeInts : pb::GeneratedMessage { + private SettingRealsFromNegativeInts() { } private static readonly SettingRealsFromNegativeInts defaultInstance = new Builder().BuildPartial(); private static readonly string[] _settingRealsFromNegativeIntsFieldNames = new string[] { }; private static readonly uint[] _settingRealsFromNegativeIntsFieldTags = new uint[] { }; @@ -2452,6 +2462,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOptionType1 : pb::ExtendableMessage { + private ComplexOptionType1() { } private static readonly ComplexOptionType1 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOptionType1FieldNames = new string[] { "foo", "foo2", "foo3" }; private static readonly uint[] _complexOptionType1FieldTags = new uint[] { 8, 16, 24 }; @@ -2778,6 +2789,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOptionType2 : pb::ExtendableMessage { + private ComplexOptionType2() { } private static readonly ComplexOptionType2 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOptionType2FieldNames = new string[] { "bar", "baz", "fred" }; private static readonly uint[] _complexOptionType2FieldTags = new uint[] { 10, 16, 26 }; @@ -2810,6 +2822,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOptionType4 : pb::GeneratedMessage { + private ComplexOptionType4() { } private static readonly ComplexOptionType4 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOptionType4FieldNames = new string[] { "waldo" }; private static readonly uint[] _complexOptionType4FieldTags = new uint[] { 8 }; @@ -3402,6 +3415,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOptionType3 : pb::GeneratedMessage { + private ComplexOptionType3() { } private static readonly ComplexOptionType3 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOptionType3FieldNames = new string[] { "complexoptiontype5", "qux" }; private static readonly uint[] _complexOptionType3FieldTags = new uint[] { 19, 8 }; @@ -3434,6 +3448,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOptionType5 : pb::GeneratedMessage { + private ComplexOptionType5() { } private static readonly ComplexOptionType5 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOptionType5FieldNames = new string[] { "plugh" }; private static readonly uint[] _complexOptionType5FieldTags = new uint[] { 24 }; @@ -3952,6 +3967,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ComplexOpt6 : pb::GeneratedMessage { + private ComplexOpt6() { } private static readonly ComplexOpt6 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _complexOpt6FieldNames = new string[] { "xyzzy" }; private static readonly uint[] _complexOpt6FieldTags = new uint[] { 60751608 }; @@ -4191,6 +4207,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class VariousComplexOptions : pb::GeneratedMessage { + private VariousComplexOptions() { } private static readonly VariousComplexOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _variousComplexOptionsFieldNames = new string[] { }; private static readonly uint[] _variousComplexOptionsFieldTags = new uint[] { }; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs index 8ba6ecd82a..149f218271 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs @@ -64,6 +64,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestEmbedOptimizedForSize : pb::GeneratedMessage { + private TestEmbedOptimizedForSize() { } private static readonly TestEmbedOptimizedForSize defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testEmbedOptimizedForSizeFieldNames = new string[] { "optional_message", "repeated_message" }; private static readonly uint[] _testEmbedOptimizedForSizeFieldTags = new uint[] { 10, 18 }; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs index 6ff79d522c..aefa95e1e6 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs @@ -125,6 +125,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class A : pb::GeneratedMessage { + private A() { } private static readonly A defaultInstance = new Builder().BuildPartial(); private static readonly string[] _aFieldNames = new string[] { "_A" }; private static readonly uint[] _aFieldTags = new uint[] { 8 }; @@ -364,6 +365,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class B : pb::GeneratedMessage { + private B() { } private static readonly B defaultInstance = new Builder().BuildPartial(); private static readonly string[] _bFieldNames = new string[] { "B_" }; private static readonly uint[] _bFieldTags = new uint[] { 8 }; @@ -603,6 +605,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class AB : pb::GeneratedMessage { + private AB() { } private static readonly AB defaultInstance = new Builder().BuildPartial(); private static readonly string[] _aBFieldNames = new string[] { "a_b" }; private static readonly uint[] _aBFieldTags = new uint[] { 8 }; @@ -842,6 +845,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NumberField : pb::GeneratedMessage { + private NumberField() { } private static readonly NumberField defaultInstance = new Builder().BuildPartial(); private static readonly string[] _numberFieldFieldNames = new string[] { "_01" }; private static readonly uint[] _numberFieldFieldTags = new uint[] { 8 }; @@ -1085,6 +1089,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NegativeEnumMessage : pb::GeneratedMessage { + private NegativeEnumMessage() { } private static readonly NegativeEnumMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _negativeEnumMessageFieldNames = new string[] { "packed_values", "value", "values" }; private static readonly uint[] _negativeEnumMessageFieldTags = new uint[] { 26, 8, 16 }; @@ -1473,6 +1478,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class DeprecatedChild : pb::GeneratedMessage { + private DeprecatedChild() { } private static readonly DeprecatedChild defaultInstance = new Builder().BuildPartial(); private static readonly string[] _deprecatedChildFieldNames = new string[] { }; private static readonly uint[] _deprecatedChildFieldTags = new uint[] { }; @@ -1671,6 +1677,7 @@ namespace UnitTest.Issues.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class DeprecatedFieldsMessage : pb::GeneratedMessage { + private DeprecatedFieldsMessage() { } private static readonly DeprecatedFieldsMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _deprecatedFieldsMessageFieldNames = new string[] { "EnumArray", "EnumValue", "MessageArray", "MessageValue", "PrimitiveArray", "PrimitiveValue" }; private static readonly uint[] _deprecatedFieldsMessageFieldTags = new uint[] { 48, 40, 34, 26, 16, 8 }; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs index 6bfb136c45..e38fe00785 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs @@ -137,6 +137,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SizeMessage1 : pb::GeneratedMessage { + private SizeMessage1() { } private static readonly SizeMessage1 defaultInstance = new Builder().BuildPartial(); public static SizeMessage1 DefaultInstance { get { return defaultInstance; } @@ -1438,6 +1439,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SizeMessage1SubMessage : pb::GeneratedMessage { + private SizeMessage1SubMessage() { } private static readonly SizeMessage1SubMessage defaultInstance = new Builder().BuildPartial(); public static SizeMessage1SubMessage DefaultInstance { get { return defaultInstance; } @@ -2121,6 +2123,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SizeMessage2 : pb::GeneratedMessage { + private SizeMessage2() { } private static readonly SizeMessage2 defaultInstance = new Builder().BuildPartial(); public static SizeMessage2 DefaultInstance { get { return defaultInstance; } @@ -2151,6 +2154,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Group1 : pb::GeneratedMessage { + private Group1() { } private static readonly Group1 defaultInstance = new Builder().BuildPartial(); public static Group1 DefaultInstance { get { return defaultInstance; } @@ -3762,6 +3766,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SizeMessage2GroupedMessage : pb::GeneratedMessage { + private SizeMessage2GroupedMessage() { } private static readonly SizeMessage2GroupedMessage defaultInstance = new Builder().BuildPartial(); public static SizeMessage2GroupedMessage DefaultInstance { get { return defaultInstance; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs index d54e126b88..93589ecfee 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs @@ -137,6 +137,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SpeedMessage1 : pb::GeneratedMessage { + private SpeedMessage1() { } private static readonly SpeedMessage1 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _speedMessage1FieldNames = new string[] { "field1", "field100", "field101", "field102", "field103", "field104", "field12", "field128", "field129", "field13", "field130", "field131", "field14", "field15", "field150", "field16", "field17", "field18", "field2", "field22", "field23", "field24", "field25", "field271", "field272", "field280", "field29", "field3", "field30", "field4", "field5", "field59", "field6", "field60", "field67", "field68", "field7", "field78", "field80", "field81", "field9" }; private static readonly uint[] _speedMessage1FieldTags = new uint[] { 10, 800, 808, 818, 826, 832, 96, 1024, 1034, 104, 1040, 1048, 112, 122, 1200, 128, 136, 146, 16, 176, 184, 192, 200, 2168, 2176, 2240, 232, 24, 240, 34, 41, 472, 48, 480, 536, 544, 58, 624, 640, 648, 74 }; @@ -2072,6 +2073,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SpeedMessage1SubMessage : pb::GeneratedMessage { + private SpeedMessage1SubMessage() { } private static readonly SpeedMessage1SubMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _speedMessage1SubMessageFieldNames = new string[] { "field1", "field12", "field13", "field14", "field15", "field16", "field19", "field2", "field20", "field203", "field204", "field205", "field206", "field207", "field21", "field22", "field23", "field28", "field3", "field300" }; private static readonly uint[] _speedMessage1SubMessageFieldTags = new uint[] { 8, 96, 104, 112, 122, 128, 152, 16, 160, 1629, 1632, 1642, 1648, 1656, 169, 176, 184, 224, 24, 2400 }; @@ -3104,6 +3106,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SpeedMessage2 : pb::GeneratedMessage { + private SpeedMessage2() { } private static readonly SpeedMessage2 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _speedMessage2FieldNames = new string[] { "field1", "field109", "field127", "field128", "field129", "field130", "field131", "field2", "field205", "field206", "field21", "field210", "field211", "field212", "field213", "field216", "field217", "field218", "field220", "field221", "field222", "field25", "field3", "field30", "field4", "field6", "field63", "field71", "field75", "group1" }; private static readonly uint[] _speedMessage2FieldTags = new uint[] { 10, 872, 1018, 1026, 1032, 1040, 1048, 18, 1640, 1648, 168, 1680, 1688, 1696, 1704, 1728, 1736, 1744, 1760, 1768, 1781, 205, 24, 240, 32, 50, 504, 568, 600, 83 }; @@ -3136,6 +3139,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Group1 : pb::GeneratedMessage { + private Group1() { } private static readonly Group1 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _group1FieldNames = new string[] { "field11", "field12", "field13", "field14", "field15", "field16", "field20", "field22", "field24", "field26", "field27", "field28", "field29", "field31", "field5", "field73" }; private static readonly uint[] _group1FieldTags = new uint[] { 93, 98, 106, 114, 120, 130, 160, 178, 194, 213, 218, 224, 234, 250, 40, 584 }; @@ -5560,6 +5564,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SpeedMessage2GroupedMessage : pb::GeneratedMessage { + private SpeedMessage2GroupedMessage() { } private static readonly SpeedMessage2GroupedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _speedMessage2GroupedMessageFieldNames = new string[] { "field1", "field10", "field11", "field2", "field3", "field4", "field5", "field6", "field7", "field8", "field9" }; private static readonly uint[] _speedMessage2GroupedMessageFieldTags = new uint[] { 13, 85, 88, 21, 29, 32, 40, 48, 56, 69, 72 }; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs index 239eaa480f..594c9417b8 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs @@ -43,6 +43,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ImportMessageLite : pb::GeneratedMessageLite { + private ImportMessageLite() { } private static readonly ImportMessageLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _importMessageLiteFieldNames = new string[] { "d" }; private static readonly uint[] _importMessageLiteFieldTags = new uint[] { 8 }; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs index f1fff865ce..c5da553795 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs @@ -71,6 +71,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ImportMessage : pb::GeneratedMessage { + private ImportMessage() { } private static readonly ImportMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _importMessageFieldNames = new string[] { "d" }; private static readonly uint[] _importMessageFieldTags = new uint[] { 8 }; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs index 73c78c2589..590af6d691 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs @@ -103,6 +103,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessageSet : pb::ExtendableMessage { + private TestMessageSet() { } private static readonly TestMessageSet defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageSetFieldNames = new string[] { }; private static readonly uint[] _testMessageSetFieldTags = new uint[] { }; @@ -306,6 +307,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessageSetContainer : pb::GeneratedMessage { + private TestMessageSetContainer() { } private static readonly TestMessageSetContainer defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageSetContainerFieldNames = new string[] { "message_set" }; private static readonly uint[] _testMessageSetContainerFieldTags = new uint[] { 10 }; @@ -568,6 +570,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessageSetExtension1 : pb::GeneratedMessage { + private TestMessageSetExtension1() { } private static readonly TestMessageSetExtension1 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageSetExtension1FieldNames = new string[] { "i" }; private static readonly uint[] _testMessageSetExtension1FieldTags = new uint[] { 120 }; @@ -809,6 +812,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessageSetExtension2 : pb::GeneratedMessage { + private TestMessageSetExtension2() { } private static readonly TestMessageSetExtension2 defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageSetExtension2FieldNames = new string[] { "str" }; private static readonly uint[] _testMessageSetExtension2FieldTags = new uint[] { 202 }; @@ -1051,6 +1055,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RawMessageSet : pb::GeneratedMessage { + private RawMessageSet() { } private static readonly RawMessageSet defaultInstance = new Builder().BuildPartial(); private static readonly string[] _rawMessageSetFieldNames = new string[] { "item" }; private static readonly uint[] _rawMessageSetFieldTags = new uint[] { 11 }; @@ -1083,6 +1088,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Item : pb::GeneratedMessage { + private Item() { } private static readonly Item defaultInstance = new Builder().BuildPartial(); private static readonly string[] _itemFieldNames = new string[] { "message", "type_id" }; private static readonly uint[] _itemFieldTags = new uint[] { 26, 16 }; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs index 89a5c30eff..5b6528719a 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs @@ -81,6 +81,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMessage : pb::ExtendableMessage { + private TestMessage() { } private static readonly TestMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMessageFieldNames = new string[] { "a" }; private static readonly uint[] _testMessageFieldTags = new uint[] { 8 }; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs index 1f6e6ff45d..d436afc88a 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs @@ -85,6 +85,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestOptimizedForSize : pb::ExtendableMessage { + private TestOptimizedForSize() { } private static readonly TestOptimizedForSize defaultInstance = new Builder().BuildPartial(); public static TestOptimizedForSize DefaultInstance { get { return defaultInstance; } @@ -272,6 +273,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequiredOptimizedForSize : pb::GeneratedMessage { + private TestRequiredOptimizedForSize() { } private static readonly TestRequiredOptimizedForSize defaultInstance = new Builder().BuildPartial(); public static TestRequiredOptimizedForSize DefaultInstance { get { return defaultInstance; } @@ -409,6 +411,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestOptionalOptimizedForSize : pb::GeneratedMessage { + private TestOptionalOptimizedForSize() { } private static readonly TestOptionalOptimizedForSize defaultInstance = new Builder().BuildPartial(); public static TestOptionalOptimizedForSize DefaultInstance { get { return defaultInstance; } diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs index 753ff3e059..866167430c 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs @@ -1122,6 +1122,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllTypes : pb::GeneratedMessage { + private TestAllTypes() { } private static readonly TestAllTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllTypesFieldNames = new string[] { "default_bool", "default_bytes", "default_cord", "default_double", "default_fixed32", "default_fixed64", "default_float", "default_foreign_enum", "default_import_enum", "default_int32", "default_int64", "default_nested_enum", "default_sfixed32", "default_sfixed64", "default_sint32", "default_sint64", "default_string", "default_string_piece", "default_uint32", "default_uint64", "optional_bool", "optional_bytes", "optional_cord", "optional_double", "optional_fixed32", "optional_fixed64", "optional_float", "optional_foreign_enum", "optional_foreign_message", "optional_import_enum", "optional_import_message", "optional_int32", "optional_int64", "optional_nested_enum", "optional_nested_message", "optional_sfixed32", "optional_sfixed64", "optional_sint32", "optional_sint64", "optional_string", "optional_string_piece", "optional_uint32", "optional_uint64", "optionalgroup", "repeated_bool", "repeated_bytes", "repeated_cord", "repeated_double", "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_foreign_enum", "repeated_foreign_message", "repeated_import_enum", "repeated_import_message", "repeated_int32", "repeated_int64", "repeated_nested_enum", "repeated_nested_message", "repeated_sfixed32", "repeated_sfixed64", "repeated_sint32", "repeated_sint64", "repeated_string", "repeated_string_piece", "repeated_uint32", "repeated_uint64", "repeatedgroup" }; private static readonly uint[] _testAllTypesFieldTags = new uint[] { 584, 602, 682, 577, 541, 545, 573, 656, 664, 488, 496, 648, 557, 561, 520, 528, 594, 674, 504, 512, 104, 122, 202, 97, 61, 65, 93, 176, 154, 184, 162, 8, 16, 168, 146, 77, 81, 40, 48, 114, 194, 24, 32, 131, 344, 362, 442, 337, 301, 305, 333, 416, 394, 424, 402, 248, 256, 408, 386, 317, 321, 280, 288, 354, 434, 264, 272, 371 }; @@ -1162,6 +1163,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NestedMessage : pb::GeneratedMessage { + private NestedMessage() { } private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _nestedMessageFieldNames = new string[] { "bb" }; private static readonly uint[] _nestedMessageFieldTags = new uint[] { 8 }; @@ -1401,6 +1403,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup : pb::GeneratedMessage { + private OptionalGroup() { } private static readonly OptionalGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupFieldNames = new string[] { "a" }; private static readonly uint[] _optionalGroupFieldTags = new uint[] { 136 }; @@ -1640,6 +1643,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup : pb::GeneratedMessage { + private RepeatedGroup() { } private static readonly RepeatedGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupFieldNames = new string[] { "a" }; private static readonly uint[] _repeatedGroupFieldTags = new uint[] { 376 }; @@ -5496,6 +5500,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDeprecatedFields : pb::GeneratedMessage { + private TestDeprecatedFields() { } private static readonly TestDeprecatedFields defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDeprecatedFieldsFieldNames = new string[] { "deprecated_int32" }; private static readonly uint[] _testDeprecatedFieldsFieldTags = new uint[] { 8 }; @@ -5741,6 +5746,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ForeignMessage : pb::GeneratedMessage { + private ForeignMessage() { } private static readonly ForeignMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _foreignMessageFieldNames = new string[] { "c" }; private static readonly uint[] _foreignMessageFieldTags = new uint[] { 8 }; @@ -5980,6 +5986,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllExtensions : pb::ExtendableMessage { + private TestAllExtensions() { } private static readonly TestAllExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllExtensionsFieldNames = new string[] { }; private static readonly uint[] _testAllExtensionsFieldTags = new uint[] { }; @@ -6183,6 +6190,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup_extension : pb::GeneratedMessage { + private OptionalGroup_extension() { } private static readonly OptionalGroup_extension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupExtensionFieldNames = new string[] { "a" }; private static readonly uint[] _optionalGroupExtensionFieldTags = new uint[] { 136 }; @@ -6422,6 +6430,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup_extension : pb::GeneratedMessage { + private RepeatedGroup_extension() { } private static readonly RepeatedGroup_extension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupExtensionFieldNames = new string[] { "a" }; private static readonly uint[] _repeatedGroupExtensionFieldTags = new uint[] { 376 }; @@ -6661,6 +6670,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestNestedExtension : pb::GeneratedMessage { + private TestNestedExtension() { } private static readonly TestNestedExtension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testNestedExtensionFieldNames = new string[] { }; private static readonly uint[] _testNestedExtensionFieldTags = new uint[] { }; @@ -6861,6 +6871,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequired : pb::GeneratedMessage { + private TestRequired() { } private static readonly TestRequired defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRequiredFieldNames = new string[] { "a", "b", "c", "dummy10", "dummy11", "dummy12", "dummy13", "dummy14", "dummy15", "dummy16", "dummy17", "dummy18", "dummy19", "dummy2", "dummy20", "dummy21", "dummy22", "dummy23", "dummy24", "dummy25", "dummy26", "dummy27", "dummy28", "dummy29", "dummy30", "dummy31", "dummy32", "dummy4", "dummy5", "dummy6", "dummy7", "dummy8", "dummy9" }; private static readonly uint[] _testRequiredFieldTags = new uint[] { 8, 24, 264, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 16, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 32, 40, 48, 56, 64, 72 }; @@ -8419,6 +8430,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequiredForeign : pb::GeneratedMessage { + private TestRequiredForeign() { } private static readonly TestRequiredForeign defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRequiredForeignFieldNames = new string[] { "dummy", "optional_message", "repeated_message" }; private static readonly uint[] _testRequiredForeignFieldTags = new uint[] { 24, 10, 18 }; @@ -8792,6 +8804,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestForeignNested : pb::GeneratedMessage { + private TestForeignNested() { } private static readonly TestForeignNested defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testForeignNestedFieldNames = new string[] { "foreign_nested" }; private static readonly uint[] _testForeignNestedFieldTags = new uint[] { 10 }; @@ -9054,6 +9067,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestEmptyMessage : pb::GeneratedMessage { + private TestEmptyMessage() { } private static readonly TestEmptyMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testEmptyMessageFieldNames = new string[] { }; private static readonly uint[] _testEmptyMessageFieldTags = new uint[] { }; @@ -9252,6 +9266,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestEmptyMessageWithExtensions : pb::ExtendableMessage { + private TestEmptyMessageWithExtensions() { } private static readonly TestEmptyMessageWithExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testEmptyMessageWithExtensionsFieldNames = new string[] { }; private static readonly uint[] _testEmptyMessageWithExtensionsFieldTags = new uint[] { }; @@ -9455,6 +9470,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMultipleExtensionRanges : pb::ExtendableMessage { + private TestMultipleExtensionRanges() { } private static readonly TestMultipleExtensionRanges defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMultipleExtensionRangesFieldNames = new string[] { }; private static readonly uint[] _testMultipleExtensionRangesFieldTags = new uint[] { }; @@ -9660,6 +9676,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestReallyLargeTagNumber : pb::GeneratedMessage { + private TestReallyLargeTagNumber() { } private static readonly TestReallyLargeTagNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testReallyLargeTagNumberFieldNames = new string[] { "a", "bb" }; private static readonly uint[] _testReallyLargeTagNumberFieldTags = new uint[] { 8, 2147483640 }; @@ -9940,6 +9957,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRecursiveMessage : pb::GeneratedMessage { + private TestRecursiveMessage() { } private static readonly TestRecursiveMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRecursiveMessageFieldNames = new string[] { "a", "i" }; private static readonly uint[] _testRecursiveMessageFieldTags = new uint[] { 10, 16 }; @@ -10243,6 +10261,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMutualRecursionA : pb::GeneratedMessage { + private TestMutualRecursionA() { } private static readonly TestMutualRecursionA defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMutualRecursionAFieldNames = new string[] { "bb" }; private static readonly uint[] _testMutualRecursionAFieldTags = new uint[] { 10 }; @@ -10505,6 +10524,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMutualRecursionB : pb::GeneratedMessage { + private TestMutualRecursionB() { } private static readonly TestMutualRecursionB defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMutualRecursionBFieldNames = new string[] { "a", "optional_int32" }; private static readonly uint[] _testMutualRecursionBFieldTags = new uint[] { 10, 16 }; @@ -10808,6 +10828,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDupFieldNumber : pb::GeneratedMessage { + private TestDupFieldNumber() { } private static readonly TestDupFieldNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDupFieldNumberFieldNames = new string[] { "a", "bar", "foo" }; private static readonly uint[] _testDupFieldNumberFieldTags = new uint[] { 8, 27, 19 }; @@ -10840,6 +10861,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Foo : pb::GeneratedMessage { + private Foo() { } private static readonly Foo defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooFieldNames = new string[] { "a" }; private static readonly uint[] _fooFieldTags = new uint[] { 8 }; @@ -11079,6 +11101,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Bar : pb::GeneratedMessage { + private Bar() { } private static readonly Bar defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barFieldNames = new string[] { "a" }; private static readonly uint[] _barFieldTags = new uint[] { 8 }; @@ -11661,6 +11684,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestNestedMessageHasBits : pb::GeneratedMessage { + private TestNestedMessageHasBits() { } private static readonly TestNestedMessageHasBits defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testNestedMessageHasBitsFieldNames = new string[] { "optional_nested_message" }; private static readonly uint[] _testNestedMessageHasBitsFieldTags = new uint[] { 10 }; @@ -11693,6 +11717,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NestedMessage : pb::GeneratedMessage { + private NestedMessage() { } private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _nestedMessageFieldNames = new string[] { "nestedmessage_repeated_foreignmessage", "nestedmessage_repeated_int32" }; private static readonly uint[] _nestedMessageFieldTags = new uint[] { 18, 8 }; @@ -12251,6 +12276,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestCamelCaseFieldNames : pb::GeneratedMessage { + private TestCamelCaseFieldNames() { } private static readonly TestCamelCaseFieldNames defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testCamelCaseFieldNamesFieldNames = new string[] { "CordField", "EnumField", "MessageField", "PrimitiveField", "RepeatedCordField", "RepeatedEnumField", "RepeatedMessageField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedStringPieceField", "StringField", "StringPieceField" }; private static readonly uint[] _testCamelCaseFieldNamesFieldTags = new uint[] { 50, 24, 34, 8, 98, 72, 82, 56, 66, 90, 18, 42 }; @@ -13097,6 +13123,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestFieldOrderings : pb::ExtendableMessage { + private TestFieldOrderings() { } private static readonly TestFieldOrderings defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testFieldOrderingsFieldNames = new string[] { "my_float", "my_int", "my_string" }; private static readonly uint[] _testFieldOrderingsFieldTags = new uint[] { 813, 8, 90 }; @@ -13425,6 +13452,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestExtremeDefaultValues : pb::GeneratedMessage { + private TestExtremeDefaultValues() { } private static readonly TestExtremeDefaultValues defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testExtremeDefaultValuesFieldNames = new string[] { "escaped_bytes", "inf_double", "inf_float", "large_float", "large_uint32", "large_uint64", "nan_double", "nan_float", "neg_inf_double", "neg_inf_float", "negative_float", "negative_one_float", "one_float", "small_float", "small_int32", "small_int64", "small_negative_float", "utf8_string", "zero_float" }; private static readonly uint[] _testExtremeDefaultValuesFieldTags = new uint[] { 10, 113, 141, 101, 16, 24, 129, 157, 121, 149, 93, 85, 69, 77, 32, 40, 109, 50, 61 }; @@ -14410,6 +14438,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OneString : pb::GeneratedMessage { + private OneString() { } private static readonly OneString defaultInstance = new Builder().BuildPartial(); private static readonly string[] _oneStringFieldNames = new string[] { "data" }; private static readonly uint[] _oneStringFieldTags = new uint[] { 10 }; @@ -14650,6 +14679,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OneBytes : pb::GeneratedMessage { + private OneBytes() { } private static readonly OneBytes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _oneBytesFieldNames = new string[] { "data" }; private static readonly uint[] _oneBytesFieldTags = new uint[] { 10 }; @@ -14890,6 +14920,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedTypes : pb::GeneratedMessage { + private TestPackedTypes() { } private static readonly TestPackedTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedTypesFieldNames = new string[] { "packed_bool", "packed_double", "packed_enum", "packed_fixed32", "packed_fixed64", "packed_float", "packed_int32", "packed_int64", "packed_sfixed32", "packed_sfixed64", "packed_sint32", "packed_sint64", "packed_uint32", "packed_uint64" }; private static readonly uint[] _testPackedTypesFieldTags = new uint[] { 818, 810, 826, 770, 778, 802, 722, 730, 786, 794, 754, 762, 738, 746 }; @@ -15980,6 +16011,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedTypes : pb::GeneratedMessage { + private TestUnpackedTypes() { } private static readonly TestUnpackedTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedTypesFieldNames = new string[] { "unpacked_bool", "unpacked_double", "unpacked_enum", "unpacked_fixed32", "unpacked_fixed64", "unpacked_float", "unpacked_int32", "unpacked_int64", "unpacked_sfixed32", "unpacked_sfixed64", "unpacked_sint32", "unpacked_sint64", "unpacked_uint32", "unpacked_uint64" }; private static readonly uint[] _testUnpackedTypesFieldTags = new uint[] { 816, 809, 824, 773, 777, 805, 720, 728, 789, 793, 752, 760, 736, 744 }; @@ -17015,6 +17047,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedExtensions : pb::ExtendableMessage { + private TestPackedExtensions() { } private static readonly TestPackedExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedExtensionsFieldNames = new string[] { }; private static readonly uint[] _testPackedExtensionsFieldTags = new uint[] { }; @@ -17218,6 +17251,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedExtensions : pb::ExtendableMessage { + private TestUnpackedExtensions() { } private static readonly TestUnpackedExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedExtensionsFieldNames = new string[] { }; private static readonly uint[] _testUnpackedExtensionsFieldTags = new uint[] { }; @@ -17421,6 +17455,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDynamicExtensions : pb::GeneratedMessage { + private TestDynamicExtensions() { } private static readonly TestDynamicExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDynamicExtensionsFieldNames = new string[] { "dynamic_enum_extension", "dynamic_message_extension", "enum_extension", "message_extension", "packed_extension", "repeated_extension", "scalar_extension" }; private static readonly uint[] _testDynamicExtensionsFieldTags = new uint[] { 16016, 16034, 16008, 16026, 16050, 16042, 16005 }; @@ -17461,6 +17496,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class DynamicMessageType : pb::GeneratedMessage { + private DynamicMessageType() { } private static readonly DynamicMessageType defaultInstance = new Builder().BuildPartial(); private static readonly string[] _dynamicMessageTypeFieldNames = new string[] { "dynamic_field" }; private static readonly uint[] _dynamicMessageTypeFieldTags = new uint[] { 16800 }; @@ -18265,6 +18301,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::GeneratedMessage { + private TestRepeatedScalarDifferentTagSizes() { } private static readonly TestRepeatedScalarDifferentTagSizes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRepeatedScalarDifferentTagSizesFieldNames = new string[] { "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_int32", "repeated_int64", "repeated_uint64" }; private static readonly uint[] _testRepeatedScalarDifferentTagSizesFieldTags = new uint[] { 101, 16369, 2097141, 104, 16376, 2097144 }; @@ -18826,6 +18863,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FooRequest : pb::GeneratedMessage { + private FooRequest() { } private static readonly FooRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooRequestFieldNames = new string[] { }; private static readonly uint[] _fooRequestFieldTags = new uint[] { }; @@ -19024,6 +19062,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FooResponse : pb::GeneratedMessage { + private FooResponse() { } private static readonly FooResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooResponseFieldNames = new string[] { }; private static readonly uint[] _fooResponseFieldTags = new uint[] { }; @@ -19222,6 +19261,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class BarRequest : pb::GeneratedMessage { + private BarRequest() { } private static readonly BarRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barRequestFieldNames = new string[] { }; private static readonly uint[] _barRequestFieldTags = new uint[] { }; @@ -19420,6 +19460,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class BarResponse : pb::GeneratedMessage { + private BarResponse() { } private static readonly BarResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barResponseFieldNames = new string[] { }; private static readonly uint[] _barResponseFieldTags = new uint[] { }; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs index 782a9bdfb7..a2a965eb43 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs @@ -83,6 +83,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SearchRequest : pb::GeneratedMessage { + private SearchRequest() { } private static readonly SearchRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _searchRequestFieldNames = new string[] { "Criteria" }; private static readonly uint[] _searchRequestFieldTags = new uint[] { 10 }; @@ -340,6 +341,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SearchResponse : pb::GeneratedMessage { + private SearchResponse() { } private static readonly SearchResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _searchResponseFieldNames = new string[] { "results" }; private static readonly uint[] _searchResponseFieldTags = new uint[] { 10 }; @@ -372,6 +374,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ResultItem : pb::GeneratedMessage { + private ResultItem() { } private static readonly ResultItem defaultInstance = new Builder().BuildPartial(); private static readonly string[] _resultItemFieldNames = new string[] { "name", "url" }; private static readonly uint[] _resultItemFieldTags = new uint[] { 18, 10 }; @@ -896,6 +899,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RefineSearchRequest : pb::GeneratedMessage { + private RefineSearchRequest() { } private static readonly RefineSearchRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _refineSearchRequestFieldNames = new string[] { "Criteria", "previous_results" }; private static readonly uint[] _refineSearchRequestFieldTags = new uint[] { 10, 18 }; diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs index 37ce670b57..ca0be5abf5 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs @@ -139,6 +139,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestXmlChild : pb::GeneratedMessage { + private TestXmlChild() { } private static readonly TestXmlChild defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testXmlChildFieldNames = new string[] { "binary", "options" }; private static readonly uint[] _testXmlChildFieldTags = new uint[] { 34, 24 }; @@ -450,6 +451,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestXmlNoFields : pb::GeneratedMessage { + private TestXmlNoFields() { } private static readonly TestXmlNoFields defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testXmlNoFieldsFieldNames = new string[] { }; private static readonly uint[] _testXmlNoFieldsFieldTags = new uint[] { }; @@ -650,6 +652,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestXmlRescursive : pb::GeneratedMessage { + private TestXmlRescursive() { } private static readonly TestXmlRescursive defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testXmlRescursiveFieldNames = new string[] { "child" }; private static readonly uint[] _testXmlRescursiveFieldTags = new uint[] { 10 }; @@ -914,6 +917,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestXmlMessage : pb::ExtendableMessage { + private TestXmlMessage() { } private static readonly TestXmlMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testXmlMessageFieldNames = new string[] { "child", "children", "number", "numbers", "text", "textlines", "valid" }; private static readonly uint[] _testXmlMessageFieldTags = new uint[] { 10, 3211, 48, 16, 26, 5602, 40 }; @@ -947,6 +951,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Children : pb::GeneratedMessage { + private Children() { } private static readonly Children defaultInstance = new Builder().BuildPartial(); private static readonly string[] _childrenFieldNames = new string[] { "binary", "options" }; private static readonly uint[] _childrenFieldTags = new uint[] { 34, 24 }; @@ -1807,6 +1812,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestXmlExtension : pb::GeneratedMessage { + private TestXmlExtension() { } private static readonly TestXmlExtension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testXmlExtensionFieldNames = new string[] { "number" }; private static readonly uint[] _testXmlExtensionFieldTags = new uint[] { 8 }; diff --git a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs index 70222e0ab0..76cb1fee7d 100644 --- a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs +++ b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs @@ -126,6 +126,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CSharpFileOptions : pb::GeneratedMessage { + private CSharpFileOptions() { } private static readonly CSharpFileOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _cSharpFileOptionsFieldNames = new string[] { "add_serializable", "cls_compliance", "code_contracts", "expand_namespace_directories", "file_extension", "ignore_google_protobuf", "multiple_files", "namespace", "nest_classes", "output_directory", "public_classes", "service_generator_type", "umbrella_classname", "umbrella_namespace" }; private static readonly uint[] _cSharpFileOptionsFieldTags = new uint[] { 72, 64, 48, 56, 1770, 1792, 32, 10, 40, 1786, 24, 1800, 18, 1778 }; @@ -911,6 +912,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CSharpFieldOptions : pb::GeneratedMessage { + private CSharpFieldOptions() { } private static readonly CSharpFieldOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _cSharpFieldOptionsFieldNames = new string[] { "property_name" }; private static readonly uint[] _cSharpFieldOptionsFieldTags = new uint[] { 10 }; @@ -1151,6 +1153,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CSharpServiceOptions : pb::GeneratedMessage { + private CSharpServiceOptions() { } private static readonly CSharpServiceOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _cSharpServiceOptionsFieldNames = new string[] { "interface_id" }; private static readonly uint[] _cSharpServiceOptionsFieldTags = new uint[] { 10 }; @@ -1391,6 +1394,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class CSharpMethodOptions : pb::GeneratedMessage { + private CSharpMethodOptions() { } private static readonly CSharpMethodOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _cSharpMethodOptionsFieldNames = new string[] { "dispatch_id" }; private static readonly uint[] _cSharpMethodOptionsFieldTags = new uint[] { 8 }; diff --git a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs index e5da80b3fd..ff5429d8c6 100644 --- a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs +++ b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs @@ -233,6 +233,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FileDescriptorSet : pb::GeneratedMessage { + private FileDescriptorSet() { } private static readonly FileDescriptorSet defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fileDescriptorSetFieldNames = new string[] { "file" }; private static readonly uint[] _fileDescriptorSetFieldTags = new uint[] { 10 }; @@ -498,6 +499,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FileDescriptorProto : pb::GeneratedMessage { + private FileDescriptorProto() { } private static readonly FileDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fileDescriptorProtoFieldNames = new string[] { "dependency", "enum_type", "extension", "message_type", "name", "options", "package", "service" }; private static readonly uint[] _fileDescriptorProtoFieldTags = new uint[] { 26, 42, 58, 34, 10, 66, 18, 50 }; @@ -1174,6 +1176,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class DescriptorProto : pb::GeneratedMessage { + private DescriptorProto() { } private static readonly DescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _descriptorProtoFieldNames = new string[] { "enum_type", "extension", "extension_range", "field", "name", "nested_type", "options" }; private static readonly uint[] _descriptorProtoFieldTags = new uint[] { 34, 50, 42, 18, 10, 26, 58 }; @@ -1206,6 +1209,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ExtensionRange : pb::GeneratedMessage { + private ExtensionRange() { } private static readonly ExtensionRange defaultInstance = new Builder().BuildPartial(); private static readonly string[] _extensionRangeFieldNames = new string[] { "end", "start" }; private static readonly uint[] _extensionRangeFieldTags = new uint[] { 16, 8 }; @@ -2101,6 +2105,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FieldDescriptorProto : pb::GeneratedMessage { + private FieldDescriptorProto() { } private static readonly FieldDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fieldDescriptorProtoFieldNames = new string[] { "default_value", "extendee", "label", "name", "number", "options", "type", "type_name" }; private static readonly uint[] _fieldDescriptorProtoFieldTags = new uint[] { 58, 18, 32, 10, 24, 66, 40, 50 }; @@ -2712,6 +2717,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class EnumDescriptorProto : pb::GeneratedMessage { + private EnumDescriptorProto() { } private static readonly EnumDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _enumDescriptorProtoFieldNames = new string[] { "name", "options", "value" }; private static readonly uint[] _enumDescriptorProtoFieldTags = new uint[] { 10, 26, 18 }; @@ -3086,6 +3092,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class EnumValueDescriptorProto : pb::GeneratedMessage { + private EnumValueDescriptorProto() { } private static readonly EnumValueDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _enumValueDescriptorProtoFieldNames = new string[] { "name", "number", "options" }; private static readonly uint[] _enumValueDescriptorProtoFieldTags = new uint[] { 10, 16, 26 }; @@ -3434,6 +3441,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ServiceDescriptorProto : pb::GeneratedMessage { + private ServiceDescriptorProto() { } private static readonly ServiceDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _serviceDescriptorProtoFieldNames = new string[] { "method", "name", "options" }; private static readonly uint[] _serviceDescriptorProtoFieldTags = new uint[] { 18, 10, 26 }; @@ -3808,6 +3816,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class MethodDescriptorProto : pb::GeneratedMessage { + private MethodDescriptorProto() { } private static readonly MethodDescriptorProto defaultInstance = new Builder().BuildPartial(); private static readonly string[] _methodDescriptorProtoFieldNames = new string[] { "input_type", "name", "options", "output_type" }; private static readonly uint[] _methodDescriptorProtoFieldTags = new uint[] { 18, 10, 34, 26 }; @@ -4199,6 +4208,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FileOptions : pb::ExtendableMessage { + private FileOptions() { } private static readonly FileOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fileOptionsFieldNames = new string[] { "cc_generic_services", "java_generic_services", "java_multiple_files", "java_outer_classname", "java_package", "optimize_for", "py_generic_services", "uninterpreted_option" }; private static readonly uint[] _fileOptionsFieldTags = new uint[] { 128, 136, 80, 66, 10, 72, 144, 7994 }; @@ -4782,6 +4792,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class MessageOptions : pb::ExtendableMessage { + private MessageOptions() { } private static readonly MessageOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _messageOptionsFieldNames = new string[] { "message_set_wire_format", "no_standard_descriptor_accessor", "uninterpreted_option" }; private static readonly uint[] _messageOptionsFieldTags = new uint[] { 8, 16, 7994 }; @@ -5134,6 +5145,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FieldOptions : pb::ExtendableMessage { + private FieldOptions() { } private static readonly FieldOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fieldOptionsFieldNames = new string[] { "ctype", "deprecated", "experimental_map_key", "packed", "uninterpreted_option" }; private static readonly uint[] _fieldOptionsFieldTags = new uint[] { 8, 24, 74, 16, 7994 }; @@ -5593,6 +5605,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class EnumOptions : pb::ExtendableMessage { + private EnumOptions() { } private static readonly EnumOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _enumOptionsFieldNames = new string[] { "uninterpreted_option" }; private static readonly uint[] _enumOptionsFieldTags = new uint[] { 7994 }; @@ -5863,6 +5876,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class EnumValueOptions : pb::ExtendableMessage { + private EnumValueOptions() { } private static readonly EnumValueOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _enumValueOptionsFieldNames = new string[] { "uninterpreted_option" }; private static readonly uint[] _enumValueOptionsFieldTags = new uint[] { 7994 }; @@ -6133,6 +6147,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ServiceOptions : pb::ExtendableMessage { + private ServiceOptions() { } private static readonly ServiceOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _serviceOptionsFieldNames = new string[] { "uninterpreted_option" }; private static readonly uint[] _serviceOptionsFieldTags = new uint[] { 7994 }; @@ -6403,6 +6418,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class MethodOptions : pb::ExtendableMessage { + private MethodOptions() { } private static readonly MethodOptions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _methodOptionsFieldNames = new string[] { "uninterpreted_option" }; private static readonly uint[] _methodOptionsFieldTags = new uint[] { 7994 }; @@ -6673,6 +6689,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class UninterpretedOption : pb::GeneratedMessage { + private UninterpretedOption() { } private static readonly UninterpretedOption defaultInstance = new Builder().BuildPartial(); private static readonly string[] _uninterpretedOptionFieldNames = new string[] { "double_value", "identifier_value", "name", "negative_int_value", "positive_int_value", "string_value" }; private static readonly uint[] _uninterpretedOptionFieldTags = new uint[] { 49, 26, 18, 40, 32, 58 }; @@ -6705,6 +6722,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NamePart : pb::GeneratedMessage { + private NamePart() { } private static readonly NamePart defaultInstance = new Builder().BuildPartial(); private static readonly string[] _namePartFieldNames = new string[] { "is_extension", "name_part" }; private static readonly uint[] _namePartFieldTags = new uint[] { 16, 10 }; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs index 58c57312e5..9119e4e9d5 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs @@ -128,6 +128,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestInteropPerson : pb::ExtendableMessage { + private TestInteropPerson() { } private static readonly TestInteropPerson defaultInstance = new Builder().BuildPartial(); public static TestInteropPerson DefaultInstance { get { return defaultInstance; } @@ -166,6 +167,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class PhoneNumber : pb::GeneratedMessage { + private PhoneNumber() { } private static readonly PhoneNumber defaultInstance = new Builder().BuildPartial(); public static PhoneNumber DefaultInstance { get { return defaultInstance; } @@ -332,6 +334,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Addresses : pb::GeneratedMessage { + private Addresses() { } private static readonly Addresses defaultInstance = new Builder().BuildPartial(); public static Addresses DefaultInstance { get { return defaultInstance; } @@ -902,6 +905,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestInteropEmployeeId : pb::GeneratedMessage { + private TestInteropEmployeeId() { } private static readonly TestInteropEmployeeId defaultInstance = new Builder().BuildPartial(); public static TestInteropEmployeeId DefaultInstance { get { return defaultInstance; } @@ -1040,6 +1044,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMissingFieldsA : pb::GeneratedMessage { + private TestMissingFieldsA() { } private static readonly TestMissingFieldsA defaultInstance = new Builder().BuildPartial(); public static TestMissingFieldsA DefaultInstance { get { return defaultInstance; } @@ -1070,6 +1075,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SubA : pb::GeneratedMessage { + private SubA() { } private static readonly SubA defaultInstance = new Builder().BuildPartial(); public static SubA DefaultInstance { get { return defaultInstance; } @@ -1467,6 +1473,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMissingFieldsB : pb::GeneratedMessage { + private TestMissingFieldsB() { } private static readonly TestMissingFieldsB defaultInstance = new Builder().BuildPartial(); public static TestMissingFieldsB DefaultInstance { get { return defaultInstance; } @@ -1497,6 +1504,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class SubB : pb::GeneratedMessage { + private SubB() { } private static readonly SubB defaultInstance = new Builder().BuildPartial(); public static SubB DefaultInstance { get { return defaultInstance; } diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs index bf0d302eca..07de8a6f33 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs @@ -60,6 +60,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequiredLite : pb::GeneratedMessageLite { + private TestRequiredLite() { } private static readonly TestRequiredLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRequiredLiteFieldNames = new string[] { "d", "en" }; private static readonly uint[] _testRequiredLiteFieldTags = new uint[] { 8, 16 }; @@ -342,6 +343,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestInteropPersonLite : pb::ExtendableMessageLite { + private TestInteropPersonLite() { } private static readonly TestInteropPersonLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testInteropPersonLiteFieldNames = new string[] { "addresses", "codes", "email", "id", "name", "phone" }; private static readonly uint[] _testInteropPersonLiteFieldTags = new uint[] { 43, 82, 26, 16, 10, 34 }; @@ -375,6 +377,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class PhoneNumber : pb::GeneratedMessageLite { + private PhoneNumber() { } private static readonly PhoneNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _phoneNumberFieldNames = new string[] { "number", "type" }; private static readonly uint[] _phoneNumberFieldTags = new uint[] { 10, 16 }; @@ -657,6 +660,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Addresses : pb::GeneratedMessageLite { + private Addresses() { } private static readonly Addresses defaultInstance = new Builder().BuildPartial(); private static readonly string[] _addressesFieldNames = new string[] { "address", "address2", "city", "state", "zip" }; private static readonly uint[] _addressesFieldTags = new uint[] { 10, 18, 26, 34, 45 }; @@ -1602,6 +1606,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestInteropEmployeeIdLite : pb::GeneratedMessageLite { + private TestInteropEmployeeIdLite() { } private static readonly TestInteropEmployeeIdLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testInteropEmployeeIdLiteFieldNames = new string[] { "number" }; private static readonly uint[] _testInteropEmployeeIdLiteFieldTags = new uint[] { 10 }; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs index 239eaa480f..594c9417b8 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs @@ -43,6 +43,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ImportMessageLite : pb::GeneratedMessageLite { + private ImportMessageLite() { } private static readonly ImportMessageLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _importMessageLiteFieldNames = new string[] { "d" }; private static readonly uint[] _importMessageLiteFieldTags = new uint[] { 8 }; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs index f1fff865ce..c5da553795 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs @@ -71,6 +71,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ImportMessage : pb::GeneratedMessage { + private ImportMessage() { } private static readonly ImportMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _importMessageFieldNames = new string[] { "d" }; private static readonly uint[] _importMessageFieldTags = new uint[] { 8 }; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs index bb53b646c8..7d72f28867 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs @@ -32,6 +32,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestLiteImportsNonlite : pb::GeneratedMessageLite { + private TestLiteImportsNonlite() { } private static readonly TestLiteImportsNonlite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testLiteImportsNonliteFieldNames = new string[] { "message" }; private static readonly uint[] _testLiteImportsNonliteFieldTags = new uint[] { 10 }; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs index e728a75b6f..3135a4ba70 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs @@ -1228,6 +1228,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllTypesLite : pb::GeneratedMessageLite { + private TestAllTypesLite() { } private static readonly TestAllTypesLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllTypesLiteFieldNames = new string[] { "default_bool", "default_bytes", "default_cord", "default_double", "default_fixed32", "default_fixed64", "default_float", "default_foreign_enum", "default_import_enum", "default_int32", "default_int64", "default_nested_enum", "default_sfixed32", "default_sfixed64", "default_sint32", "default_sint64", "default_string", "default_string_piece", "default_uint32", "default_uint64", "optional_bool", "optional_bytes", "optional_cord", "optional_double", "optional_fixed32", "optional_fixed64", "optional_float", "optional_foreign_enum", "optional_foreign_message", "optional_import_enum", "optional_import_message", "optional_int32", "optional_int64", "optional_nested_enum", "optional_nested_message", "optional_sfixed32", "optional_sfixed64", "optional_sint32", "optional_sint64", "optional_string", "optional_string_piece", "optional_uint32", "optional_uint64", "optionalgroup", "repeated_bool", "repeated_bytes", "repeated_cord", "repeated_double", "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_foreign_enum", "repeated_foreign_message", "repeated_import_enum", "repeated_import_message", "repeated_int32", "repeated_int64", "repeated_nested_enum", "repeated_nested_message", "repeated_sfixed32", "repeated_sfixed64", "repeated_sint32", "repeated_sint64", "repeated_string", "repeated_string_piece", "repeated_uint32", "repeated_uint64", "repeatedgroup" }; private static readonly uint[] _testAllTypesLiteFieldTags = new uint[] { 584, 602, 682, 577, 541, 545, 573, 656, 664, 488, 496, 648, 557, 561, 520, 528, 594, 674, 504, 512, 104, 122, 202, 97, 61, 65, 93, 176, 154, 184, 162, 8, 16, 168, 146, 77, 81, 40, 48, 114, 194, 24, 32, 131, 344, 362, 442, 337, 301, 305, 333, 416, 394, 424, 402, 248, 256, 408, 386, 317, 321, 280, 288, 354, 434, 264, 272, 371 }; @@ -1260,6 +1261,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NestedMessage : pb::GeneratedMessageLite { + private NestedMessage() { } private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _nestedMessageFieldNames = new string[] { "bb" }; private static readonly uint[] _nestedMessageFieldTags = new uint[] { 8 }; @@ -1490,6 +1492,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup : pb::GeneratedMessageLite { + private OptionalGroup() { } private static readonly OptionalGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupFieldNames = new string[] { "a" }; private static readonly uint[] _optionalGroupFieldTags = new uint[] { 136 }; @@ -1720,6 +1723,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup : pb::GeneratedMessageLite { + private RepeatedGroup() { } private static readonly RepeatedGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupFieldNames = new string[] { "a" }; private static readonly uint[] _repeatedGroupFieldTags = new uint[] { 376 }; @@ -5791,6 +5795,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ForeignMessageLite : pb::GeneratedMessageLite { + private ForeignMessageLite() { } private static readonly ForeignMessageLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _foreignMessageLiteFieldNames = new string[] { "c" }; private static readonly uint[] _foreignMessageLiteFieldTags = new uint[] { 8 }; @@ -6021,6 +6026,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedTypesLite : pb::GeneratedMessageLite { + private TestPackedTypesLite() { } private static readonly TestPackedTypesLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedTypesLiteFieldNames = new string[] { "packed_bool", "packed_double", "packed_enum", "packed_fixed32", "packed_fixed64", "packed_float", "packed_int32", "packed_int64", "packed_sfixed32", "packed_sfixed64", "packed_sint32", "packed_sint64", "packed_uint32", "packed_uint64" }; private static readonly uint[] _testPackedTypesLiteFieldTags = new uint[] { 818, 810, 826, 770, 778, 802, 722, 730, 786, 794, 754, 762, 738, 746 }; @@ -7175,6 +7181,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedTypesLite : pb::GeneratedMessageLite { + private TestUnpackedTypesLite() { } private static readonly TestUnpackedTypesLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedTypesLiteFieldNames = new string[] { "unpacked_bool", "unpacked_double", "unpacked_enum", "unpacked_fixed32", "unpacked_fixed64", "unpacked_float", "unpacked_int32", "unpacked_int64", "unpacked_sfixed32", "unpacked_sfixed64", "unpacked_sint32", "unpacked_sint64", "unpacked_uint32", "unpacked_uint64" }; private static readonly uint[] _testUnpackedTypesLiteFieldTags = new uint[] { 816, 809, 824, 773, 777, 805, 720, 728, 789, 793, 752, 760, 736, 744 }; @@ -8274,6 +8281,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllExtensionsLite : pb::ExtendableMessageLite { + private TestAllExtensionsLite() { } private static readonly TestAllExtensionsLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllExtensionsLiteFieldNames = new string[] { }; private static readonly uint[] _testAllExtensionsLiteFieldTags = new uint[] { }; @@ -8468,6 +8476,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup_extension_lite : pb::GeneratedMessageLite { + private OptionalGroup_extension_lite() { } private static readonly OptionalGroup_extension_lite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupExtensionLiteFieldNames = new string[] { "a" }; private static readonly uint[] _optionalGroupExtensionLiteFieldTags = new uint[] { 136 }; @@ -8698,6 +8707,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup_extension_lite : pb::GeneratedMessageLite { + private RepeatedGroup_extension_lite() { } private static readonly RepeatedGroup_extension_lite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupExtensionLiteFieldNames = new string[] { "a" }; private static readonly uint[] _repeatedGroupExtensionLiteFieldTags = new uint[] { 376 }; @@ -8928,6 +8938,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedExtensionsLite : pb::ExtendableMessageLite { + private TestPackedExtensionsLite() { } private static readonly TestPackedExtensionsLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedExtensionsLiteFieldNames = new string[] { }; private static readonly uint[] _testPackedExtensionsLiteFieldTags = new uint[] { }; @@ -9122,6 +9133,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedExtensionsLite : pb::ExtendableMessageLite { + private TestUnpackedExtensionsLite() { } private static readonly TestUnpackedExtensionsLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedExtensionsLiteFieldNames = new string[] { }; private static readonly uint[] _testUnpackedExtensionsLiteFieldTags = new uint[] { }; @@ -9316,6 +9328,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestNestedExtensionLite : pb::GeneratedMessageLite { + private TestNestedExtensionLite() { } private static readonly TestNestedExtensionLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testNestedExtensionLiteFieldNames = new string[] { }; private static readonly uint[] _testNestedExtensionLiteFieldTags = new uint[] { }; @@ -9504,6 +9517,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDeprecatedLite : pb::GeneratedMessageLite { + private TestDeprecatedLite() { } private static readonly TestDeprecatedLite defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDeprecatedLiteFieldNames = new string[] { "deprecated_field" }; private static readonly uint[] _testDeprecatedLiteFieldTags = new uint[] { 8 }; diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs index 753ff3e059..866167430c 100644 --- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs +++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs @@ -1122,6 +1122,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllTypes : pb::GeneratedMessage { + private TestAllTypes() { } private static readonly TestAllTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllTypesFieldNames = new string[] { "default_bool", "default_bytes", "default_cord", "default_double", "default_fixed32", "default_fixed64", "default_float", "default_foreign_enum", "default_import_enum", "default_int32", "default_int64", "default_nested_enum", "default_sfixed32", "default_sfixed64", "default_sint32", "default_sint64", "default_string", "default_string_piece", "default_uint32", "default_uint64", "optional_bool", "optional_bytes", "optional_cord", "optional_double", "optional_fixed32", "optional_fixed64", "optional_float", "optional_foreign_enum", "optional_foreign_message", "optional_import_enum", "optional_import_message", "optional_int32", "optional_int64", "optional_nested_enum", "optional_nested_message", "optional_sfixed32", "optional_sfixed64", "optional_sint32", "optional_sint64", "optional_string", "optional_string_piece", "optional_uint32", "optional_uint64", "optionalgroup", "repeated_bool", "repeated_bytes", "repeated_cord", "repeated_double", "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_foreign_enum", "repeated_foreign_message", "repeated_import_enum", "repeated_import_message", "repeated_int32", "repeated_int64", "repeated_nested_enum", "repeated_nested_message", "repeated_sfixed32", "repeated_sfixed64", "repeated_sint32", "repeated_sint64", "repeated_string", "repeated_string_piece", "repeated_uint32", "repeated_uint64", "repeatedgroup" }; private static readonly uint[] _testAllTypesFieldTags = new uint[] { 584, 602, 682, 577, 541, 545, 573, 656, 664, 488, 496, 648, 557, 561, 520, 528, 594, 674, 504, 512, 104, 122, 202, 97, 61, 65, 93, 176, 154, 184, 162, 8, 16, 168, 146, 77, 81, 40, 48, 114, 194, 24, 32, 131, 344, 362, 442, 337, 301, 305, 333, 416, 394, 424, 402, 248, 256, 408, 386, 317, 321, 280, 288, 354, 434, 264, 272, 371 }; @@ -1162,6 +1163,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NestedMessage : pb::GeneratedMessage { + private NestedMessage() { } private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _nestedMessageFieldNames = new string[] { "bb" }; private static readonly uint[] _nestedMessageFieldTags = new uint[] { 8 }; @@ -1401,6 +1403,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup : pb::GeneratedMessage { + private OptionalGroup() { } private static readonly OptionalGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupFieldNames = new string[] { "a" }; private static readonly uint[] _optionalGroupFieldTags = new uint[] { 136 }; @@ -1640,6 +1643,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup : pb::GeneratedMessage { + private RepeatedGroup() { } private static readonly RepeatedGroup defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupFieldNames = new string[] { "a" }; private static readonly uint[] _repeatedGroupFieldTags = new uint[] { 376 }; @@ -5496,6 +5500,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDeprecatedFields : pb::GeneratedMessage { + private TestDeprecatedFields() { } private static readonly TestDeprecatedFields defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDeprecatedFieldsFieldNames = new string[] { "deprecated_int32" }; private static readonly uint[] _testDeprecatedFieldsFieldTags = new uint[] { 8 }; @@ -5741,6 +5746,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class ForeignMessage : pb::GeneratedMessage { + private ForeignMessage() { } private static readonly ForeignMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _foreignMessageFieldNames = new string[] { "c" }; private static readonly uint[] _foreignMessageFieldTags = new uint[] { 8 }; @@ -5980,6 +5986,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestAllExtensions : pb::ExtendableMessage { + private TestAllExtensions() { } private static readonly TestAllExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testAllExtensionsFieldNames = new string[] { }; private static readonly uint[] _testAllExtensionsFieldTags = new uint[] { }; @@ -6183,6 +6190,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OptionalGroup_extension : pb::GeneratedMessage { + private OptionalGroup_extension() { } private static readonly OptionalGroup_extension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _optionalGroupExtensionFieldNames = new string[] { "a" }; private static readonly uint[] _optionalGroupExtensionFieldTags = new uint[] { 136 }; @@ -6422,6 +6430,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class RepeatedGroup_extension : pb::GeneratedMessage { + private RepeatedGroup_extension() { } private static readonly RepeatedGroup_extension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _repeatedGroupExtensionFieldNames = new string[] { "a" }; private static readonly uint[] _repeatedGroupExtensionFieldTags = new uint[] { 376 }; @@ -6661,6 +6670,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestNestedExtension : pb::GeneratedMessage { + private TestNestedExtension() { } private static readonly TestNestedExtension defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testNestedExtensionFieldNames = new string[] { }; private static readonly uint[] _testNestedExtensionFieldTags = new uint[] { }; @@ -6861,6 +6871,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequired : pb::GeneratedMessage { + private TestRequired() { } private static readonly TestRequired defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRequiredFieldNames = new string[] { "a", "b", "c", "dummy10", "dummy11", "dummy12", "dummy13", "dummy14", "dummy15", "dummy16", "dummy17", "dummy18", "dummy19", "dummy2", "dummy20", "dummy21", "dummy22", "dummy23", "dummy24", "dummy25", "dummy26", "dummy27", "dummy28", "dummy29", "dummy30", "dummy31", "dummy32", "dummy4", "dummy5", "dummy6", "dummy7", "dummy8", "dummy9" }; private static readonly uint[] _testRequiredFieldTags = new uint[] { 8, 24, 264, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 16, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 32, 40, 48, 56, 64, 72 }; @@ -8419,6 +8430,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRequiredForeign : pb::GeneratedMessage { + private TestRequiredForeign() { } private static readonly TestRequiredForeign defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRequiredForeignFieldNames = new string[] { "dummy", "optional_message", "repeated_message" }; private static readonly uint[] _testRequiredForeignFieldTags = new uint[] { 24, 10, 18 }; @@ -8792,6 +8804,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestForeignNested : pb::GeneratedMessage { + private TestForeignNested() { } private static readonly TestForeignNested defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testForeignNestedFieldNames = new string[] { "foreign_nested" }; private static readonly uint[] _testForeignNestedFieldTags = new uint[] { 10 }; @@ -9054,6 +9067,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestEmptyMessage : pb::GeneratedMessage { + private TestEmptyMessage() { } private static readonly TestEmptyMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testEmptyMessageFieldNames = new string[] { }; private static readonly uint[] _testEmptyMessageFieldTags = new uint[] { }; @@ -9252,6 +9266,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestEmptyMessageWithExtensions : pb::ExtendableMessage { + private TestEmptyMessageWithExtensions() { } private static readonly TestEmptyMessageWithExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testEmptyMessageWithExtensionsFieldNames = new string[] { }; private static readonly uint[] _testEmptyMessageWithExtensionsFieldTags = new uint[] { }; @@ -9455,6 +9470,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMultipleExtensionRanges : pb::ExtendableMessage { + private TestMultipleExtensionRanges() { } private static readonly TestMultipleExtensionRanges defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMultipleExtensionRangesFieldNames = new string[] { }; private static readonly uint[] _testMultipleExtensionRangesFieldTags = new uint[] { }; @@ -9660,6 +9676,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestReallyLargeTagNumber : pb::GeneratedMessage { + private TestReallyLargeTagNumber() { } private static readonly TestReallyLargeTagNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testReallyLargeTagNumberFieldNames = new string[] { "a", "bb" }; private static readonly uint[] _testReallyLargeTagNumberFieldTags = new uint[] { 8, 2147483640 }; @@ -9940,6 +9957,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRecursiveMessage : pb::GeneratedMessage { + private TestRecursiveMessage() { } private static readonly TestRecursiveMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRecursiveMessageFieldNames = new string[] { "a", "i" }; private static readonly uint[] _testRecursiveMessageFieldTags = new uint[] { 10, 16 }; @@ -10243,6 +10261,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMutualRecursionA : pb::GeneratedMessage { + private TestMutualRecursionA() { } private static readonly TestMutualRecursionA defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMutualRecursionAFieldNames = new string[] { "bb" }; private static readonly uint[] _testMutualRecursionAFieldTags = new uint[] { 10 }; @@ -10505,6 +10524,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestMutualRecursionB : pb::GeneratedMessage { + private TestMutualRecursionB() { } private static readonly TestMutualRecursionB defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testMutualRecursionBFieldNames = new string[] { "a", "optional_int32" }; private static readonly uint[] _testMutualRecursionBFieldTags = new uint[] { 10, 16 }; @@ -10808,6 +10828,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDupFieldNumber : pb::GeneratedMessage { + private TestDupFieldNumber() { } private static readonly TestDupFieldNumber defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDupFieldNumberFieldNames = new string[] { "a", "bar", "foo" }; private static readonly uint[] _testDupFieldNumberFieldTags = new uint[] { 8, 27, 19 }; @@ -10840,6 +10861,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Foo : pb::GeneratedMessage { + private Foo() { } private static readonly Foo defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooFieldNames = new string[] { "a" }; private static readonly uint[] _fooFieldTags = new uint[] { 8 }; @@ -11079,6 +11101,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class Bar : pb::GeneratedMessage { + private Bar() { } private static readonly Bar defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barFieldNames = new string[] { "a" }; private static readonly uint[] _barFieldTags = new uint[] { 8 }; @@ -11661,6 +11684,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestNestedMessageHasBits : pb::GeneratedMessage { + private TestNestedMessageHasBits() { } private static readonly TestNestedMessageHasBits defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testNestedMessageHasBitsFieldNames = new string[] { "optional_nested_message" }; private static readonly uint[] _testNestedMessageHasBitsFieldTags = new uint[] { 10 }; @@ -11693,6 +11717,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class NestedMessage : pb::GeneratedMessage { + private NestedMessage() { } private static readonly NestedMessage defaultInstance = new Builder().BuildPartial(); private static readonly string[] _nestedMessageFieldNames = new string[] { "nestedmessage_repeated_foreignmessage", "nestedmessage_repeated_int32" }; private static readonly uint[] _nestedMessageFieldTags = new uint[] { 18, 8 }; @@ -12251,6 +12276,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestCamelCaseFieldNames : pb::GeneratedMessage { + private TestCamelCaseFieldNames() { } private static readonly TestCamelCaseFieldNames defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testCamelCaseFieldNamesFieldNames = new string[] { "CordField", "EnumField", "MessageField", "PrimitiveField", "RepeatedCordField", "RepeatedEnumField", "RepeatedMessageField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedStringPieceField", "StringField", "StringPieceField" }; private static readonly uint[] _testCamelCaseFieldNamesFieldTags = new uint[] { 50, 24, 34, 8, 98, 72, 82, 56, 66, 90, 18, 42 }; @@ -13097,6 +13123,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestFieldOrderings : pb::ExtendableMessage { + private TestFieldOrderings() { } private static readonly TestFieldOrderings defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testFieldOrderingsFieldNames = new string[] { "my_float", "my_int", "my_string" }; private static readonly uint[] _testFieldOrderingsFieldTags = new uint[] { 813, 8, 90 }; @@ -13425,6 +13452,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestExtremeDefaultValues : pb::GeneratedMessage { + private TestExtremeDefaultValues() { } private static readonly TestExtremeDefaultValues defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testExtremeDefaultValuesFieldNames = new string[] { "escaped_bytes", "inf_double", "inf_float", "large_float", "large_uint32", "large_uint64", "nan_double", "nan_float", "neg_inf_double", "neg_inf_float", "negative_float", "negative_one_float", "one_float", "small_float", "small_int32", "small_int64", "small_negative_float", "utf8_string", "zero_float" }; private static readonly uint[] _testExtremeDefaultValuesFieldTags = new uint[] { 10, 113, 141, 101, 16, 24, 129, 157, 121, 149, 93, 85, 69, 77, 32, 40, 109, 50, 61 }; @@ -14410,6 +14438,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OneString : pb::GeneratedMessage { + private OneString() { } private static readonly OneString defaultInstance = new Builder().BuildPartial(); private static readonly string[] _oneStringFieldNames = new string[] { "data" }; private static readonly uint[] _oneStringFieldTags = new uint[] { 10 }; @@ -14650,6 +14679,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class OneBytes : pb::GeneratedMessage { + private OneBytes() { } private static readonly OneBytes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _oneBytesFieldNames = new string[] { "data" }; private static readonly uint[] _oneBytesFieldTags = new uint[] { 10 }; @@ -14890,6 +14920,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedTypes : pb::GeneratedMessage { + private TestPackedTypes() { } private static readonly TestPackedTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedTypesFieldNames = new string[] { "packed_bool", "packed_double", "packed_enum", "packed_fixed32", "packed_fixed64", "packed_float", "packed_int32", "packed_int64", "packed_sfixed32", "packed_sfixed64", "packed_sint32", "packed_sint64", "packed_uint32", "packed_uint64" }; private static readonly uint[] _testPackedTypesFieldTags = new uint[] { 818, 810, 826, 770, 778, 802, 722, 730, 786, 794, 754, 762, 738, 746 }; @@ -15980,6 +16011,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedTypes : pb::GeneratedMessage { + private TestUnpackedTypes() { } private static readonly TestUnpackedTypes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedTypesFieldNames = new string[] { "unpacked_bool", "unpacked_double", "unpacked_enum", "unpacked_fixed32", "unpacked_fixed64", "unpacked_float", "unpacked_int32", "unpacked_int64", "unpacked_sfixed32", "unpacked_sfixed64", "unpacked_sint32", "unpacked_sint64", "unpacked_uint32", "unpacked_uint64" }; private static readonly uint[] _testUnpackedTypesFieldTags = new uint[] { 816, 809, 824, 773, 777, 805, 720, 728, 789, 793, 752, 760, 736, 744 }; @@ -17015,6 +17047,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestPackedExtensions : pb::ExtendableMessage { + private TestPackedExtensions() { } private static readonly TestPackedExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testPackedExtensionsFieldNames = new string[] { }; private static readonly uint[] _testPackedExtensionsFieldTags = new uint[] { }; @@ -17218,6 +17251,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestUnpackedExtensions : pb::ExtendableMessage { + private TestUnpackedExtensions() { } private static readonly TestUnpackedExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testUnpackedExtensionsFieldNames = new string[] { }; private static readonly uint[] _testUnpackedExtensionsFieldTags = new uint[] { }; @@ -17421,6 +17455,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestDynamicExtensions : pb::GeneratedMessage { + private TestDynamicExtensions() { } private static readonly TestDynamicExtensions defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testDynamicExtensionsFieldNames = new string[] { "dynamic_enum_extension", "dynamic_message_extension", "enum_extension", "message_extension", "packed_extension", "repeated_extension", "scalar_extension" }; private static readonly uint[] _testDynamicExtensionsFieldTags = new uint[] { 16016, 16034, 16008, 16026, 16050, 16042, 16005 }; @@ -17461,6 +17496,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class DynamicMessageType : pb::GeneratedMessage { + private DynamicMessageType() { } private static readonly DynamicMessageType defaultInstance = new Builder().BuildPartial(); private static readonly string[] _dynamicMessageTypeFieldNames = new string[] { "dynamic_field" }; private static readonly uint[] _dynamicMessageTypeFieldTags = new uint[] { 16800 }; @@ -18265,6 +18301,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::GeneratedMessage { + private TestRepeatedScalarDifferentTagSizes() { } private static readonly TestRepeatedScalarDifferentTagSizes defaultInstance = new Builder().BuildPartial(); private static readonly string[] _testRepeatedScalarDifferentTagSizesFieldNames = new string[] { "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_int32", "repeated_int64", "repeated_uint64" }; private static readonly uint[] _testRepeatedScalarDifferentTagSizesFieldTags = new uint[] { 101, 16369, 2097141, 104, 16376, 2097144 }; @@ -18826,6 +18863,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FooRequest : pb::GeneratedMessage { + private FooRequest() { } private static readonly FooRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooRequestFieldNames = new string[] { }; private static readonly uint[] _fooRequestFieldTags = new uint[] { }; @@ -19024,6 +19062,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class FooResponse : pb::GeneratedMessage { + private FooResponse() { } private static readonly FooResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _fooResponseFieldNames = new string[] { }; private static readonly uint[] _fooResponseFieldTags = new uint[] { }; @@ -19222,6 +19261,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class BarRequest : pb::GeneratedMessage { + private BarRequest() { } private static readonly BarRequest defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barRequestFieldNames = new string[] { }; private static readonly uint[] _barRequestFieldTags = new uint[] { }; @@ -19420,6 +19460,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")] public sealed partial class BarResponse : pb::GeneratedMessage { + private BarResponse() { } private static readonly BarResponse defaultInstance = new Builder().BuildPartial(); private static readonly string[] _barResponseFieldNames = new string[] { }; private static readonly uint[] _barResponseFieldTags = new uint[] { }; From 353b0fad9042c183de3f874cde072f75a60d8d2a Mon Sep 17 00:00:00 2001 From: csharptest Date: Thu, 29 Sep 2011 16:33:31 -0500 Subject: [PATCH 27/31] Changes from code review --- .../AbstractWriter.cs | 19 +------------------ .../Http/MessageFormatOptions.cs | 2 +- .../JsonFormatWriter.cs | 18 +----------------- .../XmlFormatReader.cs | 16 ++++++++-------- .../XmlFormatWriter.cs | 18 ------------------ .../TestWriterFormatJson.cs | 2 +- .../TestWriterFormatXml.cs | 2 +- src/ProtocolBuffers/CodedOutputStream.cs | 14 +------------- src/ProtocolBuffers/ICodedOutputStream.cs | 2 +- 9 files changed, 15 insertions(+), 78 deletions(-) diff --git a/src/ProtocolBuffers.Serialization/AbstractWriter.cs b/src/ProtocolBuffers.Serialization/AbstractWriter.cs index 7ae268646f..1e087ec676 100644 --- a/src/ProtocolBuffers.Serialization/AbstractWriter.cs +++ b/src/ProtocolBuffers.Serialization/AbstractWriter.cs @@ -12,18 +12,8 @@ namespace Google.ProtocolBuffers.Serialization /// /// Provides a base class for writers that performs some basic type dispatching /// - public abstract class AbstractWriter : ICodedOutputStream, IDisposable + public abstract class AbstractWriter : ICodedOutputStream { - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public void Dispose() - { - GC.SuppressFinalize(this); - Flush(); - Dispose(true); - } - /// /// Completes any pending write operations /// @@ -31,13 +21,6 @@ namespace Google.ProtocolBuffers.Serialization { } - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - protected virtual void Dispose(bool disposing) - { - } - /// /// Writes the message to the the formatted stream. /// diff --git a/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs b/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs index 4ee18891ef..72d737171d 100644 --- a/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs +++ b/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs @@ -8,7 +8,7 @@ namespace Google.ProtocolBuffers.Serialization.Http /// /// Defines control information for the various formatting used with HTTP services /// - public struct MessageFormatOptions + public class MessageFormatOptions { /// The mime type for xml content /// Other valid xml mime types include: application/binary, application/x-protobuf diff --git a/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs b/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs index 15e08e0522..035870df23 100644 --- a/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs +++ b/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs @@ -239,27 +239,11 @@ namespace Google.ProtocolBuffers.Serialization /// Gets or sets the whitespace to use to separate the text, default = empty public string Whitespace { get; set; } - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - protected override void Dispose(bool disposing) - { - if (disposing) - { - while (_counter.Count > 1) - { - WriteMessageEnd(); - } - } - - base.Dispose(disposing); - } - private void Seperator() { if (_counter.Count == 0) { - throw new InvalidOperationException("Missmatched open/close in Json writer."); + throw new InvalidOperationException("Mismatched open/close in Json writer."); } int index = _counter.Count - 1; diff --git a/src/ProtocolBuffers.Serialization/XmlFormatReader.cs b/src/ProtocolBuffers.Serialization/XmlFormatReader.cs index 98b6977678..bf21db5545 100644 --- a/src/ProtocolBuffers.Serialization/XmlFormatReader.cs +++ b/src/ProtocolBuffers.Serialization/XmlFormatReader.cs @@ -14,16 +14,16 @@ namespace Google.ProtocolBuffers.Serialization { public const string DefaultRootElementName = XmlFormatWriter.DefaultRootElementName; private readonly XmlReader _input; - private readonly Stack _elements; + private readonly Stack _elements; private string _rootElementName; - private struct ElementStack + private struct ElementStackEntry { public readonly string LocalName; public readonly int Depth; public readonly bool IsEmpty; - public ElementStack(string localName, int depth, bool isEmpty) : this() + public ElementStackEntry(string localName, int depth, bool isEmpty) : this() { LocalName = localName; IsEmpty = isEmpty; @@ -87,7 +87,7 @@ namespace Google.ProtocolBuffers.Serialization { _input = input; _rootElementName = DefaultRootElementName; - _elements = new Stack(); + _elements = new Stack(); Options = XmlReaderOptions.None; } @@ -144,7 +144,7 @@ namespace Google.ProtocolBuffers.Serialization continue; } Assert(_input.IsStartElement() && _input.LocalName == element); - _elements.Push(new ElementStack(element, _input.Depth, _input.IsEmptyElement)); + _elements.Push(new ElementStackEntry(element, _input.Depth, _input.IsEmptyElement)); _input.Read(); } @@ -156,7 +156,7 @@ namespace Google.ProtocolBuffers.Serialization { Assert(_elements.Count > 0); - ElementStack stop = _elements.Peek(); + ElementStackEntry stop = _elements.Peek(); while (_input.NodeType != XmlNodeType.EndElement && _input.NodeType != XmlNodeType.Element && _input.Depth > stop.Depth && _input.Read()) { @@ -211,10 +211,10 @@ namespace Google.ProtocolBuffers.Serialization /// protected override bool PeekNext(out string field) { - ElementStack stopNode; + ElementStackEntry stopNode; if (_elements.Count == 0) { - stopNode = new ElementStack(null, _input.Depth - 1, false); + stopNode = new ElementStackEntry(null, _input.Depth - 1, false); } else { diff --git a/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs b/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs index 3c5cb3ab16..fc3f9dc2ca 100644 --- a/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs +++ b/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs @@ -71,24 +71,6 @@ namespace Google.ProtocolBuffers.Serialization _rootElementName = DefaultRootElementName; } - /// - /// Closes the underlying XmlTextWriter - /// - protected override void Dispose(bool disposing) - { - if (disposing) - { - while (_messageOpenCount > 0) - { - WriteMessageEnd(); - } - - _output.Close(); - } - - base.Dispose(disposing); - } - /// /// Gets or sets the default element name to use when using the Merge<TBuilder>() /// diff --git a/src/ProtocolBuffers.Test/TestWriterFormatJson.cs b/src/ProtocolBuffers.Test/TestWriterFormatJson.cs index 1958df0de3..1a1a480d9d 100644 --- a/src/ProtocolBuffers.Test/TestWriterFormatJson.cs +++ b/src/ProtocolBuffers.Test/TestWriterFormatJson.cs @@ -43,8 +43,8 @@ namespace Google.ProtocolBuffers .Build(); using (TextWriter output = new StringWriter()) - using (AbstractWriter writer = JsonFormatWriter.CreateInstance(output)) { + ICodedOutputStream writer = JsonFormatWriter.CreateInstance(output); writer.WriteMessageStart(); //manually begin the message, output is '{' writer.Flush(); diff --git a/src/ProtocolBuffers.Test/TestWriterFormatXml.cs b/src/ProtocolBuffers.Test/TestWriterFormatXml.cs index f401481eec..46853582b1 100644 --- a/src/ProtocolBuffers.Test/TestWriterFormatXml.cs +++ b/src/ProtocolBuffers.Test/TestWriterFormatXml.cs @@ -46,8 +46,8 @@ namespace Google.ProtocolBuffers .Build(); using (TextWriter output = new StringWriter()) - using (AbstractWriter writer = XmlFormatWriter.CreateInstance(output)) { + ICodedOutputStream writer = XmlFormatWriter.CreateInstance(output); writer.WriteMessageStart(); //manually begin the message, output is '{' ICodedOutputStream stream = writer; diff --git a/src/ProtocolBuffers/CodedOutputStream.cs b/src/ProtocolBuffers/CodedOutputStream.cs index 709082a71d..b9c7b58740 100644 --- a/src/ProtocolBuffers/CodedOutputStream.cs +++ b/src/ProtocolBuffers/CodedOutputStream.cs @@ -57,7 +57,7 @@ namespace Google.ProtocolBuffers /// methods are taken from the protocol buffer type names, not .NET types. /// (Hence WriteFloat instead of WriteSingle, and WriteBool instead of WriteBoolean.) /// - public sealed partial class CodedOutputStream : ICodedOutputStream, IDisposable + public sealed partial class CodedOutputStream : ICodedOutputStream { /// /// The buffer size used by CreateInstance(Stream). @@ -126,18 +126,6 @@ namespace Google.ProtocolBuffers #endregion - public void Dispose() - { - if (output != null) - { - if (position > 0) - { - Flush(); - } - output.Dispose(); - } - } - void ICodedOutputStream.WriteMessageStart() { } void ICodedOutputStream.WriteMessageEnd() { Flush(); } diff --git a/src/ProtocolBuffers/ICodedOutputStream.cs b/src/ProtocolBuffers/ICodedOutputStream.cs index a686fed178..8619508a1c 100644 --- a/src/ProtocolBuffers/ICodedOutputStream.cs +++ b/src/ProtocolBuffers/ICodedOutputStream.cs @@ -49,7 +49,7 @@ namespace Google.ProtocolBuffers /// in their binary form by creating a instance via the CodedOutputStream.CreateInstance /// static factory. /// - public interface ICodedOutputStream : IDisposable + public interface ICodedOutputStream { /// /// Writes any message initialization data needed to the output stream From 4b75bbe45f544152ca883b573cfb6728a859ab66 Mon Sep 17 00:00:00 2001 From: csharptest Date: Thu, 29 Sep 2011 19:09:32 -0500 Subject: [PATCH 28/31] Fix for incorrect handling of Whitespace after an array open in XmlFormatReader --- .../XmlFormatReader.cs | 8 +++++-- .../Compatibility/JsonCompatibilityTests.cs | 18 ++++++++++++++++ .../Compatibility/XmlCompatibilityTests.cs | 21 +++++++++++++++++++ .../TestWriterFormatXml.cs | 8 +++++-- 4 files changed, 51 insertions(+), 4 deletions(-) diff --git a/src/ProtocolBuffers.Serialization/XmlFormatReader.cs b/src/ProtocolBuffers.Serialization/XmlFormatReader.cs index bf21db5545..200271777d 100644 --- a/src/ProtocolBuffers.Serialization/XmlFormatReader.cs +++ b/src/ProtocolBuffers.Serialization/XmlFormatReader.cs @@ -315,10 +315,14 @@ namespace Google.ProtocolBuffers.Serialization } else { + string found; ReadMessageStart(field); - foreach (string item in NonNestedArrayItems("item")) + if (PeekNext(out found) && found == "item") { - yield return item; + foreach (string item in NonNestedArrayItems("item")) + { + yield return item; + } } ReadMessageEnd(); } diff --git a/src/ProtocolBuffers.Test/Compatibility/JsonCompatibilityTests.cs b/src/ProtocolBuffers.Test/Compatibility/JsonCompatibilityTests.cs index fb89504064..6b368b7da7 100644 --- a/src/ProtocolBuffers.Test/Compatibility/JsonCompatibilityTests.cs +++ b/src/ProtocolBuffers.Test/Compatibility/JsonCompatibilityTests.cs @@ -7,6 +7,24 @@ namespace Google.ProtocolBuffers.Compatibility { [TestFixture] public class JsonCompatibilityTests : CompatibilityTests + { + protected override object SerializeMessage(TMessage message) + { + StringWriter sw = new StringWriter(); + JsonFormatWriter.CreateInstance(sw) + .WriteMessage(message); + return sw.ToString(); + } + + protected override TBuilder DeserializeMessage(object message, TBuilder builder, ExtensionRegistry registry) + { + JsonFormatReader.CreateInstance((string)message).Merge(builder); + return builder; + } + } + + [TestFixture] + public class JsonCompatibilityFormattedTests : CompatibilityTests { protected override object SerializeMessage(TMessage message) { diff --git a/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs b/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs index 50ef6f0305..62b9456a7b 100644 --- a/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs +++ b/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs @@ -1,4 +1,5 @@ using System.IO; +using System.Xml; using Google.ProtocolBuffers.Serialization; using Google.ProtocolBuffers.TestProtos; using NUnit.Framework; @@ -22,4 +23,24 @@ namespace Google.ProtocolBuffers.Compatibility return reader.Merge("root", builder, registry); } } + + [TestFixture] + public class XmlCompatibilityFormattedTests : CompatibilityTests + { + protected override object SerializeMessage(TMessage message) + { + StringWriter text = new StringWriter(); + XmlWriter xwtr = XmlWriter.Create(text, new XmlWriterSettings { Indent = true, IndentChars = " " }); + + XmlFormatWriter writer = XmlFormatWriter.CreateInstance(xwtr).SetOptions(XmlWriterOptions.OutputNestedArrays); + writer.WriteMessage("root", message); + return text.ToString(); + } + + protected override TBuilder DeserializeMessage(object message, TBuilder builder, ExtensionRegistry registry) + { + XmlFormatReader reader = XmlFormatReader.CreateInstance((string)message).SetOptions(XmlReaderOptions.ReadNestedArrays); + return reader.Merge("root", builder, registry); + } + } } \ No newline at end of file diff --git a/src/ProtocolBuffers.Test/TestWriterFormatXml.cs b/src/ProtocolBuffers.Test/TestWriterFormatXml.cs index 46853582b1..a52d04e1e6 100644 --- a/src/ProtocolBuffers.Test/TestWriterFormatXml.cs +++ b/src/ProtocolBuffers.Test/TestWriterFormatXml.cs @@ -194,7 +194,9 @@ namespace Google.ProtocolBuffers .Build(); StringWriter sw = new StringWriter(); - XmlFormatWriter.CreateInstance(sw).WriteMessage("root", message); + XmlWriter xwtr = XmlWriter.Create(sw, new XmlWriterSettings {Indent = true, IndentChars = " "}); + + XmlFormatWriter.CreateInstance(xwtr).WriteMessage("root", message); string xml = sw.ToString(); @@ -221,7 +223,9 @@ namespace Google.ProtocolBuffers .Build(); StringWriter sw = new StringWriter(); - XmlFormatWriter.CreateInstance(sw) + XmlWriter xwtr = XmlWriter.Create(sw, new XmlWriterSettings { Indent = true, IndentChars = " " }); + + XmlFormatWriter.CreateInstance(xwtr) .SetOptions(XmlWriterOptions.OutputNestedArrays | XmlWriterOptions.OutputEnumValues) .WriteMessage("root", message); From fa8fa92499e4bb5f74ecaa08535f177c56d8fd52 Mon Sep 17 00:00:00 2001 From: csharptest Date: Thu, 29 Sep 2011 19:11:24 -0500 Subject: [PATCH 29/31] Added missing calls to ReadMessageEnd and writer.Flush. Added unit tests for mime-type services extension. --- .../Http/MessageFormatFactory.cs | 5 +- .../Http/ServiceExtensions.cs | 1 + .../ProtocolBuffers.Test.csproj | 1 + .../TestRpcForMimeTypes.cs | 386 ++++++++++++++++++ 4 files changed, 392 insertions(+), 1 deletion(-) create mode 100644 src/ProtocolBuffers.Test/TestRpcForMimeTypes.cs diff --git a/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs b/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs index 8d389f07de..52fff83fc3 100644 --- a/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs +++ b/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs @@ -44,7 +44,9 @@ namespace Google.ProtocolBuffers.Serialization.Http { ICodedInputStream codedInput = CreateInputStream(options, contentType, input); codedInput.ReadMessageStart(); - return (TBuilder)builder.WeakMergeFrom(codedInput, options.ExtensionRegistry); + builder.WeakMergeFrom(codedInput, options.ExtensionRegistry); + codedInput.ReadMessageEnd(); + return builder; } /// @@ -110,6 +112,7 @@ namespace Google.ProtocolBuffers.Serialization.Http // Write the closing message fragment codedOutput.WriteMessageEnd(); + codedOutput.Flush(); } private static ICodedInputStream ContentTypeToInputStream(string contentType, MessageFormatOptions options, Stream input) diff --git a/src/ProtocolBuffers.Serialization/Http/ServiceExtensions.cs b/src/ProtocolBuffers.Serialization/Http/ServiceExtensions.cs index 022cfb6a4c..6177d9dbdf 100644 --- a/src/ProtocolBuffers.Serialization/Http/ServiceExtensions.cs +++ b/src/ProtocolBuffers.Serialization/Http/ServiceExtensions.cs @@ -27,6 +27,7 @@ namespace Google.ProtocolBuffers.Serialization.Http ICodedInputStream codedInput = MessageFormatFactory.CreateInputStream(options, contentType, input); codedInput.ReadMessageStart(); IMessageLite response = stub.CallMethod(methodName, codedInput, options.ExtensionRegistry); + codedInput.ReadMessageEnd(); response.WriteTo(options, responseType, output); } } diff --git a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj index 42b5e24151..2633c3cb8d 100644 --- a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj +++ b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj @@ -88,6 +88,7 @@ + diff --git a/src/ProtocolBuffers.Test/TestRpcForMimeTypes.cs b/src/ProtocolBuffers.Test/TestRpcForMimeTypes.cs new file mode 100644 index 0000000000..a8d2b1638e --- /dev/null +++ b/src/ProtocolBuffers.Test/TestRpcForMimeTypes.cs @@ -0,0 +1,386 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using Google.ProtocolBuffers; +using Google.ProtocolBuffers.Serialization.Http; +using Google.ProtocolBuffers.TestProtos; +using NUnit.Framework; +using System.IO; +using Google.ProtocolBuffers.Serialization; +using System.Text; + +namespace Google.ProtocolBuffers +{ + /// + /// This class verifies the correct code is generated from unittest_rpc_interop.proto and provides a small demonstration + /// of using the new IRpcDispatch to write a client/server + /// + [TestFixture] + public class TestRpcForMimeTypes + { + /// + /// A sample implementation of the ISearchService for testing + /// + private class ExampleSearchImpl : ISearchService + { + SearchResponse ISearchService.Search(SearchRequest searchRequest) + { + if (searchRequest.CriteriaCount == 0) + { + throw new ArgumentException("No criteria specified.", new InvalidOperationException()); + } + SearchResponse.Builder resp = SearchResponse.CreateBuilder(); + foreach (string criteria in searchRequest.CriteriaList) + { + resp.AddResults( + SearchResponse.Types.ResultItem.CreateBuilder().SetName(criteria).SetUrl("http://search.com"). + Build()); + } + return resp.Build(); + } + + SearchResponse ISearchService.RefineSearch(RefineSearchRequest refineSearchRequest) + { + SearchResponse.Builder resp = refineSearchRequest.PreviousResults.ToBuilder(); + foreach (string criteria in refineSearchRequest.CriteriaList) + { + resp.AddResults( + SearchResponse.Types.ResultItem.CreateBuilder().SetName(criteria).SetUrl("http://refine.com"). + Build()); + } + return resp.Build(); + } + } + + /// + /// An example extraction of the wire protocol + /// + private interface IHttpTransfer + { + void Execute(string method, string contentType, Stream input, string acceptType, Stream output); + } + + /// + /// An example of a server responding to a web/http request + /// + private class ExampleHttpServer : IHttpTransfer + { + public readonly MessageFormatOptions Options = + new MessageFormatOptions + { + ExtensionRegistry = ExtensionRegistry.Empty, + FormattedOutput = true, + XmlReaderOptions = XmlReaderOptions.ReadNestedArrays, + XmlReaderRootElementName = "request", + XmlWriterOptions = XmlWriterOptions.OutputNestedArrays, + XmlWriterRootElementName = "response" + }; + + private readonly IRpcServerStub _stub; + + public ExampleHttpServer(ISearchService implementation) + { + //on the server, we create a dispatch to call the appropriate method by name + IRpcDispatch dispatch = new SearchService.Dispatch(implementation); + //we then wrap that dispatch in a server stub which will deserialize the wire bytes to the message + //type appropriate for the method name being invoked. + _stub = new SearchService.ServerStub(dispatch); + } + + void IHttpTransfer.Execute(string method, string contentType, Stream input, string acceptType, Stream output) + { + //Extension for: Google.ProtocolBuffers.Serialization.Http.ServiceExtensions.HttpCallMethod(_stub, + _stub.HttpCallMethod( + method, Options, + contentType, input, + acceptType, output + ); + } + } + + /// + /// An example of a client sending a wire request + /// + private class ExampleClient : IRpcDispatch + { + public readonly MessageFormatOptions Options = + new MessageFormatOptions + { + ExtensionRegistry = ExtensionRegistry.Empty, + FormattedOutput = true, + XmlReaderOptions = XmlReaderOptions.ReadNestedArrays, + XmlReaderRootElementName = "response", + XmlWriterOptions = XmlWriterOptions.OutputNestedArrays, + XmlWriterRootElementName = "request" + }; + + + private readonly IHttpTransfer _wire; + private readonly string _mimeType; + + public ExampleClient(IHttpTransfer wire, string mimeType) + { + _wire = wire; + _mimeType = mimeType; + } + + TMessage IRpcDispatch.CallMethod(string method, IMessageLite request, + IBuilderLite response) + { + MemoryStream input = new MemoryStream(); + MemoryStream output = new MemoryStream(); + + //Write to _mimeType format + request.WriteTo(Options, _mimeType, input); + + input.Position = 0; + _wire.Execute(method, _mimeType, input, _mimeType, output); + + //Read from _mimeType format + output.Position = 0; + response.MergeFrom(Options, _mimeType, output); + + return response.Build(); + } + } + + /// + /// Test sending and recieving messages via text/json + /// + [Test] + public void TestClientServerWithJsonFormat() + { + ExampleHttpServer server = new ExampleHttpServer(new ExampleSearchImpl()); + //obviously if this was a 'real' transport we would not use the server, rather the server would be listening, the client transmitting + IHttpTransfer wire = server; + + ISearchService client = new SearchService(new ExampleClient(wire, "text/json")); + //now the client has a real, typed, interface to work with: + SearchResponse result = client.Search(SearchRequest.CreateBuilder().AddCriteria("Test").Build()); + Assert.AreEqual(1, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + //The test part of this, call the only other method + result = + client.RefineSearch( + RefineSearchRequest.CreateBuilder().SetPreviousResults(result).AddCriteria("Refine").Build()); + Assert.AreEqual(2, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + Assert.AreEqual("Refine", result.ResultsList[1].Name); + Assert.AreEqual("http://refine.com", result.ResultsList[1].Url); + } + + /// + /// Test sending and recieving messages via text/json + /// + [Test] + public void TestClientServerWithXmlFormat() + { + ExampleHttpServer server = new ExampleHttpServer(new ExampleSearchImpl()); + //obviously if this was a 'real' transport we would not use the server, rather the server would be listening, the client transmitting + IHttpTransfer wire = server; + + ISearchService client = new SearchService(new ExampleClient(wire, "text/xml")); + //now the client has a real, typed, interface to work with: + SearchResponse result = client.Search(SearchRequest.CreateBuilder().AddCriteria("Test").Build()); + Assert.AreEqual(1, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + //The test part of this, call the only other method + result = + client.RefineSearch( + RefineSearchRequest.CreateBuilder().SetPreviousResults(result).AddCriteria("Refine").Build()); + Assert.AreEqual(2, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + Assert.AreEqual("Refine", result.ResultsList[1].Name); + Assert.AreEqual("http://refine.com", result.ResultsList[1].Url); + } + + /// + /// Test sending and recieving messages via text/json + /// + [Test] + public void TestClientServerWithProtoFormat() + { + ExampleHttpServer server = new ExampleHttpServer(new ExampleSearchImpl()); + //obviously if this was a 'real' transport we would not use the server, rather the server would be listening, the client transmitting + IHttpTransfer wire = server; + + ISearchService client = new SearchService(new ExampleClient(wire, "application/x-protobuf")); + //now the client has a real, typed, interface to work with: + SearchResponse result = client.Search(SearchRequest.CreateBuilder().AddCriteria("Test").Build()); + Assert.AreEqual(1, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + //The test part of this, call the only other method + result = + client.RefineSearch( + RefineSearchRequest.CreateBuilder().SetPreviousResults(result).AddCriteria("Refine").Build()); + Assert.AreEqual(2, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + Assert.AreEqual("Refine", result.ResultsList[1].Name); + Assert.AreEqual("http://refine.com", result.ResultsList[1].Url); + } + + /// + /// Test sending and recieving messages via text/json + /// + [Test] + public void TestClientServerWithCustomFormat() + { + ExampleHttpServer server = new ExampleHttpServer(new ExampleSearchImpl()); + //Setup our custom mime-type format as the only format supported: + server.Options.MimeInputTypes.Clear(); + server.Options.MimeInputTypes.Add("foo/bar", CodedInputStream.CreateInstance); + server.Options.MimeOutputTypes.Clear(); + server.Options.MimeOutputTypes.Add("foo/bar", CodedOutputStream.CreateInstance); + + //obviously if this was a 'real' transport we would not use the server, rather the server would be listening, the client transmitting + IHttpTransfer wire = server; + + ExampleClient exclient = new ExampleClient(wire, "foo/bar"); + //Add our custom mime-type format + exclient.Options.MimeInputTypes.Add("foo/bar", CodedInputStream.CreateInstance); + exclient.Options.MimeOutputTypes.Add("foo/bar", CodedOutputStream.CreateInstance); + ISearchService client = new SearchService(exclient); + + //now the client has a real, typed, interface to work with: + SearchResponse result = client.Search(SearchRequest.CreateBuilder().AddCriteria("Test").Build()); + Assert.AreEqual(1, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + //The test part of this, call the only other method + result = + client.RefineSearch( + RefineSearchRequest.CreateBuilder().SetPreviousResults(result).AddCriteria("Refine").Build()); + Assert.AreEqual(2, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + Assert.AreEqual("Refine", result.ResultsList[1].Name); + Assert.AreEqual("http://refine.com", result.ResultsList[1].Url); + } + + /// + /// Test sending and recieving messages via text/json + /// + [Test] + public void TestServerWithUriFormat() + { + ExampleHttpServer server = new ExampleHttpServer(new ExampleSearchImpl()); + //obviously if this was a 'real' transport we would not use the server, rather the server would be listening, the client transmitting + IHttpTransfer wire = server; + + MemoryStream input = new MemoryStream(Encoding.UTF8.GetBytes("?Criteria=Test&Criteria=Test+of%20URI")); + MemoryStream output = new MemoryStream(); + + //Call the server + wire.Execute("Search", + MessageFormatOptions.ContentFormUrlEncoded, input, + MessageFormatOptions.ContentTypeProtoBuffer, output + ); + + SearchResponse result = SearchResponse.ParseFrom(output.ToArray()); + Assert.AreEqual(2, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + Assert.AreEqual("Test of URI", result.ResultsList[1].Name); + Assert.AreEqual("http://search.com", result.ResultsList[1].Url); + } + + /// + /// Test sending and recieving messages via text/json + /// + [Test, ExpectedException(typeof(ArgumentOutOfRangeException))] + public void TestInvalidMimeType() + { + ExampleHttpServer server = new ExampleHttpServer(new ExampleSearchImpl()); + //obviously if this was a 'real' transport we would not use the server, rather the server would be listening, the client transmitting + IHttpTransfer wire = server; + + MemoryStream input = new MemoryStream(); + MemoryStream output = new MemoryStream(); + + //Call the server + wire.Execute("Search", + "bad/mime", input, + MessageFormatOptions.ContentTypeProtoBuffer, output + ); + Assert.Fail(); + } + + /// + /// Test sending and recieving messages via text/json + /// + [Test] + public void TestDefaultMimeType() + { + ExampleHttpServer server = new ExampleHttpServer(new ExampleSearchImpl()); + + //obviously if this was a 'real' transport we would not use the server, rather the server would be listening, the client transmitting + IHttpTransfer wire = server; + + + MemoryStream input = new MemoryStream(new SearchRequest.Builder().AddCriteria("Test").Build().ToByteArray()); + MemoryStream output = new MemoryStream(); + + //With this default set, any invalid/unknown mime-type will be mapped to use that format + server.Options.DefaultContentType = MessageFormatOptions.ContentTypeProtoBuffer; + + wire.Execute("Search", + "foo", input, + "bar", output + ); + + SearchResponse result = SearchResponse.ParseFrom(output.ToArray()); + Assert.AreEqual(1, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + } + } +} \ No newline at end of file From f67c83365f4fe7850eb25b6af38833de61c79057 Mon Sep 17 00:00:00 2001 From: csharptest Date: Thu, 29 Sep 2011 19:30:51 -0500 Subject: [PATCH 30/31] Added comments for private fields Renamed StartMessage(name) to WriteMessageStart(name) on XmlFormatWriter as this was intended to be an overload that did not get renamed. --- src/ProtocolBuffers.Serialization/JsonFormatReader.cs | 1 + src/ProtocolBuffers.Serialization/JsonFormatWriter.cs | 2 ++ src/ProtocolBuffers.Serialization/XmlFormatReader.cs | 4 ++++ src/ProtocolBuffers.Serialization/XmlFormatWriter.cs | 10 ++++++---- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/ProtocolBuffers.Serialization/JsonFormatReader.cs b/src/ProtocolBuffers.Serialization/JsonFormatReader.cs index 240ce625bc..7b88cafeb2 100644 --- a/src/ProtocolBuffers.Serialization/JsonFormatReader.cs +++ b/src/ProtocolBuffers.Serialization/JsonFormatReader.cs @@ -11,6 +11,7 @@ namespace Google.ProtocolBuffers.Serialization public class JsonFormatReader : AbstractTextReader { private readonly JsonCursor _input; + // The expected token that ends the current item, either ']' or '}' private readonly Stack _stopChar; private enum ReaderState diff --git a/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs b/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs index 035870df23..d7fd9e7b8e 100644 --- a/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs +++ b/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs @@ -168,7 +168,9 @@ namespace Google.ProtocolBuffers.Serialization #endregion + //Tracks the writer depth and the array element count at that depth. private readonly List _counter; + //True if the top-level of the writer is an array as opposed to a single message. private bool _isArray; /// diff --git a/src/ProtocolBuffers.Serialization/XmlFormatReader.cs b/src/ProtocolBuffers.Serialization/XmlFormatReader.cs index 200271777d..4bf6423c6c 100644 --- a/src/ProtocolBuffers.Serialization/XmlFormatReader.cs +++ b/src/ProtocolBuffers.Serialization/XmlFormatReader.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Xml; +using System.Diagnostics; namespace Google.ProtocolBuffers.Serialization { @@ -14,7 +15,9 @@ namespace Google.ProtocolBuffers.Serialization { public const string DefaultRootElementName = XmlFormatWriter.DefaultRootElementName; private readonly XmlReader _input; + // Tracks the message element for each nested message read private readonly Stack _elements; + // The default element name for ReadMessageStart private string _rootElementName; private struct ElementStackEntry @@ -118,6 +121,7 @@ namespace Google.ProtocolBuffers.Serialization } } + [DebuggerNonUserCode] private static void Assert(bool cond) { if (!cond) diff --git a/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs b/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs index fc3f9dc2ca..4bd27562cb 100644 --- a/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs +++ b/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs @@ -16,9 +16,11 @@ namespace Google.ProtocolBuffers.Serialization { private static readonly Encoding DefaultEncoding = new UTF8Encoding(false); public const string DefaultRootElementName = "root"; - private const int NestedArrayFlag = 0x0001; + private readonly XmlWriter _output; + // The default element name used for WriteMessageStart private string _rootElementName; + // Used to assert matching WriteMessageStart/WriteMessageEnd calls private int _messageOpenCount; private static XmlWriterSettings DefaultSettings(Encoding encoding) @@ -119,7 +121,7 @@ namespace Google.ProtocolBuffers.Serialization /// public override void WriteMessageStart() { - StartMessage(_rootElementName); + WriteMessageStart(_rootElementName); } /// @@ -127,7 +129,7 @@ namespace Google.ProtocolBuffers.Serialization /// After this call you can call IMessageLite.MergeTo(...) and complete the message with /// a call to WriteMessageEnd(). /// - public void StartMessage(string elementName) + public void WriteMessageStart(string elementName) { if (TestOption(XmlWriterOptions.OutputJsonTypes)) { @@ -169,7 +171,7 @@ namespace Google.ProtocolBuffers.Serialization /// public void WriteMessage(string elementName, IMessageLite message) { - StartMessage(elementName); + WriteMessageStart(elementName); message.WriteTo(this); WriteMessageEnd(); }