diff options
89 files changed, 16403 insertions, 4162 deletions
diff --git a/CHANGES.txt b/CHANGES.txt new file mode 100644 index 00000000..d3e5a85a --- /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/build/Build.bat b/build/Build.bat index 3269d54b..2b246cad 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 984fb791..e80ac8d9 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 bc1dd21e..1baccacf 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 6aa3b379..e2815961 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 921de957..bd2a7f86 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 863eafae..5a32f3f2 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 87729d8f..02f803bd 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 b8e773b2..2715f7b8 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/protos/extest/unittest_extras_lite.proto b/protos/extest/unittest_extras_lite.proto index 46d5ab91..72e7ee81 100644 --- a/protos/extest/unittest_extras_lite.proto +++ b/protos/extest/unittest_extras_lite.proto @@ -1,61 +1,62 @@ -// Additional options required for C# generation. File from copyright -// line onwards is as per original distribution. -import "google/protobuf/csharp_options.proto"; -option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; -option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasLiteProtoFile"; - -package protobuf_unittest_extra; - -option optimize_for = LITE_RUNTIME; - -option java_package = "com.google.protobuf"; - -message TestRequiredLite { - required int32 d = 1; - required ExtraEnum en = 2 [default = DEFAULT]; -} - -enum ExtraEnum { - DEFAULT = 10; - EXLITE_FOO = 7; - EXLITE_BAR = 8; - EXLITE_BAZ = 9; -} - -message TestInteropPersonLite { - required string name = 1; - required int32 id = 2; - optional string email = 3; - repeated int32 codes = 10 [packed=true]; - - enum PhoneType { - MOBILE = 0; - HOME = 1; - WORK = 2; - } - - message PhoneNumber { - required string number = 1; - optional PhoneType type = 2 [default = HOME]; - } - - repeated PhoneNumber phone = 4; - - repeated group Addresses = 5 { - required string address = 1; - optional string address2 = 2; - required string city = 3; - required string state = 4; - required fixed32 zip = 5; - } - - extensions 100 to 199; -} - -message TestInteropEmployeeIdLite { - required string number = 1; -} - -extend TestInteropPersonLite { - required TestInteropEmployeeIdLite employee_id_lite = 126; -} +// Additional options required for C# generation. File from copyright
+// line onwards is as per original distribution.
+import "google/protobuf/csharp_options.proto";
+option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
+option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasLiteProtoFile";
+option (google.protobuf.csharp_file_options).add_serializable = true;
+
+package protobuf_unittest_extra;
+
+option optimize_for = LITE_RUNTIME;
+
+option java_package = "com.google.protobuf";
+
+message TestRequiredLite {
+ required int32 d = 1;
+ required ExtraEnum en = 2 [default = DEFAULT];
+}
+
+enum ExtraEnum {
+ DEFAULT = 10;
+ EXLITE_FOO = 7;
+ EXLITE_BAR = 8;
+ EXLITE_BAZ = 9;
+}
+
+message TestInteropPersonLite {
+ required string name = 1;
+ required int32 id = 2;
+ optional string email = 3;
+ repeated int32 codes = 10 [packed=true];
+
+ enum PhoneType {
+ MOBILE = 0;
+ HOME = 1;
+ WORK = 2;
+ }
+
+ message PhoneNumber {
+ required string number = 1;
+ optional PhoneType type = 2 [default = HOME];
+ }
+
+ repeated PhoneNumber phone = 4;
+
+ repeated group Addresses = 5 {
+ required string address = 1;
+ optional string address2 = 2;
+ required string city = 3;
+ required string state = 4;
+ required fixed32 zip = 5;
+ }
+
+ extensions 100 to 199;
+}
+
+message TestInteropEmployeeIdLite {
+ required string number = 1;
+}
+
+extend TestInteropPersonLite {
+ required TestInteropEmployeeIdLite employee_id_lite = 126;
+}
diff --git a/protos/extest/unittest_extras_xmltest.proto b/protos/extest/unittest_extras_xmltest.proto index f00fb027..ab8088a7 100644 --- a/protos/extest/unittest_extras_xmltest.proto +++ b/protos/extest/unittest_extras_xmltest.proto @@ -1,52 +1,51 @@ import "google/protobuf/csharp_options.proto";
option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestXmlSerializerTestProtoFile";
+option (google.protobuf.csharp_file_options).add_serializable = true;
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/protos/extest/unittest_issues.proto b/protos/extest/unittest_issues.proto index 459e58f8..5e0da0ae 100644 --- a/protos/extest/unittest_issues.proto +++ b/protos/extest/unittest_issues.proto @@ -86,3 +86,47 @@ 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;
+}
+
+// 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];
+}
+
+// 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];
+}
\ No newline at end of file diff --git a/protos/google/protobuf/csharp_options.proto b/protos/google/protobuf/csharp_options.proto index 33a7b03d..9ebcfa6b 100644 --- a/protos/google/protobuf/csharp_options.proto +++ b/protos/google/protobuf/csharp_options.proto @@ -38,6 +38,9 @@ message CSharpFileOptions { // Generate attributes indicating non-CLS-compliance
optional bool cls_compliance = 8 [default = true];
+
+ // Generate messages/builders with the [Serializable] attribute
+ optional bool add_serializable = 9 [default = false];
// The extension that should be appended to the umbrella_classname when creating files.
optional string file_extension = 221 [default = ".cs"];
diff --git a/protos/npp.language.xml b/protos/npp.language.xml new file mode 100644 index 00000000..c6122180 --- /dev/null +++ b/protos/npp.language.xml @@ -0,0 +1,44 @@ +<NotepadPlus>
+<!--
+Defines syntax highlighting for Notepad++.
+1. Install Notepad++ from http://notepad-plus-plus.org
+2. Open Notepad++, from the View menu, select "User-Defined Dialog..."
+3. Click the "Import..." button and select this file
+4. Restart Notepad++
+5. Open and edit any *.proto file
+-->
+ <UserLang name="Proto Buffer" ext="proto">
+ <Settings>
+ <Global caseIgnored="no" />
+ <TreatAsSymbol comment="no" commentLine="yes" />
+ <Prefix words1="no" words2="no" words3="no" words4="yes" />
+ </Settings>
+ <KeywordLists>
+ <Keywords name="Delimiters">[00]00</Keywords>
+ <Keywords name="Folder+">{</Keywords>
+ <Keywords name="Folder-">}</Keywords>
+ <Keywords name="Operators">=</Keywords>
+ <Keywords name="Comment"> 1option 1package 1import 2; 0//</Keywords>
+ <Keywords name="Words1">message enum service extend</Keywords>
+ <Keywords name="Words2">required optional repeated extensions to rpc returns</Keywords>
+ <Keywords name="Words3">double float int32 int64 uint32 uint64 sint32 sint64 fixed32 fixed64 sfixed32 sfixed64 bool string bytes</Keywords>
+ <Keywords name="Words4"></Keywords>
+ </KeywordLists>
+ <Styles>
+ <WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
+ <WordsStyle name="FOLDEROPEN" styleID="12" fgColor="000000" bgColor="FFFFFF" fontStyle="1" />
+ <WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="000000" bgColor="FFFFFF" fontStyle="1" />
+ <WordsStyle name="KEYWORD1" styleID="5" fgColor="0000FF" bgColor="FFFFFF" fontStyle="0" />
+ <WordsStyle name="KEYWORD2" styleID="6" fgColor="0080C0" bgColor="FFFFFF" fontStyle="0" />
+ <WordsStyle name="KEYWORD3" styleID="7" fgColor="0000FF" bgColor="FFFFFF" fontStyle="0" />
+ <WordsStyle name="KEYWORD4" styleID="8" fgColor="008040" bgColor="FFFFFF" fontStyle="0" />
+ <WordsStyle name="COMMENT" styleID="1" fgColor="008000" bgColor="FFFFFF" fontStyle="0" />
+ <WordsStyle name="COMMENT LINE" styleID="2" fgColor="949494" bgColor="FFFFFF" fontStyle="0" />
+ <WordsStyle name="NUMBER" styleID="4" fgColor="FF0000" bgColor="FFFFFF" fontStyle="0" />
+ <WordsStyle name="OPERATOR" styleID="10" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
+ <WordsStyle name="DELIMINER1" styleID="14" fgColor="800080" bgColor="FFFFFF" fontStyle="0" />
+ <WordsStyle name="DELIMINER2" styleID="15" fgColor="808080" bgColor="FFFFFF" fontStyle="0" />
+ <WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
+ </Styles>
+ </UserLang>
+</NotepadPlus>
diff --git a/readme.txt b/readme.txt deleted file mode 100644 index 52228845..00000000 --- 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. diff --git a/src/AddressBook/AddressBookProtos.cs b/src/AddressBook/AddressBookProtos.cs index 4d391f0f..7fc1c64d 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;
@@ -68,7 +68,8 @@ 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<Person, Person.Builder> {
- private static readonly Person defaultInstance = new Builder().BuildPartial();
+ private Person() { }
+ 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 +77,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { }
public override Person DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override Person ThisMessage {
@@ -108,7 +109,8 @@ 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<PhoneNumber, PhoneNumber.Builder> {
- private static readonly PhoneNumber defaultInstance = new Builder().BuildPartial();
+ private PhoneNumber() { }
+ 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 +118,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { }
public override PhoneNumber DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override PhoneNumber ThisMessage {
@@ -219,11 +221,15 @@ 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(); }
public static Builder CreateBuilder(PhoneNumber prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -233,21 +239,48 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(PhoneNumber cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private PhoneNumber result;
- PhoneNumber result = new PhoneNumber();
+ private PhoneNumber PrepareBuilder() {
+ if (resultIsReadOnly) {
+ PhoneNumber original = result;
+ result = new PhoneNumber();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -259,12 +292,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 (resultIsReadOnly) {
+ return result;
}
- PhoneNumber returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -278,6 +310,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 +326,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 +395,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 +415,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;
@@ -523,11 +561,16 @@ 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(); }
public static Builder CreateBuilder(Person prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -537,21 +580,48 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(Person cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- Person result = new Person();
+ private bool resultIsReadOnly;
+ private Person result;
+
+ private Person PrepareBuilder() {
+ if (resultIsReadOnly) {
+ Person original = result;
+ result = new Person();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -563,13 +633,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.phone_.MakeReadOnly();
- Person returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -583,6 +651,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;
}
@@ -593,7 +662,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;
@@ -604,6 +673,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 +742,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 +762,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 +783,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<global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber> PhoneList {
- get { return result.phone_; }
+ get { return PrepareBuilder().phone_; }
}
public int PhoneCount {
get { return result.PhoneCount; }
@@ -730,29 +806,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<global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber> values) {
- base.AddRange(values, result.phone_);
+ PrepareBuilder();
+ result.phone_.Add(values);
return this;
}
public Builder ClearPhone() {
+ PrepareBuilder();
result.phone_.Clear();
return this;
}
@@ -766,7 +848,8 @@ 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<AddressBook, AddressBook.Builder> {
- private static readonly AddressBook defaultInstance = new Builder().BuildPartial();
+ private AddressBook() { }
+ 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 {
@@ -774,7 +857,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { }
public override AddressBook DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override AddressBook ThisMessage {
@@ -865,11 +948,16 @@ 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(); }
public static Builder CreateBuilder(AddressBook prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -879,21 +967,48 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(AddressBook cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private AddressBook result;
- AddressBook result = new AddressBook();
+ private AddressBook PrepareBuilder() {
+ if (resultIsReadOnly) {
+ AddressBook original = result;
+ result = new AddressBook();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -905,13 +1020,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.person_.MakeReadOnly();
- AddressBook returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -925,8 +1038,9 @@ 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_);
+ result.person_.Add(other.person_);
}
this.MergeUnknownFields(other.UnknownFields);
return this;
@@ -937,6 +1051,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 +1100,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { public pbc::IPopsicleList<global::Google.ProtocolBuffers.Examples.AddressBook.Person> PersonList {
- get { return result.person_; }
+ get { return PrepareBuilder().person_; }
}
public int PersonCount {
get { return result.PersonCount; }
@@ -995,29 +1110,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<global::Google.ProtocolBuffers.Examples.AddressBook.Person> values) {
- base.AddRange(values, result.person_);
+ PrepareBuilder();
+ result.person_.Add(values);
return this;
}
public Builder ClearPerson() {
+ PrepareBuilder();
result.person_.Clear();
return this;
}
diff --git a/src/ProtoGen.Test/DependencyResolutionTest.cs b/src/ProtoGen.Test/DependencyResolutionTest.cs index 8ac5b348..c4422b8c 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<FileDescriptor> 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<FileDescriptor> 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<FileDescriptor> 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/EnumFieldGenerator.cs b/src/ProtoGen/EnumFieldGenerator.cs index 8b56b9e9..8d70bc67 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,21 +61,25 @@ 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(" PrepareBuilder();");
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(" PrepareBuilder();");
writer.WriteLine(" result.has{0} = false;", PropertyName);
writer.WriteLine(" result.{0}_ = {1};", Name, DefaultValue);
writer.WriteLine(" return this;");
diff --git a/src/ProtoGen/FieldGeneratorBase.cs b/src/ProtoGen/FieldGeneratorBase.cs index 54294196..93aee6ca 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; } }
+
+ /// <summary>
+ /// Writes [global::System.ObsoleteAttribute()] if the member is obsolete
+ /// </summary>
+ protected void AddDeprecatedFlag(TextGenerator writer)
+ {
+ if (IsObsolete)
+ {
+ writer.WriteLine("[global::System.ObsoleteAttribute()]");
+ }
+ }
+
/// <summary>
/// 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 b86f2c9a..25b58a60 100644 --- a/src/ProtoGen/MessageFieldGenerator.cs +++ b/src/ProtoGen/MessageFieldGenerator.cs @@ -48,38 +48,48 @@ 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);
+ 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(" get {{ return {0}_ ?? {1}; }}", Name, DefaultValue);
writer.WriteLine("}");
}
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(" PrepareBuilder();");
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(" PrepareBuilder();");
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(" 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,
@@ -90,9 +100,11 @@ 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(" 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 01d47ce2..e9a037bf 100644 --- a/src/ProtoGen/MessageGenerator.cs +++ b/src/ProtoGen/MessageGenerator.cs @@ -165,9 +165,13 @@ namespace Google.ProtocolBuffers.ProtoGen {
return SourceGenerators.CreateFieldGenerator(fieldDescriptor, FieldOrdinal(fieldDescriptor));
}
-
+
public void Generate(TextGenerator writer)
{
+ if (Descriptor.File.CSharpOptions.AddSerializable)
+ {
+ writer.WriteLine("[global::System.SerializableAttribute()]");
+ }
writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]");
writer.WriteLine("[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]");
writer.WriteLine("[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"{0}\", \"{1}\")]",
@@ -177,8 +181,9 @@ 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);
+ writer.WriteLine("private static readonly {0} defaultInstance = new {0}().MakeReadOnly();", ClassName);
if (OptimizeSpeed)
{
@@ -199,7 +204,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,13 +552,28 @@ 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(); }");
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();
+ if (Descriptor.File.CSharpOptions.AddSerializable)
+ {
+ writer.WriteLine("[global::System.SerializableAttribute()]");
+ }
writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]");
writer.WriteLine("[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]");
writer.WriteLine("[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"{0}\", \"{1}\")]",
@@ -582,21 +602,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;");
+ writer.WriteLine(" resultIsReadOnly = true;");
+ writer.WriteLine("}");
+ //clone constructor
+ writer.WriteLine("internal Builder({0} cloneFrom) {{", ClassName);
+ writer.WriteLine(" result = cloneFrom;");
+ writer.WriteLine(" resultIsReadOnly = true;");
+ writer.WriteLine("}");
+ writer.WriteLine();
+ writer.WriteLine("private bool resultIsReadOnly;");
+ writer.WriteLine("private {0} result;", ClassName);
writer.WriteLine();
- writer.WriteLine("{0} result = new {0}();", ClassName);
+ writer.WriteLine("private {0} PrepareBuilder() {{", ClassName);
+ writer.WriteLine(" if (resultIsReadOnly) {");
+ writer.WriteLine(" {0} original = result;", ClassName);
+ writer.WriteLine(" result = new {0}();", ClassName);
+ writer.WriteLine(" resultIsReadOnly = false;");
+ writer.WriteLine(" MergeFrom(original);");
+ writer.WriteLine(" }");
+ writer.WriteLine(" return result;");
+ writer.WriteLine("}");
+ writer.WriteLine();
+ 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;", ClassName);
+ writer.WriteLine(" resultIsReadOnly = 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 (resultIsReadOnly) {");
+ 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 +664,11 @@ 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 (resultIsReadOnly) {");
+ 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("resultIsReadOnly = true;");
+ writer.WriteLine("return result.MakeReadOnly();");
writer.Outdent();
writer.WriteLine("}");
writer.WriteLine();
@@ -644,6 +689,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 +722,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 e945bf87..69e0d4d9 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,22 +62,26 @@ 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(" PrepareBuilder();");
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(" 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 5880390b..8c9f17b8 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,28 +73,39 @@ 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(" get {{ return PrepareBuilder().{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(" PrepareBuilder();");
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(" PrepareBuilder();");
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(" PrepareBuilder();");
+ writer.WriteLine(" result.{0}_.Add(values);", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
+ AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Clear{0}() {{", PropertyName);
+ writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.{0}_.Clear();", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
@@ -100,13 +114,13 @@ 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("}");
}
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 bfa0763f..a9a0143c 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,42 +69,57 @@ 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(" get {{ return PrepareBuilder().{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(" PrepareBuilder();");
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(" PrepareBuilder();");
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(" PrepareBuilder();");
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(" PrepareBuilder();");
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(" PrepareBuilder();");
+ writer.WriteLine(" result.{0}_.Add(values);", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
+ AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Clear{0}() {{", PropertyName);
+ writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.{0}_.Clear();", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
@@ -110,13 +128,13 @@ 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("}");
}
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 9e7f5f64..b795f3b6 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,35 +73,41 @@ 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(" get {{ return PrepareBuilder().{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(" PrepareBuilder();");
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(" PrepareBuilder();");
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(" PrepareBuilder();");
+ writer.WriteLine(" result.{0}_.Add(values);", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
+ AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Clear{0}() {{", PropertyName);
+ writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.{0}_.Clear();", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
@@ -109,13 +116,13 @@ 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("}");
}
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/UmbrellaClassGenerator.cs b/src/ProtoGen/UmbrellaClassGenerator.cs index 57a7844b..e4250458 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/CodedInputStreamTest.cs b/src/ProtocolBuffers.Test/CodedInputStreamTest.cs index c3ca0a10..64656b19 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<TestNegEnum> values = new List<TestNegEnum>();
+ ICollection<object> 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<TestNegEnum> values = new List<TestNegEnum>();
+ ICollection<object> 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 3dd2e0c3..d041d3f0 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<int> values = new List<int>();
+ 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<int> values = new List<int>();
+ 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/Collections/PopsicleListTest.cs b/src/ProtocolBuffers.Test/Collections/PopsicleListTest.cs index c339cef6..35b13a1d 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<string> list = new PopsicleList<string>();
+ try
+ {
+ list.Add((IEnumerable<string>)null);
+ }
+ catch (ArgumentNullException)
+ { return; }
+
+ Assert.Fail("List should not allow nulls.");
+ }
+
+ [Test]
+ public void DoesNotAddRangeWithNull()
+ {
+ PopsicleList<string> list = new PopsicleList<string>();
+ try
+ {
+ list.Add(new[] { "a", "b", null });
+ }
+ catch (ArgumentNullException)
+ { return; }
+
+ Assert.Fail("List should not allow nulls.");
+ }
+
+ [Test]
+ public void DoesNotAddNull()
+ {
+ PopsicleList<string> list = new PopsicleList<string>();
+ try
+ {
+ list.Add((string)null);
+ }
+ catch (ArgumentNullException)
+ { return; }
+
+ Assert.Fail("List should not allow nulls.");
+ }
+
+ [Test]
+ public void DoesNotSetNull()
+ {
+ PopsicleList<string> list = new PopsicleList<string>();
+ 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/DeprecatedMemberTest.cs b/src/ProtocolBuffers.Test/DeprecatedMemberTest.cs new file mode 100644 index 00000000..44e7914f --- /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/GeneratedBuilderTest.cs b/src/ProtocolBuffers.Test/GeneratedBuilderTest.cs new file mode 100644 index 00000000..b1290031 --- /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<T> : IEnumerable<T>
+ {
+ readonly T _item;
+ bool _enumerated;
+ public OneTimeEnumerator(T item)
+ {
+ _item = item;
+ }
+ public IEnumerator<T> 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>(
+ ForeignMessage.DefaultInstance));
+ }
+ [Test]
+ public void DoesNotEnumerateTwiceForPrimitiveList()
+ {
+ TestAllTypes.Builder b = new TestAllTypes.Builder();
+ b.AddRangeRepeatedInt32(new OneTimeEnumerator<int>(1));
+ }
+ [Test]
+ public void DoesNotEnumerateTwiceForStringList()
+ {
+ TestAllTypes.Builder b = new TestAllTypes.Builder();
+ b.AddRangeRepeatedString(new OneTimeEnumerator<string>("test"));
+ }
+ [Test]
+ public void DoesNotEnumerateTwiceForEnumList()
+ {
+ TestAllTypes.Builder b = new TestAllTypes.Builder();
+ b.AddRangeRepeatedForeignEnum(new OneTimeEnumerator<ForeignEnum>(ForeignEnum.FOREIGN_BAR));
+ }
+
+ private static void AssertThrows<T>(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<ArgumentNullException>(
+ () => b.AddRangeRepeatedForeignMessage(new ForeignMessage[] { null })
+ );
+ }
+ [Test]
+ public void DoesNotAddNullToMessageListByAdd()
+ {
+ TestAllTypes.Builder b = new TestAllTypes.Builder();
+ AssertThrows<ArgumentNullException>(
+ () => b.AddRepeatedForeignMessage((ForeignMessage)null)
+ );
+ }
+ [Test]
+ public void DoesNotAddNullToMessageListBySet()
+ {
+ TestAllTypes.Builder b = new TestAllTypes.Builder();
+ b.AddRepeatedForeignMessage(ForeignMessage.DefaultInstance);
+ AssertThrows<ArgumentNullException>(
+ () => b.SetRepeatedForeignMessage(0, (ForeignMessage)null)
+ );
+ }
+ [Test]
+ public void DoesNotAddNullToStringListByAddRange()
+ {
+ TestAllTypes.Builder b = new TestAllTypes.Builder();
+ AssertThrows<ArgumentNullException>(
+ () => b.AddRangeRepeatedString(new String[] { null })
+ );
+ }
+ [Test]
+ public void DoesNotAddNullToStringListByAdd()
+ {
+ TestAllTypes.Builder b = new TestAllTypes.Builder();
+ AssertThrows<ArgumentNullException>(
+ () => b.AddRepeatedString(null)
+ );
+ }
+ [Test]
+ public void DoesNotAddNullToStringListBySet()
+ {
+ TestAllTypes.Builder b = new TestAllTypes.Builder();
+ b.AddRepeatedString("one");
+ AssertThrows<ArgumentNullException>(
+ () => b.SetRepeatedString(0, null)
+ );
+ }
+ }
+}
diff --git a/src/ProtocolBuffers.Test/GeneratedMessageTest.cs b/src/ProtocolBuffers.Test/GeneratedMessageTest.cs index 410452d3..12224e9b 100644 --- a/src/ProtocolBuffers.Test/GeneratedMessageTest.cs +++ b/src/ProtocolBuffers.Test/GeneratedMessageTest.cs @@ -112,22 +112,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()
{
Assert.AreSame(TestAllTypes.DefaultInstance, TestAllTypes.DefaultInstance.DefaultInstanceForType);
diff --git a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj index e640462c..42b5e241 100644 --- a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj +++ b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj @@ -45,9 +45,7 @@ <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- <DocumentationFile>bin\Debug\Google.ProtocolBuffers.Test.XML</DocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- <NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -57,9 +55,7 @@ <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- <DocumentationFile>bin\Release\Google.ProtocolBuffers.Test.XML</DocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- <NoWarn>1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
@@ -94,10 +90,12 @@ <Compile Include="Compatibility\XmlCompatibilityTests.cs" />
<Compile Include="TestReaderForUrlEncoded.cs" />
<Compile Include="CSharpOptionsTest.cs" />
+ <Compile Include="DeprecatedMemberTest.cs" />
<Compile Include="DescriptorsTest.cs" />
<Compile Include="Descriptors\MessageDescriptorTest.cs" />
<Compile Include="DynamicMessageTest.cs" />
<Compile Include="ExtendableMessageTest.cs" />
+ <Compile Include="GeneratedBuilderTest.cs" />
<Compile Include="GeneratedMessageTest.cs" />
<Compile Include="MessageStreamIteratorTest.cs" />
<Compile Include="MessageStreamWriterTest.cs" />
@@ -106,7 +104,10 @@ <Compile Include="NameHelpersTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ReflectionTester.cs" />
+ <Compile Include="ReusableBuilderTest.cs" />
+ <Compile Include="SerializableTest.cs" />
<Compile Include="ServiceTest.cs" />
+ <Compile Include="TestCornerCases.cs" />
<Compile Include="TestMimeMessageFormats.cs" />
<Compile Include="TestProtos\UnitTestCSharpOptionsProtoFile.cs" />
<Compile Include="TestProtos\UnitTestCustomOptionsProtoFile.cs" />
diff --git a/src/ProtocolBuffers.Test/ReusableBuilderTest.cs b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs new file mode 100644 index 00000000..58d643ed --- /dev/null +++ b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs @@ -0,0 +1,170 @@ +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()
+ {
+ //verify that the default instance has correctly been marked as read-only
+ Assert.AreEqual(typeof(PopsicleList<bool>), TestAllTypes.DefaultInstance.RepeatedBoolList.GetType());
+ PopsicleList<bool> list = (PopsicleList<bool>)TestAllTypes.DefaultInstance.RepeatedBoolList;
+ Assert.IsTrue(list.IsReadOnly);
+ }
+
+ [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 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()
+ {
+ 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 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()
+ {
+ 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 CloneOnGetRepeatedForeignMessageList()
+ {
+ TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
+ Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
+ GC.KeepAlive(builder.RepeatedForeignMessageList);
+ 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 CloneOnGetRepeatedForeignEnumList()
+ {
+ TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
+ Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
+ GC.KeepAlive(builder.RepeatedForeignEnumList);
+ Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
+ }
+
+ }
+}
diff --git a/src/ProtocolBuffers.Test/SerializableTest.cs b/src/ProtocolBuffers.Test/SerializableTest.cs new file mode 100644 index 00000000..f1073c1e --- /dev/null +++ b/src/ProtocolBuffers.Test/SerializableTest.cs @@ -0,0 +1,177 @@ +using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
+using System.Text;
+using Google.ProtocolBuffers.TestProtos;
+using NUnit.Framework;
+
+namespace Google.ProtocolBuffers
+{
+ [TestFixture]
+ public class SerializableTest
+ {
+ /// <summary>
+ /// Just keep it from even compiling if we these objects don't implement the expected interface.
+ /// </summary>
+ public static readonly ISerializable CompileTimeCheckSerializableMessage = TestXmlMessage.DefaultInstance;
+ public static readonly ISerializable CompileTimeCheckSerializableBuilder = new TestXmlMessage.Builder();
+
+ [Test]
+ public void TestPlainMessage()
+ {
+ TestXmlMessage message = TestXmlMessage.CreateBuilder()
+ .SetValid(true)
+ .SetText("text")
+ .AddTextlines("a")
+ .AddTextlines("b")
+ .AddTextlines("c")
+ .SetNumber(0x1010101010)
+ .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])))
+ .Build();
+
+ MemoryStream ms = new MemoryStream();
+ new BinaryFormatter().Serialize(ms, message);
+
+ ms.Position = 0;
+ TestXmlMessage copy = (TestXmlMessage)new BinaryFormatter().Deserialize(ms);
+
+ Assert.AreEqual(message, copy);
+ }
+
+ [Test]
+ public void TestMessageWithExtensions()
+ {
+ TestXmlMessage message = TestXmlMessage.CreateBuilder()
+ .SetValid(true)
+ .SetText("text")
+ .AddTextlines("a")
+ .AddTextlines("b")
+ .AddTextlines("c")
+ .SetNumber(0x1010101010)
+ .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])))
+ .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionText, " extension text value ! ")
+ .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionMessage, new TestXmlExtension.Builder().SetNumber(42).Build())
+ .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 100)
+ .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 101)
+ .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 102)
+ .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionEnum, EnumOptions.ONE)
+ .Build();
+
+ ExtensionRegistry registry = ExtensionRegistry.CreateInstance();
+ UnitTestXmlSerializerTestProtoFile.RegisterAllExtensions(registry);
+
+ MemoryStream ms = new MemoryStream();
+ new BinaryFormatter().Serialize(ms, message);
+
+ ms.Position = 0;
+ //you need to provide the extension registry as context to the serializer
+ BinaryFormatter bff = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.All, registry));
+ TestXmlMessage copy = (TestXmlMessage)bff.Deserialize(ms);
+
+ // And all extensions will be defined.
+ Assert.AreEqual(message, copy);
+ }
+
+ [Test]
+ public void TestPlainBuilder()
+ {
+ TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder()
+ .SetValid(true)
+ .SetText("text")
+ .AddTextlines("a")
+ .AddTextlines("b")
+ .AddTextlines("c")
+ .SetNumber(0x1010101010)
+ .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])))
+ ;
+
+ MemoryStream ms = new MemoryStream();
+ new BinaryFormatter().Serialize(ms, builder);
+
+ ms.Position = 0;
+ TestXmlMessage.Builder copy = (TestXmlMessage.Builder)new BinaryFormatter().Deserialize(ms);
+
+ Assert.AreEqual(builder.Build(), copy.Build());
+ }
+
+ [Test]
+ public void TestBuilderWithExtensions()
+ {
+ TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder()
+ .SetValid(true)
+ .SetText("text")
+ .AddTextlines("a")
+ .AddTextlines("b")
+ .AddTextlines("c")
+ .SetNumber(0x1010101010)
+ .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])))
+ .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionText, " extension text value ! ")
+ .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionMessage, new TestXmlExtension.Builder().SetNumber(42).Build())
+ .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 100)
+ .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 101)
+ .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 102)
+ .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionEnum, EnumOptions.ONE)
+ ;
+
+ ExtensionRegistry registry = ExtensionRegistry.CreateInstance();
+ UnitTestXmlSerializerTestProtoFile.RegisterAllExtensions(registry);
+
+ MemoryStream ms = new MemoryStream();
+ new BinaryFormatter().Serialize(ms, builder);
+
+ ms.Position = 0;
+ //you need to provide the extension registry as context to the serializer
+ BinaryFormatter bff = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.All, registry));
+ TestXmlMessage.Builder copy = (TestXmlMessage.Builder)bff.Deserialize(ms);
+
+ // And all extensions will be defined.
+ Assert.AreEqual(builder.Build(), copy.Build());
+ }
+ }
+}
diff --git a/src/ProtocolBuffers.Test/TestCornerCases.cs b/src/ProtocolBuffers.Test/TestCornerCases.cs new file mode 100644 index 00000000..8a3fe051 --- /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/UnitTestCSharpOptionsProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs index ff726d65..13696c2d 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;
@@ -60,7 +60,8 @@ 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<OptionsMessage, OptionsMessage.Builder> {
- private static readonly OptionsMessage defaultInstance = new Builder().BuildPartial();
+ private OptionsMessage() { }
+ 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 +69,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override OptionsMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override OptionsMessage ThisMessage {
@@ -186,11 +187,15 @@ 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(); }
public static Builder CreateBuilder(OptionsMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -200,21 +205,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(OptionsMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private OptionsMessage result;
+
+ private OptionsMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ OptionsMessage original = result;
+ result = new OptionsMessage();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- OptionsMessage result = new OptionsMessage();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -226,12 +258,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 (resultIsReadOnly) {
+ return result;
}
- OptionsMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -245,6 +276,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 +295,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 +360,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 +381,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 +402,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 0b1be422..93d7fb9c 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;
@@ -400,7 +400,8 @@ 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<TestMessageWithCustomOptions, TestMessageWithCustomOptions.Builder> {
- private static readonly TestMessageWithCustomOptions defaultInstance = new Builder().BuildPartial();
+ private TestMessageWithCustomOptions() { }
+ 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 +409,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestMessageWithCustomOptions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestMessageWithCustomOptions ThisMessage {
@@ -509,11 +510,15 @@ 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(); }
public static Builder CreateBuilder(TestMessageWithCustomOptions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -523,21 +528,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestMessageWithCustomOptions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestMessageWithCustomOptions result = new TestMessageWithCustomOptions();
+ private bool resultIsReadOnly;
+ private TestMessageWithCustomOptions result;
+
+ private TestMessageWithCustomOptions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestMessageWithCustomOptions original = result;
+ result = new TestMessageWithCustomOptions();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -549,12 +581,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 (resultIsReadOnly) {
+ return result;
}
- TestMessageWithCustomOptions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -568,6 +599,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 +612,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 +669,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;
@@ -655,7 +690,8 @@ 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<CustomOptionFooRequest, CustomOptionFooRequest.Builder> {
- private static readonly CustomOptionFooRequest defaultInstance = new Builder().BuildPartial();
+ private CustomOptionFooRequest() { }
+ 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 {
@@ -663,7 +699,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override CustomOptionFooRequest DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override CustomOptionFooRequest ThisMessage {
@@ -733,11 +769,15 @@ 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(); }
public static Builder CreateBuilder(CustomOptionFooRequest prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -747,21 +787,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(CustomOptionFooRequest cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- CustomOptionFooRequest result = new CustomOptionFooRequest();
+ private bool resultIsReadOnly;
+ private CustomOptionFooRequest result;
+
+ private CustomOptionFooRequest PrepareBuilder() {
+ if (resultIsReadOnly) {
+ CustomOptionFooRequest original = result;
+ result = new CustomOptionFooRequest();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -773,12 +840,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 (resultIsReadOnly) {
+ return result;
}
- CustomOptionFooRequest returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -792,6 +858,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 +868,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;
@@ -853,7 +921,8 @@ 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<CustomOptionFooResponse, CustomOptionFooResponse.Builder> {
- private static readonly CustomOptionFooResponse defaultInstance = new Builder().BuildPartial();
+ private CustomOptionFooResponse() { }
+ 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 {
@@ -861,7 +930,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override CustomOptionFooResponse DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override CustomOptionFooResponse ThisMessage {
@@ -931,11 +1000,15 @@ 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(); }
public static Builder CreateBuilder(CustomOptionFooResponse prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -945,21 +1018,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(CustomOptionFooResponse cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- CustomOptionFooResponse result = new CustomOptionFooResponse();
+ private bool resultIsReadOnly;
+ private CustomOptionFooResponse result;
+
+ private CustomOptionFooResponse PrepareBuilder() {
+ if (resultIsReadOnly) {
+ CustomOptionFooResponse original = result;
+ result = new CustomOptionFooResponse();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -971,12 +1071,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 (resultIsReadOnly) {
+ return result;
}
- CustomOptionFooResponse returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -990,6 +1089,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 +1099,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;
@@ -1051,7 +1152,8 @@ 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<DummyMessageContainingEnum, DummyMessageContainingEnum.Builder> {
- private static readonly DummyMessageContainingEnum defaultInstance = new Builder().BuildPartial();
+ private DummyMessageContainingEnum() { }
+ 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 {
@@ -1059,7 +1161,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override DummyMessageContainingEnum DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override DummyMessageContainingEnum ThisMessage {
@@ -1144,11 +1246,15 @@ 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(); }
public static Builder CreateBuilder(DummyMessageContainingEnum prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1158,21 +1264,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(DummyMessageContainingEnum cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- DummyMessageContainingEnum result = new DummyMessageContainingEnum();
+ private bool resultIsReadOnly;
+ private DummyMessageContainingEnum result;
+
+ private DummyMessageContainingEnum PrepareBuilder() {
+ if (resultIsReadOnly) {
+ DummyMessageContainingEnum original = result;
+ result = new DummyMessageContainingEnum();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1184,12 +1317,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 (resultIsReadOnly) {
+ return result;
}
- DummyMessageContainingEnum returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1203,6 +1335,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 +1345,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;
@@ -1264,7 +1398,8 @@ 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<DummyMessageInvalidAsOptionType, DummyMessageInvalidAsOptionType.Builder> {
- private static readonly DummyMessageInvalidAsOptionType defaultInstance = new Builder().BuildPartial();
+ private DummyMessageInvalidAsOptionType() { }
+ 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 {
@@ -1272,7 +1407,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override DummyMessageInvalidAsOptionType DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override DummyMessageInvalidAsOptionType ThisMessage {
@@ -1342,11 +1477,15 @@ 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(); }
public static Builder CreateBuilder(DummyMessageInvalidAsOptionType prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1356,21 +1495,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(DummyMessageInvalidAsOptionType cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private DummyMessageInvalidAsOptionType result;
- DummyMessageInvalidAsOptionType result = new DummyMessageInvalidAsOptionType();
+ private DummyMessageInvalidAsOptionType PrepareBuilder() {
+ if (resultIsReadOnly) {
+ DummyMessageInvalidAsOptionType original = result;
+ result = new DummyMessageInvalidAsOptionType();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1382,12 +1548,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 (resultIsReadOnly) {
+ return result;
}
- DummyMessageInvalidAsOptionType returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1401,6 +1566,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 +1576,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;
@@ -1462,7 +1629,8 @@ 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<CustomOptionMinIntegerValues, CustomOptionMinIntegerValues.Builder> {
- private static readonly CustomOptionMinIntegerValues defaultInstance = new Builder().BuildPartial();
+ private CustomOptionMinIntegerValues() { }
+ 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 {
@@ -1470,7 +1638,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override CustomOptionMinIntegerValues DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override CustomOptionMinIntegerValues ThisMessage {
@@ -1540,11 +1708,15 @@ 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(); }
public static Builder CreateBuilder(CustomOptionMinIntegerValues prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1554,21 +1726,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(CustomOptionMinIntegerValues cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- CustomOptionMinIntegerValues result = new CustomOptionMinIntegerValues();
+ private bool resultIsReadOnly;
+ private CustomOptionMinIntegerValues result;
+
+ private CustomOptionMinIntegerValues PrepareBuilder() {
+ if (resultIsReadOnly) {
+ CustomOptionMinIntegerValues original = result;
+ result = new CustomOptionMinIntegerValues();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1580,12 +1779,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 (resultIsReadOnly) {
+ return result;
}
- CustomOptionMinIntegerValues returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1599,6 +1797,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 +1807,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;
@@ -1660,7 +1860,8 @@ 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<CustomOptionMaxIntegerValues, CustomOptionMaxIntegerValues.Builder> {
- private static readonly CustomOptionMaxIntegerValues defaultInstance = new Builder().BuildPartial();
+ private CustomOptionMaxIntegerValues() { }
+ 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 {
@@ -1668,7 +1869,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override CustomOptionMaxIntegerValues DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override CustomOptionMaxIntegerValues ThisMessage {
@@ -1738,11 +1939,15 @@ 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(); }
public static Builder CreateBuilder(CustomOptionMaxIntegerValues prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1752,21 +1957,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(CustomOptionMaxIntegerValues cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- CustomOptionMaxIntegerValues result = new CustomOptionMaxIntegerValues();
+ private bool resultIsReadOnly;
+ private CustomOptionMaxIntegerValues result;
+
+ private CustomOptionMaxIntegerValues PrepareBuilder() {
+ if (resultIsReadOnly) {
+ CustomOptionMaxIntegerValues original = result;
+ result = new CustomOptionMaxIntegerValues();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1778,12 +2010,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 (resultIsReadOnly) {
+ return result;
}
- CustomOptionMaxIntegerValues returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1797,6 +2028,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 +2038,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;
@@ -1858,7 +2091,8 @@ 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<CustomOptionOtherValues, CustomOptionOtherValues.Builder> {
- private static readonly CustomOptionOtherValues defaultInstance = new Builder().BuildPartial();
+ private CustomOptionOtherValues() { }
+ 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 {
@@ -1866,7 +2100,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override CustomOptionOtherValues DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override CustomOptionOtherValues ThisMessage {
@@ -1936,11 +2170,15 @@ 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(); }
public static Builder CreateBuilder(CustomOptionOtherValues prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1950,21 +2188,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(CustomOptionOtherValues cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- CustomOptionOtherValues result = new CustomOptionOtherValues();
+ private bool resultIsReadOnly;
+ private CustomOptionOtherValues result;
+
+ private CustomOptionOtherValues PrepareBuilder() {
+ if (resultIsReadOnly) {
+ CustomOptionOtherValues original = result;
+ result = new CustomOptionOtherValues();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1976,12 +2241,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 (resultIsReadOnly) {
+ return result;
}
- CustomOptionOtherValues returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1995,6 +2259,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 +2269,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;
@@ -2056,7 +2322,8 @@ 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<SettingRealsFromPositiveInts, SettingRealsFromPositiveInts.Builder> {
- private static readonly SettingRealsFromPositiveInts defaultInstance = new Builder().BuildPartial();
+ private SettingRealsFromPositiveInts() { }
+ 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 {
@@ -2064,7 +2331,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override SettingRealsFromPositiveInts DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override SettingRealsFromPositiveInts ThisMessage {
@@ -2134,11 +2401,15 @@ 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(); }
public static Builder CreateBuilder(SettingRealsFromPositiveInts prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -2148,21 +2419,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(SettingRealsFromPositiveInts cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private SettingRealsFromPositiveInts result;
+
+ private SettingRealsFromPositiveInts PrepareBuilder() {
+ if (resultIsReadOnly) {
+ SettingRealsFromPositiveInts original = result;
+ result = new SettingRealsFromPositiveInts();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- SettingRealsFromPositiveInts result = new SettingRealsFromPositiveInts();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -2174,12 +2472,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 (resultIsReadOnly) {
+ return result;
}
- SettingRealsFromPositiveInts returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -2193,6 +2490,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 +2500,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;
@@ -2254,7 +2553,8 @@ 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<SettingRealsFromNegativeInts, SettingRealsFromNegativeInts.Builder> {
- private static readonly SettingRealsFromNegativeInts defaultInstance = new Builder().BuildPartial();
+ private SettingRealsFromNegativeInts() { }
+ 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 {
@@ -2262,7 +2562,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override SettingRealsFromNegativeInts DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override SettingRealsFromNegativeInts ThisMessage {
@@ -2332,11 +2632,15 @@ 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(); }
public static Builder CreateBuilder(SettingRealsFromNegativeInts prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -2346,21 +2650,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(SettingRealsFromNegativeInts cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private SettingRealsFromNegativeInts result;
+
+ private SettingRealsFromNegativeInts PrepareBuilder() {
+ if (resultIsReadOnly) {
+ SettingRealsFromNegativeInts original = result;
+ result = new SettingRealsFromNegativeInts();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- SettingRealsFromNegativeInts result = new SettingRealsFromNegativeInts();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -2372,12 +2703,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 (resultIsReadOnly) {
+ return result;
}
- SettingRealsFromNegativeInts returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -2391,6 +2721,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 +2731,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;
@@ -2452,7 +2784,8 @@ 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<ComplexOptionType1, ComplexOptionType1.Builder> {
- private static readonly ComplexOptionType1 defaultInstance = new Builder().BuildPartial();
+ private ComplexOptionType1() { }
+ 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 {
@@ -2460,7 +2793,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override ComplexOptionType1 DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override ComplexOptionType1 ThisMessage {
@@ -2582,11 +2915,15 @@ 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(); }
public static Builder CreateBuilder(ComplexOptionType1 prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -2596,21 +2933,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(ComplexOptionType1 cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private ComplexOptionType1 result;
+
+ private ComplexOptionType1 PrepareBuilder() {
+ if (resultIsReadOnly) {
+ ComplexOptionType1 original = result;
+ result = new ComplexOptionType1();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -2622,12 +2986,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 (resultIsReadOnly) {
+ return result;
}
- ComplexOptionType1 returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -2641,6 +3004,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 +3024,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 +3088,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 +3108,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 +3128,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;
@@ -2778,7 +3149,8 @@ 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<ComplexOptionType2, ComplexOptionType2.Builder> {
- private static readonly ComplexOptionType2 defaultInstance = new Builder().BuildPartial();
+ private ComplexOptionType2() { }
+ 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 {
@@ -2786,7 +3158,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override ComplexOptionType2 DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override ComplexOptionType2 ThisMessage {
@@ -2810,7 +3182,8 @@ 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<ComplexOptionType4, ComplexOptionType4.Builder> {
- private static readonly ComplexOptionType4 defaultInstance = new Builder().BuildPartial();
+ private ComplexOptionType4() { }
+ 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 {
@@ -2818,7 +3191,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override ComplexOptionType4 DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override ComplexOptionType4 ThisMessage {
@@ -2906,11 +3279,15 @@ 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(); }
public static Builder CreateBuilder(ComplexOptionType4 prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -2920,21 +3297,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(ComplexOptionType4 cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private ComplexOptionType4 result;
+
+ private ComplexOptionType4 PrepareBuilder() {
+ if (resultIsReadOnly) {
+ ComplexOptionType4 original = result;
+ result = new ComplexOptionType4();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- ComplexOptionType4 result = new ComplexOptionType4();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -2946,12 +3350,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 (resultIsReadOnly) {
+ return result;
}
- ComplexOptionType4 returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -2965,6 +3368,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 +3381,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 +3437,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;
@@ -3052,12 +3459,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;
@@ -3072,12 +3479,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 {
@@ -3160,11 +3567,15 @@ 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(); }
public static Builder CreateBuilder(ComplexOptionType2 prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -3174,21 +3585,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(ComplexOptionType2 cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private ComplexOptionType2 result;
+
+ private ComplexOptionType2 PrepareBuilder() {
+ if (resultIsReadOnly) {
+ ComplexOptionType2 original = result;
+ result = new ComplexOptionType2();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- ComplexOptionType2 result = new ComplexOptionType2();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -3200,12 +3638,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 (resultIsReadOnly) {
+ return result;
}
- ComplexOptionType2 returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -3219,6 +3656,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 +3676,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 +3751,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,8 +3776,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearBar() {
+ PrepareBuilder();
result.hasBar = false;
- result.bar_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.DefaultInstance;
+ result.bar_ = null;
return this;
}
@@ -3347,11 +3790,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 +3811,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,8 +3836,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearFred() {
+ PrepareBuilder();
result.hasFred = false;
- result.fred_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.DefaultInstance;
+ result.fred_ = null;
return this;
}
}
@@ -3402,7 +3851,8 @@ 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<ComplexOptionType3, ComplexOptionType3.Builder> {
- private static readonly ComplexOptionType3 defaultInstance = new Builder().BuildPartial();
+ private ComplexOptionType3() { }
+ 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 {
@@ -3410,7 +3860,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override ComplexOptionType3 DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override ComplexOptionType3 ThisMessage {
@@ -3434,7 +3884,8 @@ 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<ComplexOptionType5, ComplexOptionType5.Builder> {
- private static readonly ComplexOptionType5 defaultInstance = new Builder().BuildPartial();
+ private ComplexOptionType5() { }
+ 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 {
@@ -3442,7 +3893,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override ComplexOptionType5 DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override ComplexOptionType5 ThisMessage {
@@ -3528,11 +3979,15 @@ 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(); }
public static Builder CreateBuilder(ComplexOptionType5 prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -3542,21 +3997,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(ComplexOptionType5 cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private ComplexOptionType5 result;
+
+ private ComplexOptionType5 PrepareBuilder() {
+ if (resultIsReadOnly) {
+ ComplexOptionType5 original = result;
+ result = new ComplexOptionType5();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -3568,12 +4050,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 (resultIsReadOnly) {
+ return result;
}
- ComplexOptionType5 returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -3587,6 +4068,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 +4081,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 +4137,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;
@@ -3684,12 +4169,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 {
@@ -3759,11 +4244,15 @@ 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(); }
public static Builder CreateBuilder(ComplexOptionType3 prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -3773,21 +4262,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(ComplexOptionType3 cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- ComplexOptionType3 result = new ComplexOptionType3();
+ private bool resultIsReadOnly;
+ private ComplexOptionType3 result;
+
+ private ComplexOptionType3 PrepareBuilder() {
+ if (resultIsReadOnly) {
+ ComplexOptionType3 original = result;
+ result = new ComplexOptionType3();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -3799,12 +4315,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 (resultIsReadOnly) {
+ return result;
}
- ComplexOptionType3 returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -3818,6 +4333,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 +4349,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 +4414,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 +4435,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,8 +4460,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearComplexOptionType5() {
+ PrepareBuilder();
result.hasComplexOptionType5 = false;
- result.complexOptionType5_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.DefaultInstance;
+ result.complexOptionType5_ = null;
return this;
}
}
@@ -3952,7 +4475,8 @@ 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<ComplexOpt6, ComplexOpt6.Builder> {
- private static readonly ComplexOpt6 defaultInstance = new Builder().BuildPartial();
+ private ComplexOpt6() { }
+ 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 {
@@ -3960,7 +4484,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override ComplexOpt6 DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override ComplexOpt6 ThisMessage {
@@ -4046,11 +4570,15 @@ 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(); }
public static Builder CreateBuilder(ComplexOpt6 prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -4060,21 +4588,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(ComplexOpt6 cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- ComplexOpt6 result = new ComplexOpt6();
+ private bool resultIsReadOnly;
+ private ComplexOpt6 result;
+
+ private ComplexOpt6 PrepareBuilder() {
+ if (resultIsReadOnly) {
+ ComplexOpt6 original = result;
+ result = new ComplexOpt6();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -4086,12 +4641,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 (resultIsReadOnly) {
+ return result;
}
- ComplexOpt6 returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -4105,6 +4659,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 +4672,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 +4728,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;
@@ -4191,7 +4749,8 @@ 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<VariousComplexOptions, VariousComplexOptions.Builder> {
- private static readonly VariousComplexOptions defaultInstance = new Builder().BuildPartial();
+ private VariousComplexOptions() { }
+ 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 {
@@ -4199,7 +4758,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override VariousComplexOptions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override VariousComplexOptions ThisMessage {
@@ -4269,11 +4828,15 @@ 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(); }
public static Builder CreateBuilder(VariousComplexOptions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -4283,21 +4846,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(VariousComplexOptions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private VariousComplexOptions result;
+
+ private VariousComplexOptions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ VariousComplexOptions original = result;
+ result = new VariousComplexOptions();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- VariousComplexOptions result = new VariousComplexOptions();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -4309,12 +4899,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 (resultIsReadOnly) {
+ return result;
}
- VariousComplexOptions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -4328,6 +4917,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 +4927,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 09ecdd63..aba049d8 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;
@@ -64,7 +64,8 @@ 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<TestEmbedOptimizedForSize, TestEmbedOptimizedForSize.Builder> {
- private static readonly TestEmbedOptimizedForSize defaultInstance = new Builder().BuildPartial();
+ private TestEmbedOptimizedForSize() { }
+ 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 +73,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestEmbedOptimizedForSize DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestEmbedOptimizedForSize ThisMessage {
@@ -89,12 +90,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,11 +183,16 @@ 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(); }
public static Builder CreateBuilder(TestEmbedOptimizedForSize prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -196,21 +202,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestEmbedOptimizedForSize cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestEmbedOptimizedForSize result;
+
+ private TestEmbedOptimizedForSize PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestEmbedOptimizedForSize original = result;
+ result = new TestEmbedOptimizedForSize();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestEmbedOptimizedForSize result = new TestEmbedOptimizedForSize();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -222,13 +255,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.repeatedMessage_.MakeReadOnly();
- TestEmbedOptimizedForSize returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -242,11 +273,12 @@ 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);
}
if (other.repeatedMessage_.Count != 0) {
- base.AddRange(other.repeatedMessage_, result.repeatedMessage_);
+ result.repeatedMessage_.Add(other.repeatedMessage_);
}
this.MergeUnknownFields(other.UnknownFields);
return this;
@@ -257,6 +289,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 +355,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 +380,14 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearOptionalMessage() {
+ PrepareBuilder();
result.hasOptionalMessage = false;
- result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance;
+ result.optionalMessage_ = null;
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize> RepeatedMessageList {
- get { return result.repeatedMessage_; }
+ get { return PrepareBuilder().repeatedMessage_; }
}
public int RepeatedMessageCount {
get { return result.RepeatedMessageCount; }
@@ -360,29 +397,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<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize> values) {
- base.AddRange(values, result.repeatedMessage_);
+ PrepareBuilder();
+ result.repeatedMessage_.Add(values);
return this;
}
public Builder ClearRepeatedMessage() {
+ PrepareBuilder();
result.repeatedMessage_.Clear();
return this;
}
diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestEmptyProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestEmptyProtoFile.cs index eb6c6c74..6c5cf369 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 db56e8b9..be2d202f 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,16 @@ namespace UnitTest.Issues.TestProtos { internal static pb::FieldAccess.FieldAccessorTable<global::UnitTest.Issues.TestProtos.AB, global::UnitTest.Issues.TestProtos.AB.Builder> internal__static_unittest_issues_AB__FieldAccessorTable;
internal static pbd::MessageDescriptor internal__static_unittest_issues_NumberField__Descriptor;
internal static pb::FieldAccess.FieldAccessorTable<global::UnitTest.Issues.TestProtos.NumberField, global::UnitTest.Issues.TestProtos.NumberField.Builder> internal__static_unittest_issues_NumberField__FieldAccessorTable;
+ internal static pbd::MessageDescriptor internal__static_unittest_issues_MyMessageAReferenceB__Descriptor;
+ internal static pb::FieldAccess.FieldAccessorTable<global::UnitTest.Issues.TestProtos.MyMessageAReferenceB, global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.Builder> internal__static_unittest_issues_MyMessageAReferenceB__FieldAccessorTable;
+ internal static pbd::MessageDescriptor internal__static_unittest_issues_MyMessageBReferenceA__Descriptor;
+ internal static pb::FieldAccess.FieldAccessorTable<global::UnitTest.Issues.TestProtos.MyMessageBReferenceA, global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.Builder> internal__static_unittest_issues_MyMessageBReferenceA__FieldAccessorTable;
+ internal static pbd::MessageDescriptor internal__static_unittest_issues_NegativeEnumMessage__Descriptor;
+ internal static pb::FieldAccess.FieldAccessorTable<global::UnitTest.Issues.TestProtos.NegativeEnumMessage, global::UnitTest.Issues.TestProtos.NegativeEnumMessage.Builder> internal__static_unittest_issues_NegativeEnumMessage__FieldAccessorTable;
+ internal static pbd::MessageDescriptor internal__static_unittest_issues_DeprecatedChild__Descriptor;
+ internal static pb::FieldAccess.FieldAccessorTable<global::UnitTest.Issues.TestProtos.DeprecatedChild, global::UnitTest.Issues.TestProtos.DeprecatedChild.Builder> internal__static_unittest_issues_DeprecatedChild__FieldAccessorTable;
+ internal static pbd::MessageDescriptor internal__static_unittest_issues_DeprecatedFieldsMessage__Descriptor;
+ internal static pb::FieldAccess.FieldAccessorTable<global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage, global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage.Builder> internal__static_unittest_issues_DeprecatedFieldsMessage__FieldAccessorTable;
#endregion
#region Descriptor
public static pbd::FileDescriptor Descriptor {
@@ -38,9 +48,26 @@ namespace UnitTest.Issues.TestProtos { "ChxleHRlc3QvdW5pdHRlc3RfaXNzdWVzLnByb3RvEg91bml0dGVzdF9pc3N1" +
"ZXMaJGdvb2dsZS9wcm90b2J1Zi9jc2hhcnBfb3B0aW9ucy5wcm90byIPCgFB" +
"EgoKAl9BGAEgASgFIg8KAUISCgoCQl8YASABKAUiEQoCQUISCwoDYV9iGAEg" +
- "ASgFIhoKC051bWJlckZpZWxkEgsKA18wMRgBIAEoBUJASAHCPjsKGlVuaXRU" +
- "ZXN0Lklzc3Vlcy5UZXN0UHJvdG9zEh1Vbml0VGVzdEV4dHJhc0lzc3Vlc1By" +
- "b3RvRmlsZQ==");
+ "ASgFIhoKC051bWJlckZpZWxkEgsKA18wMRgBIAEoBSJMChRNeU1lc3NhZ2VB" +
+ "UmVmZXJlbmNlQhI0CgV2YWx1ZRgBIAIoCzIlLnVuaXR0ZXN0X2lzc3Vlcy5N" +
+ "eU1lc3NhZ2VCUmVmZXJlbmNlQSJMChRNeU1lc3NhZ2VCUmVmZXJlbmNlQRI0" +
+ "CgV2YWx1ZRgBIAIoCzIlLnVuaXR0ZXN0X2lzc3Vlcy5NeU1lc3NhZ2VBUmVm" +
+ "ZXJlbmNlQiKsAQoTTmVnYXRpdmVFbnVtTWVzc2FnZRIsCgV2YWx1ZRgBIAEo" +
+ "DjIdLnVuaXR0ZXN0X2lzc3Vlcy5OZWdhdGl2ZUVudW0SLQoGdmFsdWVzGAIg" +
+ "AygOMh0udW5pdHRlc3RfaXNzdWVzLk5lZ2F0aXZlRW51bRI4Cg1wYWNrZWRf" +
+ "dmFsdWVzGAMgAygOMh0udW5pdHRlc3RfaXNzdWVzLk5lZ2F0aXZlRW51bUIC" +
+ "EAEiEQoPRGVwcmVjYXRlZENoaWxkIrkCChdEZXByZWNhdGVkRmllbGRzTWVz" +
+ "c2FnZRIaCg5QcmltaXRpdmVWYWx1ZRgBIAEoBUICGAESGgoOUHJpbWl0aXZl" +
+ "QXJyYXkYAiADKAVCAhgBEjoKDE1lc3NhZ2VWYWx1ZRgDIAEoCzIgLnVuaXR0" +
+ "ZXN0X2lzc3Vlcy5EZXByZWNhdGVkQ2hpbGRCAhgBEjoKDE1lc3NhZ2VBcnJh" +
+ "eRgEIAMoCzIgLnVuaXR0ZXN0X2lzc3Vlcy5EZXByZWNhdGVkQ2hpbGRCAhgB" +
+ "EjYKCUVudW1WYWx1ZRgFIAEoDjIfLnVuaXR0ZXN0X2lzc3Vlcy5EZXByZWNh" +
+ "dGVkRW51bUICGAESNgoJRW51bUFycmF5GAYgAygOMh8udW5pdHRlc3RfaXNz" +
+ "dWVzLkRlcHJlY2F0ZWRFbnVtQgIYASpHCgxOZWdhdGl2ZUVudW0SFgoJRml2" +
+ "ZUJlbG93EPv//////////wESFQoITWludXNPbmUQ////////////ARIICgRa" +
+ "ZXJvEAAqGQoORGVwcmVjYXRlZEVudW0SBwoDb25lEAFCQEgBwj47ChpVbml0" +
+ "VGVzdC5Jc3N1ZXMuVGVzdFByb3RvcxIdVW5pdFRlc3RFeHRyYXNJc3N1ZXNQ" +
+ "cm90b0ZpbGU=");
pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
descriptor = root;
internal__static_unittest_issues_A__Descriptor = Descriptor.MessageTypes[0];
@@ -59,6 +86,26 @@ namespace UnitTest.Issues.TestProtos { internal__static_unittest_issues_NumberField__FieldAccessorTable =
new pb::FieldAccess.FieldAccessorTable<global::UnitTest.Issues.TestProtos.NumberField, global::UnitTest.Issues.TestProtos.NumberField.Builder>(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<global::UnitTest.Issues.TestProtos.MyMessageAReferenceB, global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.Builder>(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<global::UnitTest.Issues.TestProtos.MyMessageBReferenceA, global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.Builder>(internal__static_unittest_issues_MyMessageBReferenceA__Descriptor,
+ new string[] { "Value", });
+ internal__static_unittest_issues_NegativeEnumMessage__Descriptor = Descriptor.MessageTypes[6];
+ internal__static_unittest_issues_NegativeEnumMessage__FieldAccessorTable =
+ new pb::FieldAccess.FieldAccessorTable<global::UnitTest.Issues.TestProtos.NegativeEnumMessage, global::UnitTest.Issues.TestProtos.NegativeEnumMessage.Builder>(internal__static_unittest_issues_NegativeEnumMessage__Descriptor,
+ new string[] { "Value", "Values", "PackedValues", });
+ internal__static_unittest_issues_DeprecatedChild__Descriptor = Descriptor.MessageTypes[7];
+ internal__static_unittest_issues_DeprecatedChild__FieldAccessorTable =
+ new pb::FieldAccess.FieldAccessorTable<global::UnitTest.Issues.TestProtos.DeprecatedChild, global::UnitTest.Issues.TestProtos.DeprecatedChild.Builder>(internal__static_unittest_issues_DeprecatedChild__Descriptor,
+ new string[] { });
+ internal__static_unittest_issues_DeprecatedFieldsMessage__Descriptor = Descriptor.MessageTypes[8];
+ internal__static_unittest_issues_DeprecatedFieldsMessage__FieldAccessorTable =
+ new pb::FieldAccess.FieldAccessorTable<global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage, global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage.Builder>(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,12 +119,30 @@ 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,
+ }
+
+ [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()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
public sealed partial class A : pb::GeneratedMessage<A, A.Builder> {
- private static readonly A defaultInstance = new Builder().BuildPartial();
+ private A() { }
+ 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 +150,7 @@ namespace UnitTest.Issues.TestProtos { }
public override A DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override A ThisMessage {
@@ -171,11 +236,15 @@ 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(); }
public static Builder CreateBuilder(A prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -185,21 +254,48 @@ namespace UnitTest.Issues.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(A cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private A result;
+
+ private A PrepareBuilder() {
+ if (resultIsReadOnly) {
+ A original = result;
+ result = new A();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- A result = new A();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -211,12 +307,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 (resultIsReadOnly) {
+ return result;
}
- A returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -230,6 +325,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 +338,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 +394,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;
@@ -316,7 +415,8 @@ 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<B, B.Builder> {
- private static readonly B defaultInstance = new Builder().BuildPartial();
+ private B() { }
+ 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 {
@@ -324,7 +424,7 @@ namespace UnitTest.Issues.TestProtos { }
public override B DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override B ThisMessage {
@@ -410,11 +510,15 @@ 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(); }
public static Builder CreateBuilder(B prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -424,21 +528,48 @@ namespace UnitTest.Issues.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(B cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private B result;
+
+ private B PrepareBuilder() {
+ if (resultIsReadOnly) {
+ B original = result;
+ result = new B();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- B result = new B();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -450,12 +581,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 (resultIsReadOnly) {
+ return result;
}
- B returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -469,6 +599,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 +612,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 +668,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;
@@ -555,7 +689,8 @@ 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<AB, AB.Builder> {
- private static readonly AB defaultInstance = new Builder().BuildPartial();
+ private AB() { }
+ 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 {
@@ -563,7 +698,7 @@ namespace UnitTest.Issues.TestProtos { }
public override AB DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override AB ThisMessage {
@@ -649,11 +784,15 @@ 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(); }
public static Builder CreateBuilder(AB prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -663,21 +802,48 @@ namespace UnitTest.Issues.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(AB cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- AB result = new AB();
+ private bool resultIsReadOnly;
+ private AB result;
+
+ private AB PrepareBuilder() {
+ if (resultIsReadOnly) {
+ AB original = result;
+ result = new AB();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -689,12 +855,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 (resultIsReadOnly) {
+ return result;
}
- AB returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -708,6 +873,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 +886,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 +942,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;
@@ -794,7 +963,8 @@ 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<NumberField, NumberField.Builder> {
- private static readonly NumberField defaultInstance = new Builder().BuildPartial();
+ private NumberField() { }
+ 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 {
@@ -802,7 +972,7 @@ namespace UnitTest.Issues.TestProtos { }
public override NumberField DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override NumberField ThisMessage {
@@ -890,11 +1060,15 @@ 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(); }
public static Builder CreateBuilder(NumberField prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -904,21 +1078,48 @@ namespace UnitTest.Issues.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(NumberField cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- NumberField result = new NumberField();
+ private bool resultIsReadOnly;
+ private NumberField result;
+
+ private NumberField PrepareBuilder() {
+ if (resultIsReadOnly) {
+ NumberField original = result;
+ result = new NumberField();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -930,12 +1131,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 (resultIsReadOnly) {
+ return result;
}
- NumberField returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -949,6 +1149,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 +1162,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 +1220,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;
@@ -1033,6 +1237,1920 @@ 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<MyMessageAReferenceB, MyMessageAReferenceB.Builder> {
+ private MyMessageAReferenceB() { }
+ 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<MyMessageAReferenceB, MyMessageAReferenceB.Builder> 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<MyMessageAReferenceB, Builder> {
+ 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<MyMessageBReferenceA, MyMessageBReferenceA.Builder> {
+ private MyMessageBReferenceA() { }
+ 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<MyMessageBReferenceA, MyMessageBReferenceA.Builder> 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<MyMessageBReferenceA, Builder> {
+ 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);
+ }
+ }
+
+ [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<NegativeEnumMessage, NegativeEnumMessage.Builder> {
+ private NegativeEnumMessage() { }
+ private static readonly NegativeEnumMessage defaultInstance = new NegativeEnumMessage().MakeReadOnly();
+ 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<NegativeEnumMessage, NegativeEnumMessage.Builder> 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<global::UnitTest.Issues.TestProtos.NegativeEnum> values_ = new pbc::PopsicleList<global::UnitTest.Issues.TestProtos.NegativeEnum>();
+ public scg::IList<global::UnitTest.Issues.TestProtos.NegativeEnum> 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<global::UnitTest.Issues.TestProtos.NegativeEnum> packedValues_ = new pbc::PopsicleList<global::UnitTest.Issues.TestProtos.NegativeEnum>();
+ public scg::IList<global::UnitTest.Issues.TestProtos.NegativeEnum> 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();
+ }
+ private NegativeEnumMessage MakeReadOnly() {
+ values_.MakeReadOnly();
+ packedValues_.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(NegativeEnumMessage 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<NegativeEnumMessage, Builder> {
+ protected override Builder ThisBuilder {
+ get { return this; }
+ }
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(NegativeEnumMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private NegativeEnumMessage result;
+
+ private NegativeEnumMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ NegativeEnumMessage original = result;
+ result = new NegativeEnumMessage();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
+
+ protected override NegativeEnumMessage 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.NegativeEnumMessage.Descriptor; }
+ }
+
+ public override NegativeEnumMessage DefaultInstanceForType {
+ get { return global::UnitTest.Issues.TestProtos.NegativeEnumMessage.DefaultInstance; }
+ }
+
+ public override NegativeEnumMessage BuildPartial() {
+ if (resultIsReadOnly) {
+ return result;
+ }
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
+ }
+
+ 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;
+ PrepareBuilder();
+ if (other.HasValue) {
+ Value = other.Value;
+ }
+ if (other.values_.Count != 0) {
+ result.values_.Add(other.values_);
+ }
+ if (other.packedValues_.Count != 0) {
+ result.packedValues_.Add(other.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) {
+ 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(_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<object> unknownItems;
+ input.ReadEnumArray<global::UnitTest.Issues.TestProtos.NegativeEnum>(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<object> unknownItems;
+ input.ReadEnumArray<global::UnitTest.Issues.TestProtos.NegativeEnum>(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) {
+ PrepareBuilder();
+ result.hasValue = true;
+ result.value_ = value;
+ return this;
+ }
+ public Builder ClearValue() {
+ PrepareBuilder();
+ result.hasValue = false;
+ result.value_ = global::UnitTest.Issues.TestProtos.NegativeEnum.FiveBelow;
+ return this;
+ }
+
+ public pbc::IPopsicleList<global::UnitTest.Issues.TestProtos.NegativeEnum> ValuesList {
+ get { return PrepareBuilder().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) {
+ PrepareBuilder();
+ result.values_[index] = value;
+ return this;
+ }
+ public Builder AddValues(global::UnitTest.Issues.TestProtos.NegativeEnum value) {
+ PrepareBuilder();
+ result.values_.Add(value);
+ return this;
+ }
+ public Builder AddRangeValues(scg::IEnumerable<global::UnitTest.Issues.TestProtos.NegativeEnum> values) {
+ PrepareBuilder();
+ result.values_.Add(values);
+ return this;
+ }
+ public Builder ClearValues() {
+ PrepareBuilder();
+ result.values_.Clear();
+ return this;
+ }
+
+ public pbc::IPopsicleList<global::UnitTest.Issues.TestProtos.NegativeEnum> PackedValuesList {
+ get { return PrepareBuilder().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) {
+ PrepareBuilder();
+ result.packedValues_[index] = value;
+ return this;
+ }
+ public Builder AddPackedValues(global::UnitTest.Issues.TestProtos.NegativeEnum value) {
+ PrepareBuilder();
+ result.packedValues_.Add(value);
+ return this;
+ }
+ public Builder AddRangePackedValues(scg::IEnumerable<global::UnitTest.Issues.TestProtos.NegativeEnum> values) {
+ PrepareBuilder();
+ result.packedValues_.Add(values);
+ return this;
+ }
+ public Builder ClearPackedValues() {
+ PrepareBuilder();
+ result.packedValues_.Clear();
+ return this;
+ }
+ }
+ static NegativeEnumMessage() {
+ 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 DeprecatedChild : pb::GeneratedMessage<DeprecatedChild, DeprecatedChild.Builder> {
+ private DeprecatedChild() { }
+ private static readonly DeprecatedChild defaultInstance = new DeprecatedChild().MakeReadOnly();
+ 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<DeprecatedChild, DeprecatedChild.Builder> 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();
+ }
+ private DeprecatedChild 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(DeprecatedChild 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<DeprecatedChild, Builder> {
+ protected override Builder ThisBuilder {
+ get { return this; }
+ }
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(DeprecatedChild cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private DeprecatedChild result;
+
+ private DeprecatedChild PrepareBuilder() {
+ if (resultIsReadOnly) {
+ DeprecatedChild original = result;
+ result = new DeprecatedChild();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
+
+ protected override DeprecatedChild 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.DeprecatedChild.Descriptor; }
+ }
+
+ public override DeprecatedChild DefaultInstanceForType {
+ get { return global::UnitTest.Issues.TestProtos.DeprecatedChild.DefaultInstance; }
+ }
+
+ public override DeprecatedChild BuildPartial() {
+ if (resultIsReadOnly) {
+ return result;
+ }
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
+ }
+
+ 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;
+ PrepareBuilder();
+ 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(_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<DeprecatedFieldsMessage, DeprecatedFieldsMessage.Builder> {
+ private DeprecatedFieldsMessage() { }
+ private static readonly DeprecatedFieldsMessage defaultInstance = new DeprecatedFieldsMessage().MakeReadOnly();
+ 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<DeprecatedFieldsMessage, DeprecatedFieldsMessage.Builder> 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<int> primitiveArray_ = new pbc::PopsicleList<int>();
+ [global::System.ObsoleteAttribute()]
+ public scg::IList<int> 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::System.ObsoleteAttribute()]
+ public bool HasMessageValue {
+ get { return hasMessageValue; }
+ }
+ [global::System.ObsoleteAttribute()]
+ public global::UnitTest.Issues.TestProtos.DeprecatedChild MessageValue {
+ get { return messageValue_ ?? global::UnitTest.Issues.TestProtos.DeprecatedChild.DefaultInstance; }
+ }
+
+ public const int MessageArrayFieldNumber = 4;
+ private pbc::PopsicleList<global::UnitTest.Issues.TestProtos.DeprecatedChild> messageArray_ = new pbc::PopsicleList<global::UnitTest.Issues.TestProtos.DeprecatedChild>();
+ [global::System.ObsoleteAttribute()]
+ public scg::IList<global::UnitTest.Issues.TestProtos.DeprecatedChild> 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<global::UnitTest.Issues.TestProtos.DeprecatedEnum> enumArray_ = new pbc::PopsicleList<global::UnitTest.Issues.TestProtos.DeprecatedEnum>();
+ [global::System.ObsoleteAttribute()]
+ public scg::IList<global::UnitTest.Issues.TestProtos.DeprecatedEnum> 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();
+ }
+ private DeprecatedFieldsMessage MakeReadOnly() {
+ primitiveArray_.MakeReadOnly();
+ messageArray_.MakeReadOnly();
+ enumArray_.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(DeprecatedFieldsMessage 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<DeprecatedFieldsMessage, Builder> {
+ protected override Builder ThisBuilder {
+ get { return this; }
+ }
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(DeprecatedFieldsMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private DeprecatedFieldsMessage result;
+
+ private DeprecatedFieldsMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ DeprecatedFieldsMessage original = result;
+ result = new DeprecatedFieldsMessage();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
+
+ protected override DeprecatedFieldsMessage 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.DeprecatedFieldsMessage.Descriptor; }
+ }
+
+ public override DeprecatedFieldsMessage DefaultInstanceForType {
+ get { return global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage.DefaultInstance; }
+ }
+
+ public override DeprecatedFieldsMessage BuildPartial() {
+ if (resultIsReadOnly) {
+ return result;
+ }
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
+ }
+
+ 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;
+ PrepareBuilder();
+ if (other.HasPrimitiveValue) {
+ PrimitiveValue = other.PrimitiveValue;
+ }
+ if (other.primitiveArray_.Count != 0) {
+ result.primitiveArray_.Add(other.primitiveArray_);
+ }
+ if (other.HasMessageValue) {
+ MergeMessageValue(other.MessageValue);
+ }
+ if (other.messageArray_.Count != 0) {
+ result.messageArray_.Add(other.messageArray_);
+ }
+ if (other.HasEnumValue) {
+ EnumValue = other.EnumValue;
+ }
+ if (other.enumArray_.Count != 0) {
+ result.enumArray_.Add(other.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) {
+ 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(_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<object> unknownItems;
+ input.ReadEnumArray<global::UnitTest.Issues.TestProtos.DeprecatedEnum>(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) {
+ PrepareBuilder();
+ result.hasPrimitiveValue = true;
+ result.primitiveValue_ = value;
+ return this;
+ }
+ [global::System.ObsoleteAttribute()]
+ public Builder ClearPrimitiveValue() {
+ PrepareBuilder();
+ result.hasPrimitiveValue = false;
+ result.primitiveValue_ = 0;
+ return this;
+ }
+
+ [global::System.ObsoleteAttribute()]
+ public pbc::IPopsicleList<int> PrimitiveArrayList {
+ get { return PrepareBuilder().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) {
+ PrepareBuilder();
+ result.primitiveArray_[index] = value;
+ return this;
+ }
+ [global::System.ObsoleteAttribute()]
+ public Builder AddPrimitiveArray(int value) {
+ PrepareBuilder();
+ result.primitiveArray_.Add(value);
+ return this;
+ }
+ [global::System.ObsoleteAttribute()]
+ public Builder AddRangePrimitiveArray(scg::IEnumerable<int> values) {
+ PrepareBuilder();
+ result.primitiveArray_.Add(values);
+ return this;
+ }
+ [global::System.ObsoleteAttribute()]
+ public Builder ClearPrimitiveArray() {
+ PrepareBuilder();
+ 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");
+ PrepareBuilder();
+ 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");
+ PrepareBuilder();
+ 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");
+ PrepareBuilder();
+ 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() {
+ PrepareBuilder();
+ result.hasMessageValue = false;
+ result.messageValue_ = null;
+ return this;
+ }
+
+ [global::System.ObsoleteAttribute()]
+ public pbc::IPopsicleList<global::UnitTest.Issues.TestProtos.DeprecatedChild> MessageArrayList {
+ get { return PrepareBuilder().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");
+ PrepareBuilder();
+ 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");
+ PrepareBuilder();
+ result.messageArray_[index] = builderForValue.Build();
+ return this;
+ }
+ [global::System.ObsoleteAttribute()]
+ public Builder AddMessageArray(global::UnitTest.Issues.TestProtos.DeprecatedChild value) {
+ pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
+ result.messageArray_.Add(value);
+ return this;
+ }
+ [global::System.ObsoleteAttribute()]
+ public Builder AddMessageArray(global::UnitTest.Issues.TestProtos.DeprecatedChild.Builder builderForValue) {
+ pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
+ result.messageArray_.Add(builderForValue.Build());
+ return this;
+ }
+ [global::System.ObsoleteAttribute()]
+ public Builder AddRangeMessageArray(scg::IEnumerable<global::UnitTest.Issues.TestProtos.DeprecatedChild> values) {
+ PrepareBuilder();
+ result.messageArray_.Add(values);
+ return this;
+ }
+ [global::System.ObsoleteAttribute()]
+ public Builder ClearMessageArray() {
+ PrepareBuilder();
+ 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) {
+ PrepareBuilder();
+ result.hasEnumValue = true;
+ result.enumValue_ = value;
+ return this;
+ }
+ [global::System.ObsoleteAttribute()]
+ public Builder ClearEnumValue() {
+ PrepareBuilder();
+ result.hasEnumValue = false;
+ result.enumValue_ = global::UnitTest.Issues.TestProtos.DeprecatedEnum.one;
+ return this;
+ }
+
+ [global::System.ObsoleteAttribute()]
+ public pbc::IPopsicleList<global::UnitTest.Issues.TestProtos.DeprecatedEnum> EnumArrayList {
+ get { return PrepareBuilder().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) {
+ PrepareBuilder();
+ result.enumArray_[index] = value;
+ return this;
+ }
+ [global::System.ObsoleteAttribute()]
+ public Builder AddEnumArray(global::UnitTest.Issues.TestProtos.DeprecatedEnum value) {
+ PrepareBuilder();
+ result.enumArray_.Add(value);
+ return this;
+ }
+ [global::System.ObsoleteAttribute()]
+ public Builder AddRangeEnumArray(scg::IEnumerable<global::UnitTest.Issues.TestProtos.DeprecatedEnum> values) {
+ PrepareBuilder();
+ result.enumArray_.Add(values);
+ return this;
+ }
+ [global::System.ObsoleteAttribute()]
+ public Builder ClearEnumArray() {
+ PrepareBuilder();
+ 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 9227c7cc..d1fa8633 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 77635f21..a758ba81 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;
@@ -137,13 +137,14 @@ 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<SizeMessage1, SizeMessage1.Builder> {
- private static readonly SizeMessage1 defaultInstance = new Builder().BuildPartial();
+ private SizeMessage1() { }
+ 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 +505,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,11 +603,16 @@ 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(); }
public static Builder CreateBuilder(SizeMessage1 prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -616,21 +622,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(SizeMessage1 cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private SizeMessage1 result;
+
+ private SizeMessage1 PrepareBuilder() {
+ if (resultIsReadOnly) {
+ SizeMessage1 original = result;
+ result = new SizeMessage1();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -642,13 +675,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.field5_.MakeReadOnly();
- SizeMessage1 returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
@@ -661,11 +692,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 +713,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 +734,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 +754,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 +774,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 +794,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 +814,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 +834,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 +854,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 +874,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 +895,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 +909,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> Field5List {
- get { return result.field5_; }
+ get { return PrepareBuilder().field5_; }
}
public int Field5Count {
get { return result.Field5Count; }
@@ -867,20 +920,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<ulong> values) {
- base.AddRange(values, result.field5_);
+ PrepareBuilder();
+ result.field5_.Add(values);
return this;
}
public Builder ClearField5() {
+ PrepareBuilder();
result.field5_.Clear();
return this;
}
@@ -893,11 +950,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 +971,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 +991,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 +1011,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 +1031,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 +1051,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 +1071,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 +1091,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 +1111,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 +1131,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 +1151,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 +1172,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 +1193,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 +1213,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 +1233,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 +1253,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 +1273,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 +1293,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 +1313,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 +1333,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 +1353,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 +1373,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 +1394,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,8 +1419,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearField15() {
+ PrepareBuilder();
result.hasField15 = false;
- result.field15_ = global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage.DefaultInstance;
+ result.field15_ = null;
return this;
}
@@ -1328,11 +1433,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 +1453,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 +1473,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 +1493,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 +1514,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 +1534,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;
@@ -1438,13 +1555,14 @@ 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<SizeMessage1SubMessage, SizeMessage1SubMessage.Builder> {
- private static readonly SizeMessage1SubMessage defaultInstance = new Builder().BuildPartial();
+ private SizeMessage1SubMessage() { }
+ 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 {
@@ -1693,11 +1811,15 @@ 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(); }
public static Builder CreateBuilder(SizeMessage1SubMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1707,21 +1829,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(SizeMessage1SubMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private SizeMessage1SubMessage result;
+
+ private SizeMessage1SubMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ SizeMessage1SubMessage original = result;
+ result = new SizeMessage1SubMessage();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- SizeMessage1SubMessage result = new SizeMessage1SubMessage();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1733,12 +1882,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 (resultIsReadOnly) {
+ return result;
}
- SizeMessage1SubMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
@@ -1750,11 +1898,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 +1918,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 +1938,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 +1959,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 +1979,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 +1999,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 +2019,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 +2039,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 +2059,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 +2079,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 +2099,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 +2121,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 +2141,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 +2161,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 +2181,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 +2203,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 +2223,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 +2244,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 +2266,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 +2288,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;
@@ -2121,13 +2309,14 @@ 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<SizeMessage2, SizeMessage2.Builder> {
- private static readonly SizeMessage2 defaultInstance = new Builder().BuildPartial();
+ private SizeMessage2() { }
+ 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 {
@@ -2151,13 +2340,14 @@ 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<Group1, Group1.Builder> {
- private static readonly Group1 defaultInstance = new Builder().BuildPartial();
+ private Group1() { }
+ 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 {
@@ -2331,12 +2521,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) {
@@ -2369,11 +2559,18 @@ 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(); }
public static Builder CreateBuilder(Group1 prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -2383,21 +2580,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(Group1 cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- Group1 result = new Group1();
+ private bool resultIsReadOnly;
+ private Group1 result;
+
+ private Group1 PrepareBuilder() {
+ if (resultIsReadOnly) {
+ Group1 original = result;
+ result = new Group1();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -2409,15 +2633,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.field14_.MakeReadOnly();
- result.field22_.MakeReadOnly();
- result.field73_.MakeReadOnly();
- Group1 returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
@@ -2429,11 +2649,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 +2669,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 +2690,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 +2711,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<string> Field14List {
- get { return result.field14_; }
+ get { return PrepareBuilder().field14_; }
}
public int Field14Count {
get { return result.Field14Count; }
@@ -2506,19 +2734,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<string> values) {
- base.AddRange(values, result.field14_);
+ PrepareBuilder();
+ result.field14_.Add(values);
return this;
}
public Builder ClearField14() {
+ PrepareBuilder();
result.field14_.Clear();
return this;
}
@@ -2533,11 +2765,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 +2785,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 +2806,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 +2826,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 +2847,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 +2868,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<string> Field22List {
- get { return result.field22_; }
+ get { return PrepareBuilder().field22_; }
}
public int Field22Count {
get { return result.Field22Count; }
@@ -2647,25 +2891,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<string> values) {
- base.AddRange(values, result.field22_);
+ PrepareBuilder();
+ result.field22_.Add(values);
return this;
}
public Builder ClearField22() {
+ PrepareBuilder();
result.field22_.Clear();
return this;
}
public pbc::IPopsicleList<int> Field73List {
- get { return result.field73_; }
+ get { return PrepareBuilder().field73_; }
}
public int Field73Count {
get { return result.Field73Count; }
@@ -2674,18 +2922,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<int> values) {
- base.AddRange(values, result.field73_);
+ PrepareBuilder();
+ result.field73_.Add(values);
return this;
}
public Builder ClearField73() {
+ PrepareBuilder();
result.field73_.Clear();
return this;
}
@@ -2698,11 +2950,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 +2971,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 +2992,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,8 +3017,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearField31() {
+ PrepareBuilder();
result.hasField31 = false;
- result.field31_ = global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage.DefaultInstance;
+ result.field31_ = null;
return this;
}
}
@@ -3109,11 +3369,19 @@ 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(); }
public static Builder CreateBuilder(SizeMessage2 prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -3123,21 +3391,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(SizeMessage2 cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private SizeMessage2 result;
+
+ private SizeMessage2 PrepareBuilder() {
+ if (resultIsReadOnly) {
+ SizeMessage2 original = result;
+ result = new SizeMessage2();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- SizeMessage2 result = new SizeMessage2();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -3149,16 +3444,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.group1_.MakeReadOnly();
- result.field128_.MakeReadOnly();
- result.field127_.MakeReadOnly();
- result.field130_.MakeReadOnly();
- SizeMessage2 returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
@@ -3171,11 +3461,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 +3481,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 +3501,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 +3521,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 +3541,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 +3562,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 +3583,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 +3603,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 +3623,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 +3643,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 +3663,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 +3683,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 +3703,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 +3723,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 +3743,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 +3763,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 +3783,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 +3803,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 +3823,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 +3843,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 +3863,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 +3883,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<global::Google.ProtocolBuffers.TestProtos.SizeMessage2.Types.Group1> Group1List {
- get { return result.group1_; }
+ get { return PrepareBuilder().group1_; }
}
public int Group1Count {
get { return result.Group1Count; }
@@ -3572,35 +3906,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<global::Google.ProtocolBuffers.TestProtos.SizeMessage2.Types.Group1> values) {
- base.AddRange(values, result.group1_);
+ PrepareBuilder();
+ result.group1_.Add(values);
return this;
}
public Builder ClearGroup1() {
+ PrepareBuilder();
result.group1_.Clear();
return this;
}
public pbc::IPopsicleList<string> Field128List {
- get { return result.field128_; }
+ get { return PrepareBuilder().field128_; }
}
public int Field128Count {
get { return result.Field128Count; }
@@ -3610,19 +3950,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<string> values) {
- base.AddRange(values, result.field128_);
+ PrepareBuilder();
+ result.field128_.Add(values);
return this;
}
public Builder ClearField128() {
+ PrepareBuilder();
result.field128_.Clear();
return this;
}
@@ -3635,18 +3979,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<string> Field127List {
- get { return result.field127_; }
+ get { return PrepareBuilder().field127_; }
}
public int Field127Count {
get { return result.Field127Count; }
@@ -3656,19 +4002,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<string> values) {
- base.AddRange(values, result.field127_);
+ PrepareBuilder();
+ result.field127_.Add(values);
return this;
}
public Builder ClearField127() {
+ PrepareBuilder();
result.field127_.Clear();
return this;
}
@@ -3681,18 +4031,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<long> Field130List {
- get { return result.field130_; }
+ get { return PrepareBuilder().field130_; }
}
public int Field130Count {
get { return result.Field130Count; }
@@ -3701,18 +4053,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<long> values) {
- base.AddRange(values, result.field130_);
+ PrepareBuilder();
+ result.field130_.Add(values);
return this;
}
public Builder ClearField130() {
+ PrepareBuilder();
result.field130_.Clear();
return this;
}
@@ -3725,11 +4081,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 +4101,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;
@@ -3762,13 +4122,14 @@ 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<SizeMessage2GroupedMessage, SizeMessage2GroupedMessage.Builder> {
- private static readonly SizeMessage2GroupedMessage defaultInstance = new Builder().BuildPartial();
+ private SizeMessage2GroupedMessage() { }
+ 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 {
@@ -3923,11 +4284,15 @@ 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(); }
public static Builder CreateBuilder(SizeMessage2GroupedMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -3937,21 +4302,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(SizeMessage2GroupedMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- SizeMessage2GroupedMessage result = new SizeMessage2GroupedMessage();
+ private bool resultIsReadOnly;
+ private SizeMessage2GroupedMessage result;
+
+ private SizeMessage2GroupedMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ SizeMessage2GroupedMessage original = result;
+ result = new SizeMessage2GroupedMessage();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -3963,12 +4355,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 (resultIsReadOnly) {
+ return result;
}
- SizeMessage2GroupedMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
@@ -3980,11 +4371,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 +4391,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 +4411,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 +4431,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 +4451,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 +4471,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 +4491,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 +4511,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 +4531,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 +4551,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 +4571,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 918be643..c7e1a93b 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;
@@ -137,7 +137,8 @@ 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<SpeedMessage1, SpeedMessage1.Builder> {
- private static readonly SpeedMessage1 defaultInstance = new Builder().BuildPartial();
+ private SpeedMessage1() { }
+ 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 +146,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override SpeedMessage1 DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override SpeedMessage1 ThisMessage {
@@ -506,12 +507,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,11 +882,16 @@ 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(); }
public static Builder CreateBuilder(SpeedMessage1 prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -895,21 +901,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(SpeedMessage1 cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private SpeedMessage1 result;
+
+ private SpeedMessage1 PrepareBuilder() {
+ if (resultIsReadOnly) {
+ SpeedMessage1 original = result;
+ result = new SpeedMessage1();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- SpeedMessage1 result = new SpeedMessage1();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -921,13 +954,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.field5_.MakeReadOnly();
- SpeedMessage1 returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -941,6 +972,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;
}
@@ -975,7 +1007,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;
@@ -1073,6 +1105,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 +1328,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 +1349,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 +1370,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 +1390,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 +1410,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 +1430,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 +1450,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 +1470,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 +1490,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 +1510,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 +1531,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 +1545,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> Field5List {
- get { return result.field5_; }
+ get { return PrepareBuilder().field5_; }
}
public int Field5Count {
get { return result.Field5Count; }
@@ -1501,20 +1556,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<ulong> values) {
- base.AddRange(values, result.field5_);
+ PrepareBuilder();
+ result.field5_.Add(values);
return this;
}
public Builder ClearField5() {
+ PrepareBuilder();
result.field5_.Clear();
return this;
}
@@ -1527,11 +1586,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 +1607,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 +1627,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 +1647,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 +1667,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 +1687,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 +1707,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 +1727,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 +1747,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 +1767,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 +1787,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 +1808,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 +1829,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 +1849,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 +1869,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 +1889,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 +1909,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 +1929,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 +1949,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 +1969,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 +1989,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 +2009,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 +2030,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,8 +2055,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearField15() {
+ PrepareBuilder();
result.hasField15 = false;
- result.field15_ = global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.DefaultInstance;
+ result.field15_ = null;
return this;
}
@@ -1962,11 +2069,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 +2089,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 +2109,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 +2129,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 +2150,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 +2170,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;
@@ -2072,7 +2191,8 @@ 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<SpeedMessage1SubMessage, SpeedMessage1SubMessage.Builder> {
- private static readonly SpeedMessage1SubMessage defaultInstance = new Builder().BuildPartial();
+ private SpeedMessage1SubMessage() { }
+ 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 {
@@ -2080,7 +2200,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override SpeedMessage1SubMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override SpeedMessage1SubMessage ThisMessage {
@@ -2474,11 +2594,15 @@ 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(); }
public static Builder CreateBuilder(SpeedMessage1SubMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -2488,21 +2612,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(SpeedMessage1SubMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private SpeedMessage1SubMessage result;
+
+ private SpeedMessage1SubMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ SpeedMessage1SubMessage original = result;
+ result = new SpeedMessage1SubMessage();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- SpeedMessage1SubMessage result = new SpeedMessage1SubMessage();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -2514,12 +2665,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 (resultIsReadOnly) {
+ return result;
}
- SpeedMessage1SubMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -2533,6 +2683,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 +2753,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 +2885,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 +2905,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 +2925,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 +2946,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 +2966,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 +2986,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 +3006,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 +3026,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 +3046,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 +3066,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 +3086,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 +3108,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 +3128,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 +3148,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 +3168,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 +3190,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 +3210,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 +3231,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 +3253,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 +3275,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;
@@ -3104,7 +3296,8 @@ 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<SpeedMessage2, SpeedMessage2.Builder> {
- private static readonly SpeedMessage2 defaultInstance = new Builder().BuildPartial();
+ private SpeedMessage2() { }
+ 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 {
@@ -3112,7 +3305,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override SpeedMessage2 DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override SpeedMessage2 ThisMessage {
@@ -3136,7 +3329,8 @@ 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<Group1, Group1.Builder> {
- private static readonly Group1 defaultInstance = new Builder().BuildPartial();
+ private Group1() { }
+ 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 {
@@ -3144,7 +3338,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override Group1 DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override Group1 ThisMessage {
@@ -3318,12 +3512,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 {
@@ -3494,11 +3688,18 @@ 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(); }
public static Builder CreateBuilder(Group1 prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -3508,21 +3709,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(Group1 cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private Group1 result;
+
+ private Group1 PrepareBuilder() {
+ if (resultIsReadOnly) {
+ Group1 original = result;
+ result = new Group1();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -3534,15 +3762,11 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override Group1 BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
- }
- result.field14_.MakeReadOnly();
- result.field22_.MakeReadOnly();
- result.field73_.MakeReadOnly();
- Group1 returnMe = result;
- result = null;
- return returnMe;
+ if (resultIsReadOnly) {
+ return result;
+ }
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -3556,6 +3780,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;
}
@@ -3569,7 +3794,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 +3815,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;
@@ -3613,6 +3838,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 +3960,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 +3980,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 +4001,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 +4022,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<string> Field14List {
- get { return result.field14_; }
+ get { return PrepareBuilder().field14_; }
}
public int Field14Count {
get { return result.Field14Count; }
@@ -3811,19 +4045,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<string> values) {
- base.AddRange(values, result.field14_);
+ PrepareBuilder();
+ result.field14_.Add(values);
return this;
}
public Builder ClearField14() {
+ PrepareBuilder();
result.field14_.Clear();
return this;
}
@@ -3838,11 +4076,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 +4096,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 +4117,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 +4137,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 +4158,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 +4179,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<string> Field22List {
- get { return result.field22_; }
+ get { return PrepareBuilder().field22_; }
}
public int Field22Count {
get { return result.Field22Count; }
@@ -3952,25 +4202,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<string> values) {
- base.AddRange(values, result.field22_);
+ PrepareBuilder();
+ result.field22_.Add(values);
return this;
}
public Builder ClearField22() {
+ PrepareBuilder();
result.field22_.Clear();
return this;
}
public pbc::IPopsicleList<int> Field73List {
- get { return result.field73_; }
+ get { return PrepareBuilder().field73_; }
}
public int Field73Count {
get { return result.Field73Count; }
@@ -3979,18 +4233,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<int> values) {
- base.AddRange(values, result.field73_);
+ PrepareBuilder();
+ result.field73_.Add(values);
return this;
}
public Builder ClearField73() {
+ PrepareBuilder();
result.field73_.Clear();
return this;
}
@@ -4003,11 +4261,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 +4282,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 +4303,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,8 +4328,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearField31() {
+ PrepareBuilder();
result.hasField31 = false;
- result.field31_ = global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.DefaultInstance;
+ result.field31_ = null;
return this;
}
}
@@ -4634,11 +4900,19 @@ 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(); }
public static Builder CreateBuilder(SpeedMessage2 prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -4648,21 +4922,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(SpeedMessage2 cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- SpeedMessage2 result = new SpeedMessage2();
+ private bool resultIsReadOnly;
+ private SpeedMessage2 result;
+
+ private SpeedMessage2 PrepareBuilder() {
+ if (resultIsReadOnly) {
+ SpeedMessage2 original = result;
+ result = new SpeedMessage2();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -4674,16 +4975,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.group1_.MakeReadOnly();
- result.field128_.MakeReadOnly();
- result.field127_.MakeReadOnly();
- result.field130_.MakeReadOnly();
- SpeedMessage2 returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -4697,6 +4993,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;
}
@@ -4764,22 +5061,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;
@@ -4796,6 +5093,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 +5267,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 +5287,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 +5307,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 +5327,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 +5347,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 +5368,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 +5389,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 +5409,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 +5429,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 +5449,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 +5469,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 +5489,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 +5509,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 +5529,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 +5549,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 +5569,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 +5589,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 +5609,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 +5629,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 +5649,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 +5669,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 +5689,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<global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1> Group1List {
- get { return result.group1_; }
+ get { return PrepareBuilder().group1_; }
}
public int Group1Count {
get { return result.Group1Count; }
@@ -5370,35 +5712,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<global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1> values) {
- base.AddRange(values, result.group1_);
+ PrepareBuilder();
+ result.group1_.Add(values);
return this;
}
public Builder ClearGroup1() {
+ PrepareBuilder();
result.group1_.Clear();
return this;
}
public pbc::IPopsicleList<string> Field128List {
- get { return result.field128_; }
+ get { return PrepareBuilder().field128_; }
}
public int Field128Count {
get { return result.Field128Count; }
@@ -5408,19 +5756,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<string> values) {
- base.AddRange(values, result.field128_);
+ PrepareBuilder();
+ result.field128_.Add(values);
return this;
}
public Builder ClearField128() {
+ PrepareBuilder();
result.field128_.Clear();
return this;
}
@@ -5433,18 +5785,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<string> Field127List {
- get { return result.field127_; }
+ get { return PrepareBuilder().field127_; }
}
public int Field127Count {
get { return result.Field127Count; }
@@ -5454,19 +5808,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<string> values) {
- base.AddRange(values, result.field127_);
+ PrepareBuilder();
+ result.field127_.Add(values);
return this;
}
public Builder ClearField127() {
+ PrepareBuilder();
result.field127_.Clear();
return this;
}
@@ -5479,18 +5837,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<long> Field130List {
- get { return result.field130_; }
+ get { return PrepareBuilder().field130_; }
}
public int Field130Count {
get { return result.Field130Count; }
@@ -5499,18 +5859,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<long> values) {
- base.AddRange(values, result.field130_);
+ PrepareBuilder();
+ result.field130_.Add(values);
return this;
}
public Builder ClearField130() {
+ PrepareBuilder();
result.field130_.Clear();
return this;
}
@@ -5523,11 +5887,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 +5907,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;
@@ -5560,7 +5928,8 @@ 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<SpeedMessage2GroupedMessage, SpeedMessage2GroupedMessage.Builder> {
- private static readonly SpeedMessage2GroupedMessage defaultInstance = new Builder().BuildPartial();
+ private SpeedMessage2GroupedMessage() { }
+ 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 {
@@ -5568,7 +5937,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override SpeedMessage2GroupedMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override SpeedMessage2GroupedMessage ThisMessage {
@@ -5814,11 +6183,15 @@ 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(); }
public static Builder CreateBuilder(SpeedMessage2GroupedMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -5828,21 +6201,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(SpeedMessage2GroupedMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- SpeedMessage2GroupedMessage result = new SpeedMessage2GroupedMessage();
+ private bool resultIsReadOnly;
+ private SpeedMessage2GroupedMessage result;
+
+ private SpeedMessage2GroupedMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ SpeedMessage2GroupedMessage original = result;
+ result = new SpeedMessage2GroupedMessage();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -5854,12 +6254,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 (resultIsReadOnly) {
+ return result;
}
- SpeedMessage2GroupedMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -5873,6 +6272,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 +6315,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 +6411,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 +6431,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 +6451,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 +6471,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 +6491,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 +6511,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 +6531,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 +6551,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 +6571,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 +6591,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 +6611,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 a96833be..f31fdd89 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;
@@ -43,7 +43,8 @@ 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<ImportMessageLite, ImportMessageLite.Builder> {
- private static readonly ImportMessageLite defaultInstance = new Builder().BuildPartial();
+ private ImportMessageLite() { }
+ 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 +52,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override ImportMessageLite DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override ImportMessageLite ThisMessage {
@@ -146,11 +147,15 @@ 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(); }
public static Builder CreateBuilder(ImportMessageLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -160,21 +165,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(ImportMessageLite cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private ImportMessageLite result;
+
+ private ImportMessageLite PrepareBuilder() {
+ if (resultIsReadOnly) {
+ ImportMessageLite original = result;
+ result = new ImportMessageLite();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- ImportMessageLite result = new ImportMessageLite();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override ImportMessageLite DefaultInstanceForType {
@@ -182,12 +214,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 (resultIsReadOnly) {
+ return result;
}
- ImportMessageLite returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -201,6 +232,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 +244,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 +287,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 5749c97f..c12aef8e 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;
@@ -71,7 +71,8 @@ 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<ImportMessage, ImportMessage.Builder> {
- private static readonly ImportMessage defaultInstance = new Builder().BuildPartial();
+ private ImportMessage() { }
+ 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 +80,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override ImportMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override ImportMessage ThisMessage {
@@ -165,11 +166,15 @@ 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(); }
public static Builder CreateBuilder(ImportMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -179,21 +184,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(ImportMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private ImportMessage result;
+
+ private ImportMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ ImportMessage original = result;
+ result = new ImportMessage();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- ImportMessage result = new ImportMessage();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -205,12 +237,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 (resultIsReadOnly) {
+ return result;
}
- ImportMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -224,6 +255,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 +268,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 +324,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 8a6bb589..f9cec1af 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;
@@ -103,7 +103,8 @@ 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<TestMessageSet, TestMessageSet.Builder> {
- private static readonly TestMessageSet defaultInstance = new Builder().BuildPartial();
+ private TestMessageSet() { }
+ 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 +112,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestMessageSet DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestMessageSet ThisMessage {
@@ -185,11 +186,15 @@ 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(); }
public static Builder CreateBuilder(TestMessageSet prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -199,21 +204,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestMessageSet cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestMessageSet result = new TestMessageSet();
+ private bool resultIsReadOnly;
+ private TestMessageSet result;
+
+ private TestMessageSet PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestMessageSet original = result;
+ result = new TestMessageSet();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -225,12 +257,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 (resultIsReadOnly) {
+ return result;
}
- TestMessageSet returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -244,6 +275,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 +286,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;
@@ -306,7 +339,8 @@ 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<TestMessageSetContainer, TestMessageSetContainer.Builder> {
- private static readonly TestMessageSetContainer defaultInstance = new Builder().BuildPartial();
+ private TestMessageSetContainer() { }
+ 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 {
@@ -314,7 +348,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestMessageSetContainer DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestMessageSetContainer ThisMessage {
@@ -331,12 +365,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 {
@@ -400,11 +434,15 @@ 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(); }
public static Builder CreateBuilder(TestMessageSetContainer prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -414,21 +452,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestMessageSetContainer cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestMessageSetContainer result = new TestMessageSetContainer();
+ private bool resultIsReadOnly;
+ private TestMessageSetContainer result;
+
+ private TestMessageSetContainer PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestMessageSetContainer original = result;
+ result = new TestMessageSetContainer();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -440,12 +505,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 (resultIsReadOnly) {
+ return result;
}
- TestMessageSetContainer returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -459,6 +523,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 +536,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 +598,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,8 +623,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearMessageSet() {
+ PrepareBuilder();
result.hasMessageSet = false;
- result.messageSet_ = global::Google.ProtocolBuffers.TestProtos.TestMessageSet.DefaultInstance;
+ result.messageSet_ = null;
return this;
}
}
@@ -568,7 +638,8 @@ 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<TestMessageSetExtension1, TestMessageSetExtension1.Builder> {
- private static readonly TestMessageSetExtension1 defaultInstance = new Builder().BuildPartial();
+ private TestMessageSetExtension1() { }
+ 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 {
@@ -576,7 +647,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestMessageSetExtension1 DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestMessageSetExtension1 ThisMessage {
@@ -664,11 +735,15 @@ 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(); }
public static Builder CreateBuilder(TestMessageSetExtension1 prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -678,21 +753,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestMessageSetExtension1 cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestMessageSetExtension1 result = new TestMessageSetExtension1();
+ private bool resultIsReadOnly;
+ private TestMessageSetExtension1 result;
+
+ private TestMessageSetExtension1 PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestMessageSetExtension1 original = result;
+ result = new TestMessageSetExtension1();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -704,12 +806,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 (resultIsReadOnly) {
+ return result;
}
- TestMessageSetExtension1 returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -723,6 +824,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 +837,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 +893,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;
@@ -809,7 +914,8 @@ 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<TestMessageSetExtension2, TestMessageSetExtension2.Builder> {
- private static readonly TestMessageSetExtension2 defaultInstance = new Builder().BuildPartial();
+ private TestMessageSetExtension2() { }
+ 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 {
@@ -817,7 +923,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestMessageSetExtension2 DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestMessageSetExtension2 ThisMessage {
@@ -905,11 +1011,15 @@ 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(); }
public static Builder CreateBuilder(TestMessageSetExtension2 prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -919,21 +1029,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestMessageSetExtension2 cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestMessageSetExtension2 result;
- TestMessageSetExtension2 result = new TestMessageSetExtension2();
+ private TestMessageSetExtension2 PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestMessageSetExtension2 original = result;
+ result = new TestMessageSetExtension2();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -945,12 +1082,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 (resultIsReadOnly) {
+ return result;
}
- TestMessageSetExtension2 returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -964,6 +1100,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 +1113,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 +1170,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;
@@ -1051,7 +1191,8 @@ 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<RawMessageSet, RawMessageSet.Builder> {
- private static readonly RawMessageSet defaultInstance = new Builder().BuildPartial();
+ private RawMessageSet() { }
+ 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 {
@@ -1059,7 +1200,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override RawMessageSet DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override RawMessageSet ThisMessage {
@@ -1083,7 +1224,8 @@ 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<Item, Item.Builder> {
- private static readonly Item defaultInstance = new Builder().BuildPartial();
+ private Item() { }
+ 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 {
@@ -1091,7 +1233,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override Item DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override Item ThisMessage {
@@ -1195,11 +1337,15 @@ 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(); }
public static Builder CreateBuilder(Item prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1209,21 +1355,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(Item cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- Item result = new Item();
+ private bool resultIsReadOnly;
+ private Item result;
+
+ private Item PrepareBuilder() {
+ if (resultIsReadOnly) {
+ Item original = result;
+ result = new Item();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1235,12 +1408,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 (resultIsReadOnly) {
+ return result;
}
- Item returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1254,6 +1426,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 +1442,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 +1502,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 +1523,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;
@@ -1438,11 +1616,16 @@ 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(); }
public static Builder CreateBuilder(RawMessageSet prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1452,21 +1635,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(RawMessageSet cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private RawMessageSet result;
- RawMessageSet result = new RawMessageSet();
+ private RawMessageSet PrepareBuilder() {
+ if (resultIsReadOnly) {
+ RawMessageSet original = result;
+ result = new RawMessageSet();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1478,13 +1688,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.item_.MakeReadOnly();
- RawMessageSet returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1498,8 +1706,9 @@ 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_);
+ result.item_.Add(other.item_);
}
this.MergeUnknownFields(other.UnknownFields);
return this;
@@ -1510,6 +1719,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 +1768,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item> ItemList {
- get { return result.item_; }
+ get { return PrepareBuilder().item_; }
}
public int ItemCount {
get { return result.ItemCount; }
@@ -1568,29 +1778,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<global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item> values) {
- base.AddRange(values, result.item_);
+ PrepareBuilder();
+ result.item_.Add(values);
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 74d6af60..ba56b145 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;
@@ -81,7 +81,8 @@ 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<TestMessage, TestMessage.Builder> {
- private static readonly TestMessage defaultInstance = new Builder().BuildPartial();
+ private TestMessage() { }
+ 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 +90,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { }
public override TestMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestMessage ThisMessage {
@@ -179,11 +180,15 @@ 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(); }
public static Builder CreateBuilder(TestMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -193,21 +198,48 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestMessage result;
+
+ private TestMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestMessage original = result;
+ result = new TestMessage();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestMessage result = new TestMessage();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -219,12 +251,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 (resultIsReadOnly) {
+ return result;
}
- TestMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -238,6 +269,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 +283,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 +339,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 c7153abc..92d965d4 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;
@@ -85,13 +85,14 @@ 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<TestOptimizedForSize, TestOptimizedForSize.Builder> {
- private static readonly TestOptimizedForSize defaultInstance = new Builder().BuildPartial();
+ private TestOptimizedForSize() { }
+ 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 +123,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,11 +161,15 @@ 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(); }
public static Builder CreateBuilder(TestOptimizedForSize prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -174,21 +179,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestOptimizedForSize cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestOptimizedForSize result;
+
+ private TestOptimizedForSize PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestOptimizedForSize original = result;
+ result = new TestOptimizedForSize();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestOptimizedForSize result = new TestOptimizedForSize();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -200,12 +232,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 (resultIsReadOnly) {
+ return result;
}
- TestOptimizedForSize returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
@@ -217,11 +248,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 +269,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,8 +294,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearMsg() {
+ PrepareBuilder();
result.hasMsg = false;
- result.msg_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance;
+ result.msg_ = null;
return this;
}
}
@@ -272,13 +309,14 @@ 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<TestRequiredOptimizedForSize, TestRequiredOptimizedForSize.Builder> {
- private static readonly TestRequiredOptimizedForSize defaultInstance = new Builder().BuildPartial();
+ private TestRequiredOptimizedForSize() { }
+ 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 {
@@ -333,11 +371,15 @@ 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(); }
public static Builder CreateBuilder(TestRequiredOptimizedForSize prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -347,21 +389,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestRequiredOptimizedForSize cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestRequiredOptimizedForSize result;
+
+ private TestRequiredOptimizedForSize PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestRequiredOptimizedForSize original = result;
+ result = new TestRequiredOptimizedForSize();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestRequiredOptimizedForSize result = new TestRequiredOptimizedForSize();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -373,12 +442,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 (resultIsReadOnly) {
+ return result;
}
- TestRequiredOptimizedForSize returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
@@ -390,11 +458,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;
@@ -409,13 +479,14 @@ 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<TestOptionalOptimizedForSize, TestOptionalOptimizedForSize.Builder> {
- private static readonly TestOptionalOptimizedForSize defaultInstance = new Builder().BuildPartial();
+ private TestOptionalOptimizedForSize() { }
+ 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 {
@@ -432,12 +503,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) {
@@ -470,11 +541,15 @@ 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(); }
public static Builder CreateBuilder(TestOptionalOptimizedForSize prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -484,21 +559,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestOptionalOptimizedForSize cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestOptionalOptimizedForSize result;
- TestOptionalOptimizedForSize result = new TestOptionalOptimizedForSize();
+ private TestOptionalOptimizedForSize PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestOptionalOptimizedForSize original = result;
+ result = new TestOptionalOptimizedForSize();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -510,12 +612,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 (resultIsReadOnly) {
+ return result;
}
- TestOptionalOptimizedForSize returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
@@ -528,18 +629,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,8 +654,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
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 d8824d49..35064953 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;
@@ -1122,7 +1122,8 @@ 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<TestAllTypes, TestAllTypes.Builder> {
- private static readonly TestAllTypes defaultInstance = new Builder().BuildPartial();
+ private TestAllTypes() { }
+ 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 +1131,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestAllTypes DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestAllTypes ThisMessage {
@@ -1162,7 +1163,8 @@ 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<NestedMessage, NestedMessage.Builder> {
- private static readonly NestedMessage defaultInstance = new Builder().BuildPartial();
+ private NestedMessage() { }
+ 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 +1172,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override NestedMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override NestedMessage ThisMessage {
@@ -1256,11 +1258,15 @@ 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(); }
public static Builder CreateBuilder(NestedMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1270,21 +1276,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(NestedMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private NestedMessage result;
+
+ private NestedMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ NestedMessage original = result;
+ result = new NestedMessage();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1296,12 +1329,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 (resultIsReadOnly) {
+ return result;
}
- NestedMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1315,6 +1347,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 +1360,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 +1416,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;
@@ -1401,7 +1437,8 @@ 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<OptionalGroup, OptionalGroup.Builder> {
- private static readonly OptionalGroup defaultInstance = new Builder().BuildPartial();
+ private OptionalGroup() { }
+ 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 {
@@ -1409,7 +1446,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override OptionalGroup DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override OptionalGroup ThisMessage {
@@ -1495,11 +1532,15 @@ 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(); }
public static Builder CreateBuilder(OptionalGroup prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1509,21 +1550,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(OptionalGroup cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private OptionalGroup result;
+
+ private OptionalGroup PrepareBuilder() {
+ if (resultIsReadOnly) {
+ OptionalGroup original = result;
+ result = new OptionalGroup();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1535,12 +1603,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 (resultIsReadOnly) {
+ return result;
}
- OptionalGroup returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1554,6 +1621,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 +1634,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 +1690,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;
@@ -1640,7 +1711,8 @@ 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<RepeatedGroup, RepeatedGroup.Builder> {
- private static readonly RepeatedGroup defaultInstance = new Builder().BuildPartial();
+ private RepeatedGroup() { }
+ 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 {
@@ -1648,7 +1720,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override RepeatedGroup DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override RepeatedGroup ThisMessage {
@@ -1734,11 +1806,15 @@ 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(); }
public static Builder CreateBuilder(RepeatedGroup prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1748,21 +1824,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(RepeatedGroup cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private RepeatedGroup result;
+
+ private RepeatedGroup PrepareBuilder() {
+ if (resultIsReadOnly) {
+ RepeatedGroup original = result;
+ result = new RepeatedGroup();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1774,12 +1877,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 (resultIsReadOnly) {
+ return result;
}
- RepeatedGroup returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1793,6 +1895,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 +1908,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 +1964,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;
@@ -2034,42 +2140,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;
@@ -3177,11 +3283,39 @@ 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(); }
public static Builder CreateBuilder(TestAllTypes prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -3191,21 +3325,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestAllTypes cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestAllTypes result;
+
+ private TestAllTypes PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestAllTypes original = result;
+ result = new TestAllTypes();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -3217,36 +3378,11 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestAllTypes BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
- }
- 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();
- TestAllTypes returnMe = result;
- result = null;
- return returnMe;
+ if (resultIsReadOnly) {
+ return result;
+ }
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -3260,6 +3396,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;
}
@@ -3333,76 +3470,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;
@@ -3473,6 +3610,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 +4045,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 +4065,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 +4087,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 +4109,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 +4129,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 +4149,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 +4171,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 +4193,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 +4213,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 +4233,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 +4253,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 +4273,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 +4293,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 +4314,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 +4335,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 +4356,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,8 +4381,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearOptionalGroup() {
+ PrepareBuilder();
result.hasOptionalGroup = false;
- result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance;
+ result.optionalGroup_ = null;
return this;
}
@@ -4224,18 +4396,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,8 +4421,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearOptionalNestedMessage() {
+ PrepareBuilder();
result.hasOptionalNestedMessage = false;
- result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance;
+ result.optionalNestedMessage_ = null;
return this;
}
@@ -4260,18 +4436,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,8 +4461,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearOptionalForeignMessage() {
+ PrepareBuilder();
result.hasOptionalForeignMessage = false;
- result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance;
+ result.optionalForeignMessage_ = null;
return this;
}
@@ -4296,18 +4476,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,8 +4501,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearOptionalImportMessage() {
+ PrepareBuilder();
result.hasOptionalImportMessage = false;
- result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance;
+ result.optionalImportMessage_ = null;
return this;
}
@@ -4331,11 +4515,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 +4535,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 +4555,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 +4576,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 +4597,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<int> RepeatedInt32List {
- get { return result.repeatedInt32_; }
+ get { return PrepareBuilder().repeatedInt32_; }
}
public int RepeatedInt32Count {
get { return result.RepeatedInt32Count; }
@@ -4425,24 +4619,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<int> values) {
- base.AddRange(values, result.repeatedInt32_);
+ PrepareBuilder();
+ result.repeatedInt32_.Add(values);
return this;
}
public Builder ClearRepeatedInt32() {
+ PrepareBuilder();
result.repeatedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedInt64List {
- get { return result.repeatedInt64_; }
+ get { return PrepareBuilder().repeatedInt64_; }
}
public int RepeatedInt64Count {
get { return result.RepeatedInt64Count; }
@@ -4451,25 +4649,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<long> values) {
- base.AddRange(values, result.repeatedInt64_);
+ PrepareBuilder();
+ result.repeatedInt64_.Add(values);
return this;
}
public Builder ClearRepeatedInt64() {
+ PrepareBuilder();
result.repeatedInt64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> RepeatedUint32List {
- get { return result.repeatedUint32_; }
+ get { return PrepareBuilder().repeatedUint32_; }
}
public int RepeatedUint32Count {
get { return result.RepeatedUint32Count; }
@@ -4480,27 +4682,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<uint> values) {
- base.AddRange(values, result.repeatedUint32_);
+ PrepareBuilder();
+ result.repeatedUint32_.Add(values);
return this;
}
public Builder ClearRepeatedUint32() {
+ PrepareBuilder();
result.repeatedUint32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> RepeatedUint64List {
- get { return result.repeatedUint64_; }
+ get { return PrepareBuilder().repeatedUint64_; }
}
public int RepeatedUint64Count {
get { return result.RepeatedUint64Count; }
@@ -4511,26 +4717,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<ulong> values) {
- base.AddRange(values, result.repeatedUint64_);
+ PrepareBuilder();
+ result.repeatedUint64_.Add(values);
return this;
}
public Builder ClearRepeatedUint64() {
+ PrepareBuilder();
result.repeatedUint64_.Clear();
return this;
}
public pbc::IPopsicleList<int> RepeatedSint32List {
- get { return result.repeatedSint32_; }
+ get { return PrepareBuilder().repeatedSint32_; }
}
public int RepeatedSint32Count {
get { return result.RepeatedSint32Count; }
@@ -4539,24 +4749,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<int> values) {
- base.AddRange(values, result.repeatedSint32_);
+ PrepareBuilder();
+ result.repeatedSint32_.Add(values);
return this;
}
public Builder ClearRepeatedSint32() {
+ PrepareBuilder();
result.repeatedSint32_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedSint64List {
- get { return result.repeatedSint64_; }
+ get { return PrepareBuilder().repeatedSint64_; }
}
public int RepeatedSint64Count {
get { return result.RepeatedSint64Count; }
@@ -4565,25 +4779,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<long> values) {
- base.AddRange(values, result.repeatedSint64_);
+ PrepareBuilder();
+ result.repeatedSint64_.Add(values);
return this;
}
public Builder ClearRepeatedSint64() {
+ PrepareBuilder();
result.repeatedSint64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> RepeatedFixed32List {
- get { return result.repeatedFixed32_; }
+ get { return PrepareBuilder().repeatedFixed32_; }
}
public int RepeatedFixed32Count {
get { return result.RepeatedFixed32Count; }
@@ -4594,27 +4812,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<uint> values) {
- base.AddRange(values, result.repeatedFixed32_);
+ PrepareBuilder();
+ result.repeatedFixed32_.Add(values);
return this;
}
public Builder ClearRepeatedFixed32() {
+ PrepareBuilder();
result.repeatedFixed32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> RepeatedFixed64List {
- get { return result.repeatedFixed64_; }
+ get { return PrepareBuilder().repeatedFixed64_; }
}
public int RepeatedFixed64Count {
get { return result.RepeatedFixed64Count; }
@@ -4625,26 +4847,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<ulong> values) {
- base.AddRange(values, result.repeatedFixed64_);
+ PrepareBuilder();
+ result.repeatedFixed64_.Add(values);
return this;
}
public Builder ClearRepeatedFixed64() {
+ PrepareBuilder();
result.repeatedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<int> RepeatedSfixed32List {
- get { return result.repeatedSfixed32_; }
+ get { return PrepareBuilder().repeatedSfixed32_; }
}
public int RepeatedSfixed32Count {
get { return result.RepeatedSfixed32Count; }
@@ -4653,24 +4879,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<int> values) {
- base.AddRange(values, result.repeatedSfixed32_);
+ PrepareBuilder();
+ result.repeatedSfixed32_.Add(values);
return this;
}
public Builder ClearRepeatedSfixed32() {
+ PrepareBuilder();
result.repeatedSfixed32_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedSfixed64List {
- get { return result.repeatedSfixed64_; }
+ get { return PrepareBuilder().repeatedSfixed64_; }
}
public int RepeatedSfixed64Count {
get { return result.RepeatedSfixed64Count; }
@@ -4679,24 +4909,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<long> values) {
- base.AddRange(values, result.repeatedSfixed64_);
+ PrepareBuilder();
+ result.repeatedSfixed64_.Add(values);
return this;
}
public Builder ClearRepeatedSfixed64() {
+ PrepareBuilder();
result.repeatedSfixed64_.Clear();
return this;
}
public pbc::IPopsicleList<float> RepeatedFloatList {
- get { return result.repeatedFloat_; }
+ get { return PrepareBuilder().repeatedFloat_; }
}
public int RepeatedFloatCount {
get { return result.RepeatedFloatCount; }
@@ -4705,24 +4939,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<float> values) {
- base.AddRange(values, result.repeatedFloat_);
+ PrepareBuilder();
+ result.repeatedFloat_.Add(values);
return this;
}
public Builder ClearRepeatedFloat() {
+ PrepareBuilder();
result.repeatedFloat_.Clear();
return this;
}
public pbc::IPopsicleList<double> RepeatedDoubleList {
- get { return result.repeatedDouble_; }
+ get { return PrepareBuilder().repeatedDouble_; }
}
public int RepeatedDoubleCount {
get { return result.RepeatedDoubleCount; }
@@ -4731,24 +4969,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<double> values) {
- base.AddRange(values, result.repeatedDouble_);
+ PrepareBuilder();
+ result.repeatedDouble_.Add(values);
return this;
}
public Builder ClearRepeatedDouble() {
+ PrepareBuilder();
result.repeatedDouble_.Clear();
return this;
}
public pbc::IPopsicleList<bool> RepeatedBoolList {
- get { return result.repeatedBool_; }
+ get { return PrepareBuilder().repeatedBool_; }
}
public int RepeatedBoolCount {
get { return result.RepeatedBoolCount; }
@@ -4757,24 +4999,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<bool> values) {
- base.AddRange(values, result.repeatedBool_);
+ PrepareBuilder();
+ result.repeatedBool_.Add(values);
return this;
}
public Builder ClearRepeatedBool() {
+ PrepareBuilder();
result.repeatedBool_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedStringList {
- get { return result.repeatedString_; }
+ get { return PrepareBuilder().repeatedString_; }
}
public int RepeatedStringCount {
get { return result.RepeatedStringCount; }
@@ -4784,25 +5030,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<string> values) {
- base.AddRange(values, result.repeatedString_);
+ PrepareBuilder();
+ result.repeatedString_.Add(values);
return this;
}
public Builder ClearRepeatedString() {
+ PrepareBuilder();
result.repeatedString_.Clear();
return this;
}
public pbc::IPopsicleList<pb::ByteString> RepeatedBytesList {
- get { return result.repeatedBytes_; }
+ get { return PrepareBuilder().repeatedBytes_; }
}
public int RepeatedBytesCount {
get { return result.RepeatedBytesCount; }
@@ -4812,25 +5062,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<pb::ByteString> values) {
- base.AddRange(values, result.repeatedBytes_);
+ PrepareBuilder();
+ result.repeatedBytes_.Add(values);
return this;
}
public Builder ClearRepeatedBytes() {
+ PrepareBuilder();
result.repeatedBytes_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup> RepeatedGroupList {
- get { return result.repeatedGroup_; }
+ get { return PrepareBuilder().repeatedGroup_; }
}
public int RepeatedGroupCount {
get { return result.RepeatedGroupCount; }
@@ -4840,35 +5094,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<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup> values) {
- base.AddRange(values, result.repeatedGroup_);
+ PrepareBuilder();
+ result.repeatedGroup_.Add(values);
return this;
}
public Builder ClearRepeatedGroup() {
+ PrepareBuilder();
result.repeatedGroup_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage> RepeatedNestedMessageList {
- get { return result.repeatedNestedMessage_; }
+ get { return PrepareBuilder().repeatedNestedMessage_; }
}
public int RepeatedNestedMessageCount {
get { return result.RepeatedNestedMessageCount; }
@@ -4878,35 +5138,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<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage> values) {
- base.AddRange(values, result.repeatedNestedMessage_);
+ PrepareBuilder();
+ result.repeatedNestedMessage_.Add(values);
return this;
}
public Builder ClearRepeatedNestedMessage() {
+ PrepareBuilder();
result.repeatedNestedMessage_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> RepeatedForeignMessageList {
- get { return result.repeatedForeignMessage_; }
+ get { return PrepareBuilder().repeatedForeignMessage_; }
}
public int RepeatedForeignMessageCount {
get { return result.RepeatedForeignMessageCount; }
@@ -4916,35 +5182,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<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> values) {
- base.AddRange(values, result.repeatedForeignMessage_);
+ PrepareBuilder();
+ result.repeatedForeignMessage_.Add(values);
return this;
}
public Builder ClearRepeatedForeignMessage() {
+ PrepareBuilder();
result.repeatedForeignMessage_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ImportMessage> RepeatedImportMessageList {
- get { return result.repeatedImportMessage_; }
+ get { return PrepareBuilder().repeatedImportMessage_; }
}
public int RepeatedImportMessageCount {
get { return result.RepeatedImportMessageCount; }
@@ -4954,35 +5226,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<global::Google.ProtocolBuffers.TestProtos.ImportMessage> values) {
- base.AddRange(values, result.repeatedImportMessage_);
+ PrepareBuilder();
+ result.repeatedImportMessage_.Add(values);
return this;
}
public Builder ClearRepeatedImportMessage() {
+ PrepareBuilder();
result.repeatedImportMessage_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum> RepeatedNestedEnumList {
- get { return result.repeatedNestedEnum_; }
+ get { return PrepareBuilder().repeatedNestedEnum_; }
}
public int RepeatedNestedEnumCount {
get { return result.RepeatedNestedEnumCount; }
@@ -4991,24 +5269,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<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum> values) {
- base.AddRange(values, result.repeatedNestedEnum_);
+ PrepareBuilder();
+ result.repeatedNestedEnum_.Add(values);
return this;
}
public Builder ClearRepeatedNestedEnum() {
+ PrepareBuilder();
result.repeatedNestedEnum_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> RepeatedForeignEnumList {
- get { return result.repeatedForeignEnum_; }
+ get { return PrepareBuilder().repeatedForeignEnum_; }
}
public int RepeatedForeignEnumCount {
get { return result.RepeatedForeignEnumCount; }
@@ -5017,24 +5299,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<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> values) {
- base.AddRange(values, result.repeatedForeignEnum_);
+ PrepareBuilder();
+ result.repeatedForeignEnum_.Add(values);
return this;
}
public Builder ClearRepeatedForeignEnum() {
+ PrepareBuilder();
result.repeatedForeignEnum_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ImportEnum> RepeatedImportEnumList {
- get { return result.repeatedImportEnum_; }
+ get { return PrepareBuilder().repeatedImportEnum_; }
}
public int RepeatedImportEnumCount {
get { return result.RepeatedImportEnumCount; }
@@ -5043,24 +5329,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<global::Google.ProtocolBuffers.TestProtos.ImportEnum> values) {
- base.AddRange(values, result.repeatedImportEnum_);
+ PrepareBuilder();
+ result.repeatedImportEnum_.Add(values);
return this;
}
public Builder ClearRepeatedImportEnum() {
+ PrepareBuilder();
result.repeatedImportEnum_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedStringPieceList {
- get { return result.repeatedStringPiece_; }
+ get { return PrepareBuilder().repeatedStringPiece_; }
}
public int RepeatedStringPieceCount {
get { return result.RepeatedStringPieceCount; }
@@ -5070,25 +5360,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<string> values) {
- base.AddRange(values, result.repeatedStringPiece_);
+ PrepareBuilder();
+ result.repeatedStringPiece_.Add(values);
return this;
}
public Builder ClearRepeatedStringPiece() {
+ PrepareBuilder();
result.repeatedStringPiece_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedCordList {
- get { return result.repeatedCord_; }
+ get { return PrepareBuilder().repeatedCord_; }
}
public int RepeatedCordCount {
get { return result.RepeatedCordCount; }
@@ -5098,19 +5392,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<string> values) {
- base.AddRange(values, result.repeatedCord_);
+ PrepareBuilder();
+ result.repeatedCord_.Add(values);
return this;
}
public Builder ClearRepeatedCord() {
+ PrepareBuilder();
result.repeatedCord_.Clear();
return this;
}
@@ -5123,11 +5421,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 +5441,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 +5463,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 +5485,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 +5505,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 +5525,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 +5547,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 +5569,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 +5589,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 +5609,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 +5629,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 +5649,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 +5669,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 +5690,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 +5711,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 +5731,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 +5751,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 +5771,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 +5792,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 +5813,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;
@@ -5496,7 +5834,8 @@ 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<TestDeprecatedFields, TestDeprecatedFields.Builder> {
- private static readonly TestDeprecatedFields defaultInstance = new Builder().BuildPartial();
+ private TestDeprecatedFields() { }
+ 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 {
@@ -5504,7 +5843,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestDeprecatedFields DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestDeprecatedFields ThisMessage {
@@ -5522,9 +5861,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_; }
}
@@ -5590,11 +5931,15 @@ 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(); }
public static Builder CreateBuilder(TestDeprecatedFields prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -5604,21 +5949,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestDeprecatedFields cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestDeprecatedFields result;
+
+ private TestDeprecatedFields PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestDeprecatedFields original = result;
+ result = new TestDeprecatedFields();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestDeprecatedFields result = new TestDeprecatedFields();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -5630,12 +6002,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 (resultIsReadOnly) {
+ return result;
}
- TestDeprecatedFields returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -5649,6 +6020,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 +6033,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;
@@ -5708,19 +6081,25 @@ 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) {
+ PrepareBuilder();
result.hasDeprecatedInt32 = true;
result.deprecatedInt32_ = value;
return this;
}
+ [global::System.ObsoleteAttribute()]
public Builder ClearDeprecatedInt32() {
+ PrepareBuilder();
result.hasDeprecatedInt32 = false;
result.deprecatedInt32_ = 0;
return this;
@@ -5735,7 +6114,8 @@ 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<ForeignMessage, ForeignMessage.Builder> {
- private static readonly ForeignMessage defaultInstance = new Builder().BuildPartial();
+ private ForeignMessage() { }
+ 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 {
@@ -5743,7 +6123,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override ForeignMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override ForeignMessage ThisMessage {
@@ -5829,11 +6209,15 @@ 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(); }
public static Builder CreateBuilder(ForeignMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -5843,21 +6227,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(ForeignMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private ForeignMessage result;
+
+ private ForeignMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ ForeignMessage original = result;
+ result = new ForeignMessage();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- ForeignMessage result = new ForeignMessage();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -5869,12 +6280,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 (resultIsReadOnly) {
+ return result;
}
- ForeignMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -5888,6 +6298,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 +6311,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 +6367,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;
@@ -5974,7 +6388,8 @@ 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<TestAllExtensions, TestAllExtensions.Builder> {
- private static readonly TestAllExtensions defaultInstance = new Builder().BuildPartial();
+ private TestAllExtensions() { }
+ 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 {
@@ -5982,7 +6397,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestAllExtensions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestAllExtensions ThisMessage {
@@ -6056,11 +6471,15 @@ 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(); }
public static Builder CreateBuilder(TestAllExtensions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -6070,21 +6489,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestAllExtensions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestAllExtensions result;
+
+ private TestAllExtensions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestAllExtensions original = result;
+ result = new TestAllExtensions();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestAllExtensions result = new TestAllExtensions();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -6096,12 +6542,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 (resultIsReadOnly) {
+ return result;
}
- TestAllExtensions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -6115,6 +6560,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 +6571,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;
@@ -6177,7 +6624,8 @@ 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<OptionalGroup_extension, OptionalGroup_extension.Builder> {
- private static readonly OptionalGroup_extension defaultInstance = new Builder().BuildPartial();
+ private OptionalGroup_extension() { }
+ 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 {
@@ -6185,7 +6633,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override OptionalGroup_extension DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override OptionalGroup_extension ThisMessage {
@@ -6271,11 +6719,15 @@ 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(); }
public static Builder CreateBuilder(OptionalGroup_extension prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -6285,21 +6737,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(OptionalGroup_extension cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private OptionalGroup_extension result;
- OptionalGroup_extension result = new OptionalGroup_extension();
+ private OptionalGroup_extension PrepareBuilder() {
+ if (resultIsReadOnly) {
+ OptionalGroup_extension original = result;
+ result = new OptionalGroup_extension();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -6311,12 +6790,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 (resultIsReadOnly) {
+ return result;
}
- OptionalGroup_extension returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -6330,6 +6808,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 +6821,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 +6877,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;
@@ -6416,7 +6898,8 @@ 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<RepeatedGroup_extension, RepeatedGroup_extension.Builder> {
- private static readonly RepeatedGroup_extension defaultInstance = new Builder().BuildPartial();
+ private RepeatedGroup_extension() { }
+ 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 {
@@ -6424,7 +6907,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override RepeatedGroup_extension DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override RepeatedGroup_extension ThisMessage {
@@ -6510,11 +6993,15 @@ 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(); }
public static Builder CreateBuilder(RepeatedGroup_extension prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -6524,21 +7011,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(RepeatedGroup_extension cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private RepeatedGroup_extension result;
+
+ private RepeatedGroup_extension PrepareBuilder() {
+ if (resultIsReadOnly) {
+ RepeatedGroup_extension original = result;
+ result = new RepeatedGroup_extension();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -6550,12 +7064,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 (resultIsReadOnly) {
+ return result;
}
- RepeatedGroup_extension returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -6569,6 +7082,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 +7095,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 +7151,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;
@@ -6655,7 +7172,8 @@ 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<TestNestedExtension, TestNestedExtension.Builder> {
- private static readonly TestNestedExtension defaultInstance = new Builder().BuildPartial();
+ private TestNestedExtension() { }
+ 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 {
@@ -6663,7 +7181,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestNestedExtension DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestNestedExtension ThisMessage {
@@ -6735,11 +7253,15 @@ 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(); }
public static Builder CreateBuilder(TestNestedExtension prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -6749,21 +7271,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestNestedExtension cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestNestedExtension result;
- TestNestedExtension result = new TestNestedExtension();
+ private TestNestedExtension PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestNestedExtension original = result;
+ result = new TestNestedExtension();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -6775,12 +7324,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 (resultIsReadOnly) {
+ return result;
}
- TestNestedExtension returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -6794,6 +7342,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 +7352,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;
@@ -6855,7 +7405,8 @@ 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<TestRequired, TestRequired.Builder> {
- private static readonly TestRequired defaultInstance = new Builder().BuildPartial();
+ private TestRequired() { }
+ 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 {
@@ -6863,7 +7414,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestRequired DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestRequired ThisMessage {
@@ -7468,11 +8019,15 @@ 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(); }
public static Builder CreateBuilder(TestRequired prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -7482,21 +8037,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestRequired cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestRequired result;
+
+ private TestRequired PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestRequired original = result;
+ result = new TestRequired();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestRequired result = new TestRequired();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -7508,12 +8090,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 (resultIsReadOnly) {
+ return result;
}
- TestRequired returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -7527,6 +8108,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 +8217,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 +8401,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 +8421,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 +8441,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 +8461,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 +8481,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 +8501,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 +8521,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 +8541,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 +8561,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 +8581,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 +8601,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 +8621,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 +8641,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 +8661,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 +8681,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 +8701,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 +8721,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 +8741,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 +8761,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 +8781,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 +8801,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 +8821,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 +8841,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 +8861,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 +8881,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 +8901,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 +8921,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 +8941,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 +8961,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 +8981,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 +9001,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 +9021,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 +9041,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;
@@ -8413,7 +9062,8 @@ 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<TestRequiredForeign, TestRequiredForeign.Builder> {
- private static readonly TestRequiredForeign defaultInstance = new Builder().BuildPartial();
+ private TestRequiredForeign() { }
+ 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 {
@@ -8421,7 +9071,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestRequiredForeign DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestRequiredForeign ThisMessage {
@@ -8438,12 +9088,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;
@@ -8547,11 +9197,16 @@ 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(); }
public static Builder CreateBuilder(TestRequiredForeign prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -8561,21 +9216,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestRequiredForeign cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestRequiredForeign result;
+
+ private TestRequiredForeign PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestRequiredForeign original = result;
+ result = new TestRequiredForeign();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestRequiredForeign result = new TestRequiredForeign();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -8587,13 +9269,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.repeatedMessage_.MakeReadOnly();
- TestRequiredForeign returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -8607,11 +9287,12 @@ 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);
}
if (other.repeatedMessage_.Count != 0) {
- base.AddRange(other.repeatedMessage_, result.repeatedMessage_);
+ result.repeatedMessage_.Add(other.repeatedMessage_);
}
if (other.HasDummy) {
Dummy = other.Dummy;
@@ -8625,6 +9306,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 +9376,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 +9401,14 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearOptionalMessage() {
+ PrepareBuilder();
result.hasOptionalMessage = false;
- result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance;
+ result.optionalMessage_ = null;
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestRequired> RepeatedMessageList {
- get { return result.repeatedMessage_; }
+ get { return PrepareBuilder().repeatedMessage_; }
}
public int RepeatedMessageCount {
get { return result.RepeatedMessageCount; }
@@ -8732,29 +9418,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<global::Google.ProtocolBuffers.TestProtos.TestRequired> values) {
- base.AddRange(values, result.repeatedMessage_);
+ PrepareBuilder();
+ result.repeatedMessage_.Add(values);
return this;
}
public Builder ClearRepeatedMessage() {
+ PrepareBuilder();
result.repeatedMessage_.Clear();
return this;
}
@@ -8767,11 +9459,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;
@@ -8786,7 +9480,8 @@ 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<TestForeignNested, TestForeignNested.Builder> {
- private static readonly TestForeignNested defaultInstance = new Builder().BuildPartial();
+ private TestForeignNested() { }
+ 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 {
@@ -8794,7 +9489,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestForeignNested DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestForeignNested ThisMessage {
@@ -8811,12 +9506,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 {
@@ -8880,11 +9575,15 @@ 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(); }
public static Builder CreateBuilder(TestForeignNested prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -8894,21 +9593,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestForeignNested cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestForeignNested result;
+
+ private TestForeignNested PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestForeignNested original = result;
+ result = new TestForeignNested();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestForeignNested result = new TestForeignNested();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -8920,12 +9646,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 (resultIsReadOnly) {
+ return result;
}
- TestForeignNested returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -8939,6 +9664,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 +9677,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 +9739,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,8 +9764,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearForeignNested() {
+ PrepareBuilder();
result.hasForeignNested = false;
- result.foreignNested_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance;
+ result.foreignNested_ = null;
return this;
}
}
@@ -9048,7 +9779,8 @@ 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<TestEmptyMessage, TestEmptyMessage.Builder> {
- private static readonly TestEmptyMessage defaultInstance = new Builder().BuildPartial();
+ private TestEmptyMessage() { }
+ 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 {
@@ -9056,7 +9788,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestEmptyMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestEmptyMessage ThisMessage {
@@ -9126,11 +9858,15 @@ 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(); }
public static Builder CreateBuilder(TestEmptyMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9140,21 +9876,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestEmptyMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestEmptyMessage result;
+
+ private TestEmptyMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestEmptyMessage original = result;
+ result = new TestEmptyMessage();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -9166,12 +9929,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 (resultIsReadOnly) {
+ return result;
}
- TestEmptyMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -9185,6 +9947,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 +9957,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;
@@ -9246,7 +10010,8 @@ 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<TestEmptyMessageWithExtensions, TestEmptyMessageWithExtensions.Builder> {
- private static readonly TestEmptyMessageWithExtensions defaultInstance = new Builder().BuildPartial();
+ private TestEmptyMessageWithExtensions() { }
+ 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 {
@@ -9254,7 +10019,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestEmptyMessageWithExtensions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestEmptyMessageWithExtensions ThisMessage {
@@ -9328,11 +10093,15 @@ 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(); }
public static Builder CreateBuilder(TestEmptyMessageWithExtensions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9342,21 +10111,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestEmptyMessageWithExtensions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestEmptyMessageWithExtensions result;
+
+ private TestEmptyMessageWithExtensions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestEmptyMessageWithExtensions original = result;
+ result = new TestEmptyMessageWithExtensions();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestEmptyMessageWithExtensions result = new TestEmptyMessageWithExtensions();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -9368,12 +10164,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 (resultIsReadOnly) {
+ return result;
}
- TestEmptyMessageWithExtensions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -9387,6 +10182,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 +10193,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;
@@ -9449,7 +10246,8 @@ 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<TestMultipleExtensionRanges, TestMultipleExtensionRanges.Builder> {
- private static readonly TestMultipleExtensionRanges defaultInstance = new Builder().BuildPartial();
+ private TestMultipleExtensionRanges() { }
+ 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 {
@@ -9457,7 +10255,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestMultipleExtensionRanges DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestMultipleExtensionRanges ThisMessage {
@@ -9533,11 +10331,15 @@ 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(); }
public static Builder CreateBuilder(TestMultipleExtensionRanges prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9547,21 +10349,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestMultipleExtensionRanges cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestMultipleExtensionRanges result;
+
+ private TestMultipleExtensionRanges PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestMultipleExtensionRanges original = result;
+ result = new TestMultipleExtensionRanges();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -9573,12 +10402,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 (resultIsReadOnly) {
+ return result;
}
- TestMultipleExtensionRanges returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -9592,6 +10420,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 +10431,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;
@@ -9654,7 +10484,8 @@ 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<TestReallyLargeTagNumber, TestReallyLargeTagNumber.Builder> {
- private static readonly TestReallyLargeTagNumber defaultInstance = new Builder().BuildPartial();
+ private TestReallyLargeTagNumber() { }
+ 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 {
@@ -9662,7 +10493,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestReallyLargeTagNumber DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestReallyLargeTagNumber ThisMessage {
@@ -9764,11 +10595,15 @@ 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(); }
public static Builder CreateBuilder(TestReallyLargeTagNumber prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9778,21 +10613,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestReallyLargeTagNumber cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestReallyLargeTagNumber result;
+
+ private TestReallyLargeTagNumber PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestReallyLargeTagNumber original = result;
+ result = new TestReallyLargeTagNumber();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -9804,12 +10666,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 (resultIsReadOnly) {
+ return result;
}
- TestReallyLargeTagNumber returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -9823,6 +10684,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 +10700,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 +10760,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 +10780,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;
@@ -9934,7 +10801,8 @@ 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<TestRecursiveMessage, TestRecursiveMessage.Builder> {
- private static readonly TestRecursiveMessage defaultInstance = new Builder().BuildPartial();
+ private TestRecursiveMessage() { }
+ 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 {
@@ -9942,7 +10810,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestRecursiveMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestRecursiveMessage ThisMessage {
@@ -9959,12 +10827,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;
@@ -10044,11 +10912,15 @@ 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(); }
public static Builder CreateBuilder(TestRecursiveMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -10058,21 +10930,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestRecursiveMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestRecursiveMessage result = new TestRecursiveMessage();
+ private bool resultIsReadOnly;
+ private TestRecursiveMessage result;
+
+ private TestRecursiveMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestRecursiveMessage original = result;
+ result = new TestRecursiveMessage();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -10084,12 +10983,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 (resultIsReadOnly) {
+ return result;
}
- TestRecursiveMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -10103,6 +11001,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 +11017,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 +11083,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,8 +11108,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
- result.a_ = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance;
+ result.a_ = null;
return this;
}
@@ -10218,11 +11122,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;
@@ -10237,7 +11143,8 @@ 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<TestMutualRecursionA, TestMutualRecursionA.Builder> {
- private static readonly TestMutualRecursionA defaultInstance = new Builder().BuildPartial();
+ private TestMutualRecursionA() { }
+ 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 {
@@ -10245,7 +11152,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestMutualRecursionA DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestMutualRecursionA ThisMessage {
@@ -10262,12 +11169,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 {
@@ -10331,11 +11238,15 @@ 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(); }
public static Builder CreateBuilder(TestMutualRecursionA prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -10345,21 +11256,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestMutualRecursionA cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestMutualRecursionA result;
+
+ private TestMutualRecursionA PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestMutualRecursionA original = result;
+ result = new TestMutualRecursionA();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -10371,12 +11309,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 (resultIsReadOnly) {
+ return result;
}
- TestMutualRecursionA returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -10390,6 +11327,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 +11340,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 +11402,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,8 +11427,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearBb() {
+ PrepareBuilder();
result.hasBb = false;
- result.bb_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance;
+ result.bb_ = null;
return this;
}
}
@@ -10499,7 +11442,8 @@ 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<TestMutualRecursionB, TestMutualRecursionB.Builder> {
- private static readonly TestMutualRecursionB defaultInstance = new Builder().BuildPartial();
+ private TestMutualRecursionB() { }
+ 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 {
@@ -10507,7 +11451,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestMutualRecursionB DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestMutualRecursionB ThisMessage {
@@ -10524,12 +11468,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;
@@ -10609,11 +11553,15 @@ 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(); }
public static Builder CreateBuilder(TestMutualRecursionB prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -10623,21 +11571,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestMutualRecursionB cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestMutualRecursionB result;
+
+ private TestMutualRecursionB PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestMutualRecursionB original = result;
+ result = new TestMutualRecursionB();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestMutualRecursionB result = new TestMutualRecursionB();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -10649,12 +11624,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 (resultIsReadOnly) {
+ return result;
}
- TestMutualRecursionB returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -10668,6 +11642,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 +11658,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 +11724,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,8 +11749,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
- result.a_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance;
+ result.a_ = null;
return this;
}
@@ -10783,11 +11763,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;
@@ -10802,7 +11784,8 @@ 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<TestDupFieldNumber, TestDupFieldNumber.Builder> {
- private static readonly TestDupFieldNumber defaultInstance = new Builder().BuildPartial();
+ private TestDupFieldNumber() { }
+ 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 {
@@ -10810,7 +11793,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestDupFieldNumber DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestDupFieldNumber ThisMessage {
@@ -10834,7 +11817,8 @@ 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<Foo, Foo.Builder> {
- private static readonly Foo defaultInstance = new Builder().BuildPartial();
+ private Foo() { }
+ 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 {
@@ -10842,7 +11826,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override Foo DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override Foo ThisMessage {
@@ -10928,11 +11912,15 @@ 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(); }
public static Builder CreateBuilder(Foo prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -10942,21 +11930,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(Foo cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private Foo result;
+
+ private Foo PrepareBuilder() {
+ if (resultIsReadOnly) {
+ Foo original = result;
+ result = new Foo();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- Foo result = new Foo();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -10968,12 +11983,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 (resultIsReadOnly) {
+ return result;
}
- Foo returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -10987,6 +12001,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 +12014,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 +12070,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;
@@ -11073,7 +12091,8 @@ 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<Bar, Bar.Builder> {
- private static readonly Bar defaultInstance = new Builder().BuildPartial();
+ private Bar() { }
+ 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 {
@@ -11081,7 +12100,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override Bar DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override Bar ThisMessage {
@@ -11167,11 +12186,15 @@ 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(); }
public static Builder CreateBuilder(Bar prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -11181,21 +12204,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(Bar cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private Bar result;
+
+ private Bar PrepareBuilder() {
+ if (resultIsReadOnly) {
+ Bar original = result;
+ result = new Bar();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- Bar result = new Bar();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -11207,12 +12257,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 (resultIsReadOnly) {
+ return result;
}
- Bar returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -11226,6 +12275,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 +12288,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 +12344,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;
@@ -11323,22 +12376,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 {
@@ -11414,11 +12467,15 @@ 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(); }
public static Builder CreateBuilder(TestDupFieldNumber prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -11428,21 +12485,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestDupFieldNumber cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestDupFieldNumber result;
+
+ private TestDupFieldNumber PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestDupFieldNumber original = result;
+ result = new TestDupFieldNumber();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestDupFieldNumber result = new TestDupFieldNumber();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -11454,12 +12538,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 (resultIsReadOnly) {
+ return result;
}
- TestDupFieldNumber returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -11473,6 +12556,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 +12575,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 +12649,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 +12670,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,8 +12695,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearFoo() {
+ PrepareBuilder();
result.hasFoo = false;
- result.foo_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance;
+ result.foo_ = null;
return this;
}
@@ -11619,18 +12710,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,8 +12735,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearBar() {
+ PrepareBuilder();
result.hasBar = false;
- result.bar_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance;
+ result.bar_ = null;
return this;
}
}
@@ -11655,7 +12750,8 @@ 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<TestNestedMessageHasBits, TestNestedMessageHasBits.Builder> {
- private static readonly TestNestedMessageHasBits defaultInstance = new Builder().BuildPartial();
+ private TestNestedMessageHasBits() { }
+ 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 {
@@ -11663,7 +12759,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestNestedMessageHasBits DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestNestedMessageHasBits ThisMessage {
@@ -11687,7 +12783,8 @@ 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<NestedMessage, NestedMessage.Builder> {
- private static readonly NestedMessage defaultInstance = new Builder().BuildPartial();
+ private NestedMessage() { }
+ 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 {
@@ -11695,7 +12792,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override NestedMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override NestedMessage ThisMessage {
@@ -11806,11 +12903,17 @@ 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(); }
public static Builder CreateBuilder(NestedMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -11820,21 +12923,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(NestedMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private NestedMessage result;
+
+ private NestedMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ NestedMessage original = result;
+ result = new NestedMessage();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -11846,14 +12976,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 (resultIsReadOnly) {
+ return result;
}
- result.nestedmessageRepeatedInt32_.MakeReadOnly();
- result.nestedmessageRepeatedForeignmessage_.MakeReadOnly();
- NestedMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -11867,11 +12994,12 @@ 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_);
+ 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;
@@ -11882,6 +13010,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 +13064,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList<int> NestedmessageRepeatedInt32List {
- get { return result.nestedmessageRepeatedInt32_; }
+ get { return PrepareBuilder().nestedmessageRepeatedInt32_; }
}
public int NestedmessageRepeatedInt32Count {
get { return result.NestedmessageRepeatedInt32Count; }
@@ -11944,24 +13073,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<int> values) {
- base.AddRange(values, result.nestedmessageRepeatedInt32_);
+ PrepareBuilder();
+ result.nestedmessageRepeatedInt32_.Add(values);
return this;
}
public Builder ClearNestedmessageRepeatedInt32() {
+ PrepareBuilder();
result.nestedmessageRepeatedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> NestedmessageRepeatedForeignmessageList {
- get { return result.nestedmessageRepeatedForeignmessage_; }
+ get { return PrepareBuilder().nestedmessageRepeatedForeignmessage_; }
}
public int NestedmessageRepeatedForeignmessageCount {
get { return result.NestedmessageRepeatedForeignmessageCount; }
@@ -11971,29 +13104,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<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> values) {
- base.AddRange(values, result.nestedmessageRepeatedForeignmessage_);
+ PrepareBuilder();
+ result.nestedmessageRepeatedForeignmessage_.Add(values);
return this;
}
public Builder ClearNestedmessageRepeatedForeignmessage() {
+ PrepareBuilder();
result.nestedmessageRepeatedForeignmessage_.Clear();
return this;
}
@@ -12008,12 +13147,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 {
@@ -12077,11 +13216,15 @@ 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(); }
public static Builder CreateBuilder(TestNestedMessageHasBits prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -12091,21 +13234,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestNestedMessageHasBits cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestNestedMessageHasBits result;
+
+ private TestNestedMessageHasBits PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestNestedMessageHasBits original = result;
+ result = new TestNestedMessageHasBits();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestNestedMessageHasBits result = new TestNestedMessageHasBits();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -12117,12 +13287,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 (resultIsReadOnly) {
+ return result;
}
- TestNestedMessageHasBits returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -12136,6 +13305,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 +13318,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 +13380,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,8 +13405,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearOptionalNestedMessage() {
+ PrepareBuilder();
result.hasOptionalNestedMessage = false;
- result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance;
+ result.optionalNestedMessage_ = null;
return this;
}
}
@@ -12245,7 +13420,8 @@ 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<TestCamelCaseFieldNames, TestCamelCaseFieldNames.Builder> {
- private static readonly TestCamelCaseFieldNames defaultInstance = new Builder().BuildPartial();
+ private TestCamelCaseFieldNames() { }
+ 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 {
@@ -12253,7 +13429,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestCamelCaseFieldNames DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestCamelCaseFieldNames ThisMessage {
@@ -12300,12 +13476,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;
@@ -12554,11 +13730,21 @@ 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(); }
public static Builder CreateBuilder(TestCamelCaseFieldNames prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -12568,21 +13754,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestCamelCaseFieldNames cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestCamelCaseFieldNames result;
+
+ private TestCamelCaseFieldNames PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestCamelCaseFieldNames original = result;
+ result = new TestCamelCaseFieldNames();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -12594,18 +13807,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.repeatedPrimitiveField_.MakeReadOnly();
- result.repeatedStringField_.MakeReadOnly();
- result.repeatedEnumField_.MakeReadOnly();
- result.repeatedMessageField_.MakeReadOnly();
- result.repeatedStringPieceField_.MakeReadOnly();
- result.repeatedCordField_.MakeReadOnly();
- TestCamelCaseFieldNames returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -12619,6 +13825,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;
}
@@ -12638,22 +13845,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;
@@ -12664,6 +13871,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 +13995,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 +14016,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 +14036,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 +14057,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,8 +14082,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearMessageField() {
+ PrepareBuilder();
result.hasMessageField = false;
- result.messageField_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance;
+ result.messageField_ = null;
return this;
}
@@ -12879,11 +14097,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 +14118,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<int> RepeatedPrimitiveFieldList {
- get { return result.repeatedPrimitiveField_; }
+ get { return PrepareBuilder().repeatedPrimitiveField_; }
}
public int RepeatedPrimitiveFieldCount {
get { return result.RepeatedPrimitiveFieldCount; }
@@ -12918,24 +14140,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<int> values) {
- base.AddRange(values, result.repeatedPrimitiveField_);
+ PrepareBuilder();
+ result.repeatedPrimitiveField_.Add(values);
return this;
}
public Builder ClearRepeatedPrimitiveField() {
+ PrepareBuilder();
result.repeatedPrimitiveField_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedStringFieldList {
- get { return result.repeatedStringField_; }
+ get { return PrepareBuilder().repeatedStringField_; }
}
public int RepeatedStringFieldCount {
get { return result.RepeatedStringFieldCount; }
@@ -12945,25 +14171,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<string> values) {
- base.AddRange(values, result.repeatedStringField_);
+ PrepareBuilder();
+ result.repeatedStringField_.Add(values);
return this;
}
public Builder ClearRepeatedStringField() {
+ PrepareBuilder();
result.repeatedStringField_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> RepeatedEnumFieldList {
- get { return result.repeatedEnumField_; }
+ get { return PrepareBuilder().repeatedEnumField_; }
}
public int RepeatedEnumFieldCount {
get { return result.RepeatedEnumFieldCount; }
@@ -12972,24 +14202,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<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> values) {
- base.AddRange(values, result.repeatedEnumField_);
+ PrepareBuilder();
+ result.repeatedEnumField_.Add(values);
return this;
}
public Builder ClearRepeatedEnumField() {
+ PrepareBuilder();
result.repeatedEnumField_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> RepeatedMessageFieldList {
- get { return result.repeatedMessageField_; }
+ get { return PrepareBuilder().repeatedMessageField_; }
}
public int RepeatedMessageFieldCount {
get { return result.RepeatedMessageFieldCount; }
@@ -12999,35 +14233,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<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> values) {
- base.AddRange(values, result.repeatedMessageField_);
+ PrepareBuilder();
+ result.repeatedMessageField_.Add(values);
return this;
}
public Builder ClearRepeatedMessageField() {
+ PrepareBuilder();
result.repeatedMessageField_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedStringPieceFieldList {
- get { return result.repeatedStringPieceField_; }
+ get { return PrepareBuilder().repeatedStringPieceField_; }
}
public int RepeatedStringPieceFieldCount {
get { return result.RepeatedStringPieceFieldCount; }
@@ -13037,25 +14277,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<string> values) {
- base.AddRange(values, result.repeatedStringPieceField_);
+ PrepareBuilder();
+ result.repeatedStringPieceField_.Add(values);
return this;
}
public Builder ClearRepeatedStringPieceField() {
+ PrepareBuilder();
result.repeatedStringPieceField_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedCordFieldList {
- get { return result.repeatedCordField_; }
+ get { return PrepareBuilder().repeatedCordField_; }
}
public int RepeatedCordFieldCount {
get { return result.RepeatedCordFieldCount; }
@@ -13065,19 +14309,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<string> values) {
- base.AddRange(values, result.repeatedCordField_);
+ PrepareBuilder();
+ result.repeatedCordField_.Add(values);
return this;
}
public Builder ClearRepeatedCordField() {
+ PrepareBuilder();
result.repeatedCordField_.Clear();
return this;
}
@@ -13091,7 +14339,8 @@ 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<TestFieldOrderings, TestFieldOrderings.Builder> {
- private static readonly TestFieldOrderings defaultInstance = new Builder().BuildPartial();
+ private TestFieldOrderings() { }
+ 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 {
@@ -13099,7 +14348,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestFieldOrderings DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestFieldOrderings ThisMessage {
@@ -13222,11 +14471,15 @@ 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(); }
public static Builder CreateBuilder(TestFieldOrderings prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -13236,21 +14489,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestFieldOrderings cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestFieldOrderings result;
+
+ private TestFieldOrderings PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestFieldOrderings original = result;
+ result = new TestFieldOrderings();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -13262,12 +14542,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 (resultIsReadOnly) {
+ return result;
}
- TestFieldOrderings returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -13281,6 +14560,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 +14580,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 +14645,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 +14665,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 +14685,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;
@@ -13419,7 +14706,8 @@ 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<TestExtremeDefaultValues, TestExtremeDefaultValues.Builder> {
- private static readonly TestExtremeDefaultValues defaultInstance = new Builder().BuildPartial();
+ private TestExtremeDefaultValues() { }
+ 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 {
@@ -13427,7 +14715,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestExtremeDefaultValues DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestExtremeDefaultValues ThisMessage {
@@ -13803,11 +15091,15 @@ 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(); }
public static Builder CreateBuilder(TestExtremeDefaultValues prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -13817,21 +15109,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestExtremeDefaultValues cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestExtremeDefaultValues result;
+
+ private TestExtremeDefaultValues PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestExtremeDefaultValues original = result;
+ result = new TestExtremeDefaultValues();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestExtremeDefaultValues result = new TestExtremeDefaultValues();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -13843,12 +15162,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 (resultIsReadOnly) {
+ return result;
}
- TestExtremeDefaultValues returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -13862,6 +15180,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 +15247,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 +15376,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 +15398,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 +15420,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 +15440,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 +15460,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 +15481,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 +15501,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 +15521,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 +15541,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 +15561,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 +15581,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 +15601,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 +15621,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 +15641,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 +15661,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 +15681,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 +15701,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 +15721,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 +15741,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;
@@ -14404,7 +15762,8 @@ 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<OneString, OneString.Builder> {
- private static readonly OneString defaultInstance = new Builder().BuildPartial();
+ private OneString() { }
+ 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 {
@@ -14412,7 +15771,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override OneString DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override OneString ThisMessage {
@@ -14498,11 +15857,15 @@ 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(); }
public static Builder CreateBuilder(OneString prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -14512,21 +15875,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(OneString cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private OneString result;
+
+ private OneString PrepareBuilder() {
+ if (resultIsReadOnly) {
+ OneString original = result;
+ result = new OneString();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- OneString result = new OneString();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -14538,12 +15928,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 (resultIsReadOnly) {
+ return result;
}
- OneString returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -14557,6 +15946,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 +15959,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 +16016,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;
@@ -14644,7 +16037,8 @@ 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<OneBytes, OneBytes.Builder> {
- private static readonly OneBytes defaultInstance = new Builder().BuildPartial();
+ private OneBytes() { }
+ 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 {
@@ -14652,7 +16046,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override OneBytes DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override OneBytes ThisMessage {
@@ -14738,11 +16132,15 @@ 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(); }
public static Builder CreateBuilder(OneBytes prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -14752,21 +16150,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(OneBytes cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- OneBytes result = new OneBytes();
+ private bool resultIsReadOnly;
+ private OneBytes result;
+
+ private OneBytes PrepareBuilder() {
+ if (resultIsReadOnly) {
+ OneBytes original = result;
+ result = new OneBytes();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -14778,12 +16203,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 (resultIsReadOnly) {
+ return result;
}
- OneBytes returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -14797,6 +16221,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 +16234,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 +16291,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;
@@ -14884,7 +16312,8 @@ 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<TestPackedTypes, TestPackedTypes.Builder> {
- private static readonly TestPackedTypes defaultInstance = new Builder().BuildPartial();
+ private TestPackedTypes() { }
+ 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 {
@@ -14892,7 +16321,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestPackedTypes DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestPackedTypes ThisMessage {
@@ -15335,11 +16764,29 @@ 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(); }
public static Builder CreateBuilder(TestPackedTypes prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -15349,21 +16796,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestPackedTypes cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestPackedTypes result;
+
+ private TestPackedTypes PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestPackedTypes original = result;
+ result = new TestPackedTypes();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestPackedTypes result = new TestPackedTypes();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -15375,26 +16849,11 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestPackedTypes BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
- }
- 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();
- TestPackedTypes returnMe = result;
- result = null;
- return returnMe;
+ if (resultIsReadOnly) {
+ return result;
+ }
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -15408,47 +16867,48 @@ 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_);
+ 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;
@@ -15459,6 +16919,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 +17043,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList<int> PackedInt32List {
- get { return result.packedInt32_; }
+ get { return PrepareBuilder().packedInt32_; }
}
public int PackedInt32Count {
get { return result.PackedInt32Count; }
@@ -15591,24 +17052,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<int> values) {
- base.AddRange(values, result.packedInt32_);
+ PrepareBuilder();
+ result.packedInt32_.Add(values);
return this;
}
public Builder ClearPackedInt32() {
+ PrepareBuilder();
result.packedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<long> PackedInt64List {
- get { return result.packedInt64_; }
+ get { return PrepareBuilder().packedInt64_; }
}
public int PackedInt64Count {
get { return result.PackedInt64Count; }
@@ -15617,25 +17082,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<long> values) {
- base.AddRange(values, result.packedInt64_);
+ PrepareBuilder();
+ result.packedInt64_.Add(values);
return this;
}
public Builder ClearPackedInt64() {
+ PrepareBuilder();
result.packedInt64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> PackedUint32List {
- get { return result.packedUint32_; }
+ get { return PrepareBuilder().packedUint32_; }
}
public int PackedUint32Count {
get { return result.PackedUint32Count; }
@@ -15646,27 +17115,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<uint> values) {
- base.AddRange(values, result.packedUint32_);
+ PrepareBuilder();
+ result.packedUint32_.Add(values);
return this;
}
public Builder ClearPackedUint32() {
+ PrepareBuilder();
result.packedUint32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> PackedUint64List {
- get { return result.packedUint64_; }
+ get { return PrepareBuilder().packedUint64_; }
}
public int PackedUint64Count {
get { return result.PackedUint64Count; }
@@ -15677,26 +17150,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<ulong> values) {
- base.AddRange(values, result.packedUint64_);
+ PrepareBuilder();
+ result.packedUint64_.Add(values);
return this;
}
public Builder ClearPackedUint64() {
+ PrepareBuilder();
result.packedUint64_.Clear();
return this;
}
public pbc::IPopsicleList<int> PackedSint32List {
- get { return result.packedSint32_; }
+ get { return PrepareBuilder().packedSint32_; }
}
public int PackedSint32Count {
get { return result.PackedSint32Count; }
@@ -15705,24 +17182,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<int> values) {
- base.AddRange(values, result.packedSint32_);
+ PrepareBuilder();
+ result.packedSint32_.Add(values);
return this;
}
public Builder ClearPackedSint32() {
+ PrepareBuilder();
result.packedSint32_.Clear();
return this;
}
public pbc::IPopsicleList<long> PackedSint64List {
- get { return result.packedSint64_; }
+ get { return PrepareBuilder().packedSint64_; }
}
public int PackedSint64Count {
get { return result.PackedSint64Count; }
@@ -15731,25 +17212,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<long> values) {
- base.AddRange(values, result.packedSint64_);
+ PrepareBuilder();
+ result.packedSint64_.Add(values);
return this;
}
public Builder ClearPackedSint64() {
+ PrepareBuilder();
result.packedSint64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> PackedFixed32List {
- get { return result.packedFixed32_; }
+ get { return PrepareBuilder().packedFixed32_; }
}
public int PackedFixed32Count {
get { return result.PackedFixed32Count; }
@@ -15760,27 +17245,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<uint> values) {
- base.AddRange(values, result.packedFixed32_);
+ PrepareBuilder();
+ result.packedFixed32_.Add(values);
return this;
}
public Builder ClearPackedFixed32() {
+ PrepareBuilder();
result.packedFixed32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> PackedFixed64List {
- get { return result.packedFixed64_; }
+ get { return PrepareBuilder().packedFixed64_; }
}
public int PackedFixed64Count {
get { return result.PackedFixed64Count; }
@@ -15791,26 +17280,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<ulong> values) {
- base.AddRange(values, result.packedFixed64_);
+ PrepareBuilder();
+ result.packedFixed64_.Add(values);
return this;
}
public Builder ClearPackedFixed64() {
+ PrepareBuilder();
result.packedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<int> PackedSfixed32List {
- get { return result.packedSfixed32_; }
+ get { return PrepareBuilder().packedSfixed32_; }
}
public int PackedSfixed32Count {
get { return result.PackedSfixed32Count; }
@@ -15819,24 +17312,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<int> values) {
- base.AddRange(values, result.packedSfixed32_);
+ PrepareBuilder();
+ result.packedSfixed32_.Add(values);
return this;
}
public Builder ClearPackedSfixed32() {
+ PrepareBuilder();
result.packedSfixed32_.Clear();
return this;
}
public pbc::IPopsicleList<long> PackedSfixed64List {
- get { return result.packedSfixed64_; }
+ get { return PrepareBuilder().packedSfixed64_; }
}
public int PackedSfixed64Count {
get { return result.PackedSfixed64Count; }
@@ -15845,24 +17342,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<long> values) {
- base.AddRange(values, result.packedSfixed64_);
+ PrepareBuilder();
+ result.packedSfixed64_.Add(values);
return this;
}
public Builder ClearPackedSfixed64() {
+ PrepareBuilder();
result.packedSfixed64_.Clear();
return this;
}
public pbc::IPopsicleList<float> PackedFloatList {
- get { return result.packedFloat_; }
+ get { return PrepareBuilder().packedFloat_; }
}
public int PackedFloatCount {
get { return result.PackedFloatCount; }
@@ -15871,24 +17372,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<float> values) {
- base.AddRange(values, result.packedFloat_);
+ PrepareBuilder();
+ result.packedFloat_.Add(values);
return this;
}
public Builder ClearPackedFloat() {
+ PrepareBuilder();
result.packedFloat_.Clear();
return this;
}
public pbc::IPopsicleList<double> PackedDoubleList {
- get { return result.packedDouble_; }
+ get { return PrepareBuilder().packedDouble_; }
}
public int PackedDoubleCount {
get { return result.PackedDoubleCount; }
@@ -15897,24 +17402,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<double> values) {
- base.AddRange(values, result.packedDouble_);
+ PrepareBuilder();
+ result.packedDouble_.Add(values);
return this;
}
public Builder ClearPackedDouble() {
+ PrepareBuilder();
result.packedDouble_.Clear();
return this;
}
public pbc::IPopsicleList<bool> PackedBoolList {
- get { return result.packedBool_; }
+ get { return PrepareBuilder().packedBool_; }
}
public int PackedBoolCount {
get { return result.PackedBoolCount; }
@@ -15923,24 +17432,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<bool> values) {
- base.AddRange(values, result.packedBool_);
+ PrepareBuilder();
+ result.packedBool_.Add(values);
return this;
}
public Builder ClearPackedBool() {
+ PrepareBuilder();
result.packedBool_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> PackedEnumList {
- get { return result.packedEnum_; }
+ get { return PrepareBuilder().packedEnum_; }
}
public int PackedEnumCount {
get { return result.PackedEnumCount; }
@@ -15949,18 +17462,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<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> values) {
- base.AddRange(values, result.packedEnum_);
+ PrepareBuilder();
+ result.packedEnum_.Add(values);
return this;
}
public Builder ClearPackedEnum() {
+ PrepareBuilder();
result.packedEnum_.Clear();
return this;
}
@@ -15974,7 +17491,8 @@ 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<TestUnpackedTypes, TestUnpackedTypes.Builder> {
- private static readonly TestUnpackedTypes defaultInstance = new Builder().BuildPartial();
+ private TestUnpackedTypes() { }
+ 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 {
@@ -15982,7 +17500,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestUnpackedTypes DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestUnpackedTypes ThisMessage {
@@ -16370,11 +17888,29 @@ 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(); }
public static Builder CreateBuilder(TestUnpackedTypes prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -16384,21 +17920,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestUnpackedTypes cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestUnpackedTypes result;
+
+ private TestUnpackedTypes PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestUnpackedTypes original = result;
+ result = new TestUnpackedTypes();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -16410,26 +17973,11 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestUnpackedTypes BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
- }
- 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();
- TestUnpackedTypes returnMe = result;
- result = null;
- return returnMe;
+ if (resultIsReadOnly) {
+ return result;
+ }
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -16443,47 +17991,48 @@ 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_);
+ 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;
@@ -16494,6 +18043,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 +18167,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList<int> UnpackedInt32List {
- get { return result.unpackedInt32_; }
+ get { return PrepareBuilder().unpackedInt32_; }
}
public int UnpackedInt32Count {
get { return result.UnpackedInt32Count; }
@@ -16626,24 +18176,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<int> values) {
- base.AddRange(values, result.unpackedInt32_);
+ PrepareBuilder();
+ result.unpackedInt32_.Add(values);
return this;
}
public Builder ClearUnpackedInt32() {
+ PrepareBuilder();
result.unpackedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<long> UnpackedInt64List {
- get { return result.unpackedInt64_; }
+ get { return PrepareBuilder().unpackedInt64_; }
}
public int UnpackedInt64Count {
get { return result.UnpackedInt64Count; }
@@ -16652,25 +18206,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<long> values) {
- base.AddRange(values, result.unpackedInt64_);
+ PrepareBuilder();
+ result.unpackedInt64_.Add(values);
return this;
}
public Builder ClearUnpackedInt64() {
+ PrepareBuilder();
result.unpackedInt64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> UnpackedUint32List {
- get { return result.unpackedUint32_; }
+ get { return PrepareBuilder().unpackedUint32_; }
}
public int UnpackedUint32Count {
get { return result.UnpackedUint32Count; }
@@ -16681,27 +18239,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<uint> values) {
- base.AddRange(values, result.unpackedUint32_);
+ PrepareBuilder();
+ result.unpackedUint32_.Add(values);
return this;
}
public Builder ClearUnpackedUint32() {
+ PrepareBuilder();
result.unpackedUint32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> UnpackedUint64List {
- get { return result.unpackedUint64_; }
+ get { return PrepareBuilder().unpackedUint64_; }
}
public int UnpackedUint64Count {
get { return result.UnpackedUint64Count; }
@@ -16712,26 +18274,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<ulong> values) {
- base.AddRange(values, result.unpackedUint64_);
+ PrepareBuilder();
+ result.unpackedUint64_.Add(values);
return this;
}
public Builder ClearUnpackedUint64() {
+ PrepareBuilder();
result.unpackedUint64_.Clear();
return this;
}
public pbc::IPopsicleList<int> UnpackedSint32List {
- get { return result.unpackedSint32_; }
+ get { return PrepareBuilder().unpackedSint32_; }
}
public int UnpackedSint32Count {
get { return result.UnpackedSint32Count; }
@@ -16740,24 +18306,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<int> values) {
- base.AddRange(values, result.unpackedSint32_);
+ PrepareBuilder();
+ result.unpackedSint32_.Add(values);
return this;
}
public Builder ClearUnpackedSint32() {
+ PrepareBuilder();
result.unpackedSint32_.Clear();
return this;
}
public pbc::IPopsicleList<long> UnpackedSint64List {
- get { return result.unpackedSint64_; }
+ get { return PrepareBuilder().unpackedSint64_; }
}
public int UnpackedSint64Count {
get { return result.UnpackedSint64Count; }
@@ -16766,25 +18336,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<long> values) {
- base.AddRange(values, result.unpackedSint64_);
+ PrepareBuilder();
+ result.unpackedSint64_.Add(values);
return this;
}
public Builder ClearUnpackedSint64() {
+ PrepareBuilder();
result.unpackedSint64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> UnpackedFixed32List {
- get { return result.unpackedFixed32_; }
+ get { return PrepareBuilder().unpackedFixed32_; }
}
public int UnpackedFixed32Count {
get { return result.UnpackedFixed32Count; }
@@ -16795,27 +18369,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<uint> values) {
- base.AddRange(values, result.unpackedFixed32_);
+ PrepareBuilder();
+ result.unpackedFixed32_.Add(values);
return this;
}
public Builder ClearUnpackedFixed32() {
+ PrepareBuilder();
result.unpackedFixed32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> UnpackedFixed64List {
- get { return result.unpackedFixed64_; }
+ get { return PrepareBuilder().unpackedFixed64_; }
}
public int UnpackedFixed64Count {
get { return result.UnpackedFixed64Count; }
@@ -16826,26 +18404,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<ulong> values) {
- base.AddRange(values, result.unpackedFixed64_);
+ PrepareBuilder();
+ result.unpackedFixed64_.Add(values);
return this;
}
public Builder ClearUnpackedFixed64() {
+ PrepareBuilder();
result.unpackedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<int> UnpackedSfixed32List {
- get { return result.unpackedSfixed32_; }
+ get { return PrepareBuilder().unpackedSfixed32_; }
}
public int UnpackedSfixed32Count {
get { return result.UnpackedSfixed32Count; }
@@ -16854,24 +18436,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<int> values) {
- base.AddRange(values, result.unpackedSfixed32_);
+ PrepareBuilder();
+ result.unpackedSfixed32_.Add(values);
return this;
}
public Builder ClearUnpackedSfixed32() {
+ PrepareBuilder();
result.unpackedSfixed32_.Clear();
return this;
}
public pbc::IPopsicleList<long> UnpackedSfixed64List {
- get { return result.unpackedSfixed64_; }
+ get { return PrepareBuilder().unpackedSfixed64_; }
}
public int UnpackedSfixed64Count {
get { return result.UnpackedSfixed64Count; }
@@ -16880,24 +18466,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<long> values) {
- base.AddRange(values, result.unpackedSfixed64_);
+ PrepareBuilder();
+ result.unpackedSfixed64_.Add(values);
return this;
}
public Builder ClearUnpackedSfixed64() {
+ PrepareBuilder();
result.unpackedSfixed64_.Clear();
return this;
}
public pbc::IPopsicleList<float> UnpackedFloatList {
- get { return result.unpackedFloat_; }
+ get { return PrepareBuilder().unpackedFloat_; }
}
public int UnpackedFloatCount {
get { return result.UnpackedFloatCount; }
@@ -16906,24 +18496,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<float> values) {
- base.AddRange(values, result.unpackedFloat_);
+ PrepareBuilder();
+ result.unpackedFloat_.Add(values);
return this;
}
public Builder ClearUnpackedFloat() {
+ PrepareBuilder();
result.unpackedFloat_.Clear();
return this;
}
public pbc::IPopsicleList<double> UnpackedDoubleList {
- get { return result.unpackedDouble_; }
+ get { return PrepareBuilder().unpackedDouble_; }
}
public int UnpackedDoubleCount {
get { return result.UnpackedDoubleCount; }
@@ -16932,24 +18526,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<double> values) {
- base.AddRange(values, result.unpackedDouble_);
+ PrepareBuilder();
+ result.unpackedDouble_.Add(values);
return this;
}
public Builder ClearUnpackedDouble() {
+ PrepareBuilder();
result.unpackedDouble_.Clear();
return this;
}
public pbc::IPopsicleList<bool> UnpackedBoolList {
- get { return result.unpackedBool_; }
+ get { return PrepareBuilder().unpackedBool_; }
}
public int UnpackedBoolCount {
get { return result.UnpackedBoolCount; }
@@ -16958,24 +18556,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<bool> values) {
- base.AddRange(values, result.unpackedBool_);
+ PrepareBuilder();
+ result.unpackedBool_.Add(values);
return this;
}
public Builder ClearUnpackedBool() {
+ PrepareBuilder();
result.unpackedBool_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> UnpackedEnumList {
- get { return result.unpackedEnum_; }
+ get { return PrepareBuilder().unpackedEnum_; }
}
public int UnpackedEnumCount {
get { return result.UnpackedEnumCount; }
@@ -16984,18 +18586,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<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> values) {
- base.AddRange(values, result.unpackedEnum_);
+ PrepareBuilder();
+ result.unpackedEnum_.Add(values);
return this;
}
public Builder ClearUnpackedEnum() {
+ PrepareBuilder();
result.unpackedEnum_.Clear();
return this;
}
@@ -17009,7 +18615,8 @@ 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<TestPackedExtensions, TestPackedExtensions.Builder> {
- private static readonly TestPackedExtensions defaultInstance = new Builder().BuildPartial();
+ private TestPackedExtensions() { }
+ 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 {
@@ -17017,7 +18624,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestPackedExtensions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestPackedExtensions ThisMessage {
@@ -17091,11 +18698,15 @@ 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(); }
public static Builder CreateBuilder(TestPackedExtensions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -17105,21 +18716,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestPackedExtensions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestPackedExtensions result;
+
+ private TestPackedExtensions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestPackedExtensions original = result;
+ result = new TestPackedExtensions();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -17131,12 +18769,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 (resultIsReadOnly) {
+ return result;
}
- TestPackedExtensions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -17150,6 +18787,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 +18798,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;
@@ -17212,7 +18851,8 @@ 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<TestUnpackedExtensions, TestUnpackedExtensions.Builder> {
- private static readonly TestUnpackedExtensions defaultInstance = new Builder().BuildPartial();
+ private TestUnpackedExtensions() { }
+ 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 {
@@ -17220,7 +18860,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestUnpackedExtensions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestUnpackedExtensions ThisMessage {
@@ -17294,11 +18934,15 @@ 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(); }
public static Builder CreateBuilder(TestUnpackedExtensions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -17308,21 +18952,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestUnpackedExtensions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestUnpackedExtensions result;
+
+ private TestUnpackedExtensions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestUnpackedExtensions original = result;
+ result = new TestUnpackedExtensions();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -17334,12 +19005,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 (resultIsReadOnly) {
+ return result;
}
- TestUnpackedExtensions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -17353,6 +19023,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 +19034,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;
@@ -17415,7 +19087,8 @@ 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<TestDynamicExtensions, TestDynamicExtensions.Builder> {
- private static readonly TestDynamicExtensions defaultInstance = new Builder().BuildPartial();
+ private TestDynamicExtensions() { }
+ 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 {
@@ -17423,7 +19096,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestDynamicExtensions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestDynamicExtensions ThisMessage {
@@ -17455,7 +19128,8 @@ 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<DynamicMessageType, DynamicMessageType.Builder> {
- private static readonly DynamicMessageType defaultInstance = new Builder().BuildPartial();
+ private DynamicMessageType() { }
+ 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 {
@@ -17463,7 +19137,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override DynamicMessageType DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override DynamicMessageType ThisMessage {
@@ -17549,11 +19223,15 @@ 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(); }
public static Builder CreateBuilder(DynamicMessageType prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -17563,21 +19241,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(DynamicMessageType cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- DynamicMessageType result = new DynamicMessageType();
+ private bool resultIsReadOnly;
+ private DynamicMessageType result;
+
+ private DynamicMessageType PrepareBuilder() {
+ if (resultIsReadOnly) {
+ DynamicMessageType original = result;
+ result = new DynamicMessageType();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -17589,12 +19294,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 (resultIsReadOnly) {
+ return result;
}
- DynamicMessageType returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -17608,6 +19312,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 +19325,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 +19381,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;
@@ -17726,22 +19434,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;
@@ -17879,11 +19587,17 @@ 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(); }
public static Builder CreateBuilder(TestDynamicExtensions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -17893,21 +19607,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestDynamicExtensions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestDynamicExtensions result;
+
+ private TestDynamicExtensions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestDynamicExtensions original = result;
+ result = new TestDynamicExtensions();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestDynamicExtensions result = new TestDynamicExtensions();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -17919,14 +19660,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.repeatedExtension_.MakeReadOnly();
- result.packedExtension_.MakeReadOnly();
- TestDynamicExtensions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -17940,6 +19678,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;
}
@@ -17956,10 +19695,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;
@@ -17970,6 +19709,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 +19818,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 +19838,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 +19858,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 +19879,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,8 +19904,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearMessageExtension() {
+ PrepareBuilder();
result.hasMessageExtension = false;
- result.messageExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance;
+ result.messageExtension_ = null;
return this;
}
@@ -18169,18 +19919,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 +19944,14 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearDynamicMessageExtension() {
+ PrepareBuilder();
result.hasDynamicMessageExtension = false;
- result.dynamicMessageExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance;
+ result.dynamicMessageExtension_ = null;
return this;
}
public pbc::IPopsicleList<string> RepeatedExtensionList {
- get { return result.repeatedExtension_; }
+ get { return PrepareBuilder().repeatedExtension_; }
}
public int RepeatedExtensionCount {
get { return result.RepeatedExtensionCount; }
@@ -18207,25 +19961,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<string> values) {
- base.AddRange(values, result.repeatedExtension_);
+ PrepareBuilder();
+ result.repeatedExtension_.Add(values);
return this;
}
public Builder ClearRepeatedExtension() {
+ PrepareBuilder();
result.repeatedExtension_.Clear();
return this;
}
public pbc::IPopsicleList<int> PackedExtensionList {
- get { return result.packedExtension_; }
+ get { return PrepareBuilder().packedExtension_; }
}
public int PackedExtensionCount {
get { return result.PackedExtensionCount; }
@@ -18234,18 +19992,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<int> values) {
- base.AddRange(values, result.packedExtension_);
+ PrepareBuilder();
+ result.packedExtension_.Add(values);
return this;
}
public Builder ClearPackedExtension() {
+ PrepareBuilder();
result.packedExtension_.Clear();
return this;
}
@@ -18259,7 +20021,8 @@ 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<TestRepeatedScalarDifferentTagSizes, TestRepeatedScalarDifferentTagSizes.Builder> {
- private static readonly TestRepeatedScalarDifferentTagSizes defaultInstance = new Builder().BuildPartial();
+ private TestRepeatedScalarDifferentTagSizes() { }
+ 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 {
@@ -18267,7 +20030,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestRepeatedScalarDifferentTagSizes DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestRepeatedScalarDifferentTagSizes ThisMessage {
@@ -18475,11 +20238,21 @@ 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(); }
public static Builder CreateBuilder(TestRepeatedScalarDifferentTagSizes prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -18489,21 +20262,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestRepeatedScalarDifferentTagSizes cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestRepeatedScalarDifferentTagSizes result = new TestRepeatedScalarDifferentTagSizes();
+ private bool resultIsReadOnly;
+ private TestRepeatedScalarDifferentTagSizes result;
+
+ private TestRepeatedScalarDifferentTagSizes PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestRepeatedScalarDifferentTagSizes original = result;
+ result = new TestRepeatedScalarDifferentTagSizes();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -18515,18 +20315,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.repeatedFixed32_.MakeReadOnly();
- result.repeatedInt32_.MakeReadOnly();
- result.repeatedFixed64_.MakeReadOnly();
- result.repeatedInt64_.MakeReadOnly();
- result.repeatedFloat_.MakeReadOnly();
- result.repeatedUint64_.MakeReadOnly();
- TestRepeatedScalarDifferentTagSizes returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -18540,23 +20333,24 @@ 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_);
+ 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;
@@ -18567,6 +20361,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 +20437,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> RepeatedFixed32List {
- get { return result.repeatedFixed32_; }
+ get { return PrepareBuilder().repeatedFixed32_; }
}
public int RepeatedFixed32Count {
get { return result.RepeatedFixed32Count; }
@@ -18653,26 +20448,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<uint> values) {
- base.AddRange(values, result.repeatedFixed32_);
+ PrepareBuilder();
+ result.repeatedFixed32_.Add(values);
return this;
}
public Builder ClearRepeatedFixed32() {
+ PrepareBuilder();
result.repeatedFixed32_.Clear();
return this;
}
public pbc::IPopsicleList<int> RepeatedInt32List {
- get { return result.repeatedInt32_; }
+ get { return PrepareBuilder().repeatedInt32_; }
}
public int RepeatedInt32Count {
get { return result.RepeatedInt32Count; }
@@ -18681,25 +20480,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<int> values) {
- base.AddRange(values, result.repeatedInt32_);
+ PrepareBuilder();
+ result.repeatedInt32_.Add(values);
return this;
}
public Builder ClearRepeatedInt32() {
+ PrepareBuilder();
result.repeatedInt32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> RepeatedFixed64List {
- get { return result.repeatedFixed64_; }
+ get { return PrepareBuilder().repeatedFixed64_; }
}
public int RepeatedFixed64Count {
get { return result.RepeatedFixed64Count; }
@@ -18710,26 +20513,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<ulong> values) {
- base.AddRange(values, result.repeatedFixed64_);
+ PrepareBuilder();
+ result.repeatedFixed64_.Add(values);
return this;
}
public Builder ClearRepeatedFixed64() {
+ PrepareBuilder();
result.repeatedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedInt64List {
- get { return result.repeatedInt64_; }
+ get { return PrepareBuilder().repeatedInt64_; }
}
public int RepeatedInt64Count {
get { return result.RepeatedInt64Count; }
@@ -18738,24 +20545,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<long> values) {
- base.AddRange(values, result.repeatedInt64_);
+ PrepareBuilder();
+ result.repeatedInt64_.Add(values);
return this;
}
public Builder ClearRepeatedInt64() {
+ PrepareBuilder();
result.repeatedInt64_.Clear();
return this;
}
public pbc::IPopsicleList<float> RepeatedFloatList {
- get { return result.repeatedFloat_; }
+ get { return PrepareBuilder().repeatedFloat_; }
}
public int RepeatedFloatCount {
get { return result.RepeatedFloatCount; }
@@ -18764,25 +20575,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<float> values) {
- base.AddRange(values, result.repeatedFloat_);
+ PrepareBuilder();
+ result.repeatedFloat_.Add(values);
return this;
}
public Builder ClearRepeatedFloat() {
+ PrepareBuilder();
result.repeatedFloat_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> RepeatedUint64List {
- get { return result.repeatedUint64_; }
+ get { return PrepareBuilder().repeatedUint64_; }
}
public int RepeatedUint64Count {
get { return result.RepeatedUint64Count; }
@@ -18793,20 +20608,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<ulong> values) {
- base.AddRange(values, result.repeatedUint64_);
+ PrepareBuilder();
+ result.repeatedUint64_.Add(values);
return this;
}
public Builder ClearRepeatedUint64() {
+ PrepareBuilder();
result.repeatedUint64_.Clear();
return this;
}
@@ -18820,7 +20639,8 @@ 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<FooRequest, FooRequest.Builder> {
- private static readonly FooRequest defaultInstance = new Builder().BuildPartial();
+ private FooRequest() { }
+ 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 {
@@ -18828,7 +20648,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override FooRequest DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override FooRequest ThisMessage {
@@ -18898,11 +20718,15 @@ 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(); }
public static Builder CreateBuilder(FooRequest prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -18912,21 +20736,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(FooRequest cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private FooRequest result;
+
+ private FooRequest PrepareBuilder() {
+ if (resultIsReadOnly) {
+ FooRequest original = result;
+ result = new FooRequest();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- FooRequest result = new FooRequest();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -18938,12 +20789,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 (resultIsReadOnly) {
+ return result;
}
- FooRequest returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -18957,6 +20807,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 +20817,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;
@@ -19018,7 +20870,8 @@ 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<FooResponse, FooResponse.Builder> {
- private static readonly FooResponse defaultInstance = new Builder().BuildPartial();
+ private FooResponse() { }
+ 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 {
@@ -19026,7 +20879,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override FooResponse DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override FooResponse ThisMessage {
@@ -19096,11 +20949,15 @@ 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(); }
public static Builder CreateBuilder(FooResponse prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -19110,21 +20967,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(FooResponse cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- FooResponse result = new FooResponse();
+ private bool resultIsReadOnly;
+ private FooResponse result;
+
+ private FooResponse PrepareBuilder() {
+ if (resultIsReadOnly) {
+ FooResponse original = result;
+ result = new FooResponse();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -19136,12 +21020,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 (resultIsReadOnly) {
+ return result;
}
- FooResponse returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -19155,6 +21038,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 +21048,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;
@@ -19216,7 +21101,8 @@ 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<BarRequest, BarRequest.Builder> {
- private static readonly BarRequest defaultInstance = new Builder().BuildPartial();
+ private BarRequest() { }
+ 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 {
@@ -19224,7 +21110,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override BarRequest DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override BarRequest ThisMessage {
@@ -19294,11 +21180,15 @@ 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(); }
public static Builder CreateBuilder(BarRequest prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -19308,21 +21198,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(BarRequest cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- BarRequest result = new BarRequest();
+ private bool resultIsReadOnly;
+ private BarRequest result;
+
+ private BarRequest PrepareBuilder() {
+ if (resultIsReadOnly) {
+ BarRequest original = result;
+ result = new BarRequest();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -19334,12 +21251,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 (resultIsReadOnly) {
+ return result;
}
- BarRequest returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -19353,6 +21269,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 +21279,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;
@@ -19414,7 +21332,8 @@ 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<BarResponse, BarResponse.Builder> {
- private static readonly BarResponse defaultInstance = new Builder().BuildPartial();
+ private BarResponse() { }
+ 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 {
@@ -19422,7 +21341,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override BarResponse DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override BarResponse ThisMessage {
@@ -19492,11 +21411,15 @@ 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(); }
public static Builder CreateBuilder(BarResponse prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -19506,21 +21429,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(BarResponse cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- BarResponse result = new BarResponse();
+ private bool resultIsReadOnly;
+ private BarResponse result;
+
+ private BarResponse PrepareBuilder() {
+ if (resultIsReadOnly) {
+ BarResponse original = result;
+ result = new BarResponse();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -19532,12 +21482,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 (resultIsReadOnly) {
+ return result;
}
- BarResponse returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -19551,6 +21500,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 +21510,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 ae309fa7..ce8f66d9 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;
@@ -83,7 +83,8 @@ 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<SearchRequest, SearchRequest.Builder> {
- private static readonly SearchRequest defaultInstance = new Builder().BuildPartial();
+ private SearchRequest() { }
+ 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 +92,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override SearchRequest DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override SearchRequest ThisMessage {
@@ -184,11 +185,16 @@ 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(); }
public static Builder CreateBuilder(SearchRequest prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -198,21 +204,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(SearchRequest cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- SearchRequest result = new SearchRequest();
+ private bool resultIsReadOnly;
+ private SearchRequest result;
+
+ private SearchRequest PrepareBuilder() {
+ if (resultIsReadOnly) {
+ SearchRequest original = result;
+ result = new SearchRequest();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -224,13 +257,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.criteria_.MakeReadOnly();
- SearchRequest returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -244,8 +275,9 @@ 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_);
+ result.criteria_.Add(other.criteria_);
}
this.MergeUnknownFields(other.UnknownFields);
return this;
@@ -256,6 +288,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 +337,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList<string> CriteriaList {
- get { return result.criteria_; }
+ get { return PrepareBuilder().criteria_; }
}
public int CriteriaCount {
get { return result.CriteriaCount; }
@@ -314,19 +347,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<string> values) {
- base.AddRange(values, result.criteria_);
+ PrepareBuilder();
+ result.criteria_.Add(values);
return this;
}
public Builder ClearCriteria() {
+ PrepareBuilder();
result.criteria_.Clear();
return this;
}
@@ -340,7 +377,8 @@ 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<SearchResponse, SearchResponse.Builder> {
- private static readonly SearchResponse defaultInstance = new Builder().BuildPartial();
+ private SearchResponse() { }
+ 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 {
@@ -348,7 +386,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override SearchResponse DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override SearchResponse ThisMessage {
@@ -372,7 +410,8 @@ 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<ResultItem, ResultItem.Builder> {
- private static readonly ResultItem defaultInstance = new Builder().BuildPartial();
+ private ResultItem() { }
+ 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 {
@@ -380,7 +419,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override ResultItem DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override ResultItem ThisMessage {
@@ -483,11 +522,15 @@ 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(); }
public static Builder CreateBuilder(ResultItem prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -497,21 +540,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(ResultItem cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- ResultItem result = new ResultItem();
+ private bool resultIsReadOnly;
+ private ResultItem result;
+
+ private ResultItem PrepareBuilder() {
+ if (resultIsReadOnly) {
+ ResultItem original = result;
+ result = new ResultItem();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -523,12 +593,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 (resultIsReadOnly) {
+ return result;
}
- ResultItem returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -542,6 +611,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 +627,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 +688,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 +709,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;
@@ -730,11 +805,16 @@ 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(); }
public static Builder CreateBuilder(SearchResponse prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -744,21 +824,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(SearchResponse cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private SearchResponse result;
+
+ private SearchResponse PrepareBuilder() {
+ if (resultIsReadOnly) {
+ SearchResponse original = result;
+ result = new SearchResponse();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- SearchResponse result = new SearchResponse();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -770,13 +877,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.results_.MakeReadOnly();
- SearchResponse returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -790,8 +895,9 @@ 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_);
+ result.results_.Add(other.results_);
}
this.MergeUnknownFields(other.UnknownFields);
return this;
@@ -802,6 +908,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 +957,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem> ResultsList {
- get { return result.results_; }
+ get { return PrepareBuilder().results_; }
}
public int ResultsCount {
get { return result.ResultsCount; }
@@ -860,29 +967,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<global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem> values) {
- base.AddRange(values, result.results_);
+ PrepareBuilder();
+ result.results_.Add(values);
return this;
}
public Builder ClearResults() {
+ PrepareBuilder();
result.results_.Clear();
return this;
}
@@ -896,7 +1009,8 @@ 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<RefineSearchRequest, RefineSearchRequest.Builder> {
- private static readonly RefineSearchRequest defaultInstance = new Builder().BuildPartial();
+ private RefineSearchRequest() { }
+ 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 {
@@ -904,7 +1018,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override RefineSearchRequest DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override RefineSearchRequest ThisMessage {
@@ -933,12 +1047,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 {
@@ -1015,11 +1129,16 @@ 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(); }
public static Builder CreateBuilder(RefineSearchRequest prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1029,21 +1148,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(RefineSearchRequest cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private RefineSearchRequest result;
+
+ private RefineSearchRequest PrepareBuilder() {
+ if (resultIsReadOnly) {
+ RefineSearchRequest original = result;
+ result = new RefineSearchRequest();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- RefineSearchRequest result = new RefineSearchRequest();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1055,13 +1201,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.criteria_.MakeReadOnly();
- RefineSearchRequest returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1075,8 +1219,9 @@ 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_);
+ result.criteria_.Add(other.criteria_);
}
if (other.HasPreviousResults) {
MergePreviousResults(other.PreviousResults);
@@ -1090,6 +1235,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 +1293,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList<string> CriteriaList {
- get { return result.criteria_; }
+ get { return PrepareBuilder().criteria_; }
}
public int CriteriaCount {
get { return result.CriteriaCount; }
@@ -1157,19 +1303,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<string> values) {
- base.AddRange(values, result.criteria_);
+ PrepareBuilder();
+ result.criteria_.Add(values);
return this;
}
public Builder ClearCriteria() {
+ PrepareBuilder();
result.criteria_.Clear();
return this;
}
@@ -1183,18 +1333,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,8 +1358,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
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 3d818a60..e63d8c3b 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;
@@ -76,9 +76,9 @@ namespace Google.ProtocolBuffers.TestProtos { "dGVuc2lvbl9udW1iZXISJy5wcm90b2J1Zl91bml0dGVzdF9leHRyYS5UZXN0" +
"WG1sTWVzc2FnZRhnIAMoBUICEAE6bgoRZXh0ZW5zaW9uX21lc3NhZ2USJy5w" +
"cm90b2J1Zl91bml0dGVzdF9leHRyYS5UZXN0WG1sTWVzc2FnZRjHASABKAsy" +
- "KS5wcm90b2J1Zl91bml0dGVzdF9leHRyYS5UZXN0WG1sRXh0ZW5zaW9uQkxI" +
- "AcI+RwohR29vZ2xlLlByb3RvY29sQnVmZmVycy5UZXN0UHJvdG9zEiJVbml0" +
- "VGVzdFhtbFNlcmlhbGl6ZXJUZXN0UHJvdG9GaWxl");
+ "KS5wcm90b2J1Zl91bml0dGVzdF9leHRyYS5UZXN0WG1sRXh0ZW5zaW9uQk5I" +
+ "AcI+SQohR29vZ2xlLlByb3RvY29sQnVmZmVycy5UZXN0UHJvdG9zEiJVbml0" +
+ "VGVzdFhtbFNlcmlhbGl6ZXJUZXN0UHJvdG9GaWxlSAE=");
pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
descriptor = root;
internal__static_protobuf_unittest_extra_TestXmlChild__Descriptor = Descriptor.MessageTypes[0];
@@ -134,11 +134,13 @@ namespace Google.ProtocolBuffers.TestProtos { #endregion
#region Messages
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
public sealed partial class TestXmlChild : pb::GeneratedMessage<TestXmlChild, TestXmlChild.Builder> {
- private static readonly TestXmlChild defaultInstance = new Builder().BuildPartial();
+ private TestXmlChild() { }
+ 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 +148,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestXmlChild DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestXmlChild ThisMessage {
@@ -257,13 +259,19 @@ 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(); }
public static Builder CreateBuilder(TestXmlChild prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
@@ -271,21 +279,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestXmlChild cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestXmlChild result = new TestXmlChild();
+ private bool resultIsReadOnly;
+ private TestXmlChild result;
+
+ private TestXmlChild PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestXmlChild original = result;
+ result = new TestXmlChild();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -297,13 +332,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.options_.MakeReadOnly();
- TestXmlChild returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -317,8 +350,9 @@ 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_);
+ result.options_.Add(other.options_);
}
if (other.HasBinary) {
Binary = other.Binary;
@@ -332,6 +366,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 +429,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.EnumOptions> OptionsList {
- get { return result.options_; }
+ get { return PrepareBuilder().options_; }
}
public int OptionsCount {
get { return result.OptionsCount; }
@@ -403,18 +438,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<global::Google.ProtocolBuffers.TestProtos.EnumOptions> values) {
- base.AddRange(values, result.options_);
+ PrepareBuilder();
+ result.options_.Add(values);
return this;
}
public Builder ClearOptions() {
+ PrepareBuilder();
result.options_.Clear();
return this;
}
@@ -428,11 +467,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;
@@ -443,11 +484,13 @@ namespace Google.ProtocolBuffers.TestProtos { }
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
public sealed partial class TestXmlNoFields : pb::GeneratedMessage<TestXmlNoFields, TestXmlNoFields.Builder> {
- private static readonly TestXmlNoFields defaultInstance = new Builder().BuildPartial();
+ private TestXmlNoFields() { }
+ 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 {
@@ -455,7 +498,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestXmlNoFields DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestXmlNoFields ThisMessage {
@@ -525,13 +568,18 @@ 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(); }
public static Builder CreateBuilder(TestXmlNoFields prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
@@ -539,21 +587,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestXmlNoFields cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestXmlNoFields result = new TestXmlNoFields();
+ private bool resultIsReadOnly;
+ private TestXmlNoFields result;
+
+ private TestXmlNoFields PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestXmlNoFields original = result;
+ result = new TestXmlNoFields();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -565,12 +640,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 (resultIsReadOnly) {
+ return result;
}
- TestXmlNoFields returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -584,6 +658,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 +668,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;
@@ -641,11 +717,13 @@ namespace Google.ProtocolBuffers.TestProtos { }
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
public sealed partial class TestXmlRescursive : pb::GeneratedMessage<TestXmlRescursive, TestXmlRescursive.Builder> {
- private static readonly TestXmlRescursive defaultInstance = new Builder().BuildPartial();
+ private TestXmlRescursive() { }
+ 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 {
@@ -653,7 +731,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestXmlRescursive DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestXmlRescursive ThisMessage {
@@ -670,12 +748,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 {
@@ -739,13 +817,18 @@ 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(); }
public static Builder CreateBuilder(TestXmlRescursive prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
@@ -753,21 +836,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestXmlRescursive cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestXmlRescursive result = new TestXmlRescursive();
+ private bool resultIsReadOnly;
+ private TestXmlRescursive result;
+
+ private TestXmlRescursive PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestXmlRescursive original = result;
+ result = new TestXmlRescursive();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -779,12 +889,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 (resultIsReadOnly) {
+ return result;
}
- TestXmlRescursive returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -798,6 +907,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 +920,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 +982,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,8 +1007,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearChild() {
+ PrepareBuilder();
result.hasChild = false;
- result.child_ = global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.DefaultInstance;
+ result.child_ = null;
return this;
}
}
@@ -903,11 +1018,13 @@ namespace Google.ProtocolBuffers.TestProtos { }
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
public sealed partial class TestXmlMessage : pb::ExtendableMessage<TestXmlMessage, TestXmlMessage.Builder> {
- private static readonly TestXmlMessage defaultInstance = new Builder().BuildPartial();
+ private TestXmlMessage() { }
+ 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 {
@@ -915,7 +1032,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestXmlMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestXmlMessage ThisMessage {
@@ -935,11 +1052,13 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
public static class Types {
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
public sealed partial class Children : pb::GeneratedMessage<Children, Children.Builder> {
- private static readonly Children defaultInstance = new Builder().BuildPartial();
+ private Children() { }
+ 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 {
@@ -947,7 +1066,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override Children DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override Children ThisMessage {
@@ -1058,13 +1177,19 @@ 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(); }
public static Builder CreateBuilder(Children prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
@@ -1072,21 +1197,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(Children cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private Children result;
+
+ private Children PrepareBuilder() {
+ if (resultIsReadOnly) {
+ Children original = result;
+ result = new Children();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- Children result = new Children();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1098,13 +1250,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.options_.MakeReadOnly();
- Children returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1118,8 +1268,9 @@ 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_);
+ result.options_.Add(other.options_);
}
if (other.HasBinary) {
Binary = other.Binary;
@@ -1133,6 +1284,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 +1347,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.EnumOptions> OptionsList {
- get { return result.options_; }
+ get { return PrepareBuilder().options_; }
}
public int OptionsCount {
get { return result.OptionsCount; }
@@ -1204,18 +1356,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<global::Google.ProtocolBuffers.TestProtos.EnumOptions> values) {
- base.AddRange(values, result.options_);
+ PrepareBuilder();
+ result.options_.Add(values);
return this;
}
public Builder ClearOptions() {
+ PrepareBuilder();
result.options_.Clear();
return this;
}
@@ -1229,11 +1385,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;
@@ -1303,12 +1461,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;
@@ -1434,13 +1592,21 @@ 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(); }
public static Builder CreateBuilder(TestXmlMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
@@ -1448,21 +1614,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestXmlMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestXmlMessage result;
+
+ private TestXmlMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestXmlMessage original = result;
+ result = new TestXmlMessage();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestXmlMessage result = new TestXmlMessage();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1474,15 +1667,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.numbers_.MakeReadOnly();
- result.textlines_.MakeReadOnly();
- result.children_.MakeReadOnly();
- TestXmlMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1496,17 +1685,18 @@ 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;
}
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 +1705,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);
@@ -1527,6 +1717,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 +1803,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<int> NumbersList {
- get { return result.numbers_; }
+ get { return PrepareBuilder().numbers_; }
}
public int NumbersCount {
get { return result.NumbersCount; }
@@ -1632,18 +1825,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<int> values) {
- base.AddRange(values, result.numbers_);
+ PrepareBuilder();
+ result.numbers_.Add(values);
return this;
}
public Builder ClearNumbers() {
+ PrepareBuilder();
result.numbers_.Clear();
return this;
}
@@ -1657,18 +1854,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<string> TextlinesList {
- get { return result.textlines_; }
+ get { return PrepareBuilder().textlines_; }
}
public int TextlinesCount {
get { return result.TextlinesCount; }
@@ -1678,19 +1877,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<string> values) {
- base.AddRange(values, result.textlines_);
+ PrepareBuilder();
+ result.textlines_.Add(values);
return this;
}
public Builder ClearTextlines() {
+ PrepareBuilder();
result.textlines_.Clear();
return this;
}
@@ -1703,11 +1906,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 +1927,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 +1952,14 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearChild() {
+ PrepareBuilder();
result.hasChild = false;
- result.child_ = global::Google.ProtocolBuffers.TestProtos.TestXmlChild.DefaultInstance;
+ result.child_ = null;
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children> ChildrenList {
- get { return result.children_; }
+ get { return PrepareBuilder().children_; }
}
public int ChildrenCount {
get { return result.ChildrenCount; }
@@ -1760,29 +1969,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<global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children> values) {
- base.AddRange(values, result.children_);
+ PrepareBuilder();
+ result.children_.Add(values);
return this;
}
public Builder ClearChildren() {
+ PrepareBuilder();
result.children_.Clear();
return this;
}
@@ -1792,11 +2007,13 @@ namespace Google.ProtocolBuffers.TestProtos { }
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
public sealed partial class TestXmlExtension : pb::GeneratedMessage<TestXmlExtension, TestXmlExtension.Builder> {
- private static readonly TestXmlExtension defaultInstance = new Builder().BuildPartial();
+ private TestXmlExtension() { }
+ 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 {
@@ -1804,7 +2021,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestXmlExtension DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestXmlExtension ThisMessage {
@@ -1891,13 +2108,18 @@ 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(); }
public static Builder CreateBuilder(TestXmlExtension prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
@@ -1905,21 +2127,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestXmlExtension cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestXmlExtension result;
- TestXmlExtension result = new TestXmlExtension();
+ private TestXmlExtension PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestXmlExtension original = result;
+ result = new TestXmlExtension();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1931,12 +2180,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 (resultIsReadOnly) {
+ return result;
}
- TestXmlExtension returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1950,6 +2198,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 +2211,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 +2267,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/AbstractBuilder.cs b/src/ProtocolBuffers/AbstractBuilder.cs index e477194c..47d84a35 100644 --- a/src/ProtocolBuffers/AbstractBuilder.cs +++ b/src/ProtocolBuffers/AbstractBuilder.cs @@ -44,7 +44,7 @@ namespace Google.ProtocolBuffers /// <summary>
/// Implementation of the non-generic IMessage interface as far as possible.
/// </summary>
- public abstract class AbstractBuilder<TMessage, TBuilder> : AbstractBuilderLite<TMessage, TBuilder>,
+ public abstract partial class AbstractBuilder<TMessage, TBuilder> : AbstractBuilderLite<TMessage, TBuilder>,
IBuilder<TMessage, TBuilder>
where TMessage : AbstractMessage<TMessage, TBuilder>
where TBuilder : AbstractBuilder<TMessage, TBuilder>
diff --git a/src/ProtocolBuffers/AbstractBuilderLite.cs b/src/ProtocolBuffers/AbstractBuilderLite.cs index 8899d9b2..a7fedeae 100644 --- a/src/ProtocolBuffers/AbstractBuilderLite.cs +++ b/src/ProtocolBuffers/AbstractBuilderLite.cs @@ -42,7 +42,7 @@ namespace Google.ProtocolBuffers /// <summary>
/// Implementation of the non-generic IMessage interface as far as possible.
/// </summary>
- public abstract class AbstractBuilderLite<TMessage, TBuilder> : IBuilderLite<TMessage, TBuilder>
+ public abstract partial class AbstractBuilderLite<TMessage, TBuilder> : IBuilderLite<TMessage, TBuilder>
where TMessage : AbstractMessageLite<TMessage, TBuilder>
where TBuilder : AbstractBuilderLite<TMessage, TBuilder>
{
diff --git a/src/ProtocolBuffers/AbstractMessage.cs b/src/ProtocolBuffers/AbstractMessage.cs index 13443b1c..16c8c786 100644 --- a/src/ProtocolBuffers/AbstractMessage.cs +++ b/src/ProtocolBuffers/AbstractMessage.cs @@ -46,7 +46,7 @@ namespace Google.ProtocolBuffers /// <summary>
/// Implementation of the non-generic IMessage interface as far as possible.
/// </summary>
- public abstract class AbstractMessage<TMessage, TBuilder> : AbstractMessageLite<TMessage, TBuilder>,
+ public abstract partial class AbstractMessage<TMessage, TBuilder> : AbstractMessageLite<TMessage, TBuilder>,
IMessage<TMessage, TBuilder>
where TMessage : AbstractMessage<TMessage, TBuilder>
where TBuilder : AbstractBuilder<TMessage, TBuilder>
diff --git a/src/ProtocolBuffers/AbstractMessageLite.cs b/src/ProtocolBuffers/AbstractMessageLite.cs index 021cb0ef..1cdead2e 100644 --- a/src/ProtocolBuffers/AbstractMessageLite.cs +++ b/src/ProtocolBuffers/AbstractMessageLite.cs @@ -41,7 +41,7 @@ namespace Google.ProtocolBuffers /// <summary>
/// Implementation of the non-generic IMessage interface as far as possible.
/// </summary>
- public abstract class AbstractMessageLite<TMessage, TBuilder> : IMessageLite<TMessage, TBuilder>
+ public abstract partial class AbstractMessageLite<TMessage, TBuilder> : IMessageLite<TMessage, TBuilder>
where TMessage : AbstractMessageLite<TMessage, TBuilder>
where TBuilder : AbstractBuilderLite<TMessage, TBuilder>
{
diff --git a/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs b/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs index 50bf28d2..2da0080e 100644 --- a/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs +++ b/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs @@ -202,7 +202,7 @@ namespace Google.ProtocolBuffers /// </summary>
public static int ComputeEnumSize(int fieldNumber, int value)
{
- return ComputeTagSize(fieldNumber) + ComputeRawVarint32Size((uint) value);
+ return ComputeTagSize(fieldNumber) + ComputeEnumSizeNoTag(value);
}
/// <summary>
@@ -391,7 +391,7 @@ namespace Google.ProtocolBuffers /// </summary>
public static int ComputeEnumSizeNoTag(int value)
{
- return ComputeRawVarint32Size((uint) value);
+ return ComputeInt32SizeNoTag(value);
}
/// <summary>
diff --git a/src/ProtocolBuffers/CodedOutputStream.cs b/src/ProtocolBuffers/CodedOutputStream.cs index 37c60387..709082a7 100644 --- a/src/ProtocolBuffers/CodedOutputStream.cs +++ b/src/ProtocolBuffers/CodedOutputStream.cs @@ -388,7 +388,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)
@@ -663,7 +663,7 @@ namespace Google.ProtocolBuffers public void WriteEnumNoTag(int value)
{
- WriteRawVarint32((uint) value);
+ WriteInt32NoTag(value);
}
public void WriteSFixed32NoTag(int value)
diff --git a/src/ProtocolBuffers/Collections/PopsicleList.cs b/src/ProtocolBuffers/Collections/PopsicleList.cs index dc5c5836..3de97f89 100644 --- a/src/ProtocolBuffers/Collections/PopsicleList.cs +++ b/src/ProtocolBuffers/Collections/PopsicleList.cs @@ -42,6 +42,7 @@ namespace Google.ProtocolBuffers.Collections /// </summary>
public sealed class PopsicleList<T> : IPopsicleList<T>, ICastArray
{
+ private static readonly bool CheckForNull = default(T) == null;
private static readonly T[] EmptySet = new T[0];
private List<T> 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<T> collection)
{
- if (readOnly)
+ ValidateModification();
+ ThrowHelper.ThrowIfNull(collection);
+
+ if (!CheckForNull || collection is PopsicleList<T>)
{
- throw new NotSupportedException("List is read-only");
+ items.AddRange(collection);
}
- if (items == null)
+ else
{
- items = new List<T>();
+ // Assumption, it's ok to enumerate collections more than once.
+ if (collection is ICollection<T>)
+ {
+ 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/CustomSerialization.cs b/src/ProtocolBuffers/CustomSerialization.cs new file mode 100644 index 00000000..5af673ad --- /dev/null +++ b/src/ProtocolBuffers/CustomSerialization.cs @@ -0,0 +1,188 @@ +#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 System.Runtime.Serialization;
+
+/*
+ * This entire source file is not supported on the Silverlight platform
+ */
+#if !SILVERLIGHT2
+namespace Google.ProtocolBuffers
+{
+ /*
+ * Specialized handing of *all* message types. Messages are serialized into a byte[] and stored
+ * into the SerializationInfo, and are then reconstituted by an IObjectReference class after
+ * deserialization. IDeserializationCallback is supported on both the Builder and Message.
+ */
+ [Serializable]
+ partial class AbstractMessageLite<TMessage, TBuilder> : ISerializable
+ {
+ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ info.SetType(typeof(SerializationSurrogate));
+ info.AddValue("message", ToByteArray());
+ info.AddValue("initialized", IsInitialized);
+ }
+
+ [Serializable]
+ private sealed class SerializationSurrogate : IObjectReference, ISerializable
+ {
+ static readonly TBuilder TemplateInstance = (TBuilder)Activator.CreateInstance(typeof(TBuilder));
+ private readonly byte[] _message;
+ private readonly bool _initialized;
+
+ private SerializationSurrogate(SerializationInfo info, StreamingContext context)
+ {
+ _message = (byte[])info.GetValue("message", typeof(byte[]));
+ _initialized = info.GetBoolean("initialized");
+ }
+
+ object IObjectReference.GetRealObject(StreamingContext context)
+ {
+ ExtensionRegistry registry = context.Context as ExtensionRegistry;
+ TBuilder builder = TemplateInstance.DefaultInstanceForType.CreateBuilderForType();
+ builder.MergeFrom(_message, registry ?? ExtensionRegistry.Empty);
+
+ IDeserializationCallback callback = builder as IDeserializationCallback;
+ if(callback != null)
+ {
+ callback.OnDeserialization(context);
+ }
+
+ TMessage message = _initialized ? builder.Build() : builder.BuildPartial();
+ callback = message as IDeserializationCallback;
+ if (callback != null)
+ {
+ callback.OnDeserialization(context);
+ }
+
+ return message;
+ }
+
+ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue("message", _message);
+ }
+ }
+ }
+
+ [Serializable]
+ partial class AbstractBuilderLite<TMessage, TBuilder> : ISerializable
+ {
+ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ info.SetType(typeof(SerializationSurrogate));
+ info.AddValue("message", Clone().BuildPartial().ToByteArray());
+ }
+
+ [Serializable]
+ private sealed class SerializationSurrogate : IObjectReference, ISerializable
+ {
+ static readonly TBuilder TemplateInstance = (TBuilder)Activator.CreateInstance(typeof(TBuilder));
+ private readonly byte[] _message;
+
+ private SerializationSurrogate(SerializationInfo info, StreamingContext context)
+ {
+ _message = (byte[])info.GetValue("message", typeof(byte[]));
+ }
+
+ object IObjectReference.GetRealObject(StreamingContext context)
+ {
+ ExtensionRegistry registry = context.Context as ExtensionRegistry;
+ TBuilder builder = TemplateInstance.DefaultInstanceForType.CreateBuilderForType();
+ builder.MergeFrom(_message, registry ?? ExtensionRegistry.Empty);
+
+ IDeserializationCallback callback = builder as IDeserializationCallback;
+ if(callback != null)
+ {
+ callback.OnDeserialization(context);
+ }
+
+ return builder;
+ }
+
+ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue("message", _message);
+ }
+ }
+ }
+
+ /*
+ * Spread some attribute love around, keeping this all here so we don't use conditional compliation
+ * in every one of these classes. If we introduce a new platform that also does not support this
+ * we can control it all from this source file.
+ */
+
+ [Serializable]
+ partial class GeneratedMessageLite<TMessage, TBuilder> { }
+
+ [Serializable]
+ partial class ExtendableMessageLite<TMessage, TBuilder> { }
+
+ [Serializable]
+ partial class AbstractMessage<TMessage, TBuilder> { }
+
+ [Serializable]
+ partial class GeneratedMessage<TMessage, TBuilder> { }
+
+ [Serializable]
+ partial class ExtendableMessage<TMessage, TBuilder> { }
+
+ [Serializable]
+ partial class GeneratedBuilderLite<TMessage, TBuilder> { }
+
+ [Serializable]
+ partial class ExtendableBuilderLite<TMessage, TBuilder> { }
+
+ [Serializable]
+ partial class AbstractBuilder<TMessage, TBuilder> { }
+
+ [Serializable]
+ partial class GeneratedBuilder<TMessage, TBuilder> { }
+
+ [Serializable]
+ partial class ExtendableBuilder<TMessage, TBuilder> { }
+
+ [Serializable]
+ partial class DynamicMessage
+ {
+ [Serializable]
+ partial class Builder { }
+ }
+}
+#endif
\ No newline at end of file diff --git a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs index 853b0e7d..4eb9c05d 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;
@@ -52,36 +52,37 @@ namespace Google.ProtocolBuffers.DescriptorProtos { byte[] descriptorData = global::System.Convert.FromBase64String(
"CiRnb29nbGUvcHJvdG9idWYvY3NoYXJwX29wdGlvbnMucHJvdG8SD2dvb2ds" +
"ZS5wcm90b2J1ZhogZ29vZ2xlL3Byb3RvYnVmL2Rlc2NyaXB0b3IucHJvdG8i" +
- "tgMKEUNTaGFycEZpbGVPcHRpb25zEhEKCW5hbWVzcGFjZRgBIAEoCRIaChJ1" +
+ "1wMKEUNTaGFycEZpbGVPcHRpb25zEhEKCW5hbWVzcGFjZRgBIAEoCRIaChJ1" +
"bWJyZWxsYV9jbGFzc25hbWUYAiABKAkSHAoOcHVibGljX2NsYXNzZXMYAyAB" +
"KAg6BHRydWUSFgoObXVsdGlwbGVfZmlsZXMYBCABKAgSFAoMbmVzdF9jbGFz" +
"c2VzGAUgASgIEhYKDmNvZGVfY29udHJhY3RzGAYgASgIEiQKHGV4cGFuZF9u" +
"YW1lc3BhY2VfZGlyZWN0b3JpZXMYByABKAgSHAoOY2xzX2NvbXBsaWFuY2UY" +
- "CCABKAg6BHRydWUSHAoOZmlsZV9leHRlbnNpb24Y3QEgASgJOgMuY3MSGwoS" +
- "dW1icmVsbGFfbmFtZXNwYWNlGN4BIAEoCRIcChBvdXRwdXRfZGlyZWN0b3J5" +
- "GN8BIAEoCToBLhImChZpZ25vcmVfZ29vZ2xlX3Byb3RvYnVmGOABIAEoCDoF" +
- "ZmFsc2USSQoWc2VydmljZV9nZW5lcmF0b3JfdHlwZRjhASABKA4yIi5nb29n" +
- "bGUucHJvdG9idWYuQ1NoYXJwU2VydmljZVR5cGU6BE5PTkUiKwoSQ1NoYXJw" +
- "RmllbGRPcHRpb25zEhUKDXByb3BlcnR5X25hbWUYASABKAkiLAoUQ1NoYXJw" +
- "U2VydmljZU9wdGlvbnMSFAoMaW50ZXJmYWNlX2lkGAEgASgJIioKE0NTaGFy" +
- "cE1ldGhvZE9wdGlvbnMSEwoLZGlzcGF0Y2hfaWQYASABKAUqSwoRQ1NoYXJw" +
- "U2VydmljZVR5cGUSCAoETk9ORRAAEgsKB0dFTkVSSUMQARINCglJTlRFUkZB" +
- "Q0UQAhIQCgxJUlBDRElTUEFUQ0gQAzpeChNjc2hhcnBfZmlsZV9vcHRpb25z" +
- "EhwuZ29vZ2xlLnByb3RvYnVmLkZpbGVPcHRpb25zGOgHIAEoCzIiLmdvb2ds" +
- "ZS5wcm90b2J1Zi5DU2hhcnBGaWxlT3B0aW9uczphChRjc2hhcnBfZmllbGRf" +
- "b3B0aW9ucxIdLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE9wdGlvbnMY6AcgASgL" +
- "MiMuZ29vZ2xlLnByb3RvYnVmLkNTaGFycEZpZWxkT3B0aW9uczpnChZjc2hh" +
- "cnBfc2VydmljZV9vcHRpb25zEh8uZ29vZ2xlLnByb3RvYnVmLlNlcnZpY2VP" +
- "cHRpb25zGOgHIAEoCzIlLmdvb2dsZS5wcm90b2J1Zi5DU2hhcnBTZXJ2aWNl" +
- "T3B0aW9uczpkChVjc2hhcnBfbWV0aG9kX29wdGlvbnMSHi5nb29nbGUucHJv" +
- "dG9idWYuTWV0aG9kT3B0aW9ucxjoByABKAsyJC5nb29nbGUucHJvdG9idWYu" +
- "Q1NoYXJwTWV0aG9kT3B0aW9ucw==");
+ "CCABKAg6BHRydWUSHwoQYWRkX3NlcmlhbGl6YWJsZRgJIAEoCDoFZmFsc2US" +
+ "HAoOZmlsZV9leHRlbnNpb24Y3QEgASgJOgMuY3MSGwoSdW1icmVsbGFfbmFt" +
+ "ZXNwYWNlGN4BIAEoCRIcChBvdXRwdXRfZGlyZWN0b3J5GN8BIAEoCToBLhIm" +
+ "ChZpZ25vcmVfZ29vZ2xlX3Byb3RvYnVmGOABIAEoCDoFZmFsc2USSQoWc2Vy" +
+ "dmljZV9nZW5lcmF0b3JfdHlwZRjhASABKA4yIi5nb29nbGUucHJvdG9idWYu" +
+ "Q1NoYXJwU2VydmljZVR5cGU6BE5PTkUiKwoSQ1NoYXJwRmllbGRPcHRpb25z" +
+ "EhUKDXByb3BlcnR5X25hbWUYASABKAkiLAoUQ1NoYXJwU2VydmljZU9wdGlv" +
+ "bnMSFAoMaW50ZXJmYWNlX2lkGAEgASgJIioKE0NTaGFycE1ldGhvZE9wdGlv" +
+ "bnMSEwoLZGlzcGF0Y2hfaWQYASABKAUqSwoRQ1NoYXJwU2VydmljZVR5cGUS" +
+ "CAoETk9ORRAAEgsKB0dFTkVSSUMQARINCglJTlRFUkZBQ0UQAhIQCgxJUlBD" +
+ "RElTUEFUQ0gQAzpeChNjc2hhcnBfZmlsZV9vcHRpb25zEhwuZ29vZ2xlLnBy" +
+ "b3RvYnVmLkZpbGVPcHRpb25zGOgHIAEoCzIiLmdvb2dsZS5wcm90b2J1Zi5D" +
+ "U2hhcnBGaWxlT3B0aW9uczphChRjc2hhcnBfZmllbGRfb3B0aW9ucxIdLmdv" +
+ "b2dsZS5wcm90b2J1Zi5GaWVsZE9wdGlvbnMY6AcgASgLMiMuZ29vZ2xlLnBy" +
+ "b3RvYnVmLkNTaGFycEZpZWxkT3B0aW9uczpnChZjc2hhcnBfc2VydmljZV9v" +
+ "cHRpb25zEh8uZ29vZ2xlLnByb3RvYnVmLlNlcnZpY2VPcHRpb25zGOgHIAEo" +
+ "CzIlLmdvb2dsZS5wcm90b2J1Zi5DU2hhcnBTZXJ2aWNlT3B0aW9uczpkChVj" +
+ "c2hhcnBfbWV0aG9kX29wdGlvbnMSHi5nb29nbGUucHJvdG9idWYuTWV0aG9k" +
+ "T3B0aW9ucxjoByABKAsyJC5nb29nbGUucHJvdG9idWYuQ1NoYXJwTWV0aG9k" +
+ "T3B0aW9ucw==");
pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
descriptor = root;
internal__static_google_protobuf_CSharpFileOptions__Descriptor = Descriptor.MessageTypes[0];
internal__static_google_protobuf_CSharpFileOptions__FieldAccessorTable =
new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.DescriptorProtos.CSharpFileOptions, global::Google.ProtocolBuffers.DescriptorProtos.CSharpFileOptions.Builder>(internal__static_google_protobuf_CSharpFileOptions__Descriptor,
- new string[] { "Namespace", "UmbrellaClassname", "PublicClasses", "MultipleFiles", "NestClasses", "CodeContracts", "ExpandNamespaceDirectories", "ClsCompliance", "FileExtension", "UmbrellaNamespace", "OutputDirectory", "IgnoreGoogleProtobuf", "ServiceGeneratorType", });
+ new string[] { "Namespace", "UmbrellaClassname", "PublicClasses", "MultipleFiles", "NestClasses", "CodeContracts", "ExpandNamespaceDirectories", "ClsCompliance", "AddSerializable", "FileExtension", "UmbrellaNamespace", "OutputDirectory", "IgnoreGoogleProtobuf", "ServiceGeneratorType", });
internal__static_google_protobuf_CSharpFieldOptions__Descriptor = Descriptor.MessageTypes[1];
internal__static_google_protobuf_CSharpFieldOptions__FieldAccessorTable =
new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.DescriptorProtos.CSharpFieldOptions, global::Google.ProtocolBuffers.DescriptorProtos.CSharpFieldOptions.Builder>(internal__static_google_protobuf_CSharpFieldOptions__Descriptor,
@@ -125,15 +126,16 @@ 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<CSharpFileOptions, CSharpFileOptions.Builder> {
- 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" };
- private static readonly uint[] _cSharpFileOptionsFieldTags = new uint[] { 64, 48, 56, 1770, 1792, 32, 10, 40, 1786, 24, 1800, 18, 1778 };
+ private CSharpFileOptions() { }
+ private static readonly CSharpFileOptions defaultInstance = new CSharpFileOptions().MakeReadOnly();
+ 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 };
public static CSharpFileOptions DefaultInstance {
get { return defaultInstance; }
}
public override CSharpFileOptions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override CSharpFileOptions ThisMessage {
@@ -228,6 +230,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos { get { return clsCompliance_; }
}
+ public const int AddSerializableFieldNumber = 9;
+ private bool hasAddSerializable;
+ private bool addSerializable_;
+ public bool HasAddSerializable {
+ get { return hasAddSerializable; }
+ }
+ public bool AddSerializable {
+ get { return addSerializable_; }
+ }
+
public const int FileExtensionFieldNumber = 221;
private bool hasFileExtension;
private string fileExtension_ = ".cs";
@@ -288,43 +300,46 @@ namespace Google.ProtocolBuffers.DescriptorProtos { int size = SerializedSize;
string[] field_names = _cSharpFileOptionsFieldNames;
if (hasNamespace) {
- output.WriteString(1, field_names[6], Namespace);
+ output.WriteString(1, field_names[7], Namespace);
}
if (hasUmbrellaClassname) {
- output.WriteString(2, field_names[11], UmbrellaClassname);
+ output.WriteString(2, field_names[12], UmbrellaClassname);
}
if (hasPublicClasses) {
- output.WriteBool(3, field_names[9], PublicClasses);
+ output.WriteBool(3, field_names[10], PublicClasses);
}
if (hasMultipleFiles) {
- output.WriteBool(4, field_names[5], MultipleFiles);
+ output.WriteBool(4, field_names[6], MultipleFiles);
}
if (hasNestClasses) {
- output.WriteBool(5, field_names[7], NestClasses);
+ output.WriteBool(5, field_names[8], NestClasses);
}
if (hasCodeContracts) {
- output.WriteBool(6, field_names[1], CodeContracts);
+ output.WriteBool(6, field_names[2], CodeContracts);
}
if (hasExpandNamespaceDirectories) {
- output.WriteBool(7, field_names[2], ExpandNamespaceDirectories);
+ output.WriteBool(7, field_names[3], ExpandNamespaceDirectories);
}
if (hasClsCompliance) {
- output.WriteBool(8, field_names[0], ClsCompliance);
+ output.WriteBool(8, field_names[1], ClsCompliance);
+ }
+ if (hasAddSerializable) {
+ output.WriteBool(9, field_names[0], AddSerializable);
}
if (hasFileExtension) {
- output.WriteString(221, field_names[3], FileExtension);
+ output.WriteString(221, field_names[4], FileExtension);
}
if (hasUmbrellaNamespace) {
- output.WriteString(222, field_names[12], UmbrellaNamespace);
+ output.WriteString(222, field_names[13], UmbrellaNamespace);
}
if (hasOutputDirectory) {
- output.WriteString(223, field_names[8], OutputDirectory);
+ output.WriteString(223, field_names[9], OutputDirectory);
}
if (hasIgnoreGoogleProtobuf) {
- output.WriteBool(224, field_names[4], IgnoreGoogleProtobuf);
+ output.WriteBool(224, field_names[5], IgnoreGoogleProtobuf);
}
if (hasServiceGeneratorType) {
- output.WriteEnum(225, field_names[10], (int) ServiceGeneratorType, ServiceGeneratorType);
+ output.WriteEnum(225, field_names[11], (int) ServiceGeneratorType, ServiceGeneratorType);
}
UnknownFields.WriteTo(output);
}
@@ -360,6 +375,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos { if (hasClsCompliance) {
size += pb::CodedOutputStream.ComputeBoolSize(8, ClsCompliance);
}
+ if (hasAddSerializable) {
+ size += pb::CodedOutputStream.ComputeBoolSize(9, AddSerializable);
+ }
if (hasFileExtension) {
size += pb::CodedOutputStream.ComputeStringSize(221, FileExtension);
}
@@ -411,11 +429,15 @@ 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(); }
public static Builder CreateBuilder(CSharpFileOptions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -425,21 +447,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(CSharpFileOptions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private CSharpFileOptions result;
+
+ private CSharpFileOptions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ CSharpFileOptions original = result;
+ result = new CSharpFileOptions();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- CSharpFileOptions result = new CSharpFileOptions();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -451,12 +500,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 (resultIsReadOnly) {
+ return result;
}
- CSharpFileOptions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -470,6 +518,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;
}
@@ -494,6 +543,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos { if (other.HasClsCompliance) {
ClsCompliance = other.ClsCompliance;
}
+ if (other.HasAddSerializable) {
+ AddSerializable = other.AddSerializable;
+ }
if (other.HasFileExtension) {
FileExtension = other.FileExtension;
}
@@ -518,6 +570,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;
@@ -583,6 +636,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos { result.hasClsCompliance = input.ReadBool(ref result.clsCompliance_);
break;
}
+ case 72: {
+ result.hasAddSerializable = input.ReadBool(ref result.addSerializable_);
+ break;
+ }
case 1770: {
result.hasFileExtension = input.ReadString(ref result.fileExtension_);
break;
@@ -630,11 +687,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 +708,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 +728,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 +748,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 +768,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 +788,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 +808,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,16 +828,38 @@ 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;
}
+ public bool HasAddSerializable {
+ get { return result.hasAddSerializable; }
+ }
+ public bool AddSerializable {
+ get { return result.AddSerializable; }
+ set { SetAddSerializable(value); }
+ }
+ public Builder SetAddSerializable(bool value) {
+ PrepareBuilder();
+ result.hasAddSerializable = true;
+ result.addSerializable_ = value;
+ return this;
+ }
+ public Builder ClearAddSerializable() {
+ PrepareBuilder();
+ result.hasAddSerializable = false;
+ result.addSerializable_ = false;
+ return this;
+ }
+
public bool HasFileExtension {
get { return result.hasFileExtension; }
}
@@ -776,11 +869,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 +890,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 +911,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 +931,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 +951,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;
@@ -869,7 +972,8 @@ 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<CSharpFieldOptions, CSharpFieldOptions.Builder> {
- private static readonly CSharpFieldOptions defaultInstance = new Builder().BuildPartial();
+ private CSharpFieldOptions() { }
+ 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 {
@@ -877,7 +981,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override CSharpFieldOptions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override CSharpFieldOptions ThisMessage {
@@ -963,11 +1067,15 @@ 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(); }
public static Builder CreateBuilder(CSharpFieldOptions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -977,21 +1085,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(CSharpFieldOptions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- CSharpFieldOptions result = new CSharpFieldOptions();
+ private bool resultIsReadOnly;
+ private CSharpFieldOptions result;
+
+ private CSharpFieldOptions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ CSharpFieldOptions original = result;
+ result = new CSharpFieldOptions();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1003,12 +1138,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 (resultIsReadOnly) {
+ return result;
}
- CSharpFieldOptions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1022,6 +1156,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 +1169,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 +1226,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;
@@ -1109,7 +1247,8 @@ 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<CSharpServiceOptions, CSharpServiceOptions.Builder> {
- private static readonly CSharpServiceOptions defaultInstance = new Builder().BuildPartial();
+ private CSharpServiceOptions() { }
+ 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 {
@@ -1117,7 +1256,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override CSharpServiceOptions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override CSharpServiceOptions ThisMessage {
@@ -1203,11 +1342,15 @@ 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(); }
public static Builder CreateBuilder(CSharpServiceOptions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1217,21 +1360,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(CSharpServiceOptions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- CSharpServiceOptions result = new CSharpServiceOptions();
+ private bool resultIsReadOnly;
+ private CSharpServiceOptions result;
+
+ private CSharpServiceOptions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ CSharpServiceOptions original = result;
+ result = new CSharpServiceOptions();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1243,12 +1413,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 (resultIsReadOnly) {
+ return result;
}
- CSharpServiceOptions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1262,6 +1431,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 +1444,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 +1501,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;
@@ -1349,7 +1522,8 @@ 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<CSharpMethodOptions, CSharpMethodOptions.Builder> {
- private static readonly CSharpMethodOptions defaultInstance = new Builder().BuildPartial();
+ private CSharpMethodOptions() { }
+ 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 {
@@ -1357,7 +1531,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override CSharpMethodOptions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override CSharpMethodOptions ThisMessage {
@@ -1443,11 +1617,15 @@ 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(); }
public static Builder CreateBuilder(CSharpMethodOptions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1457,21 +1635,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(CSharpMethodOptions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- CSharpMethodOptions result = new CSharpMethodOptions();
+ private bool resultIsReadOnly;
+ private CSharpMethodOptions result;
+
+ private CSharpMethodOptions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ CSharpMethodOptions original = result;
+ result = new CSharpMethodOptions();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1483,12 +1688,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 (resultIsReadOnly) {
+ return result;
}
- CSharpMethodOptions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1502,6 +1706,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 +1719,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 +1775,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 5b48cde1..01048ed3 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;
@@ -233,7 +233,8 @@ 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<FileDescriptorSet, FileDescriptorSet.Builder> {
- private static readonly FileDescriptorSet defaultInstance = new Builder().BuildPartial();
+ private FileDescriptorSet() { }
+ 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 +242,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override FileDescriptorSet DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override FileDescriptorSet ThisMessage {
@@ -332,11 +333,16 @@ 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(); }
public static Builder CreateBuilder(FileDescriptorSet prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -346,21 +352,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(FileDescriptorSet cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private FileDescriptorSet result;
+
+ private FileDescriptorSet PrepareBuilder() {
+ if (resultIsReadOnly) {
+ FileDescriptorSet original = result;
+ result = new FileDescriptorSet();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- FileDescriptorSet result = new FileDescriptorSet();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -372,13 +405,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.file_.MakeReadOnly();
- FileDescriptorSet returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -392,8 +423,9 @@ 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_);
+ result.file_.Add(other.file_);
}
this.MergeUnknownFields(other.UnknownFields);
return this;
@@ -404,6 +436,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 +485,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public pbc::IPopsicleList<global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto> FileList {
- get { return result.file_; }
+ get { return PrepareBuilder().file_; }
}
public int FileCount {
get { return result.FileCount; }
@@ -462,29 +495,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<global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto> values) {
- base.AddRange(values, result.file_);
+ PrepareBuilder();
+ result.file_.Add(values);
return this;
}
public Builder ClearFile() {
+ PrepareBuilder();
result.file_.Clear();
return this;
}
@@ -498,7 +537,8 @@ 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<FileDescriptorProto, FileDescriptorProto.Builder> {
- private static readonly FileDescriptorProto defaultInstance = new Builder().BuildPartial();
+ private FileDescriptorProto() { }
+ 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 {
@@ -506,7 +546,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override FileDescriptorProto DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override FileDescriptorProto ThisMessage {
@@ -603,12 +643,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 {
@@ -734,11 +774,20 @@ 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(); }
public static Builder CreateBuilder(FileDescriptorProto prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -748,21 +797,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(FileDescriptorProto cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private FileDescriptorProto result;
+
+ private FileDescriptorProto PrepareBuilder() {
+ if (resultIsReadOnly) {
+ FileDescriptorProto original = result;
+ result = new FileDescriptorProto();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- FileDescriptorProto result = new FileDescriptorProto();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -774,17 +850,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.dependency_.MakeReadOnly();
- result.messageType_.MakeReadOnly();
- result.enumType_.MakeReadOnly();
- result.service_.MakeReadOnly();
- result.extension_.MakeReadOnly();
- FileDescriptorProto returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -798,6 +868,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;
}
@@ -805,19 +876,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);
@@ -831,6 +902,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 +992,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 +1013,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<string> DependencyList {
- get { return result.dependency_; }
+ get { return PrepareBuilder().dependency_; }
}
public int DependencyCount {
get { return result.DependencyCount; }
@@ -960,25 +1036,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<string> values) {
- base.AddRange(values, result.dependency_);
+ PrepareBuilder();
+ result.dependency_.Add(values);
return this;
}
public Builder ClearDependency() {
+ PrepareBuilder();
result.dependency_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto> MessageTypeList {
- get { return result.messageType_; }
+ get { return PrepareBuilder().messageType_; }
}
public int MessageTypeCount {
get { return result.MessageTypeCount; }
@@ -988,35 +1068,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<global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto> values) {
- base.AddRange(values, result.messageType_);
+ PrepareBuilder();
+ result.messageType_.Add(values);
return this;
}
public Builder ClearMessageType() {
+ PrepareBuilder();
result.messageType_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto> EnumTypeList {
- get { return result.enumType_; }
+ get { return PrepareBuilder().enumType_; }
}
public int EnumTypeCount {
get { return result.EnumTypeCount; }
@@ -1026,35 +1112,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<global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto> values) {
- base.AddRange(values, result.enumType_);
+ PrepareBuilder();
+ result.enumType_.Add(values);
return this;
}
public Builder ClearEnumType() {
+ PrepareBuilder();
result.enumType_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto> ServiceList {
- get { return result.service_; }
+ get { return PrepareBuilder().service_; }
}
public int ServiceCount {
get { return result.ServiceCount; }
@@ -1064,35 +1156,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<global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto> values) {
- base.AddRange(values, result.service_);
+ PrepareBuilder();
+ result.service_.Add(values);
return this;
}
public Builder ClearService() {
+ PrepareBuilder();
result.service_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto> ExtensionList {
- get { return result.extension_; }
+ get { return PrepareBuilder().extension_; }
}
public int ExtensionCount {
get { return result.ExtensionCount; }
@@ -1102,29 +1200,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<global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto> values) {
- base.AddRange(values, result.extension_);
+ PrepareBuilder();
+ result.extension_.Add(values);
return this;
}
public Builder ClearExtension() {
+ PrepareBuilder();
result.extension_.Clear();
return this;
}
@@ -1138,18 +1242,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,8 +1267,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this;
}
public Builder ClearOptions() {
+ PrepareBuilder();
result.hasOptions = false;
- result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.DefaultInstance;
+ result.options_ = null;
return this;
}
}
@@ -1174,7 +1282,8 @@ 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<DescriptorProto, DescriptorProto.Builder> {
- private static readonly DescriptorProto defaultInstance = new Builder().BuildPartial();
+ private DescriptorProto() { }
+ 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 {
@@ -1182,7 +1291,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override DescriptorProto DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override DescriptorProto ThisMessage {
@@ -1206,7 +1315,8 @@ 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<ExtensionRange, ExtensionRange.Builder> {
- private static readonly ExtensionRange defaultInstance = new Builder().BuildPartial();
+ private ExtensionRange() { }
+ 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 {
@@ -1214,7 +1324,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override ExtensionRange DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override ExtensionRange ThisMessage {
@@ -1316,11 +1426,15 @@ 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(); }
public static Builder CreateBuilder(ExtensionRange prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1330,21 +1444,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(ExtensionRange cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private ExtensionRange result;
+
+ private ExtensionRange PrepareBuilder() {
+ if (resultIsReadOnly) {
+ ExtensionRange original = result;
+ result = new ExtensionRange();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- ExtensionRange result = new ExtensionRange();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1356,12 +1497,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 (resultIsReadOnly) {
+ return result;
}
- ExtensionRange returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1375,6 +1515,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 +1531,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 +1591,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 +1611,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;
@@ -1557,12 +1703,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 {
@@ -1677,11 +1823,20 @@ 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(); }
public static Builder CreateBuilder(DescriptorProto prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1691,21 +1846,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(DescriptorProto cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- DescriptorProto result = new DescriptorProto();
+ private bool resultIsReadOnly;
+ private DescriptorProto result;
+
+ private DescriptorProto PrepareBuilder() {
+ if (resultIsReadOnly) {
+ DescriptorProto original = result;
+ result = new DescriptorProto();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1717,17 +1899,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.field_.MakeReadOnly();
- result.extension_.MakeReadOnly();
- result.nestedType_.MakeReadOnly();
- result.enumType_.MakeReadOnly();
- result.extensionRange_.MakeReadOnly();
- DescriptorProto returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1741,23 +1917,24 @@ 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;
}
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);
@@ -1771,6 +1948,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 +2034,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<global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto> FieldList {
- get { return result.field_; }
+ get { return PrepareBuilder().field_; }
}
public int FieldCount {
get { return result.FieldCount; }
@@ -1877,35 +2057,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<global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto> values) {
- base.AddRange(values, result.field_);
+ PrepareBuilder();
+ result.field_.Add(values);
return this;
}
public Builder ClearField() {
+ PrepareBuilder();
result.field_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto> ExtensionList {
- get { return result.extension_; }
+ get { return PrepareBuilder().extension_; }
}
public int ExtensionCount {
get { return result.ExtensionCount; }
@@ -1915,35 +2101,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<global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto> values) {
- base.AddRange(values, result.extension_);
+ PrepareBuilder();
+ result.extension_.Add(values);
return this;
}
public Builder ClearExtension() {
+ PrepareBuilder();
result.extension_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto> NestedTypeList {
- get { return result.nestedType_; }
+ get { return PrepareBuilder().nestedType_; }
}
public int NestedTypeCount {
get { return result.NestedTypeCount; }
@@ -1953,35 +2145,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<global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto> values) {
- base.AddRange(values, result.nestedType_);
+ PrepareBuilder();
+ result.nestedType_.Add(values);
return this;
}
public Builder ClearNestedType() {
+ PrepareBuilder();
result.nestedType_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto> EnumTypeList {
- get { return result.enumType_; }
+ get { return PrepareBuilder().enumType_; }
}
public int EnumTypeCount {
get { return result.EnumTypeCount; }
@@ -1991,35 +2189,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<global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto> values) {
- base.AddRange(values, result.enumType_);
+ PrepareBuilder();
+ result.enumType_.Add(values);
return this;
}
public Builder ClearEnumType() {
+ PrepareBuilder();
result.enumType_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange> ExtensionRangeList {
- get { return result.extensionRange_; }
+ get { return PrepareBuilder().extensionRange_; }
}
public int ExtensionRangeCount {
get { return result.ExtensionRangeCount; }
@@ -2029,29 +2233,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<global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange> values) {
- base.AddRange(values, result.extensionRange_);
+ PrepareBuilder();
+ result.extensionRange_.Add(values);
return this;
}
public Builder ClearExtensionRange() {
+ PrepareBuilder();
result.extensionRange_.Clear();
return this;
}
@@ -2065,18 +2275,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,8 +2300,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this;
}
public Builder ClearOptions() {
+ PrepareBuilder();
result.hasOptions = false;
- result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.DefaultInstance;
+ result.options_ = null;
return this;
}
}
@@ -2101,7 +2315,8 @@ 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<FieldDescriptorProto, FieldDescriptorProto.Builder> {
- private static readonly FieldDescriptorProto defaultInstance = new Builder().BuildPartial();
+ private FieldDescriptorProto() { }
+ 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 {
@@ -2109,7 +2324,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override FieldDescriptorProto DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override FieldDescriptorProto ThisMessage {
@@ -2235,12 +2450,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 {
@@ -2349,11 +2564,15 @@ 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(); }
public static Builder CreateBuilder(FieldDescriptorProto prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -2363,21 +2582,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(FieldDescriptorProto cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- FieldDescriptorProto result = new FieldDescriptorProto();
+ private bool resultIsReadOnly;
+ private FieldDescriptorProto result;
+
+ private FieldDescriptorProto PrepareBuilder() {
+ if (resultIsReadOnly) {
+ FieldDescriptorProto original = result;
+ result = new FieldDescriptorProto();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -2389,12 +2635,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 (resultIsReadOnly) {
+ return result;
}
- FieldDescriptorProto returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -2408,6 +2653,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 +2687,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 +2793,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 +2813,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 +2833,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 +2853,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 +2874,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 +2895,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 +2916,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 +2937,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,8 +2962,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this;
}
public Builder ClearOptions() {
+ PrepareBuilder();
result.hasOptions = false;
- result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.DefaultInstance;
+ result.options_ = null;
return this;
}
}
@@ -2712,7 +2977,8 @@ 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<EnumDescriptorProto, EnumDescriptorProto.Builder> {
- private static readonly EnumDescriptorProto defaultInstance = new Builder().BuildPartial();
+ private EnumDescriptorProto() { }
+ 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 {
@@ -2720,7 +2986,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override EnumDescriptorProto DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override EnumDescriptorProto ThisMessage {
@@ -2759,12 +3025,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 {
@@ -2846,11 +3112,16 @@ 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(); }
public static Builder CreateBuilder(EnumDescriptorProto prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -2860,21 +3131,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(EnumDescriptorProto cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- EnumDescriptorProto result = new EnumDescriptorProto();
+ private bool resultIsReadOnly;
+ private EnumDescriptorProto result;
+
+ private EnumDescriptorProto PrepareBuilder() {
+ if (resultIsReadOnly) {
+ EnumDescriptorProto original = result;
+ result = new EnumDescriptorProto();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -2886,13 +3184,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.value_.MakeReadOnly();
- EnumDescriptorProto returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -2906,11 +3202,12 @@ 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;
}
if (other.value_.Count != 0) {
- base.AddRange(other.value_, result.value_);
+ result.value_.Add(other.value_);
}
if (other.HasOptions) {
MergeOptions(other.Options);
@@ -2924,6 +3221,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 +3291,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<global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto> ValueList {
- get { return result.value_; }
+ get { return PrepareBuilder().value_; }
}
public int ValueCount {
get { return result.ValueCount; }
@@ -3014,29 +3314,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<global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto> values) {
- base.AddRange(values, result.value_);
+ PrepareBuilder();
+ result.value_.Add(values);
return this;
}
public Builder ClearValue() {
+ PrepareBuilder();
result.value_.Clear();
return this;
}
@@ -3050,18 +3356,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,8 +3381,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this;
}
public Builder ClearOptions() {
+ PrepareBuilder();
result.hasOptions = false;
- result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.DefaultInstance;
+ result.options_ = null;
return this;
}
}
@@ -3086,7 +3396,8 @@ 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<EnumValueDescriptorProto, EnumValueDescriptorProto.Builder> {
- private static readonly EnumValueDescriptorProto defaultInstance = new Builder().BuildPartial();
+ private EnumValueDescriptorProto() { }
+ 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 {
@@ -3094,7 +3405,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override EnumValueDescriptorProto DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override EnumValueDescriptorProto ThisMessage {
@@ -3131,12 +3442,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 {
@@ -3215,11 +3526,15 @@ 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(); }
public static Builder CreateBuilder(EnumValueDescriptorProto prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -3229,21 +3544,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(EnumValueDescriptorProto cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private EnumValueDescriptorProto result;
+
+ private EnumValueDescriptorProto PrepareBuilder() {
+ if (resultIsReadOnly) {
+ EnumValueDescriptorProto original = result;
+ result = new EnumValueDescriptorProto();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- EnumValueDescriptorProto result = new EnumValueDescriptorProto();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -3255,12 +3597,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 (resultIsReadOnly) {
+ return result;
}
- EnumValueDescriptorProto returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -3274,6 +3615,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 +3634,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 +3704,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 +3724,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 +3745,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,8 +3770,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this;
}
public Builder ClearOptions() {
+ PrepareBuilder();
result.hasOptions = false;
- result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.DefaultInstance;
+ result.options_ = null;
return this;
}
}
@@ -3434,7 +3785,8 @@ 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<ServiceDescriptorProto, ServiceDescriptorProto.Builder> {
- private static readonly ServiceDescriptorProto defaultInstance = new Builder().BuildPartial();
+ private ServiceDescriptorProto() { }
+ 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 {
@@ -3442,7 +3794,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override ServiceDescriptorProto DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override ServiceDescriptorProto ThisMessage {
@@ -3481,12 +3833,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 {
@@ -3568,11 +3920,16 @@ 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(); }
public static Builder CreateBuilder(ServiceDescriptorProto prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -3582,21 +3939,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(ServiceDescriptorProto cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private ServiceDescriptorProto result;
- ServiceDescriptorProto result = new ServiceDescriptorProto();
+ private ServiceDescriptorProto PrepareBuilder() {
+ if (resultIsReadOnly) {
+ ServiceDescriptorProto original = result;
+ result = new ServiceDescriptorProto();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -3608,13 +3992,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.method_.MakeReadOnly();
- ServiceDescriptorProto returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -3628,11 +4010,12 @@ 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;
}
if (other.method_.Count != 0) {
- base.AddRange(other.method_, result.method_);
+ result.method_.Add(other.method_);
}
if (other.HasOptions) {
MergeOptions(other.Options);
@@ -3646,6 +4029,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 +4099,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<global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto> MethodList {
- get { return result.method_; }
+ get { return PrepareBuilder().method_; }
}
public int MethodCount {
get { return result.MethodCount; }
@@ -3736,29 +4122,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<global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto> values) {
- base.AddRange(values, result.method_);
+ PrepareBuilder();
+ result.method_.Add(values);
return this;
}
public Builder ClearMethod() {
+ PrepareBuilder();
result.method_.Clear();
return this;
}
@@ -3772,18 +4164,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,8 +4189,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this;
}
public Builder ClearOptions() {
+ PrepareBuilder();
result.hasOptions = false;
- result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.DefaultInstance;
+ result.options_ = null;
return this;
}
}
@@ -3808,7 +4204,8 @@ 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<MethodDescriptorProto, MethodDescriptorProto.Builder> {
- private static readonly MethodDescriptorProto defaultInstance = new Builder().BuildPartial();
+ private MethodDescriptorProto() { }
+ 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 {
@@ -3816,7 +4213,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override MethodDescriptorProto DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override MethodDescriptorProto ThisMessage {
@@ -3863,12 +4260,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 {
@@ -3953,11 +4350,15 @@ 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(); }
public static Builder CreateBuilder(MethodDescriptorProto prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -3967,21 +4368,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(MethodDescriptorProto cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- MethodDescriptorProto result = new MethodDescriptorProto();
+ private bool resultIsReadOnly;
+ private MethodDescriptorProto result;
+
+ private MethodDescriptorProto PrepareBuilder() {
+ if (resultIsReadOnly) {
+ MethodDescriptorProto original = result;
+ result = new MethodDescriptorProto();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -3993,12 +4421,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 (resultIsReadOnly) {
+ return result;
}
- MethodDescriptorProto returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -4012,6 +4439,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 +4461,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 +4535,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 +4556,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 +4577,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 +4598,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,8 +4623,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos { return this;
}
public Builder ClearOptions() {
+ PrepareBuilder();
result.hasOptions = false;
- result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.DefaultInstance;
+ result.options_ = null;
return this;
}
}
@@ -4199,7 +4638,8 @@ 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<FileOptions, FileOptions.Builder> {
- private static readonly FileOptions defaultInstance = new Builder().BuildPartial();
+ private FileOptions() { }
+ 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 {
@@ -4207,7 +4647,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override FileOptions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override FileOptions ThisMessage {
@@ -4430,11 +4870,16 @@ 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(); }
public static Builder CreateBuilder(FileOptions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -4444,21 +4889,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(FileOptions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private FileOptions result;
+
+ private FileOptions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ FileOptions original = result;
+ result = new FileOptions();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- FileOptions result = new FileOptions();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -4470,13 +4942,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.uninterpretedOption_.MakeReadOnly();
- FileOptions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -4490,6 +4960,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;
}
@@ -4512,7 +4983,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);
@@ -4524,6 +4995,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 +5088,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 +5109,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 +5129,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 +5149,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 +5169,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 +5189,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 +5209,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<global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption> UninterpretedOptionList {
- get { return result.uninterpretedOption_; }
+ get { return PrepareBuilder().uninterpretedOption_; }
}
public int UninterpretedOptionCount {
get { return result.UninterpretedOptionCount; }
@@ -4746,29 +5232,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<global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption> values) {
- base.AddRange(values, result.uninterpretedOption_);
+ PrepareBuilder();
+ result.uninterpretedOption_.Add(values);
return this;
}
public Builder ClearUninterpretedOption() {
+ PrepareBuilder();
result.uninterpretedOption_.Clear();
return this;
}
@@ -4782,7 +5274,8 @@ 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<MessageOptions, MessageOptions.Builder> {
- private static readonly MessageOptions defaultInstance = new Builder().BuildPartial();
+ private MessageOptions() { }
+ 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 {
@@ -4790,7 +5283,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override MessageOptions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override MessageOptions ThisMessage {
@@ -4917,11 +5410,16 @@ 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(); }
public static Builder CreateBuilder(MessageOptions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -4931,21 +5429,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(MessageOptions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private MessageOptions result;
+
+ private MessageOptions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ MessageOptions original = result;
+ result = new MessageOptions();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- MessageOptions result = new MessageOptions();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -4957,13 +5482,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.uninterpretedOption_.MakeReadOnly();
- MessageOptions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -4977,6 +5500,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;
}
@@ -4984,7 +5508,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);
@@ -4996,6 +5520,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 +5584,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 +5604,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<global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption> UninterpretedOptionList {
- get { return result.uninterpretedOption_; }
+ get { return PrepareBuilder().uninterpretedOption_; }
}
public int UninterpretedOptionCount {
get { return result.UninterpretedOptionCount; }
@@ -5098,29 +5627,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<global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption> values) {
- base.AddRange(values, result.uninterpretedOption_);
+ PrepareBuilder();
+ result.uninterpretedOption_.Add(values);
return this;
}
public Builder ClearUninterpretedOption() {
+ PrepareBuilder();
result.uninterpretedOption_.Clear();
return this;
}
@@ -5134,7 +5669,8 @@ 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<FieldOptions, FieldOptions.Builder> {
- private static readonly FieldOptions defaultInstance = new Builder().BuildPartial();
+ private FieldOptions() { }
+ 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 {
@@ -5142,7 +5678,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override FieldOptions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override FieldOptions ThisMessage {
@@ -5317,11 +5853,16 @@ 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(); }
public static Builder CreateBuilder(FieldOptions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -5331,21 +5872,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(FieldOptions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private FieldOptions result;
- FieldOptions result = new FieldOptions();
+ private FieldOptions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ FieldOptions original = result;
+ result = new FieldOptions();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -5357,13 +5925,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.uninterpretedOption_.MakeReadOnly();
- FieldOptions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -5377,6 +5943,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;
}
@@ -5390,7 +5957,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);
@@ -5402,6 +5969,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 +6049,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 +6069,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 +6089,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 +6110,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<global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption> UninterpretedOptionList {
- get { return result.uninterpretedOption_; }
+ get { return PrepareBuilder().uninterpretedOption_; }
}
public int UninterpretedOptionCount {
get { return result.UninterpretedOptionCount; }
@@ -5557,29 +6133,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<global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption> values) {
- base.AddRange(values, result.uninterpretedOption_);
+ PrepareBuilder();
+ result.uninterpretedOption_.Add(values);
return this;
}
public Builder ClearUninterpretedOption() {
+ PrepareBuilder();
result.uninterpretedOption_.Clear();
return this;
}
@@ -5593,7 +6175,8 @@ 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<EnumOptions, EnumOptions.Builder> {
- private static readonly EnumOptions defaultInstance = new Builder().BuildPartial();
+ private EnumOptions() { }
+ 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 {
@@ -5601,7 +6184,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override EnumOptions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override EnumOptions ThisMessage {
@@ -5696,11 +6279,16 @@ 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(); }
public static Builder CreateBuilder(EnumOptions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -5710,21 +6298,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(EnumOptions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- EnumOptions result = new EnumOptions();
+ private bool resultIsReadOnly;
+ private EnumOptions result;
+
+ private EnumOptions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ EnumOptions original = result;
+ result = new EnumOptions();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -5736,13 +6351,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.uninterpretedOption_.MakeReadOnly();
- EnumOptions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -5756,8 +6369,9 @@ 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_);
+ result.uninterpretedOption_.Add(other.uninterpretedOption_);
}
this.MergeExtensionFields(other);
this.MergeUnknownFields(other.UnknownFields);
@@ -5769,6 +6383,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 +6432,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public pbc::IPopsicleList<global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption> UninterpretedOptionList {
- get { return result.uninterpretedOption_; }
+ get { return PrepareBuilder().uninterpretedOption_; }
}
public int UninterpretedOptionCount {
get { return result.UninterpretedOptionCount; }
@@ -5827,29 +6442,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<global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption> values) {
- base.AddRange(values, result.uninterpretedOption_);
+ PrepareBuilder();
+ result.uninterpretedOption_.Add(values);
return this;
}
public Builder ClearUninterpretedOption() {
+ PrepareBuilder();
result.uninterpretedOption_.Clear();
return this;
}
@@ -5863,7 +6484,8 @@ 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<EnumValueOptions, EnumValueOptions.Builder> {
- private static readonly EnumValueOptions defaultInstance = new Builder().BuildPartial();
+ private EnumValueOptions() { }
+ 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 {
@@ -5871,7 +6493,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override EnumValueOptions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override EnumValueOptions ThisMessage {
@@ -5966,11 +6588,16 @@ 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(); }
public static Builder CreateBuilder(EnumValueOptions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -5980,21 +6607,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(EnumValueOptions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- EnumValueOptions result = new EnumValueOptions();
+ private bool resultIsReadOnly;
+ private EnumValueOptions result;
+
+ private EnumValueOptions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ EnumValueOptions original = result;
+ result = new EnumValueOptions();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -6006,13 +6660,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.uninterpretedOption_.MakeReadOnly();
- EnumValueOptions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -6026,8 +6678,9 @@ 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_);
+ result.uninterpretedOption_.Add(other.uninterpretedOption_);
}
this.MergeExtensionFields(other);
this.MergeUnknownFields(other.UnknownFields);
@@ -6039,6 +6692,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 +6741,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public pbc::IPopsicleList<global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption> UninterpretedOptionList {
- get { return result.uninterpretedOption_; }
+ get { return PrepareBuilder().uninterpretedOption_; }
}
public int UninterpretedOptionCount {
get { return result.UninterpretedOptionCount; }
@@ -6097,29 +6751,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<global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption> values) {
- base.AddRange(values, result.uninterpretedOption_);
+ PrepareBuilder();
+ result.uninterpretedOption_.Add(values);
return this;
}
public Builder ClearUninterpretedOption() {
+ PrepareBuilder();
result.uninterpretedOption_.Clear();
return this;
}
@@ -6133,7 +6793,8 @@ 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<ServiceOptions, ServiceOptions.Builder> {
- private static readonly ServiceOptions defaultInstance = new Builder().BuildPartial();
+ private ServiceOptions() { }
+ 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 {
@@ -6141,7 +6802,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override ServiceOptions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override ServiceOptions ThisMessage {
@@ -6236,11 +6897,16 @@ 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(); }
public static Builder CreateBuilder(ServiceOptions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -6250,21 +6916,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(ServiceOptions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- ServiceOptions result = new ServiceOptions();
+ private bool resultIsReadOnly;
+ private ServiceOptions result;
+
+ private ServiceOptions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ ServiceOptions original = result;
+ result = new ServiceOptions();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -6276,13 +6969,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.uninterpretedOption_.MakeReadOnly();
- ServiceOptions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -6296,8 +6987,9 @@ 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_);
+ result.uninterpretedOption_.Add(other.uninterpretedOption_);
}
this.MergeExtensionFields(other);
this.MergeUnknownFields(other.UnknownFields);
@@ -6309,6 +7001,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 +7050,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public pbc::IPopsicleList<global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption> UninterpretedOptionList {
- get { return result.uninterpretedOption_; }
+ get { return PrepareBuilder().uninterpretedOption_; }
}
public int UninterpretedOptionCount {
get { return result.UninterpretedOptionCount; }
@@ -6367,29 +7060,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<global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption> values) {
- base.AddRange(values, result.uninterpretedOption_);
+ PrepareBuilder();
+ result.uninterpretedOption_.Add(values);
return this;
}
public Builder ClearUninterpretedOption() {
+ PrepareBuilder();
result.uninterpretedOption_.Clear();
return this;
}
@@ -6403,7 +7102,8 @@ 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<MethodOptions, MethodOptions.Builder> {
- private static readonly MethodOptions defaultInstance = new Builder().BuildPartial();
+ private MethodOptions() { }
+ 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 {
@@ -6411,7 +7111,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override MethodOptions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override MethodOptions ThisMessage {
@@ -6506,11 +7206,16 @@ 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(); }
public static Builder CreateBuilder(MethodOptions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -6520,21 +7225,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(MethodOptions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private MethodOptions result;
+
+ private MethodOptions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ MethodOptions original = result;
+ result = new MethodOptions();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- MethodOptions result = new MethodOptions();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -6546,13 +7278,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.uninterpretedOption_.MakeReadOnly();
- MethodOptions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -6566,8 +7296,9 @@ 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_);
+ result.uninterpretedOption_.Add(other.uninterpretedOption_);
}
this.MergeExtensionFields(other);
this.MergeUnknownFields(other.UnknownFields);
@@ -6579,6 +7310,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 +7359,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public pbc::IPopsicleList<global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption> UninterpretedOptionList {
- get { return result.uninterpretedOption_; }
+ get { return PrepareBuilder().uninterpretedOption_; }
}
public int UninterpretedOptionCount {
get { return result.UninterpretedOptionCount; }
@@ -6637,29 +7369,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<global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption> values) {
- base.AddRange(values, result.uninterpretedOption_);
+ PrepareBuilder();
+ result.uninterpretedOption_.Add(values);
return this;
}
public Builder ClearUninterpretedOption() {
+ PrepareBuilder();
result.uninterpretedOption_.Clear();
return this;
}
@@ -6673,7 +7411,8 @@ 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<UninterpretedOption, UninterpretedOption.Builder> {
- private static readonly UninterpretedOption defaultInstance = new Builder().BuildPartial();
+ private UninterpretedOption() { }
+ 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 {
@@ -6681,7 +7420,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override UninterpretedOption DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override UninterpretedOption ThisMessage {
@@ -6705,7 +7444,8 @@ 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<NamePart, NamePart.Builder> {
- private static readonly NamePart defaultInstance = new Builder().BuildPartial();
+ private NamePart() { }
+ 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 {
@@ -6713,7 +7453,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { }
public override NamePart DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override NamePart ThisMessage {
@@ -6817,11 +7557,15 @@ 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(); }
public static Builder CreateBuilder(NamePart prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -6831,21 +7575,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(NamePart cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- NamePart result = new NamePart();
+ private bool resultIsReadOnly;
+ private NamePart result;
+
+ private NamePart PrepareBuilder() {
+ if (resultIsReadOnly) {
+ NamePart original = result;
+ result = new NamePart();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -6857,12 +7628,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 (resultIsReadOnly) {
+ return result;
}
- NamePart returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -6876,6 +7646,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 +7662,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 +7723,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 +7743,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;
@@ -7144,11 +7920,16 @@ 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(); }
public static Builder CreateBuilder(UninterpretedOption prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -7158,21 +7939,48 @@ namespace Google.ProtocolBuffers.DescriptorProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(UninterpretedOption cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- UninterpretedOption result = new UninterpretedOption();
+ private bool resultIsReadOnly;
+ private UninterpretedOption result;
+
+ private UninterpretedOption PrepareBuilder() {
+ if (resultIsReadOnly) {
+ UninterpretedOption original = result;
+ result = new UninterpretedOption();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -7184,13 +7992,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.name_.MakeReadOnly();
- UninterpretedOption returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -7204,8 +8010,9 @@ 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_);
+ result.name_.Add(other.name_);
}
if (other.HasIdentifierValue) {
IdentifierValue = other.IdentifierValue;
@@ -7231,6 +8038,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 +8107,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos { public pbc::IPopsicleList<global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart> NameList {
- get { return result.name_; }
+ get { return PrepareBuilder().name_; }
}
public int NameCount {
get { return result.NameCount; }
@@ -7309,29 +8117,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<global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart> values) {
- base.AddRange(values, result.name_);
+ PrepareBuilder();
+ result.name_.Add(values);
return this;
}
public Builder ClearName() {
+ PrepareBuilder();
result.name_.Clear();
return this;
}
@@ -7345,11 +8159,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 +8181,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 +8201,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 +8221,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 +8242,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/DynamicMessage.cs b/src/ProtocolBuffers/DynamicMessage.cs index 6235eb5b..e39efb12 100644 --- a/src/ProtocolBuffers/DynamicMessage.cs +++ b/src/ProtocolBuffers/DynamicMessage.cs @@ -44,7 +44,7 @@ namespace Google.ProtocolBuffers /// <summary>
/// An implementation of IMessage that can represent arbitrary types, given a MessageaDescriptor.
/// </summary>
- public sealed class DynamicMessage : AbstractMessage<DynamicMessage, DynamicMessage.Builder>
+ public sealed partial class DynamicMessage : AbstractMessage<DynamicMessage, DynamicMessage.Builder>
{
private readonly MessageDescriptor type;
private readonly FieldSet fields;
@@ -308,7 +308,7 @@ namespace Google.ProtocolBuffers /// <summary>
/// Builder for dynamic messages. Instances are created with DynamicMessage.CreateBuilder.
/// </summary>
- public sealed class Builder : AbstractBuilder<DynamicMessage, Builder>
+ public sealed partial class Builder : AbstractBuilder<DynamicMessage, Builder>
{
private readonly MessageDescriptor type;
private FieldSet fields;
diff --git a/src/ProtocolBuffers/ExtendableBuilder.cs b/src/ProtocolBuffers/ExtendableBuilder.cs index 137762ab..111ff57e 100644 --- a/src/ProtocolBuffers/ExtendableBuilder.cs +++ b/src/ProtocolBuffers/ExtendableBuilder.cs @@ -40,7 +40,7 @@ using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers
{
- public abstract class ExtendableBuilder<TMessage, TBuilder> : GeneratedBuilder<TMessage, TBuilder>
+ public abstract partial class ExtendableBuilder<TMessage, TBuilder> : GeneratedBuilder<TMessage, TBuilder>
where TMessage : ExtendableMessage<TMessage, TBuilder>
where TBuilder : GeneratedBuilder<TMessage, TBuilder>, new()
{
diff --git a/src/ProtocolBuffers/ExtendableBuilderLite.cs b/src/ProtocolBuffers/ExtendableBuilderLite.cs index cdec4fa3..2a71aa4a 100644 --- a/src/ProtocolBuffers/ExtendableBuilderLite.cs +++ b/src/ProtocolBuffers/ExtendableBuilderLite.cs @@ -40,7 +40,7 @@ using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers
{
- public abstract class ExtendableBuilderLite<TMessage, TBuilder> : GeneratedBuilderLite<TMessage, TBuilder>
+ public abstract partial class ExtendableBuilderLite<TMessage, TBuilder> : GeneratedBuilderLite<TMessage, TBuilder>
where TMessage : ExtendableMessageLite<TMessage, TBuilder>
where TBuilder : GeneratedBuilderLite<TMessage, TBuilder>
{
diff --git a/src/ProtocolBuffers/ExtendableMessage.cs b/src/ProtocolBuffers/ExtendableMessage.cs index e8f9ce41..71cd1b38 100644 --- a/src/ProtocolBuffers/ExtendableMessage.cs +++ b/src/ProtocolBuffers/ExtendableMessage.cs @@ -41,7 +41,7 @@ using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers
{
- public abstract class ExtendableMessage<TMessage, TBuilder> : GeneratedMessage<TMessage, TBuilder>
+ public abstract partial class ExtendableMessage<TMessage, TBuilder> : GeneratedMessage<TMessage, TBuilder>
where TMessage : GeneratedMessage<TMessage, TBuilder>
where TBuilder : GeneratedBuilder<TMessage, TBuilder>, new()
{
diff --git a/src/ProtocolBuffers/ExtendableMessageLite.cs b/src/ProtocolBuffers/ExtendableMessageLite.cs index 6ff56566..e682475d 100644 --- a/src/ProtocolBuffers/ExtendableMessageLite.cs +++ b/src/ProtocolBuffers/ExtendableMessageLite.cs @@ -42,7 +42,7 @@ using Google.ProtocolBuffers.Collections; namespace Google.ProtocolBuffers
{
- public abstract class ExtendableMessageLite<TMessage, TBuilder> : GeneratedMessageLite<TMessage, TBuilder>
+ public abstract partial class ExtendableMessageLite<TMessage, TBuilder> : GeneratedMessageLite<TMessage, TBuilder>
where TMessage : GeneratedMessageLite<TMessage, TBuilder>
where TBuilder : GeneratedBuilderLite<TMessage, TBuilder>
{
diff --git a/src/ProtocolBuffers/GeneratedBuilder.cs b/src/ProtocolBuffers/GeneratedBuilder.cs index 94948e49..fd6fe4d7 100644 --- a/src/ProtocolBuffers/GeneratedBuilder.cs +++ b/src/ProtocolBuffers/GeneratedBuilder.cs @@ -47,7 +47,7 @@ namespace Google.ProtocolBuffers /// most of the IBuilder interface using reflection. Users can ignore this class
/// as an implementation detail.
/// </summary>
- public abstract class GeneratedBuilder<TMessage, TBuilder> : AbstractBuilder<TMessage, TBuilder>
+ public abstract partial class GeneratedBuilder<TMessage, TBuilder> : AbstractBuilder<TMessage, TBuilder>
where TMessage : GeneratedMessage<TMessage, TBuilder>
where TBuilder : GeneratedBuilder<TMessage, TBuilder>, new()
{
@@ -58,12 +58,7 @@ namespace Google.ProtocolBuffers protected internal FieldAccessorTable<TMessage, TBuilder> InternalFieldAccessors
{
- get { return MessageBeingBuilt.FieldAccessorsFromBuilder; }
- }
-
- public override bool IsInitialized
- {
- get { return MessageBeingBuilt.IsInitialized; }
+ get { return DefaultInstanceForType.FieldAccessorsFromBuilder; }
}
public override IDictionary<FieldDescriptor, object> AllFields
@@ -85,32 +80,6 @@ namespace Google.ProtocolBuffers }
/// <summary>
- /// Adds all of the specified values to the given collection.
- /// </summary>
- /// <exception cref="ArgumentNullException">Any element of the list is null</exception>
- protected void AddRange<T>(IEnumerable<T> source, IList<T> destination)
- {
- ThrowHelper.ThrowIfNull(source);
- // We only need to check this for nullable types.
- if (default(T) == null)
- {
- ThrowHelper.ThrowIfAnyNull(source);
- }
- List<T> list = destination as List<T>;
- if (list != null)
- {
- list.AddRange(source);
- }
- else
- {
- foreach (T element in source)
- {
- destination.Add(element);
- }
- }
- }
-
- /// <summary>
/// Called by derived classes to parse an unknown field.
/// </summary>
/// <returns>true unless the tag is an end-group tag</returns>
@@ -123,7 +92,7 @@ namespace Google.ProtocolBuffers public override MessageDescriptor DescriptorForType
{
- get { return MessageBeingBuilt.DescriptorForType; }
+ get { return DefaultInstanceForType.DescriptorForType; }
}
public override int GetRepeatedFieldCount(FieldDescriptor field)
@@ -230,7 +199,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 cd2b8395..4030e801 100644 --- a/src/ProtocolBuffers/GeneratedBuilderLite.cs +++ b/src/ProtocolBuffers/GeneratedBuilderLite.cs @@ -44,7 +44,7 @@ namespace Google.ProtocolBuffers /// most of the IBuilder interface using reflection. Users can ignore this class
/// as an implementation detail.
/// </summary>
- public abstract class GeneratedBuilderLite<TMessage, TBuilder> : AbstractBuilderLite<TMessage, TBuilder>
+ public abstract partial class GeneratedBuilderLite<TMessage, TBuilder> : AbstractBuilderLite<TMessage, TBuilder>
where TMessage : GeneratedMessageLite<TMessage, TBuilder>
where TBuilder : GeneratedBuilderLite<TMessage, TBuilder>
{
@@ -61,37 +61,6 @@ namespace Google.ProtocolBuffers public abstract TBuilder MergeFrom(TMessage other);
- public override bool IsInitialized
- {
- get { return MessageBeingBuilt.IsInitialized; }
- }
-
- /// <summary>
- /// Adds all of the specified values to the given collection.
- /// </summary>
- /// <exception cref="ArgumentNullException">Any element of the list is null</exception>
- protected void AddRange<T>(IEnumerable<T> source, IList<T> destination)
- {
- ThrowHelper.ThrowIfNull(source);
- // We only need to check this for nullable types.
- if (default(T) == null)
- {
- ThrowHelper.ThrowIfAnyNull(source);
- }
- List<T> list = destination as List<T>;
- if (list != null)
- {
- list.AddRange(source);
- }
- else
- {
- foreach (T element in source)
- {
- destination.Add(element);
- }
- }
- }
-
/// <summary>
/// Called by derived classes to parse an unknown field.
/// </summary>
@@ -122,7 +91,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/GeneratedMessage.cs b/src/ProtocolBuffers/GeneratedMessage.cs index ce755bed..6f4b6657 100644 --- a/src/ProtocolBuffers/GeneratedMessage.cs +++ b/src/ProtocolBuffers/GeneratedMessage.cs @@ -50,7 +50,7 @@ namespace Google.ProtocolBuffers /// most of the IMessage interface using reflection. Users
/// can ignore this class as an implementation detail.
/// </summary>
- public abstract class GeneratedMessage<TMessage, TBuilder> : AbstractMessage<TMessage, TBuilder>
+ public abstract partial class GeneratedMessage<TMessage, TBuilder> : AbstractMessage<TMessage, TBuilder>
where TMessage : GeneratedMessage<TMessage, TBuilder>
where TBuilder : GeneratedBuilder<TMessage, TBuilder>, new()
{
diff --git a/src/ProtocolBuffers/GeneratedMessageLite.cs b/src/ProtocolBuffers/GeneratedMessageLite.cs index 1406d304..aecba7d6 100644 --- a/src/ProtocolBuffers/GeneratedMessageLite.cs +++ b/src/ProtocolBuffers/GeneratedMessageLite.cs @@ -47,7 +47,7 @@ namespace Google.ProtocolBuffers /// most of the IMessage interface using reflection. Users
/// can ignore this class as an implementation detail.
/// </summary>
- public abstract class GeneratedMessageLite<TMessage, TBuilder> : AbstractMessageLite<TMessage, TBuilder>
+ public abstract partial class GeneratedMessageLite<TMessage, TBuilder> : AbstractMessageLite<TMessage, TBuilder>
where TMessage : GeneratedMessageLite<TMessage, TBuilder>
where TBuilder : GeneratedBuilderLite<TMessage, TBuilder>
{
diff --git a/src/ProtocolBuffers/IBuilderLite.cs b/src/ProtocolBuffers/IBuilderLite.cs index 801f8e24..330fe495 100644 --- a/src/ProtocolBuffers/IBuilderLite.cs +++ b/src/ProtocolBuffers/IBuilderLite.cs @@ -46,7 +46,7 @@ namespace Google.ProtocolBuffers /// use explicit interface implemenation for the non-generic form. This mirrors
/// how IEnumerable and IEnumerable<T> work.
/// </summary>
- public interface IBuilderLite
+ public partial interface IBuilderLite
{
/// <summary>
/// Returns true iff all required fields in the message and all
diff --git a/src/ProtocolBuffers/IMessageLite.cs b/src/ProtocolBuffers/IMessageLite.cs index 90fb9509..ea5d9940 100644 --- a/src/ProtocolBuffers/IMessageLite.cs +++ b/src/ProtocolBuffers/IMessageLite.cs @@ -42,7 +42,7 @@ namespace Google.ProtocolBuffers /// Non-generic interface used for all parts of the API which don't require
/// any type knowledge.
/// </summary>
- public interface IMessageLite
+ public partial interface IMessageLite
{
/// <summary>
/// Returns true iff all required fields in the message and all embedded
diff --git a/src/ProtocolBuffers/IRpcController.cs b/src/ProtocolBuffers/IRpcController.cs index f6220e37..b155bec5 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.
/// </summary>
- bool isCanceled();
+ bool IsCanceled();
/// <summary>
/// Requests that the given callback be called when the RPC is canceled.
diff --git a/src/ProtocolBuffers/IRpcDispatch.cs b/src/ProtocolBuffers/IRpcDispatch.cs index 1da5c806..524838e4 100644 --- a/src/ProtocolBuffers/IRpcDispatch.cs +++ b/src/ProtocolBuffers/IRpcDispatch.cs @@ -34,18 +34,42 @@ #endregion
+using System;
+
namespace Google.ProtocolBuffers
{
/// <summary>
- ///
+ /// Provides an entry-point for transport listeners to call a specified method on a service
/// </summary>
- public interface IRpcServerStub
+ public interface IRpcServerStub : IDisposable
{
+ /// <summary>
+ /// Calls the method identified by methodName and returns the message
+ /// </summary>
+ /// <param name="methodName">The method name on the service descriptor (case-sensitive)</param>
+ /// <param name="input">The ICodedInputStream to deserialize the call parameter from</param>
+ /// <param name="registry">The extension registry to use when deserializing the call parameter</param>
+ /// <returns>The message that was returned from the service's method</returns>
IMessageLite CallMethod(string methodName, ICodedInputStream input, ExtensionRegistry registry);
}
+ /// <summary>
+ /// Used to forward an invocation of a service method to a transport sender implementation
+ /// </summary>
public interface IRpcDispatch
{
+ /// <summary>
+ /// 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.
+ /// </summary>
+ /// <typeparam name="TMessage">The type of the response message</typeparam>
+ /// <typeparam name="TBuilder">The type of of the response builder</typeparam>
+ /// <param name="method">The name of the method on the service</param>
+ /// <param name="request">The message instance provided to the service call</param>
+ /// <param name="response">The builder used to deserialize the response</param>
+ /// <returns>The resulting message of the service call</returns>
TMessage CallMethod<TMessage, TBuilder>(string method, IMessageLite request,
IBuilderLite<TMessage, TBuilder> response)
where TMessage : IMessageLite<TMessage, TBuilder>
diff --git a/src/ProtocolBuffers/ProtocolBuffers.csproj b/src/ProtocolBuffers/ProtocolBuffers.csproj index 336b387f..be80bd36 100644 --- a/src/ProtocolBuffers/ProtocolBuffers.csproj +++ b/src/ProtocolBuffers/ProtocolBuffers.csproj @@ -105,6 +105,7 @@ <Compile Include="Collections\IPopsicleList.cs" />
<Compile Include="Collections\PopsicleList.cs" />
<Compile Include="CodedOutputStream.ComputeSize.cs" />
+ <Compile Include="CustomSerialization.cs" />
<Compile Include="Delegates.cs" />
<Compile Include="CodedInputStream.cs" />
<Compile Include="CodedOutputStream.cs" />
diff --git a/src/ProtocolBuffers/ProtocolBuffersLite.csproj b/src/ProtocolBuffers/ProtocolBuffersLite.csproj index 44c92550..e2d44785 100644 --- a/src/ProtocolBuffers/ProtocolBuffersLite.csproj +++ b/src/ProtocolBuffers/ProtocolBuffersLite.csproj @@ -86,6 +86,7 @@ <Compile Include="Collections\Lists.cs" />
<Compile Include="Collections\PopsicleList.cs" />
<Compile Include="Collections\ReadOnlyDictionary.cs" />
+ <Compile Include="CustomSerialization.cs" />
<Compile Include="Descriptors\FieldMappingAttribute.cs" />
<Compile Include="Descriptors\FieldType.cs" />
<Compile Include="Descriptors\MappedType.cs" />
diff --git a/src/ProtocolBuffers/UnknownFieldSet.cs b/src/ProtocolBuffers/UnknownFieldSet.cs index 9261dbae..09ed680f 100644 --- a/src/ProtocolBuffers/UnknownFieldSet.cs +++ b/src/ProtocolBuffers/UnknownFieldSet.cs @@ -53,7 +53,7 @@ namespace Google.ProtocolBuffers ///
/// Most users will never need to use this class directly.
/// </summary>
- public sealed class UnknownFieldSet : IMessageLite
+ public sealed partial class UnknownFieldSet : IMessageLite
{
private static readonly UnknownFieldSet defaultInstance =
new UnknownFieldSet(new Dictionary<int, UnknownField>());
@@ -314,7 +314,7 @@ namespace Google.ProtocolBuffers /// <summary>
/// Builder for UnknownFieldSets.
/// </summary>
- public sealed class Builder : IBuilderLite
+ public sealed partial class Builder : IBuilderLite
{
/// <summary>
/// Mapping from number to field. Note that by using a SortedList we ensure
diff --git a/src/ProtocolBuffers2008.sln b/src/ProtocolBuffers2008.sln index 0baadbae..26924c60 100644 --- a/src/ProtocolBuffers2008.sln +++ b/src/ProtocolBuffers2008.sln @@ -23,7 +23,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unittest", "unittest", "{C8 ..\protos\extest\unittest_generic_services.proto = ..\protos\extest\unittest_generic_services.proto
..\protos\google\protobuf\unittest_import.proto = ..\protos\google\protobuf\unittest_import.proto
..\protos\google\protobuf\unittest_import_lite.proto = ..\protos\google\protobuf\unittest_import_lite.proto
- ..\protos\extest\unittest_issues.proto = ..\protos\extest\unittest_issues.proto
..\protos\google\protobuf\unittest_lite.proto = ..\protos\google\protobuf\unittest_lite.proto
..\protos\google\protobuf\unittest_lite_imports_nonlite.proto = ..\protos\google\protobuf\unittest_lite_imports_nonlite.proto
..\protos\google\protobuf\unittest_mset.proto = ..\protos\google\protobuf\unittest_mset.proto
diff --git a/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.csproj b/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.csproj index 2b8fe7ce..8da5b263 100644 --- a/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.csproj +++ b/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.csproj @@ -61,6 +61,7 @@ <Compile Include="ExtendableBuilderLiteTest.cs" />
<Compile Include="ExtendableMessageLiteTest.cs" />
<Compile Include="LiteTest.cs" />
+ <Compile Include="SerializableLiteTest.cs" />
<Compile Include="TestLiteByApi.cs" />
<Compile Include="TestProtos\UnitTestExtrasLiteProtoFile.cs" />
<Compile Include="TestProtos\UnitTestImportLiteProtoFile.cs" />
diff --git a/src/ProtocolBuffersLite.Test/SerializableLiteTest.cs b/src/ProtocolBuffersLite.Test/SerializableLiteTest.cs new file mode 100644 index 00000000..7c12ef40 --- /dev/null +++ b/src/ProtocolBuffersLite.Test/SerializableLiteTest.cs @@ -0,0 +1,53 @@ +using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
+using System.Text;
+using Google.ProtocolBuffers.TestProtos;
+using NUnit.Framework;
+
+namespace Google.ProtocolBuffers
+{
+ [TestFixture]
+ public class SerializableLiteTest
+ {
+ /// <summary>
+ /// Just keep it from even compiling if we these objects don't implement the expected interface.
+ /// </summary>
+ public static readonly ISerializable CompileTimeCheckSerializableMessage = TestRequiredLite.DefaultInstance;
+ public static readonly ISerializable CompileTimeCheckSerializableBuilder = new TestRequiredLite.Builder();
+
+ [Test]
+ public void TestPlainMessage()
+ {
+ TestRequiredLite message = TestRequiredLite.CreateBuilder()
+ .SetD(42)
+ .BuildPartial();
+
+ MemoryStream ms = new MemoryStream();
+ new BinaryFormatter().Serialize(ms, message);
+
+ ms.Position = 0;
+ TestRequiredLite copy = (TestRequiredLite)new BinaryFormatter().Deserialize(ms);
+
+ Assert.AreEqual(message, copy);
+ }
+
+ [Test]
+ public void TestPlainBuilder()
+ {
+ TestRequiredLite.Builder builder = TestRequiredLite.CreateBuilder()
+ .SetD(42)
+ ;
+
+ MemoryStream ms = new MemoryStream();
+ new BinaryFormatter().Serialize(ms, builder);
+
+ ms.Position = 0;
+ TestRequiredLite.Builder copy = (TestRequiredLite.Builder)new BinaryFormatter().Deserialize(ms);
+
+ Assert.AreEqual(builder.BuildPartial(), copy.BuildPartial());
+ }
+ }
+}
diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs index a9ee7772..ba46dc6a 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;
@@ -128,13 +128,14 @@ 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<TestInteropPerson, TestInteropPerson.Builder> {
- private static readonly TestInteropPerson defaultInstance = new Builder().BuildPartial();
+ private TestInteropPerson() { }
+ 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 +167,14 @@ 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<PhoneNumber, PhoneNumber.Builder> {
- private static readonly PhoneNumber defaultInstance = new Builder().BuildPartial();
+ private PhoneNumber() { }
+ 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,11 +239,15 @@ 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(); }
public static Builder CreateBuilder(PhoneNumber prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -251,21 +257,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(PhoneNumber cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- PhoneNumber result = new PhoneNumber();
+ private bool resultIsReadOnly;
+ private PhoneNumber result;
+
+ private PhoneNumber PrepareBuilder() {
+ if (resultIsReadOnly) {
+ PhoneNumber original = result;
+ result = new PhoneNumber();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -277,12 +310,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 (resultIsReadOnly) {
+ return result;
}
- PhoneNumber returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
@@ -295,11 +327,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 +347,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;
@@ -332,13 +368,14 @@ 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<Addresses, Addresses.Builder> {
- private static readonly Addresses defaultInstance = new Builder().BuildPartial();
+ private Addresses() { }
+ 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 {
@@ -434,11 +471,15 @@ 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(); }
public static Builder CreateBuilder(Addresses prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -448,21 +489,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(Addresses cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- Addresses result = new Addresses();
+ private bool resultIsReadOnly;
+ private Addresses result;
+
+ private Addresses PrepareBuilder() {
+ if (resultIsReadOnly) {
+ Addresses original = result;
+ result = new Addresses();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -474,12 +542,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 (resultIsReadOnly) {
+ return result;
}
- Addresses returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
@@ -492,11 +559,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 +580,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 +601,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 +622,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 +644,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;
@@ -683,11 +760,18 @@ 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(); }
public static Builder CreateBuilder(TestInteropPerson prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -697,21 +781,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestInteropPerson cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestInteropPerson result;
+
+ private TestInteropPerson PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestInteropPerson original = result;
+ result = new TestInteropPerson();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestInteropPerson result = new TestInteropPerson();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -723,15 +834,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.codes_.MakeReadOnly();
- result.phone_.MakeReadOnly();
- result.addresses_.MakeReadOnly();
- TestInteropPerson returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
@@ -744,11 +851,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 +871,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 +892,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<int> CodesList {
- get { return result.codes_; }
+ get { return PrepareBuilder().codes_; }
}
public int CodesCount {
get { return result.CodesCount; }
@@ -801,24 +914,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<int> values) {
- base.AddRange(values, result.codes_);
+ PrepareBuilder();
+ result.codes_.Add(values);
return this;
}
public Builder ClearCodes() {
+ PrepareBuilder();
result.codes_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber> PhoneList {
- get { return result.phone_; }
+ get { return PrepareBuilder().phone_; }
}
public int PhoneCount {
get { return result.PhoneCount; }
@@ -828,35 +945,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<global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber> values) {
- base.AddRange(values, result.phone_);
+ PrepareBuilder();
+ result.phone_.Add(values);
return this;
}
public Builder ClearPhone() {
+ PrepareBuilder();
result.phone_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses> AddressesList {
- get { return result.addresses_; }
+ get { return PrepareBuilder().addresses_; }
}
public int AddressesCount {
get { return result.AddressesCount; }
@@ -866,29 +989,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<global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses> values) {
- base.AddRange(values, result.addresses_);
+ PrepareBuilder();
+ result.addresses_.Add(values);
return this;
}
public Builder ClearAddresses() {
+ PrepareBuilder();
result.addresses_.Clear();
return this;
}
@@ -902,13 +1031,14 @@ 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<TestInteropEmployeeId, TestInteropEmployeeId.Builder> {
- private static readonly TestInteropEmployeeId defaultInstance = new Builder().BuildPartial();
+ private TestInteropEmployeeId() { }
+ 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 {
@@ -963,11 +1093,15 @@ 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(); }
public static Builder CreateBuilder(TestInteropEmployeeId prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -977,21 +1111,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestInteropEmployeeId cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestInteropEmployeeId result = new TestInteropEmployeeId();
+ private bool resultIsReadOnly;
+ private TestInteropEmployeeId result;
+
+ private TestInteropEmployeeId PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestInteropEmployeeId original = result;
+ result = new TestInteropEmployeeId();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1003,12 +1164,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 (resultIsReadOnly) {
+ return result;
}
- TestInteropEmployeeId returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
@@ -1021,11 +1181,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;
@@ -1040,13 +1202,14 @@ 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<TestMissingFieldsA, TestMissingFieldsA.Builder> {
- private static readonly TestMissingFieldsA defaultInstance = new Builder().BuildPartial();
+ private TestMissingFieldsA() { }
+ 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 {
@@ -1070,13 +1233,14 @@ 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<SubA, SubA.Builder> {
- private static readonly SubA defaultInstance = new Builder().BuildPartial();
+ private SubA() { }
+ 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 {
@@ -1143,11 +1307,16 @@ 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(); }
public static Builder CreateBuilder(SubA prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1157,21 +1326,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(SubA cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- SubA result = new SubA();
+ private bool resultIsReadOnly;
+ private SubA result;
+
+ private SubA PrepareBuilder() {
+ if (resultIsReadOnly) {
+ SubA original = result;
+ result = new SubA();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1183,13 +1379,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.values_.MakeReadOnly();
- SubA returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
@@ -1201,18 +1395,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<string> ValuesList {
- get { return result.values_; }
+ get { return PrepareBuilder().values_; }
}
public int ValuesCount {
get { return result.ValuesCount; }
@@ -1222,19 +1418,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<string> values) {
- base.AddRange(values, result.values_);
+ PrepareBuilder();
+ result.values_.Add(values);
return this;
}
public Builder ClearValues() {
+ PrepareBuilder();
result.values_.Clear();
return this;
}
@@ -1279,12 +1479,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) {
@@ -1317,11 +1517,15 @@ 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(); }
public static Builder CreateBuilder(TestMissingFieldsA prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1331,21 +1535,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestMissingFieldsA cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestMissingFieldsA result = new TestMissingFieldsA();
+ private bool resultIsReadOnly;
+ private TestMissingFieldsA result;
+
+ private TestMissingFieldsA PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestMissingFieldsA original = result;
+ result = new TestMissingFieldsA();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1357,12 +1588,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 (resultIsReadOnly) {
+ return result;
}
- TestMissingFieldsA returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
@@ -1375,11 +1605,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 +1625,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 +1646,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 +1667,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,8 +1692,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearTestA() {
+ PrepareBuilder();
result.hasTestA = false;
- result.testA_ = global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.DefaultInstance;
+ result.testA_ = null;
return this;
}
}
@@ -1467,13 +1707,14 @@ 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<TestMissingFieldsB, TestMissingFieldsB.Builder> {
- private static readonly TestMissingFieldsB defaultInstance = new Builder().BuildPartial();
+ private TestMissingFieldsB() { }
+ 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 {
@@ -1497,13 +1738,14 @@ 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<SubB, SubB.Builder> {
- private static readonly SubB defaultInstance = new Builder().BuildPartial();
+ private SubB() { }
+ 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 {
@@ -1560,11 +1802,16 @@ 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(); }
public static Builder CreateBuilder(SubB prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1574,21 +1821,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(SubB cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- SubB result = new SubB();
+ private bool resultIsReadOnly;
+ private SubB result;
+
+ private SubB PrepareBuilder() {
+ if (resultIsReadOnly) {
+ SubB original = result;
+ result = new SubB();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1600,18 +1874,16 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.values_.MakeReadOnly();
- SubB returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public pbc::IPopsicleList<string> ValuesList {
- get { return result.values_; }
+ get { return PrepareBuilder().values_; }
}
public int ValuesCount {
get { return result.ValuesCount; }
@@ -1621,19 +1893,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<string> values) {
- base.AddRange(values, result.values_);
+ PrepareBuilder();
+ result.values_.Add(values);
return this;
}
public Builder ClearValues() {
+ PrepareBuilder();
result.values_.Clear();
return this;
}
@@ -1678,12 +1954,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) {
@@ -1716,11 +1992,15 @@ 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(); }
public static Builder CreateBuilder(TestMissingFieldsB prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1730,21 +2010,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestMissingFieldsB cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestMissingFieldsB result = new TestMissingFieldsB();
+ private bool resultIsReadOnly;
+ private TestMissingFieldsB result;
+
+ private TestMissingFieldsB PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestMissingFieldsB original = result;
+ result = new TestMissingFieldsB();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1756,12 +2063,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 (resultIsReadOnly) {
+ return result;
}
- TestMissingFieldsB returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
@@ -1774,11 +2080,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 +2100,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 +2121,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 +2142,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,8 +2167,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
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 bc214e25..e3df2328 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;
@@ -55,11 +55,13 @@ namespace Google.ProtocolBuffers.TestProtos { #endregion
#region Messages
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
public sealed partial class TestRequiredLite : pb::GeneratedMessageLite<TestRequiredLite, TestRequiredLite.Builder> {
- private static readonly TestRequiredLite defaultInstance = new Builder().BuildPartial();
+ private TestRequiredLite() { }
+ 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 +69,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestRequiredLite DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestRequiredLite ThisMessage {
@@ -183,13 +185,18 @@ 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(); }
public static Builder CreateBuilder(TestRequiredLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
@@ -197,21 +204,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestRequiredLite cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestRequiredLite result;
+
+ private TestRequiredLite PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestRequiredLite original = result;
+ result = new TestRequiredLite();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestRequiredLite DefaultInstanceForType {
@@ -219,12 +253,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 (resultIsReadOnly) {
+ return result;
}
- TestRequiredLite returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -238,6 +271,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 +286,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 +337,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 +357,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;
@@ -335,11 +374,13 @@ namespace Google.ProtocolBuffers.TestProtos { }
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
public sealed partial class TestInteropPersonLite : pb::ExtendableMessageLite<TestInteropPersonLite, TestInteropPersonLite.Builder> {
- private static readonly TestInteropPersonLite defaultInstance = new Builder().BuildPartial();
+ private TestInteropPersonLite() { }
+ 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 {
@@ -347,7 +388,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestInteropPersonLite DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestInteropPersonLite ThisMessage {
@@ -367,11 +408,13 @@ namespace Google.ProtocolBuffers.TestProtos { WORK = 2,
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
public sealed partial class PhoneNumber : pb::GeneratedMessageLite<PhoneNumber, PhoneNumber.Builder> {
- private static readonly PhoneNumber defaultInstance = new Builder().BuildPartial();
+ private PhoneNumber() { }
+ 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 {
@@ -379,7 +422,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override PhoneNumber DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override PhoneNumber ThisMessage {
@@ -494,13 +537,18 @@ 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(); }
public static Builder CreateBuilder(PhoneNumber prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
@@ -508,21 +556,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(PhoneNumber cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private PhoneNumber result;
+
+ private PhoneNumber PrepareBuilder() {
+ if (resultIsReadOnly) {
+ PhoneNumber original = result;
+ result = new PhoneNumber();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- PhoneNumber result = new PhoneNumber();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override PhoneNumber DefaultInstanceForType {
@@ -530,12 +605,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 (resultIsReadOnly) {
+ return result;
}
- PhoneNumber returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -549,6 +623,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 +638,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 +690,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 +710,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;
@@ -647,11 +727,13 @@ namespace Google.ProtocolBuffers.TestProtos { }
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
public sealed partial class Addresses : pb::GeneratedMessageLite<Addresses, Addresses.Builder> {
- private static readonly Addresses defaultInstance = new Builder().BuildPartial();
+ private Addresses() { }
+ 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 {
@@ -659,7 +741,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override Addresses DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override Addresses ThisMessage {
@@ -835,13 +917,18 @@ 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(); }
public static Builder CreateBuilder(Addresses prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
@@ -849,21 +936,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(Addresses cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private Addresses result;
+
+ private Addresses PrepareBuilder() {
+ if (resultIsReadOnly) {
+ Addresses original = result;
+ result = new Addresses();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override Addresses DefaultInstanceForType {
@@ -871,12 +985,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 (resultIsReadOnly) {
+ return result;
}
- Addresses returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -890,6 +1003,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 +1027,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 +1087,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 +1108,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 +1129,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 +1150,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 +1172,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;
@@ -1286,13 +1411,21 @@ 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(); }
public static Builder CreateBuilder(TestInteropPersonLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
@@ -1300,21 +1433,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestInteropPersonLite cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestInteropPersonLite result = new TestInteropPersonLite();
+ private bool resultIsReadOnly;
+ private TestInteropPersonLite result;
+
+ private TestInteropPersonLite PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestInteropPersonLite original = result;
+ result = new TestInteropPersonLite();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestInteropPersonLite DefaultInstanceForType {
@@ -1322,15 +1482,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.codes_.MakeReadOnly();
- result.phone_.MakeReadOnly();
- result.addresses_.MakeReadOnly();
- TestInteropPersonLite returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -1344,6 +1500,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;
}
@@ -1354,13 +1511,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;
@@ -1371,6 +1528,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 +1593,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 +1613,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 +1634,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<int> CodesList {
- get { return result.codes_; }
+ get { return PrepareBuilder().codes_; }
}
public int CodesCount {
get { return result.CodesCount; }
@@ -1492,24 +1656,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<int> values) {
- base.AddRange(values, result.codes_);
+ PrepareBuilder();
+ result.codes_.Add(values);
return this;
}
public Builder ClearCodes() {
+ PrepareBuilder();
result.codes_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber> PhoneList {
- get { return result.phone_; }
+ get { return PrepareBuilder().phone_; }
}
public int PhoneCount {
get { return result.PhoneCount; }
@@ -1519,35 +1687,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<global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber> values) {
- base.AddRange(values, result.phone_);
+ PrepareBuilder();
+ result.phone_.Add(values);
return this;
}
public Builder ClearPhone() {
+ PrepareBuilder();
result.phone_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses> AddressesList {
- get { return result.addresses_; }
+ get { return PrepareBuilder().addresses_; }
}
public int AddressesCount {
get { return result.AddressesCount; }
@@ -1557,29 +1731,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<global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses> values) {
- base.AddRange(values, result.addresses_);
+ PrepareBuilder();
+ result.addresses_.Add(values);
return this;
}
public Builder ClearAddresses() {
+ PrepareBuilder();
result.addresses_.Clear();
return this;
}
@@ -1589,11 +1769,13 @@ namespace Google.ProtocolBuffers.TestProtos { }
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
public sealed partial class TestInteropEmployeeIdLite : pb::GeneratedMessageLite<TestInteropEmployeeIdLite, TestInteropEmployeeIdLite.Builder> {
- private static readonly TestInteropEmployeeIdLite defaultInstance = new Builder().BuildPartial();
+ private TestInteropEmployeeIdLite() { }
+ 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 {
@@ -1601,7 +1783,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestInteropEmployeeIdLite DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestInteropEmployeeIdLite ThisMessage {
@@ -1697,13 +1879,18 @@ 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(); }
public static Builder CreateBuilder(TestInteropEmployeeIdLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
+ [global::System.SerializableAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
@@ -1711,21 +1898,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestInteropEmployeeIdLite cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestInteropEmployeeIdLite result = new TestInteropEmployeeIdLite();
+ private bool resultIsReadOnly;
+ private TestInteropEmployeeIdLite result;
+
+ private TestInteropEmployeeIdLite PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestInteropEmployeeIdLite original = result;
+ result = new TestInteropEmployeeIdLite();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestInteropEmployeeIdLite DefaultInstanceForType {
@@ -1733,12 +1947,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 (resultIsReadOnly) {
+ return result;
}
- TestInteropEmployeeIdLite returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -1752,6 +1965,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 +1977,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 +2021,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 a96833be..f31fdd89 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;
@@ -43,7 +43,8 @@ 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<ImportMessageLite, ImportMessageLite.Builder> {
- private static readonly ImportMessageLite defaultInstance = new Builder().BuildPartial();
+ private ImportMessageLite() { }
+ 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 +52,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override ImportMessageLite DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override ImportMessageLite ThisMessage {
@@ -146,11 +147,15 @@ 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(); }
public static Builder CreateBuilder(ImportMessageLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -160,21 +165,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(ImportMessageLite cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private ImportMessageLite result;
+
+ private ImportMessageLite PrepareBuilder() {
+ if (resultIsReadOnly) {
+ ImportMessageLite original = result;
+ result = new ImportMessageLite();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- ImportMessageLite result = new ImportMessageLite();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override ImportMessageLite DefaultInstanceForType {
@@ -182,12 +214,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 (resultIsReadOnly) {
+ return result;
}
- ImportMessageLite returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -201,6 +232,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 +244,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 +287,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 5749c97f..c12aef8e 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;
@@ -71,7 +71,8 @@ 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<ImportMessage, ImportMessage.Builder> {
- private static readonly ImportMessage defaultInstance = new Builder().BuildPartial();
+ private ImportMessage() { }
+ 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 +80,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override ImportMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override ImportMessage ThisMessage {
@@ -165,11 +166,15 @@ 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(); }
public static Builder CreateBuilder(ImportMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -179,21 +184,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(ImportMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private ImportMessage result;
+
+ private ImportMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ ImportMessage original = result;
+ result = new ImportMessage();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- ImportMessage result = new ImportMessage();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -205,12 +237,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 (resultIsReadOnly) {
+ return result;
}
- ImportMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -224,6 +255,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 +268,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 +324,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 7c2836cd..0e7b5070 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;
@@ -32,7 +32,8 @@ 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<TestLiteImportsNonlite, TestLiteImportsNonlite.Builder> {
- private static readonly TestLiteImportsNonlite defaultInstance = new Builder().BuildPartial();
+ private TestLiteImportsNonlite() { }
+ 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 +41,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestLiteImportsNonlite DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestLiteImportsNonlite ThisMessage {
@@ -49,12 +50,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,11 +136,15 @@ 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(); }
public static Builder CreateBuilder(TestLiteImportsNonlite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -149,21 +154,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestLiteImportsNonlite cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestLiteImportsNonlite result;
+
+ private TestLiteImportsNonlite PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestLiteImportsNonlite original = result;
+ result = new TestLiteImportsNonlite();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestLiteImportsNonlite result = new TestLiteImportsNonlite();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestLiteImportsNonlite DefaultInstanceForType {
@@ -171,12 +203,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 (resultIsReadOnly) {
+ return result;
}
- TestLiteImportsNonlite returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -190,6 +221,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 +233,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 +282,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,8 +307,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
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 78bed7e2..c682ad1c 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;
@@ -1228,7 +1228,8 @@ 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<TestAllTypesLite, TestAllTypesLite.Builder> {
- private static readonly TestAllTypesLite defaultInstance = new Builder().BuildPartial();
+ private TestAllTypesLite() { }
+ 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 +1237,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestAllTypesLite DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestAllTypesLite ThisMessage {
@@ -1260,7 +1261,8 @@ 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<NestedMessage, NestedMessage.Builder> {
- private static readonly NestedMessage defaultInstance = new Builder().BuildPartial();
+ private NestedMessage() { }
+ 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 +1270,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override NestedMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override NestedMessage ThisMessage {
@@ -1363,11 +1365,15 @@ 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(); }
public static Builder CreateBuilder(NestedMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1377,21 +1383,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(NestedMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private NestedMessage result;
- NestedMessage result = new NestedMessage();
+ private NestedMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ NestedMessage original = result;
+ result = new NestedMessage();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override NestedMessage DefaultInstanceForType {
@@ -1399,12 +1432,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 (resultIsReadOnly) {
+ return result;
}
- NestedMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -1418,6 +1450,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 +1462,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 +1505,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;
@@ -1490,7 +1526,8 @@ 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<OptionalGroup, OptionalGroup.Builder> {
- private static readonly OptionalGroup defaultInstance = new Builder().BuildPartial();
+ private OptionalGroup() { }
+ 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 {
@@ -1498,7 +1535,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override OptionalGroup DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override OptionalGroup ThisMessage {
@@ -1593,11 +1630,15 @@ 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(); }
public static Builder CreateBuilder(OptionalGroup prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1607,21 +1648,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(OptionalGroup cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- OptionalGroup result = new OptionalGroup();
+ private bool resultIsReadOnly;
+ private OptionalGroup result;
+
+ private OptionalGroup PrepareBuilder() {
+ if (resultIsReadOnly) {
+ OptionalGroup original = result;
+ result = new OptionalGroup();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override OptionalGroup DefaultInstanceForType {
@@ -1629,12 +1697,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 (resultIsReadOnly) {
+ return result;
}
- OptionalGroup returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -1648,6 +1715,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 +1727,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 +1770,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;
@@ -1720,7 +1791,8 @@ 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<RepeatedGroup, RepeatedGroup.Builder> {
- private static readonly RepeatedGroup defaultInstance = new Builder().BuildPartial();
+ private RepeatedGroup() { }
+ 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 {
@@ -1728,7 +1800,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override RepeatedGroup DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override RepeatedGroup ThisMessage {
@@ -1823,11 +1895,15 @@ 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(); }
public static Builder CreateBuilder(RepeatedGroup prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1837,21 +1913,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(RepeatedGroup cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- RepeatedGroup result = new RepeatedGroup();
+ private bool resultIsReadOnly;
+ private RepeatedGroup result;
+
+ private RepeatedGroup PrepareBuilder() {
+ if (resultIsReadOnly) {
+ RepeatedGroup original = result;
+ result = new RepeatedGroup();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override RepeatedGroup DefaultInstanceForType {
@@ -1859,12 +1962,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 (resultIsReadOnly) {
+ return result;
}
- RepeatedGroup returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -1878,6 +1980,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 +1992,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 +2035,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;
@@ -2105,42 +2211,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;
@@ -3538,11 +3644,39 @@ 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(); }
public static Builder CreateBuilder(TestAllTypesLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -3552,21 +3686,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestAllTypesLite cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestAllTypesLite result;
+
+ private TestAllTypesLite PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestAllTypesLite original = result;
+ result = new TestAllTypesLite();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestAllTypesLite result = new TestAllTypesLite();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestAllTypesLite DefaultInstanceForType {
@@ -3574,36 +3735,11 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestAllTypesLite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
- }
- 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();
- TestAllTypesLite returnMe = result;
- result = null;
- return returnMe;
+ if (resultIsReadOnly) {
+ return result;
+ }
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -3617,6 +3753,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;
}
@@ -3690,76 +3827,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;
@@ -3829,6 +3966,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 +4340,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 +4360,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 +4382,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 +4404,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 +4424,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 +4444,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 +4466,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 +4488,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 +4508,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 +4528,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 +4548,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 +4568,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 +4588,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 +4609,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 +4630,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 +4651,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,8 +4676,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearOptionalGroup() {
+ PrepareBuilder();
result.hasOptionalGroup = false;
- result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.DefaultInstance;
+ result.optionalGroup_ = null;
return this;
}
@@ -4519,18 +4691,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,8 +4716,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearOptionalNestedMessage() {
+ PrepareBuilder();
result.hasOptionalNestedMessage = false;
- result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance;
+ result.optionalNestedMessage_ = null;
return this;
}
@@ -4555,18 +4731,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,8 +4756,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearOptionalForeignMessage() {
+ PrepareBuilder();
result.hasOptionalForeignMessage = false;
- result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance;
+ result.optionalForeignMessage_ = null;
return this;
}
@@ -4591,18 +4771,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,8 +4796,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearOptionalImportMessage() {
+ PrepareBuilder();
result.hasOptionalImportMessage = false;
- result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance;
+ result.optionalImportMessage_ = null;
return this;
}
@@ -4626,11 +4810,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 +4830,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 +4850,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 +4871,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 +4892,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<int> RepeatedInt32List {
- get { return result.repeatedInt32_; }
+ get { return PrepareBuilder().repeatedInt32_; }
}
public int RepeatedInt32Count {
get { return result.RepeatedInt32Count; }
@@ -4720,24 +4914,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<int> values) {
- base.AddRange(values, result.repeatedInt32_);
+ PrepareBuilder();
+ result.repeatedInt32_.Add(values);
return this;
}
public Builder ClearRepeatedInt32() {
+ PrepareBuilder();
result.repeatedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedInt64List {
- get { return result.repeatedInt64_; }
+ get { return PrepareBuilder().repeatedInt64_; }
}
public int RepeatedInt64Count {
get { return result.RepeatedInt64Count; }
@@ -4746,25 +4944,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<long> values) {
- base.AddRange(values, result.repeatedInt64_);
+ PrepareBuilder();
+ result.repeatedInt64_.Add(values);
return this;
}
public Builder ClearRepeatedInt64() {
+ PrepareBuilder();
result.repeatedInt64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> RepeatedUint32List {
- get { return result.repeatedUint32_; }
+ get { return PrepareBuilder().repeatedUint32_; }
}
public int RepeatedUint32Count {
get { return result.RepeatedUint32Count; }
@@ -4775,27 +4977,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<uint> values) {
- base.AddRange(values, result.repeatedUint32_);
+ PrepareBuilder();
+ result.repeatedUint32_.Add(values);
return this;
}
public Builder ClearRepeatedUint32() {
+ PrepareBuilder();
result.repeatedUint32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> RepeatedUint64List {
- get { return result.repeatedUint64_; }
+ get { return PrepareBuilder().repeatedUint64_; }
}
public int RepeatedUint64Count {
get { return result.RepeatedUint64Count; }
@@ -4806,26 +5012,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<ulong> values) {
- base.AddRange(values, result.repeatedUint64_);
+ PrepareBuilder();
+ result.repeatedUint64_.Add(values);
return this;
}
public Builder ClearRepeatedUint64() {
+ PrepareBuilder();
result.repeatedUint64_.Clear();
return this;
}
public pbc::IPopsicleList<int> RepeatedSint32List {
- get { return result.repeatedSint32_; }
+ get { return PrepareBuilder().repeatedSint32_; }
}
public int RepeatedSint32Count {
get { return result.RepeatedSint32Count; }
@@ -4834,24 +5044,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<int> values) {
- base.AddRange(values, result.repeatedSint32_);
+ PrepareBuilder();
+ result.repeatedSint32_.Add(values);
return this;
}
public Builder ClearRepeatedSint32() {
+ PrepareBuilder();
result.repeatedSint32_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedSint64List {
- get { return result.repeatedSint64_; }
+ get { return PrepareBuilder().repeatedSint64_; }
}
public int RepeatedSint64Count {
get { return result.RepeatedSint64Count; }
@@ -4860,25 +5074,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<long> values) {
- base.AddRange(values, result.repeatedSint64_);
+ PrepareBuilder();
+ result.repeatedSint64_.Add(values);
return this;
}
public Builder ClearRepeatedSint64() {
+ PrepareBuilder();
result.repeatedSint64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> RepeatedFixed32List {
- get { return result.repeatedFixed32_; }
+ get { return PrepareBuilder().repeatedFixed32_; }
}
public int RepeatedFixed32Count {
get { return result.RepeatedFixed32Count; }
@@ -4889,27 +5107,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<uint> values) {
- base.AddRange(values, result.repeatedFixed32_);
+ PrepareBuilder();
+ result.repeatedFixed32_.Add(values);
return this;
}
public Builder ClearRepeatedFixed32() {
+ PrepareBuilder();
result.repeatedFixed32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> RepeatedFixed64List {
- get { return result.repeatedFixed64_; }
+ get { return PrepareBuilder().repeatedFixed64_; }
}
public int RepeatedFixed64Count {
get { return result.RepeatedFixed64Count; }
@@ -4920,26 +5142,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<ulong> values) {
- base.AddRange(values, result.repeatedFixed64_);
+ PrepareBuilder();
+ result.repeatedFixed64_.Add(values);
return this;
}
public Builder ClearRepeatedFixed64() {
+ PrepareBuilder();
result.repeatedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<int> RepeatedSfixed32List {
- get { return result.repeatedSfixed32_; }
+ get { return PrepareBuilder().repeatedSfixed32_; }
}
public int RepeatedSfixed32Count {
get { return result.RepeatedSfixed32Count; }
@@ -4948,24 +5174,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<int> values) {
- base.AddRange(values, result.repeatedSfixed32_);
+ PrepareBuilder();
+ result.repeatedSfixed32_.Add(values);
return this;
}
public Builder ClearRepeatedSfixed32() {
+ PrepareBuilder();
result.repeatedSfixed32_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedSfixed64List {
- get { return result.repeatedSfixed64_; }
+ get { return PrepareBuilder().repeatedSfixed64_; }
}
public int RepeatedSfixed64Count {
get { return result.RepeatedSfixed64Count; }
@@ -4974,24 +5204,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<long> values) {
- base.AddRange(values, result.repeatedSfixed64_);
+ PrepareBuilder();
+ result.repeatedSfixed64_.Add(values);
return this;
}
public Builder ClearRepeatedSfixed64() {
+ PrepareBuilder();
result.repeatedSfixed64_.Clear();
return this;
}
public pbc::IPopsicleList<float> RepeatedFloatList {
- get { return result.repeatedFloat_; }
+ get { return PrepareBuilder().repeatedFloat_; }
}
public int RepeatedFloatCount {
get { return result.RepeatedFloatCount; }
@@ -5000,24 +5234,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<float> values) {
- base.AddRange(values, result.repeatedFloat_);
+ PrepareBuilder();
+ result.repeatedFloat_.Add(values);
return this;
}
public Builder ClearRepeatedFloat() {
+ PrepareBuilder();
result.repeatedFloat_.Clear();
return this;
}
public pbc::IPopsicleList<double> RepeatedDoubleList {
- get { return result.repeatedDouble_; }
+ get { return PrepareBuilder().repeatedDouble_; }
}
public int RepeatedDoubleCount {
get { return result.RepeatedDoubleCount; }
@@ -5026,24 +5264,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<double> values) {
- base.AddRange(values, result.repeatedDouble_);
+ PrepareBuilder();
+ result.repeatedDouble_.Add(values);
return this;
}
public Builder ClearRepeatedDouble() {
+ PrepareBuilder();
result.repeatedDouble_.Clear();
return this;
}
public pbc::IPopsicleList<bool> RepeatedBoolList {
- get { return result.repeatedBool_; }
+ get { return PrepareBuilder().repeatedBool_; }
}
public int RepeatedBoolCount {
get { return result.RepeatedBoolCount; }
@@ -5052,24 +5294,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<bool> values) {
- base.AddRange(values, result.repeatedBool_);
+ PrepareBuilder();
+ result.repeatedBool_.Add(values);
return this;
}
public Builder ClearRepeatedBool() {
+ PrepareBuilder();
result.repeatedBool_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedStringList {
- get { return result.repeatedString_; }
+ get { return PrepareBuilder().repeatedString_; }
}
public int RepeatedStringCount {
get { return result.RepeatedStringCount; }
@@ -5079,25 +5325,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<string> values) {
- base.AddRange(values, result.repeatedString_);
+ PrepareBuilder();
+ result.repeatedString_.Add(values);
return this;
}
public Builder ClearRepeatedString() {
+ PrepareBuilder();
result.repeatedString_.Clear();
return this;
}
public pbc::IPopsicleList<pb::ByteString> RepeatedBytesList {
- get { return result.repeatedBytes_; }
+ get { return PrepareBuilder().repeatedBytes_; }
}
public int RepeatedBytesCount {
get { return result.RepeatedBytesCount; }
@@ -5107,25 +5357,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<pb::ByteString> values) {
- base.AddRange(values, result.repeatedBytes_);
+ PrepareBuilder();
+ result.repeatedBytes_.Add(values);
return this;
}
public Builder ClearRepeatedBytes() {
+ PrepareBuilder();
result.repeatedBytes_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup> RepeatedGroupList {
- get { return result.repeatedGroup_; }
+ get { return PrepareBuilder().repeatedGroup_; }
}
public int RepeatedGroupCount {
get { return result.RepeatedGroupCount; }
@@ -5135,35 +5389,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<global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup> values) {
- base.AddRange(values, result.repeatedGroup_);
+ PrepareBuilder();
+ result.repeatedGroup_.Add(values);
return this;
}
public Builder ClearRepeatedGroup() {
+ PrepareBuilder();
result.repeatedGroup_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage> RepeatedNestedMessageList {
- get { return result.repeatedNestedMessage_; }
+ get { return PrepareBuilder().repeatedNestedMessage_; }
}
public int RepeatedNestedMessageCount {
get { return result.RepeatedNestedMessageCount; }
@@ -5173,35 +5433,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<global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage> values) {
- base.AddRange(values, result.repeatedNestedMessage_);
+ PrepareBuilder();
+ result.repeatedNestedMessage_.Add(values);
return this;
}
public Builder ClearRepeatedNestedMessage() {
+ PrepareBuilder();
result.repeatedNestedMessage_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite> RepeatedForeignMessageList {
- get { return result.repeatedForeignMessage_; }
+ get { return PrepareBuilder().repeatedForeignMessage_; }
}
public int RepeatedForeignMessageCount {
get { return result.RepeatedForeignMessageCount; }
@@ -5211,35 +5477,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<global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite> values) {
- base.AddRange(values, result.repeatedForeignMessage_);
+ PrepareBuilder();
+ result.repeatedForeignMessage_.Add(values);
return this;
}
public Builder ClearRepeatedForeignMessage() {
+ PrepareBuilder();
result.repeatedForeignMessage_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ImportMessageLite> RepeatedImportMessageList {
- get { return result.repeatedImportMessage_; }
+ get { return PrepareBuilder().repeatedImportMessage_; }
}
public int RepeatedImportMessageCount {
get { return result.RepeatedImportMessageCount; }
@@ -5249,35 +5521,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<global::Google.ProtocolBuffers.TestProtos.ImportMessageLite> values) {
- base.AddRange(values, result.repeatedImportMessage_);
+ PrepareBuilder();
+ result.repeatedImportMessage_.Add(values);
return this;
}
public Builder ClearRepeatedImportMessage() {
+ PrepareBuilder();
result.repeatedImportMessage_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum> RepeatedNestedEnumList {
- get { return result.repeatedNestedEnum_; }
+ get { return PrepareBuilder().repeatedNestedEnum_; }
}
public int RepeatedNestedEnumCount {
get { return result.RepeatedNestedEnumCount; }
@@ -5286,24 +5564,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<global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum> values) {
- base.AddRange(values, result.repeatedNestedEnum_);
+ PrepareBuilder();
+ result.repeatedNestedEnum_.Add(values);
return this;
}
public Builder ClearRepeatedNestedEnum() {
+ PrepareBuilder();
result.repeatedNestedEnum_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite> RepeatedForeignEnumList {
- get { return result.repeatedForeignEnum_; }
+ get { return PrepareBuilder().repeatedForeignEnum_; }
}
public int RepeatedForeignEnumCount {
get { return result.RepeatedForeignEnumCount; }
@@ -5312,24 +5594,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<global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite> values) {
- base.AddRange(values, result.repeatedForeignEnum_);
+ PrepareBuilder();
+ result.repeatedForeignEnum_.Add(values);
return this;
}
public Builder ClearRepeatedForeignEnum() {
+ PrepareBuilder();
result.repeatedForeignEnum_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ImportEnumLite> RepeatedImportEnumList {
- get { return result.repeatedImportEnum_; }
+ get { return PrepareBuilder().repeatedImportEnum_; }
}
public int RepeatedImportEnumCount {
get { return result.RepeatedImportEnumCount; }
@@ -5338,24 +5624,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<global::Google.ProtocolBuffers.TestProtos.ImportEnumLite> values) {
- base.AddRange(values, result.repeatedImportEnum_);
+ PrepareBuilder();
+ result.repeatedImportEnum_.Add(values);
return this;
}
public Builder ClearRepeatedImportEnum() {
+ PrepareBuilder();
result.repeatedImportEnum_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedStringPieceList {
- get { return result.repeatedStringPiece_; }
+ get { return PrepareBuilder().repeatedStringPiece_; }
}
public int RepeatedStringPieceCount {
get { return result.RepeatedStringPieceCount; }
@@ -5365,25 +5655,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<string> values) {
- base.AddRange(values, result.repeatedStringPiece_);
+ PrepareBuilder();
+ result.repeatedStringPiece_.Add(values);
return this;
}
public Builder ClearRepeatedStringPiece() {
+ PrepareBuilder();
result.repeatedStringPiece_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedCordList {
- get { return result.repeatedCord_; }
+ get { return PrepareBuilder().repeatedCord_; }
}
public int RepeatedCordCount {
get { return result.RepeatedCordCount; }
@@ -5393,19 +5687,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<string> values) {
- base.AddRange(values, result.repeatedCord_);
+ PrepareBuilder();
+ result.repeatedCord_.Add(values);
return this;
}
public Builder ClearRepeatedCord() {
+ PrepareBuilder();
result.repeatedCord_.Clear();
return this;
}
@@ -5418,11 +5716,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 +5736,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 +5758,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 +5780,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 +5800,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 +5820,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 +5842,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 +5864,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 +5884,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 +5904,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 +5924,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 +5944,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 +5964,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 +5985,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 +6006,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 +6026,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 +6046,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 +6066,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 +6087,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 +6108,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;
@@ -5791,7 +6129,8 @@ 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<ForeignMessageLite, ForeignMessageLite.Builder> {
- private static readonly ForeignMessageLite defaultInstance = new Builder().BuildPartial();
+ private ForeignMessageLite() { }
+ 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 {
@@ -5799,7 +6138,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override ForeignMessageLite DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override ForeignMessageLite ThisMessage {
@@ -5894,11 +6233,15 @@ 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(); }
public static Builder CreateBuilder(ForeignMessageLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -5908,21 +6251,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(ForeignMessageLite cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- ForeignMessageLite result = new ForeignMessageLite();
+ private bool resultIsReadOnly;
+ private ForeignMessageLite result;
+
+ private ForeignMessageLite PrepareBuilder() {
+ if (resultIsReadOnly) {
+ ForeignMessageLite original = result;
+ result = new ForeignMessageLite();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override ForeignMessageLite DefaultInstanceForType {
@@ -5930,12 +6300,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 (resultIsReadOnly) {
+ return result;
}
- ForeignMessageLite returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -5949,6 +6318,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 +6330,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 +6373,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;
@@ -6021,7 +6394,8 @@ 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<TestPackedTypesLite, TestPackedTypesLite.Builder> {
- private static readonly TestPackedTypesLite defaultInstance = new Builder().BuildPartial();
+ private TestPackedTypesLite() { }
+ 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 {
@@ -6029,7 +6403,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestPackedTypesLite DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestPackedTypesLite ThisMessage {
@@ -6562,11 +6936,29 @@ 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(); }
public static Builder CreateBuilder(TestPackedTypesLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -6576,21 +6968,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestPackedTypesLite cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestPackedTypesLite result;
+
+ private TestPackedTypesLite PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestPackedTypesLite original = result;
+ result = new TestPackedTypesLite();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestPackedTypesLite result = new TestPackedTypesLite();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestPackedTypesLite DefaultInstanceForType {
@@ -6598,26 +7017,11 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestPackedTypesLite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
- }
- 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();
- TestPackedTypesLite returnMe = result;
- result = null;
- return returnMe;
+ if (resultIsReadOnly) {
+ return result;
+ }
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -6631,47 +7035,48 @@ 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_);
+ 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;
}
@@ -6681,6 +7086,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 +7189,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList<int> PackedInt32List {
- get { return result.packedInt32_; }
+ get { return PrepareBuilder().packedInt32_; }
}
public int PackedInt32Count {
get { return result.PackedInt32Count; }
@@ -6792,24 +7198,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<int> values) {
- base.AddRange(values, result.packedInt32_);
+ PrepareBuilder();
+ result.packedInt32_.Add(values);
return this;
}
public Builder ClearPackedInt32() {
+ PrepareBuilder();
result.packedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<long> PackedInt64List {
- get { return result.packedInt64_; }
+ get { return PrepareBuilder().packedInt64_; }
}
public int PackedInt64Count {
get { return result.PackedInt64Count; }
@@ -6818,25 +7228,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<long> values) {
- base.AddRange(values, result.packedInt64_);
+ PrepareBuilder();
+ result.packedInt64_.Add(values);
return this;
}
public Builder ClearPackedInt64() {
+ PrepareBuilder();
result.packedInt64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> PackedUint32List {
- get { return result.packedUint32_; }
+ get { return PrepareBuilder().packedUint32_; }
}
public int PackedUint32Count {
get { return result.PackedUint32Count; }
@@ -6847,27 +7261,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<uint> values) {
- base.AddRange(values, result.packedUint32_);
+ PrepareBuilder();
+ result.packedUint32_.Add(values);
return this;
}
public Builder ClearPackedUint32() {
+ PrepareBuilder();
result.packedUint32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> PackedUint64List {
- get { return result.packedUint64_; }
+ get { return PrepareBuilder().packedUint64_; }
}
public int PackedUint64Count {
get { return result.PackedUint64Count; }
@@ -6878,26 +7296,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<ulong> values) {
- base.AddRange(values, result.packedUint64_);
+ PrepareBuilder();
+ result.packedUint64_.Add(values);
return this;
}
public Builder ClearPackedUint64() {
+ PrepareBuilder();
result.packedUint64_.Clear();
return this;
}
public pbc::IPopsicleList<int> PackedSint32List {
- get { return result.packedSint32_; }
+ get { return PrepareBuilder().packedSint32_; }
}
public int PackedSint32Count {
get { return result.PackedSint32Count; }
@@ -6906,24 +7328,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<int> values) {
- base.AddRange(values, result.packedSint32_);
+ PrepareBuilder();
+ result.packedSint32_.Add(values);
return this;
}
public Builder ClearPackedSint32() {
+ PrepareBuilder();
result.packedSint32_.Clear();
return this;
}
public pbc::IPopsicleList<long> PackedSint64List {
- get { return result.packedSint64_; }
+ get { return PrepareBuilder().packedSint64_; }
}
public int PackedSint64Count {
get { return result.PackedSint64Count; }
@@ -6932,25 +7358,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<long> values) {
- base.AddRange(values, result.packedSint64_);
+ PrepareBuilder();
+ result.packedSint64_.Add(values);
return this;
}
public Builder ClearPackedSint64() {
+ PrepareBuilder();
result.packedSint64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> PackedFixed32List {
- get { return result.packedFixed32_; }
+ get { return PrepareBuilder().packedFixed32_; }
}
public int PackedFixed32Count {
get { return result.PackedFixed32Count; }
@@ -6961,27 +7391,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<uint> values) {
- base.AddRange(values, result.packedFixed32_);
+ PrepareBuilder();
+ result.packedFixed32_.Add(values);
return this;
}
public Builder ClearPackedFixed32() {
+ PrepareBuilder();
result.packedFixed32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> PackedFixed64List {
- get { return result.packedFixed64_; }
+ get { return PrepareBuilder().packedFixed64_; }
}
public int PackedFixed64Count {
get { return result.PackedFixed64Count; }
@@ -6992,26 +7426,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<ulong> values) {
- base.AddRange(values, result.packedFixed64_);
+ PrepareBuilder();
+ result.packedFixed64_.Add(values);
return this;
}
public Builder ClearPackedFixed64() {
+ PrepareBuilder();
result.packedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<int> PackedSfixed32List {
- get { return result.packedSfixed32_; }
+ get { return PrepareBuilder().packedSfixed32_; }
}
public int PackedSfixed32Count {
get { return result.PackedSfixed32Count; }
@@ -7020,24 +7458,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<int> values) {
- base.AddRange(values, result.packedSfixed32_);
+ PrepareBuilder();
+ result.packedSfixed32_.Add(values);
return this;
}
public Builder ClearPackedSfixed32() {
+ PrepareBuilder();
result.packedSfixed32_.Clear();
return this;
}
public pbc::IPopsicleList<long> PackedSfixed64List {
- get { return result.packedSfixed64_; }
+ get { return PrepareBuilder().packedSfixed64_; }
}
public int PackedSfixed64Count {
get { return result.PackedSfixed64Count; }
@@ -7046,24 +7488,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<long> values) {
- base.AddRange(values, result.packedSfixed64_);
+ PrepareBuilder();
+ result.packedSfixed64_.Add(values);
return this;
}
public Builder ClearPackedSfixed64() {
+ PrepareBuilder();
result.packedSfixed64_.Clear();
return this;
}
public pbc::IPopsicleList<float> PackedFloatList {
- get { return result.packedFloat_; }
+ get { return PrepareBuilder().packedFloat_; }
}
public int PackedFloatCount {
get { return result.PackedFloatCount; }
@@ -7072,24 +7518,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<float> values) {
- base.AddRange(values, result.packedFloat_);
+ PrepareBuilder();
+ result.packedFloat_.Add(values);
return this;
}
public Builder ClearPackedFloat() {
+ PrepareBuilder();
result.packedFloat_.Clear();
return this;
}
public pbc::IPopsicleList<double> PackedDoubleList {
- get { return result.packedDouble_; }
+ get { return PrepareBuilder().packedDouble_; }
}
public int PackedDoubleCount {
get { return result.PackedDoubleCount; }
@@ -7098,24 +7548,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<double> values) {
- base.AddRange(values, result.packedDouble_);
+ PrepareBuilder();
+ result.packedDouble_.Add(values);
return this;
}
public Builder ClearPackedDouble() {
+ PrepareBuilder();
result.packedDouble_.Clear();
return this;
}
public pbc::IPopsicleList<bool> PackedBoolList {
- get { return result.packedBool_; }
+ get { return PrepareBuilder().packedBool_; }
}
public int PackedBoolCount {
get { return result.PackedBoolCount; }
@@ -7124,24 +7578,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<bool> values) {
- base.AddRange(values, result.packedBool_);
+ PrepareBuilder();
+ result.packedBool_.Add(values);
return this;
}
public Builder ClearPackedBool() {
+ PrepareBuilder();
result.packedBool_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite> PackedEnumList {
- get { return result.packedEnum_; }
+ get { return PrepareBuilder().packedEnum_; }
}
public int PackedEnumCount {
get { return result.PackedEnumCount; }
@@ -7150,18 +7608,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<global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite> values) {
- base.AddRange(values, result.packedEnum_);
+ PrepareBuilder();
+ result.packedEnum_.Add(values);
return this;
}
public Builder ClearPackedEnum() {
+ PrepareBuilder();
result.packedEnum_.Clear();
return this;
}
@@ -7175,7 +7637,8 @@ 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<TestUnpackedTypesLite, TestUnpackedTypesLite.Builder> {
- private static readonly TestUnpackedTypesLite defaultInstance = new Builder().BuildPartial();
+ private TestUnpackedTypesLite() { }
+ 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 {
@@ -7183,7 +7646,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestUnpackedTypesLite DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestUnpackedTypesLite ThisMessage {
@@ -7661,11 +8124,29 @@ 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(); }
public static Builder CreateBuilder(TestUnpackedTypesLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -7675,21 +8156,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestUnpackedTypesLite cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestUnpackedTypesLite result;
+
+ private TestUnpackedTypesLite PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestUnpackedTypesLite original = result;
+ result = new TestUnpackedTypesLite();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestUnpackedTypesLite result = new TestUnpackedTypesLite();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestUnpackedTypesLite DefaultInstanceForType {
@@ -7697,26 +8205,11 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestUnpackedTypesLite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
- }
- 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();
- TestUnpackedTypesLite returnMe = result;
- result = null;
- return returnMe;
+ if (resultIsReadOnly) {
+ return result;
+ }
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -7730,47 +8223,48 @@ 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_);
+ 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;
}
@@ -7780,6 +8274,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 +8377,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList<int> UnpackedInt32List {
- get { return result.unpackedInt32_; }
+ get { return PrepareBuilder().unpackedInt32_; }
}
public int UnpackedInt32Count {
get { return result.UnpackedInt32Count; }
@@ -7891,24 +8386,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<int> values) {
- base.AddRange(values, result.unpackedInt32_);
+ PrepareBuilder();
+ result.unpackedInt32_.Add(values);
return this;
}
public Builder ClearUnpackedInt32() {
+ PrepareBuilder();
result.unpackedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<long> UnpackedInt64List {
- get { return result.unpackedInt64_; }
+ get { return PrepareBuilder().unpackedInt64_; }
}
public int UnpackedInt64Count {
get { return result.UnpackedInt64Count; }
@@ -7917,25 +8416,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<long> values) {
- base.AddRange(values, result.unpackedInt64_);
+ PrepareBuilder();
+ result.unpackedInt64_.Add(values);
return this;
}
public Builder ClearUnpackedInt64() {
+ PrepareBuilder();
result.unpackedInt64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> UnpackedUint32List {
- get { return result.unpackedUint32_; }
+ get { return PrepareBuilder().unpackedUint32_; }
}
public int UnpackedUint32Count {
get { return result.UnpackedUint32Count; }
@@ -7946,27 +8449,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<uint> values) {
- base.AddRange(values, result.unpackedUint32_);
+ PrepareBuilder();
+ result.unpackedUint32_.Add(values);
return this;
}
public Builder ClearUnpackedUint32() {
+ PrepareBuilder();
result.unpackedUint32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> UnpackedUint64List {
- get { return result.unpackedUint64_; }
+ get { return PrepareBuilder().unpackedUint64_; }
}
public int UnpackedUint64Count {
get { return result.UnpackedUint64Count; }
@@ -7977,26 +8484,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<ulong> values) {
- base.AddRange(values, result.unpackedUint64_);
+ PrepareBuilder();
+ result.unpackedUint64_.Add(values);
return this;
}
public Builder ClearUnpackedUint64() {
+ PrepareBuilder();
result.unpackedUint64_.Clear();
return this;
}
public pbc::IPopsicleList<int> UnpackedSint32List {
- get { return result.unpackedSint32_; }
+ get { return PrepareBuilder().unpackedSint32_; }
}
public int UnpackedSint32Count {
get { return result.UnpackedSint32Count; }
@@ -8005,24 +8516,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<int> values) {
- base.AddRange(values, result.unpackedSint32_);
+ PrepareBuilder();
+ result.unpackedSint32_.Add(values);
return this;
}
public Builder ClearUnpackedSint32() {
+ PrepareBuilder();
result.unpackedSint32_.Clear();
return this;
}
public pbc::IPopsicleList<long> UnpackedSint64List {
- get { return result.unpackedSint64_; }
+ get { return PrepareBuilder().unpackedSint64_; }
}
public int UnpackedSint64Count {
get { return result.UnpackedSint64Count; }
@@ -8031,25 +8546,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<long> values) {
- base.AddRange(values, result.unpackedSint64_);
+ PrepareBuilder();
+ result.unpackedSint64_.Add(values);
return this;
}
public Builder ClearUnpackedSint64() {
+ PrepareBuilder();
result.unpackedSint64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> UnpackedFixed32List {
- get { return result.unpackedFixed32_; }
+ get { return PrepareBuilder().unpackedFixed32_; }
}
public int UnpackedFixed32Count {
get { return result.UnpackedFixed32Count; }
@@ -8060,27 +8579,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<uint> values) {
- base.AddRange(values, result.unpackedFixed32_);
+ PrepareBuilder();
+ result.unpackedFixed32_.Add(values);
return this;
}
public Builder ClearUnpackedFixed32() {
+ PrepareBuilder();
result.unpackedFixed32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> UnpackedFixed64List {
- get { return result.unpackedFixed64_; }
+ get { return PrepareBuilder().unpackedFixed64_; }
}
public int UnpackedFixed64Count {
get { return result.UnpackedFixed64Count; }
@@ -8091,26 +8614,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<ulong> values) {
- base.AddRange(values, result.unpackedFixed64_);
+ PrepareBuilder();
+ result.unpackedFixed64_.Add(values);
return this;
}
public Builder ClearUnpackedFixed64() {
+ PrepareBuilder();
result.unpackedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<int> UnpackedSfixed32List {
- get { return result.unpackedSfixed32_; }
+ get { return PrepareBuilder().unpackedSfixed32_; }
}
public int UnpackedSfixed32Count {
get { return result.UnpackedSfixed32Count; }
@@ -8119,24 +8646,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<int> values) {
- base.AddRange(values, result.unpackedSfixed32_);
+ PrepareBuilder();
+ result.unpackedSfixed32_.Add(values);
return this;
}
public Builder ClearUnpackedSfixed32() {
+ PrepareBuilder();
result.unpackedSfixed32_.Clear();
return this;
}
public pbc::IPopsicleList<long> UnpackedSfixed64List {
- get { return result.unpackedSfixed64_; }
+ get { return PrepareBuilder().unpackedSfixed64_; }
}
public int UnpackedSfixed64Count {
get { return result.UnpackedSfixed64Count; }
@@ -8145,24 +8676,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<long> values) {
- base.AddRange(values, result.unpackedSfixed64_);
+ PrepareBuilder();
+ result.unpackedSfixed64_.Add(values);
return this;
}
public Builder ClearUnpackedSfixed64() {
+ PrepareBuilder();
result.unpackedSfixed64_.Clear();
return this;
}
public pbc::IPopsicleList<float> UnpackedFloatList {
- get { return result.unpackedFloat_; }
+ get { return PrepareBuilder().unpackedFloat_; }
}
public int UnpackedFloatCount {
get { return result.UnpackedFloatCount; }
@@ -8171,24 +8706,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<float> values) {
- base.AddRange(values, result.unpackedFloat_);
+ PrepareBuilder();
+ result.unpackedFloat_.Add(values);
return this;
}
public Builder ClearUnpackedFloat() {
+ PrepareBuilder();
result.unpackedFloat_.Clear();
return this;
}
public pbc::IPopsicleList<double> UnpackedDoubleList {
- get { return result.unpackedDouble_; }
+ get { return PrepareBuilder().unpackedDouble_; }
}
public int UnpackedDoubleCount {
get { return result.UnpackedDoubleCount; }
@@ -8197,24 +8736,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<double> values) {
- base.AddRange(values, result.unpackedDouble_);
+ PrepareBuilder();
+ result.unpackedDouble_.Add(values);
return this;
}
public Builder ClearUnpackedDouble() {
+ PrepareBuilder();
result.unpackedDouble_.Clear();
return this;
}
public pbc::IPopsicleList<bool> UnpackedBoolList {
- get { return result.unpackedBool_; }
+ get { return PrepareBuilder().unpackedBool_; }
}
public int UnpackedBoolCount {
get { return result.UnpackedBoolCount; }
@@ -8223,24 +8766,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<bool> values) {
- base.AddRange(values, result.unpackedBool_);
+ PrepareBuilder();
+ result.unpackedBool_.Add(values);
return this;
}
public Builder ClearUnpackedBool() {
+ PrepareBuilder();
result.unpackedBool_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite> UnpackedEnumList {
- get { return result.unpackedEnum_; }
+ get { return PrepareBuilder().unpackedEnum_; }
}
public int UnpackedEnumCount {
get { return result.UnpackedEnumCount; }
@@ -8249,18 +8796,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<global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite> values) {
- base.AddRange(values, result.unpackedEnum_);
+ PrepareBuilder();
+ result.unpackedEnum_.Add(values);
return this;
}
public Builder ClearUnpackedEnum() {
+ PrepareBuilder();
result.unpackedEnum_.Clear();
return this;
}
@@ -8274,7 +8825,8 @@ 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<TestAllExtensionsLite, TestAllExtensionsLite.Builder> {
- private static readonly TestAllExtensionsLite defaultInstance = new Builder().BuildPartial();
+ private TestAllExtensionsLite() { }
+ 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 {
@@ -8282,7 +8834,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestAllExtensionsLite DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestAllExtensionsLite ThisMessage {
@@ -8365,11 +8917,15 @@ 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(); }
public static Builder CreateBuilder(TestAllExtensionsLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -8379,21 +8935,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestAllExtensionsLite cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestAllExtensionsLite result = new TestAllExtensionsLite();
+ private bool resultIsReadOnly;
+ private TestAllExtensionsLite result;
+
+ private TestAllExtensionsLite PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestAllExtensionsLite original = result;
+ result = new TestAllExtensionsLite();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestAllExtensionsLite DefaultInstanceForType {
@@ -8401,12 +8984,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 (resultIsReadOnly) {
+ return result;
}
- TestAllExtensionsLite returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -8420,6 +9002,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 +9012,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)) {
@@ -8468,7 +9052,8 @@ 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<OptionalGroup_extension_lite, OptionalGroup_extension_lite.Builder> {
- private static readonly OptionalGroup_extension_lite defaultInstance = new Builder().BuildPartial();
+ private OptionalGroup_extension_lite() { }
+ 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 {
@@ -8476,7 +9061,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override OptionalGroup_extension_lite DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override OptionalGroup_extension_lite ThisMessage {
@@ -8571,11 +9156,15 @@ 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(); }
public static Builder CreateBuilder(OptionalGroup_extension_lite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -8585,21 +9174,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(OptionalGroup_extension_lite cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- OptionalGroup_extension_lite result = new OptionalGroup_extension_lite();
+ private bool resultIsReadOnly;
+ private OptionalGroup_extension_lite result;
+
+ private OptionalGroup_extension_lite PrepareBuilder() {
+ if (resultIsReadOnly) {
+ OptionalGroup_extension_lite original = result;
+ result = new OptionalGroup_extension_lite();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override OptionalGroup_extension_lite DefaultInstanceForType {
@@ -8607,12 +9223,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 (resultIsReadOnly) {
+ return result;
}
- OptionalGroup_extension_lite returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -8626,6 +9241,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 +9253,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 +9296,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;
@@ -8698,7 +9317,8 @@ 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<RepeatedGroup_extension_lite, RepeatedGroup_extension_lite.Builder> {
- private static readonly RepeatedGroup_extension_lite defaultInstance = new Builder().BuildPartial();
+ private RepeatedGroup_extension_lite() { }
+ 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 {
@@ -8706,7 +9326,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override RepeatedGroup_extension_lite DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override RepeatedGroup_extension_lite ThisMessage {
@@ -8801,11 +9421,15 @@ 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(); }
public static Builder CreateBuilder(RepeatedGroup_extension_lite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -8815,21 +9439,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(RepeatedGroup_extension_lite cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private RepeatedGroup_extension_lite result;
- RepeatedGroup_extension_lite result = new RepeatedGroup_extension_lite();
+ private RepeatedGroup_extension_lite PrepareBuilder() {
+ if (resultIsReadOnly) {
+ RepeatedGroup_extension_lite original = result;
+ result = new RepeatedGroup_extension_lite();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override RepeatedGroup_extension_lite DefaultInstanceForType {
@@ -8837,12 +9488,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 (resultIsReadOnly) {
+ return result;
}
- RepeatedGroup_extension_lite returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -8856,6 +9506,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 +9518,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 +9561,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;
@@ -8928,7 +9582,8 @@ 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<TestPackedExtensionsLite, TestPackedExtensionsLite.Builder> {
- private static readonly TestPackedExtensionsLite defaultInstance = new Builder().BuildPartial();
+ private TestPackedExtensionsLite() { }
+ 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 {
@@ -8936,7 +9591,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestPackedExtensionsLite DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestPackedExtensionsLite ThisMessage {
@@ -9019,11 +9674,15 @@ 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(); }
public static Builder CreateBuilder(TestPackedExtensionsLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9033,21 +9692,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestPackedExtensionsLite cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestPackedExtensionsLite result = new TestPackedExtensionsLite();
+ private bool resultIsReadOnly;
+ private TestPackedExtensionsLite result;
+
+ private TestPackedExtensionsLite PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestPackedExtensionsLite original = result;
+ result = new TestPackedExtensionsLite();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestPackedExtensionsLite DefaultInstanceForType {
@@ -9055,12 +9741,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 (resultIsReadOnly) {
+ return result;
}
- TestPackedExtensionsLite returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -9074,6 +9759,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 +9769,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)) {
@@ -9122,7 +9809,8 @@ 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<TestUnpackedExtensionsLite, TestUnpackedExtensionsLite.Builder> {
- private static readonly TestUnpackedExtensionsLite defaultInstance = new Builder().BuildPartial();
+ private TestUnpackedExtensionsLite() { }
+ 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 {
@@ -9130,7 +9818,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestUnpackedExtensionsLite DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestUnpackedExtensionsLite ThisMessage {
@@ -9213,11 +9901,15 @@ 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(); }
public static Builder CreateBuilder(TestUnpackedExtensionsLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9227,21 +9919,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestUnpackedExtensionsLite cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestUnpackedExtensionsLite result = new TestUnpackedExtensionsLite();
+ private bool resultIsReadOnly;
+ private TestUnpackedExtensionsLite result;
+
+ private TestUnpackedExtensionsLite PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestUnpackedExtensionsLite original = result;
+ result = new TestUnpackedExtensionsLite();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestUnpackedExtensionsLite DefaultInstanceForType {
@@ -9249,12 +9968,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 (resultIsReadOnly) {
+ return result;
}
- TestUnpackedExtensionsLite returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -9268,6 +9986,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 +9996,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)) {
@@ -9316,7 +10036,8 @@ 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<TestNestedExtensionLite, TestNestedExtensionLite.Builder> {
- private static readonly TestNestedExtensionLite defaultInstance = new Builder().BuildPartial();
+ private TestNestedExtensionLite() { }
+ 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 {
@@ -9324,7 +10045,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestNestedExtensionLite DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestNestedExtensionLite ThisMessage {
@@ -9402,11 +10123,15 @@ 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(); }
public static Builder CreateBuilder(TestNestedExtensionLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9416,21 +10141,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestNestedExtensionLite cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestNestedExtensionLite result;
- TestNestedExtensionLite result = new TestNestedExtensionLite();
+ private TestNestedExtensionLite PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestNestedExtensionLite original = result;
+ result = new TestNestedExtensionLite();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestNestedExtensionLite DefaultInstanceForType {
@@ -9438,12 +10190,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 (resultIsReadOnly) {
+ return result;
}
- TestNestedExtensionLite returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -9457,6 +10208,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 +10217,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)) {
@@ -9504,7 +10257,8 @@ 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<TestDeprecatedLite, TestDeprecatedLite.Builder> {
- private static readonly TestDeprecatedLite defaultInstance = new Builder().BuildPartial();
+ private TestDeprecatedLite() { }
+ 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 {
@@ -9512,7 +10266,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestDeprecatedLite DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestDeprecatedLite ThisMessage {
@@ -9522,9 +10276,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_; }
}
@@ -9607,11 +10363,15 @@ 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(); }
public static Builder CreateBuilder(TestDeprecatedLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9621,21 +10381,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestDeprecatedLite cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestDeprecatedLite result;
+
+ private TestDeprecatedLite PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestDeprecatedLite original = result;
+ result = new TestDeprecatedLite();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestDeprecatedLite result = new TestDeprecatedLite();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestDeprecatedLite DefaultInstanceForType {
@@ -9643,12 +10430,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 (resultIsReadOnly) {
+ return result;
}
- TestDeprecatedLite returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -9662,6 +10448,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 +10460,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)) {
@@ -9707,19 +10495,25 @@ 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) {
+ PrepareBuilder();
result.hasDeprecatedField = true;
result.deprecatedField_ = value;
return this;
}
+ [global::System.ObsoleteAttribute()]
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 d8824d49..35064953 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;
@@ -1122,7 +1122,8 @@ 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<TestAllTypes, TestAllTypes.Builder> {
- private static readonly TestAllTypes defaultInstance = new Builder().BuildPartial();
+ private TestAllTypes() { }
+ 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 +1131,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestAllTypes DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestAllTypes ThisMessage {
@@ -1162,7 +1163,8 @@ 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<NestedMessage, NestedMessage.Builder> {
- private static readonly NestedMessage defaultInstance = new Builder().BuildPartial();
+ private NestedMessage() { }
+ 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 +1172,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override NestedMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override NestedMessage ThisMessage {
@@ -1256,11 +1258,15 @@ 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(); }
public static Builder CreateBuilder(NestedMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1270,21 +1276,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(NestedMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private NestedMessage result;
+
+ private NestedMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ NestedMessage original = result;
+ result = new NestedMessage();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1296,12 +1329,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 (resultIsReadOnly) {
+ return result;
}
- NestedMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1315,6 +1347,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 +1360,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 +1416,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;
@@ -1401,7 +1437,8 @@ 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<OptionalGroup, OptionalGroup.Builder> {
- private static readonly OptionalGroup defaultInstance = new Builder().BuildPartial();
+ private OptionalGroup() { }
+ 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 {
@@ -1409,7 +1446,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override OptionalGroup DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override OptionalGroup ThisMessage {
@@ -1495,11 +1532,15 @@ 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(); }
public static Builder CreateBuilder(OptionalGroup prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1509,21 +1550,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(OptionalGroup cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private OptionalGroup result;
+
+ private OptionalGroup PrepareBuilder() {
+ if (resultIsReadOnly) {
+ OptionalGroup original = result;
+ result = new OptionalGroup();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1535,12 +1603,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 (resultIsReadOnly) {
+ return result;
}
- OptionalGroup returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1554,6 +1621,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 +1634,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 +1690,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;
@@ -1640,7 +1711,8 @@ 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<RepeatedGroup, RepeatedGroup.Builder> {
- private static readonly RepeatedGroup defaultInstance = new Builder().BuildPartial();
+ private RepeatedGroup() { }
+ 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 {
@@ -1648,7 +1720,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override RepeatedGroup DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override RepeatedGroup ThisMessage {
@@ -1734,11 +1806,15 @@ 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(); }
public static Builder CreateBuilder(RepeatedGroup prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1748,21 +1824,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(RepeatedGroup cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private RepeatedGroup result;
+
+ private RepeatedGroup PrepareBuilder() {
+ if (resultIsReadOnly) {
+ RepeatedGroup original = result;
+ result = new RepeatedGroup();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1774,12 +1877,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 (resultIsReadOnly) {
+ return result;
}
- RepeatedGroup returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1793,6 +1895,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 +1908,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 +1964,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;
@@ -2034,42 +2140,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;
@@ -3177,11 +3283,39 @@ 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(); }
public static Builder CreateBuilder(TestAllTypes prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -3191,21 +3325,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestAllTypes cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestAllTypes result;
+
+ private TestAllTypes PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestAllTypes original = result;
+ result = new TestAllTypes();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -3217,36 +3378,11 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestAllTypes BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
- }
- 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();
- TestAllTypes returnMe = result;
- result = null;
- return returnMe;
+ if (resultIsReadOnly) {
+ return result;
+ }
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -3260,6 +3396,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;
}
@@ -3333,76 +3470,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;
@@ -3473,6 +3610,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 +4045,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 +4065,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 +4087,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 +4109,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 +4129,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 +4149,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 +4171,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 +4193,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 +4213,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 +4233,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 +4253,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 +4273,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 +4293,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 +4314,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 +4335,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 +4356,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,8 +4381,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearOptionalGroup() {
+ PrepareBuilder();
result.hasOptionalGroup = false;
- result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance;
+ result.optionalGroup_ = null;
return this;
}
@@ -4224,18 +4396,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,8 +4421,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearOptionalNestedMessage() {
+ PrepareBuilder();
result.hasOptionalNestedMessage = false;
- result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance;
+ result.optionalNestedMessage_ = null;
return this;
}
@@ -4260,18 +4436,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,8 +4461,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearOptionalForeignMessage() {
+ PrepareBuilder();
result.hasOptionalForeignMessage = false;
- result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance;
+ result.optionalForeignMessage_ = null;
return this;
}
@@ -4296,18 +4476,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,8 +4501,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearOptionalImportMessage() {
+ PrepareBuilder();
result.hasOptionalImportMessage = false;
- result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance;
+ result.optionalImportMessage_ = null;
return this;
}
@@ -4331,11 +4515,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 +4535,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 +4555,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 +4576,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 +4597,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<int> RepeatedInt32List {
- get { return result.repeatedInt32_; }
+ get { return PrepareBuilder().repeatedInt32_; }
}
public int RepeatedInt32Count {
get { return result.RepeatedInt32Count; }
@@ -4425,24 +4619,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<int> values) {
- base.AddRange(values, result.repeatedInt32_);
+ PrepareBuilder();
+ result.repeatedInt32_.Add(values);
return this;
}
public Builder ClearRepeatedInt32() {
+ PrepareBuilder();
result.repeatedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedInt64List {
- get { return result.repeatedInt64_; }
+ get { return PrepareBuilder().repeatedInt64_; }
}
public int RepeatedInt64Count {
get { return result.RepeatedInt64Count; }
@@ -4451,25 +4649,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<long> values) {
- base.AddRange(values, result.repeatedInt64_);
+ PrepareBuilder();
+ result.repeatedInt64_.Add(values);
return this;
}
public Builder ClearRepeatedInt64() {
+ PrepareBuilder();
result.repeatedInt64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> RepeatedUint32List {
- get { return result.repeatedUint32_; }
+ get { return PrepareBuilder().repeatedUint32_; }
}
public int RepeatedUint32Count {
get { return result.RepeatedUint32Count; }
@@ -4480,27 +4682,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<uint> values) {
- base.AddRange(values, result.repeatedUint32_);
+ PrepareBuilder();
+ result.repeatedUint32_.Add(values);
return this;
}
public Builder ClearRepeatedUint32() {
+ PrepareBuilder();
result.repeatedUint32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> RepeatedUint64List {
- get { return result.repeatedUint64_; }
+ get { return PrepareBuilder().repeatedUint64_; }
}
public int RepeatedUint64Count {
get { return result.RepeatedUint64Count; }
@@ -4511,26 +4717,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<ulong> values) {
- base.AddRange(values, result.repeatedUint64_);
+ PrepareBuilder();
+ result.repeatedUint64_.Add(values);
return this;
}
public Builder ClearRepeatedUint64() {
+ PrepareBuilder();
result.repeatedUint64_.Clear();
return this;
}
public pbc::IPopsicleList<int> RepeatedSint32List {
- get { return result.repeatedSint32_; }
+ get { return PrepareBuilder().repeatedSint32_; }
}
public int RepeatedSint32Count {
get { return result.RepeatedSint32Count; }
@@ -4539,24 +4749,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<int> values) {
- base.AddRange(values, result.repeatedSint32_);
+ PrepareBuilder();
+ result.repeatedSint32_.Add(values);
return this;
}
public Builder ClearRepeatedSint32() {
+ PrepareBuilder();
result.repeatedSint32_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedSint64List {
- get { return result.repeatedSint64_; }
+ get { return PrepareBuilder().repeatedSint64_; }
}
public int RepeatedSint64Count {
get { return result.RepeatedSint64Count; }
@@ -4565,25 +4779,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<long> values) {
- base.AddRange(values, result.repeatedSint64_);
+ PrepareBuilder();
+ result.repeatedSint64_.Add(values);
return this;
}
public Builder ClearRepeatedSint64() {
+ PrepareBuilder();
result.repeatedSint64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> RepeatedFixed32List {
- get { return result.repeatedFixed32_; }
+ get { return PrepareBuilder().repeatedFixed32_; }
}
public int RepeatedFixed32Count {
get { return result.RepeatedFixed32Count; }
@@ -4594,27 +4812,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<uint> values) {
- base.AddRange(values, result.repeatedFixed32_);
+ PrepareBuilder();
+ result.repeatedFixed32_.Add(values);
return this;
}
public Builder ClearRepeatedFixed32() {
+ PrepareBuilder();
result.repeatedFixed32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> RepeatedFixed64List {
- get { return result.repeatedFixed64_; }
+ get { return PrepareBuilder().repeatedFixed64_; }
}
public int RepeatedFixed64Count {
get { return result.RepeatedFixed64Count; }
@@ -4625,26 +4847,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<ulong> values) {
- base.AddRange(values, result.repeatedFixed64_);
+ PrepareBuilder();
+ result.repeatedFixed64_.Add(values);
return this;
}
public Builder ClearRepeatedFixed64() {
+ PrepareBuilder();
result.repeatedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<int> RepeatedSfixed32List {
- get { return result.repeatedSfixed32_; }
+ get { return PrepareBuilder().repeatedSfixed32_; }
}
public int RepeatedSfixed32Count {
get { return result.RepeatedSfixed32Count; }
@@ -4653,24 +4879,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<int> values) {
- base.AddRange(values, result.repeatedSfixed32_);
+ PrepareBuilder();
+ result.repeatedSfixed32_.Add(values);
return this;
}
public Builder ClearRepeatedSfixed32() {
+ PrepareBuilder();
result.repeatedSfixed32_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedSfixed64List {
- get { return result.repeatedSfixed64_; }
+ get { return PrepareBuilder().repeatedSfixed64_; }
}
public int RepeatedSfixed64Count {
get { return result.RepeatedSfixed64Count; }
@@ -4679,24 +4909,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<long> values) {
- base.AddRange(values, result.repeatedSfixed64_);
+ PrepareBuilder();
+ result.repeatedSfixed64_.Add(values);
return this;
}
public Builder ClearRepeatedSfixed64() {
+ PrepareBuilder();
result.repeatedSfixed64_.Clear();
return this;
}
public pbc::IPopsicleList<float> RepeatedFloatList {
- get { return result.repeatedFloat_; }
+ get { return PrepareBuilder().repeatedFloat_; }
}
public int RepeatedFloatCount {
get { return result.RepeatedFloatCount; }
@@ -4705,24 +4939,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<float> values) {
- base.AddRange(values, result.repeatedFloat_);
+ PrepareBuilder();
+ result.repeatedFloat_.Add(values);
return this;
}
public Builder ClearRepeatedFloat() {
+ PrepareBuilder();
result.repeatedFloat_.Clear();
return this;
}
public pbc::IPopsicleList<double> RepeatedDoubleList {
- get { return result.repeatedDouble_; }
+ get { return PrepareBuilder().repeatedDouble_; }
}
public int RepeatedDoubleCount {
get { return result.RepeatedDoubleCount; }
@@ -4731,24 +4969,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<double> values) {
- base.AddRange(values, result.repeatedDouble_);
+ PrepareBuilder();
+ result.repeatedDouble_.Add(values);
return this;
}
public Builder ClearRepeatedDouble() {
+ PrepareBuilder();
result.repeatedDouble_.Clear();
return this;
}
public pbc::IPopsicleList<bool> RepeatedBoolList {
- get { return result.repeatedBool_; }
+ get { return PrepareBuilder().repeatedBool_; }
}
public int RepeatedBoolCount {
get { return result.RepeatedBoolCount; }
@@ -4757,24 +4999,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<bool> values) {
- base.AddRange(values, result.repeatedBool_);
+ PrepareBuilder();
+ result.repeatedBool_.Add(values);
return this;
}
public Builder ClearRepeatedBool() {
+ PrepareBuilder();
result.repeatedBool_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedStringList {
- get { return result.repeatedString_; }
+ get { return PrepareBuilder().repeatedString_; }
}
public int RepeatedStringCount {
get { return result.RepeatedStringCount; }
@@ -4784,25 +5030,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<string> values) {
- base.AddRange(values, result.repeatedString_);
+ PrepareBuilder();
+ result.repeatedString_.Add(values);
return this;
}
public Builder ClearRepeatedString() {
+ PrepareBuilder();
result.repeatedString_.Clear();
return this;
}
public pbc::IPopsicleList<pb::ByteString> RepeatedBytesList {
- get { return result.repeatedBytes_; }
+ get { return PrepareBuilder().repeatedBytes_; }
}
public int RepeatedBytesCount {
get { return result.RepeatedBytesCount; }
@@ -4812,25 +5062,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<pb::ByteString> values) {
- base.AddRange(values, result.repeatedBytes_);
+ PrepareBuilder();
+ result.repeatedBytes_.Add(values);
return this;
}
public Builder ClearRepeatedBytes() {
+ PrepareBuilder();
result.repeatedBytes_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup> RepeatedGroupList {
- get { return result.repeatedGroup_; }
+ get { return PrepareBuilder().repeatedGroup_; }
}
public int RepeatedGroupCount {
get { return result.RepeatedGroupCount; }
@@ -4840,35 +5094,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<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup> values) {
- base.AddRange(values, result.repeatedGroup_);
+ PrepareBuilder();
+ result.repeatedGroup_.Add(values);
return this;
}
public Builder ClearRepeatedGroup() {
+ PrepareBuilder();
result.repeatedGroup_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage> RepeatedNestedMessageList {
- get { return result.repeatedNestedMessage_; }
+ get { return PrepareBuilder().repeatedNestedMessage_; }
}
public int RepeatedNestedMessageCount {
get { return result.RepeatedNestedMessageCount; }
@@ -4878,35 +5138,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<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage> values) {
- base.AddRange(values, result.repeatedNestedMessage_);
+ PrepareBuilder();
+ result.repeatedNestedMessage_.Add(values);
return this;
}
public Builder ClearRepeatedNestedMessage() {
+ PrepareBuilder();
result.repeatedNestedMessage_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> RepeatedForeignMessageList {
- get { return result.repeatedForeignMessage_; }
+ get { return PrepareBuilder().repeatedForeignMessage_; }
}
public int RepeatedForeignMessageCount {
get { return result.RepeatedForeignMessageCount; }
@@ -4916,35 +5182,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<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> values) {
- base.AddRange(values, result.repeatedForeignMessage_);
+ PrepareBuilder();
+ result.repeatedForeignMessage_.Add(values);
return this;
}
public Builder ClearRepeatedForeignMessage() {
+ PrepareBuilder();
result.repeatedForeignMessage_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ImportMessage> RepeatedImportMessageList {
- get { return result.repeatedImportMessage_; }
+ get { return PrepareBuilder().repeatedImportMessage_; }
}
public int RepeatedImportMessageCount {
get { return result.RepeatedImportMessageCount; }
@@ -4954,35 +5226,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<global::Google.ProtocolBuffers.TestProtos.ImportMessage> values) {
- base.AddRange(values, result.repeatedImportMessage_);
+ PrepareBuilder();
+ result.repeatedImportMessage_.Add(values);
return this;
}
public Builder ClearRepeatedImportMessage() {
+ PrepareBuilder();
result.repeatedImportMessage_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum> RepeatedNestedEnumList {
- get { return result.repeatedNestedEnum_; }
+ get { return PrepareBuilder().repeatedNestedEnum_; }
}
public int RepeatedNestedEnumCount {
get { return result.RepeatedNestedEnumCount; }
@@ -4991,24 +5269,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<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum> values) {
- base.AddRange(values, result.repeatedNestedEnum_);
+ PrepareBuilder();
+ result.repeatedNestedEnum_.Add(values);
return this;
}
public Builder ClearRepeatedNestedEnum() {
+ PrepareBuilder();
result.repeatedNestedEnum_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> RepeatedForeignEnumList {
- get { return result.repeatedForeignEnum_; }
+ get { return PrepareBuilder().repeatedForeignEnum_; }
}
public int RepeatedForeignEnumCount {
get { return result.RepeatedForeignEnumCount; }
@@ -5017,24 +5299,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<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> values) {
- base.AddRange(values, result.repeatedForeignEnum_);
+ PrepareBuilder();
+ result.repeatedForeignEnum_.Add(values);
return this;
}
public Builder ClearRepeatedForeignEnum() {
+ PrepareBuilder();
result.repeatedForeignEnum_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ImportEnum> RepeatedImportEnumList {
- get { return result.repeatedImportEnum_; }
+ get { return PrepareBuilder().repeatedImportEnum_; }
}
public int RepeatedImportEnumCount {
get { return result.RepeatedImportEnumCount; }
@@ -5043,24 +5329,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<global::Google.ProtocolBuffers.TestProtos.ImportEnum> values) {
- base.AddRange(values, result.repeatedImportEnum_);
+ PrepareBuilder();
+ result.repeatedImportEnum_.Add(values);
return this;
}
public Builder ClearRepeatedImportEnum() {
+ PrepareBuilder();
result.repeatedImportEnum_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedStringPieceList {
- get { return result.repeatedStringPiece_; }
+ get { return PrepareBuilder().repeatedStringPiece_; }
}
public int RepeatedStringPieceCount {
get { return result.RepeatedStringPieceCount; }
@@ -5070,25 +5360,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<string> values) {
- base.AddRange(values, result.repeatedStringPiece_);
+ PrepareBuilder();
+ result.repeatedStringPiece_.Add(values);
return this;
}
public Builder ClearRepeatedStringPiece() {
+ PrepareBuilder();
result.repeatedStringPiece_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedCordList {
- get { return result.repeatedCord_; }
+ get { return PrepareBuilder().repeatedCord_; }
}
public int RepeatedCordCount {
get { return result.RepeatedCordCount; }
@@ -5098,19 +5392,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<string> values) {
- base.AddRange(values, result.repeatedCord_);
+ PrepareBuilder();
+ result.repeatedCord_.Add(values);
return this;
}
public Builder ClearRepeatedCord() {
+ PrepareBuilder();
result.repeatedCord_.Clear();
return this;
}
@@ -5123,11 +5421,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 +5441,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 +5463,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 +5485,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 +5505,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 +5525,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 +5547,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 +5569,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 +5589,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 +5609,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 +5629,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 +5649,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 +5669,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 +5690,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 +5711,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 +5731,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 +5751,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 +5771,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 +5792,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 +5813,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;
@@ -5496,7 +5834,8 @@ 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<TestDeprecatedFields, TestDeprecatedFields.Builder> {
- private static readonly TestDeprecatedFields defaultInstance = new Builder().BuildPartial();
+ private TestDeprecatedFields() { }
+ 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 {
@@ -5504,7 +5843,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestDeprecatedFields DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestDeprecatedFields ThisMessage {
@@ -5522,9 +5861,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_; }
}
@@ -5590,11 +5931,15 @@ 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(); }
public static Builder CreateBuilder(TestDeprecatedFields prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -5604,21 +5949,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestDeprecatedFields cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestDeprecatedFields result;
+
+ private TestDeprecatedFields PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestDeprecatedFields original = result;
+ result = new TestDeprecatedFields();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestDeprecatedFields result = new TestDeprecatedFields();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -5630,12 +6002,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 (resultIsReadOnly) {
+ return result;
}
- TestDeprecatedFields returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -5649,6 +6020,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 +6033,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;
@@ -5708,19 +6081,25 @@ 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) {
+ PrepareBuilder();
result.hasDeprecatedInt32 = true;
result.deprecatedInt32_ = value;
return this;
}
+ [global::System.ObsoleteAttribute()]
public Builder ClearDeprecatedInt32() {
+ PrepareBuilder();
result.hasDeprecatedInt32 = false;
result.deprecatedInt32_ = 0;
return this;
@@ -5735,7 +6114,8 @@ 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<ForeignMessage, ForeignMessage.Builder> {
- private static readonly ForeignMessage defaultInstance = new Builder().BuildPartial();
+ private ForeignMessage() { }
+ 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 {
@@ -5743,7 +6123,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override ForeignMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override ForeignMessage ThisMessage {
@@ -5829,11 +6209,15 @@ 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(); }
public static Builder CreateBuilder(ForeignMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -5843,21 +6227,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(ForeignMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private ForeignMessage result;
+
+ private ForeignMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ ForeignMessage original = result;
+ result = new ForeignMessage();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- ForeignMessage result = new ForeignMessage();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -5869,12 +6280,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 (resultIsReadOnly) {
+ return result;
}
- ForeignMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -5888,6 +6298,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 +6311,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 +6367,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;
@@ -5974,7 +6388,8 @@ 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<TestAllExtensions, TestAllExtensions.Builder> {
- private static readonly TestAllExtensions defaultInstance = new Builder().BuildPartial();
+ private TestAllExtensions() { }
+ 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 {
@@ -5982,7 +6397,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestAllExtensions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestAllExtensions ThisMessage {
@@ -6056,11 +6471,15 @@ 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(); }
public static Builder CreateBuilder(TestAllExtensions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -6070,21 +6489,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestAllExtensions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestAllExtensions result;
+
+ private TestAllExtensions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestAllExtensions original = result;
+ result = new TestAllExtensions();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestAllExtensions result = new TestAllExtensions();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -6096,12 +6542,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 (resultIsReadOnly) {
+ return result;
}
- TestAllExtensions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -6115,6 +6560,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 +6571,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;
@@ -6177,7 +6624,8 @@ 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<OptionalGroup_extension, OptionalGroup_extension.Builder> {
- private static readonly OptionalGroup_extension defaultInstance = new Builder().BuildPartial();
+ private OptionalGroup_extension() { }
+ 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 {
@@ -6185,7 +6633,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override OptionalGroup_extension DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override OptionalGroup_extension ThisMessage {
@@ -6271,11 +6719,15 @@ 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(); }
public static Builder CreateBuilder(OptionalGroup_extension prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -6285,21 +6737,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(OptionalGroup_extension cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private OptionalGroup_extension result;
- OptionalGroup_extension result = new OptionalGroup_extension();
+ private OptionalGroup_extension PrepareBuilder() {
+ if (resultIsReadOnly) {
+ OptionalGroup_extension original = result;
+ result = new OptionalGroup_extension();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -6311,12 +6790,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 (resultIsReadOnly) {
+ return result;
}
- OptionalGroup_extension returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -6330,6 +6808,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 +6821,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 +6877,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;
@@ -6416,7 +6898,8 @@ 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<RepeatedGroup_extension, RepeatedGroup_extension.Builder> {
- private static readonly RepeatedGroup_extension defaultInstance = new Builder().BuildPartial();
+ private RepeatedGroup_extension() { }
+ 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 {
@@ -6424,7 +6907,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override RepeatedGroup_extension DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override RepeatedGroup_extension ThisMessage {
@@ -6510,11 +6993,15 @@ 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(); }
public static Builder CreateBuilder(RepeatedGroup_extension prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -6524,21 +7011,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(RepeatedGroup_extension cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private RepeatedGroup_extension result;
+
+ private RepeatedGroup_extension PrepareBuilder() {
+ if (resultIsReadOnly) {
+ RepeatedGroup_extension original = result;
+ result = new RepeatedGroup_extension();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -6550,12 +7064,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 (resultIsReadOnly) {
+ return result;
}
- RepeatedGroup_extension returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -6569,6 +7082,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 +7095,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 +7151,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;
@@ -6655,7 +7172,8 @@ 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<TestNestedExtension, TestNestedExtension.Builder> {
- private static readonly TestNestedExtension defaultInstance = new Builder().BuildPartial();
+ private TestNestedExtension() { }
+ 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 {
@@ -6663,7 +7181,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestNestedExtension DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestNestedExtension ThisMessage {
@@ -6735,11 +7253,15 @@ 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(); }
public static Builder CreateBuilder(TestNestedExtension prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -6749,21 +7271,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestNestedExtension cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestNestedExtension result;
- TestNestedExtension result = new TestNestedExtension();
+ private TestNestedExtension PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestNestedExtension original = result;
+ result = new TestNestedExtension();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -6775,12 +7324,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 (resultIsReadOnly) {
+ return result;
}
- TestNestedExtension returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -6794,6 +7342,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 +7352,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;
@@ -6855,7 +7405,8 @@ 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<TestRequired, TestRequired.Builder> {
- private static readonly TestRequired defaultInstance = new Builder().BuildPartial();
+ private TestRequired() { }
+ 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 {
@@ -6863,7 +7414,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestRequired DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestRequired ThisMessage {
@@ -7468,11 +8019,15 @@ 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(); }
public static Builder CreateBuilder(TestRequired prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -7482,21 +8037,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestRequired cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestRequired result;
+
+ private TestRequired PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestRequired original = result;
+ result = new TestRequired();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestRequired result = new TestRequired();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -7508,12 +8090,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 (resultIsReadOnly) {
+ return result;
}
- TestRequired returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -7527,6 +8108,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 +8217,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 +8401,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 +8421,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 +8441,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 +8461,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 +8481,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 +8501,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 +8521,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 +8541,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 +8561,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 +8581,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 +8601,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 +8621,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 +8641,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 +8661,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 +8681,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 +8701,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 +8721,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 +8741,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 +8761,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 +8781,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 +8801,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 +8821,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 +8841,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 +8861,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 +8881,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 +8901,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 +8921,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 +8941,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 +8961,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 +8981,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 +9001,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 +9021,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 +9041,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;
@@ -8413,7 +9062,8 @@ 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<TestRequiredForeign, TestRequiredForeign.Builder> {
- private static readonly TestRequiredForeign defaultInstance = new Builder().BuildPartial();
+ private TestRequiredForeign() { }
+ 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 {
@@ -8421,7 +9071,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestRequiredForeign DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestRequiredForeign ThisMessage {
@@ -8438,12 +9088,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;
@@ -8547,11 +9197,16 @@ 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(); }
public static Builder CreateBuilder(TestRequiredForeign prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -8561,21 +9216,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestRequiredForeign cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestRequiredForeign result;
+
+ private TestRequiredForeign PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestRequiredForeign original = result;
+ result = new TestRequiredForeign();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestRequiredForeign result = new TestRequiredForeign();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -8587,13 +9269,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.repeatedMessage_.MakeReadOnly();
- TestRequiredForeign returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -8607,11 +9287,12 @@ 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);
}
if (other.repeatedMessage_.Count != 0) {
- base.AddRange(other.repeatedMessage_, result.repeatedMessage_);
+ result.repeatedMessage_.Add(other.repeatedMessage_);
}
if (other.HasDummy) {
Dummy = other.Dummy;
@@ -8625,6 +9306,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 +9376,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 +9401,14 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearOptionalMessage() {
+ PrepareBuilder();
result.hasOptionalMessage = false;
- result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance;
+ result.optionalMessage_ = null;
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestRequired> RepeatedMessageList {
- get { return result.repeatedMessage_; }
+ get { return PrepareBuilder().repeatedMessage_; }
}
public int RepeatedMessageCount {
get { return result.RepeatedMessageCount; }
@@ -8732,29 +9418,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<global::Google.ProtocolBuffers.TestProtos.TestRequired> values) {
- base.AddRange(values, result.repeatedMessage_);
+ PrepareBuilder();
+ result.repeatedMessage_.Add(values);
return this;
}
public Builder ClearRepeatedMessage() {
+ PrepareBuilder();
result.repeatedMessage_.Clear();
return this;
}
@@ -8767,11 +9459,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;
@@ -8786,7 +9480,8 @@ 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<TestForeignNested, TestForeignNested.Builder> {
- private static readonly TestForeignNested defaultInstance = new Builder().BuildPartial();
+ private TestForeignNested() { }
+ 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 {
@@ -8794,7 +9489,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestForeignNested DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestForeignNested ThisMessage {
@@ -8811,12 +9506,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 {
@@ -8880,11 +9575,15 @@ 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(); }
public static Builder CreateBuilder(TestForeignNested prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -8894,21 +9593,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestForeignNested cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestForeignNested result;
+
+ private TestForeignNested PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestForeignNested original = result;
+ result = new TestForeignNested();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestForeignNested result = new TestForeignNested();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -8920,12 +9646,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 (resultIsReadOnly) {
+ return result;
}
- TestForeignNested returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -8939,6 +9664,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 +9677,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 +9739,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,8 +9764,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearForeignNested() {
+ PrepareBuilder();
result.hasForeignNested = false;
- result.foreignNested_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance;
+ result.foreignNested_ = null;
return this;
}
}
@@ -9048,7 +9779,8 @@ 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<TestEmptyMessage, TestEmptyMessage.Builder> {
- private static readonly TestEmptyMessage defaultInstance = new Builder().BuildPartial();
+ private TestEmptyMessage() { }
+ 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 {
@@ -9056,7 +9788,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestEmptyMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestEmptyMessage ThisMessage {
@@ -9126,11 +9858,15 @@ 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(); }
public static Builder CreateBuilder(TestEmptyMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9140,21 +9876,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestEmptyMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestEmptyMessage result;
+
+ private TestEmptyMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestEmptyMessage original = result;
+ result = new TestEmptyMessage();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -9166,12 +9929,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 (resultIsReadOnly) {
+ return result;
}
- TestEmptyMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -9185,6 +9947,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 +9957,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;
@@ -9246,7 +10010,8 @@ 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<TestEmptyMessageWithExtensions, TestEmptyMessageWithExtensions.Builder> {
- private static readonly TestEmptyMessageWithExtensions defaultInstance = new Builder().BuildPartial();
+ private TestEmptyMessageWithExtensions() { }
+ 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 {
@@ -9254,7 +10019,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestEmptyMessageWithExtensions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestEmptyMessageWithExtensions ThisMessage {
@@ -9328,11 +10093,15 @@ 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(); }
public static Builder CreateBuilder(TestEmptyMessageWithExtensions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9342,21 +10111,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestEmptyMessageWithExtensions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestEmptyMessageWithExtensions result;
+
+ private TestEmptyMessageWithExtensions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestEmptyMessageWithExtensions original = result;
+ result = new TestEmptyMessageWithExtensions();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestEmptyMessageWithExtensions result = new TestEmptyMessageWithExtensions();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -9368,12 +10164,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 (resultIsReadOnly) {
+ return result;
}
- TestEmptyMessageWithExtensions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -9387,6 +10182,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 +10193,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;
@@ -9449,7 +10246,8 @@ 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<TestMultipleExtensionRanges, TestMultipleExtensionRanges.Builder> {
- private static readonly TestMultipleExtensionRanges defaultInstance = new Builder().BuildPartial();
+ private TestMultipleExtensionRanges() { }
+ 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 {
@@ -9457,7 +10255,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestMultipleExtensionRanges DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestMultipleExtensionRanges ThisMessage {
@@ -9533,11 +10331,15 @@ 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(); }
public static Builder CreateBuilder(TestMultipleExtensionRanges prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9547,21 +10349,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestMultipleExtensionRanges cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestMultipleExtensionRanges result;
+
+ private TestMultipleExtensionRanges PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestMultipleExtensionRanges original = result;
+ result = new TestMultipleExtensionRanges();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -9573,12 +10402,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 (resultIsReadOnly) {
+ return result;
}
- TestMultipleExtensionRanges returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -9592,6 +10420,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 +10431,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;
@@ -9654,7 +10484,8 @@ 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<TestReallyLargeTagNumber, TestReallyLargeTagNumber.Builder> {
- private static readonly TestReallyLargeTagNumber defaultInstance = new Builder().BuildPartial();
+ private TestReallyLargeTagNumber() { }
+ 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 {
@@ -9662,7 +10493,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestReallyLargeTagNumber DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestReallyLargeTagNumber ThisMessage {
@@ -9764,11 +10595,15 @@ 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(); }
public static Builder CreateBuilder(TestReallyLargeTagNumber prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9778,21 +10613,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestReallyLargeTagNumber cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestReallyLargeTagNumber result;
+
+ private TestReallyLargeTagNumber PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestReallyLargeTagNumber original = result;
+ result = new TestReallyLargeTagNumber();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -9804,12 +10666,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 (resultIsReadOnly) {
+ return result;
}
- TestReallyLargeTagNumber returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -9823,6 +10684,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 +10700,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 +10760,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 +10780,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;
@@ -9934,7 +10801,8 @@ 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<TestRecursiveMessage, TestRecursiveMessage.Builder> {
- private static readonly TestRecursiveMessage defaultInstance = new Builder().BuildPartial();
+ private TestRecursiveMessage() { }
+ 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 {
@@ -9942,7 +10810,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestRecursiveMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestRecursiveMessage ThisMessage {
@@ -9959,12 +10827,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;
@@ -10044,11 +10912,15 @@ 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(); }
public static Builder CreateBuilder(TestRecursiveMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -10058,21 +10930,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestRecursiveMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestRecursiveMessage result = new TestRecursiveMessage();
+ private bool resultIsReadOnly;
+ private TestRecursiveMessage result;
+
+ private TestRecursiveMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestRecursiveMessage original = result;
+ result = new TestRecursiveMessage();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -10084,12 +10983,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 (resultIsReadOnly) {
+ return result;
}
- TestRecursiveMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -10103,6 +11001,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 +11017,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 +11083,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,8 +11108,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
- result.a_ = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance;
+ result.a_ = null;
return this;
}
@@ -10218,11 +11122,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;
@@ -10237,7 +11143,8 @@ 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<TestMutualRecursionA, TestMutualRecursionA.Builder> {
- private static readonly TestMutualRecursionA defaultInstance = new Builder().BuildPartial();
+ private TestMutualRecursionA() { }
+ 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 {
@@ -10245,7 +11152,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestMutualRecursionA DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestMutualRecursionA ThisMessage {
@@ -10262,12 +11169,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 {
@@ -10331,11 +11238,15 @@ 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(); }
public static Builder CreateBuilder(TestMutualRecursionA prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -10345,21 +11256,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestMutualRecursionA cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestMutualRecursionA result;
+
+ private TestMutualRecursionA PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestMutualRecursionA original = result;
+ result = new TestMutualRecursionA();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -10371,12 +11309,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 (resultIsReadOnly) {
+ return result;
}
- TestMutualRecursionA returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -10390,6 +11327,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 +11340,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 +11402,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,8 +11427,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearBb() {
+ PrepareBuilder();
result.hasBb = false;
- result.bb_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance;
+ result.bb_ = null;
return this;
}
}
@@ -10499,7 +11442,8 @@ 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<TestMutualRecursionB, TestMutualRecursionB.Builder> {
- private static readonly TestMutualRecursionB defaultInstance = new Builder().BuildPartial();
+ private TestMutualRecursionB() { }
+ 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 {
@@ -10507,7 +11451,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestMutualRecursionB DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestMutualRecursionB ThisMessage {
@@ -10524,12 +11468,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;
@@ -10609,11 +11553,15 @@ 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(); }
public static Builder CreateBuilder(TestMutualRecursionB prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -10623,21 +11571,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestMutualRecursionB cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestMutualRecursionB result;
+
+ private TestMutualRecursionB PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestMutualRecursionB original = result;
+ result = new TestMutualRecursionB();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestMutualRecursionB result = new TestMutualRecursionB();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -10649,12 +11624,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 (resultIsReadOnly) {
+ return result;
}
- TestMutualRecursionB returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -10668,6 +11642,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 +11658,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 +11724,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,8 +11749,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
- result.a_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance;
+ result.a_ = null;
return this;
}
@@ -10783,11 +11763,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;
@@ -10802,7 +11784,8 @@ 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<TestDupFieldNumber, TestDupFieldNumber.Builder> {
- private static readonly TestDupFieldNumber defaultInstance = new Builder().BuildPartial();
+ private TestDupFieldNumber() { }
+ 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 {
@@ -10810,7 +11793,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestDupFieldNumber DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestDupFieldNumber ThisMessage {
@@ -10834,7 +11817,8 @@ 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<Foo, Foo.Builder> {
- private static readonly Foo defaultInstance = new Builder().BuildPartial();
+ private Foo() { }
+ 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 {
@@ -10842,7 +11826,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override Foo DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override Foo ThisMessage {
@@ -10928,11 +11912,15 @@ 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(); }
public static Builder CreateBuilder(Foo prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -10942,21 +11930,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(Foo cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private Foo result;
+
+ private Foo PrepareBuilder() {
+ if (resultIsReadOnly) {
+ Foo original = result;
+ result = new Foo();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- Foo result = new Foo();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -10968,12 +11983,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 (resultIsReadOnly) {
+ return result;
}
- Foo returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -10987,6 +12001,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 +12014,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 +12070,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;
@@ -11073,7 +12091,8 @@ 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<Bar, Bar.Builder> {
- private static readonly Bar defaultInstance = new Builder().BuildPartial();
+ private Bar() { }
+ 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 {
@@ -11081,7 +12100,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override Bar DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override Bar ThisMessage {
@@ -11167,11 +12186,15 @@ 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(); }
public static Builder CreateBuilder(Bar prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -11181,21 +12204,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(Bar cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private Bar result;
+
+ private Bar PrepareBuilder() {
+ if (resultIsReadOnly) {
+ Bar original = result;
+ result = new Bar();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- Bar result = new Bar();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -11207,12 +12257,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 (resultIsReadOnly) {
+ return result;
}
- Bar returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -11226,6 +12275,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 +12288,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 +12344,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;
@@ -11323,22 +12376,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 {
@@ -11414,11 +12467,15 @@ 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(); }
public static Builder CreateBuilder(TestDupFieldNumber prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -11428,21 +12485,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestDupFieldNumber cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestDupFieldNumber result;
+
+ private TestDupFieldNumber PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestDupFieldNumber original = result;
+ result = new TestDupFieldNumber();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestDupFieldNumber result = new TestDupFieldNumber();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -11454,12 +12538,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 (resultIsReadOnly) {
+ return result;
}
- TestDupFieldNumber returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -11473,6 +12556,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 +12575,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 +12649,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 +12670,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,8 +12695,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearFoo() {
+ PrepareBuilder();
result.hasFoo = false;
- result.foo_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance;
+ result.foo_ = null;
return this;
}
@@ -11619,18 +12710,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,8 +12735,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearBar() {
+ PrepareBuilder();
result.hasBar = false;
- result.bar_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance;
+ result.bar_ = null;
return this;
}
}
@@ -11655,7 +12750,8 @@ 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<TestNestedMessageHasBits, TestNestedMessageHasBits.Builder> {
- private static readonly TestNestedMessageHasBits defaultInstance = new Builder().BuildPartial();
+ private TestNestedMessageHasBits() { }
+ 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 {
@@ -11663,7 +12759,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestNestedMessageHasBits DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestNestedMessageHasBits ThisMessage {
@@ -11687,7 +12783,8 @@ 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<NestedMessage, NestedMessage.Builder> {
- private static readonly NestedMessage defaultInstance = new Builder().BuildPartial();
+ private NestedMessage() { }
+ 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 {
@@ -11695,7 +12792,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override NestedMessage DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override NestedMessage ThisMessage {
@@ -11806,11 +12903,17 @@ 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(); }
public static Builder CreateBuilder(NestedMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -11820,21 +12923,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(NestedMessage cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private NestedMessage result;
+
+ private NestedMessage PrepareBuilder() {
+ if (resultIsReadOnly) {
+ NestedMessage original = result;
+ result = new NestedMessage();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -11846,14 +12976,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 (resultIsReadOnly) {
+ return result;
}
- result.nestedmessageRepeatedInt32_.MakeReadOnly();
- result.nestedmessageRepeatedForeignmessage_.MakeReadOnly();
- NestedMessage returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -11867,11 +12994,12 @@ 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_);
+ 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;
@@ -11882,6 +13010,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 +13064,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList<int> NestedmessageRepeatedInt32List {
- get { return result.nestedmessageRepeatedInt32_; }
+ get { return PrepareBuilder().nestedmessageRepeatedInt32_; }
}
public int NestedmessageRepeatedInt32Count {
get { return result.NestedmessageRepeatedInt32Count; }
@@ -11944,24 +13073,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<int> values) {
- base.AddRange(values, result.nestedmessageRepeatedInt32_);
+ PrepareBuilder();
+ result.nestedmessageRepeatedInt32_.Add(values);
return this;
}
public Builder ClearNestedmessageRepeatedInt32() {
+ PrepareBuilder();
result.nestedmessageRepeatedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> NestedmessageRepeatedForeignmessageList {
- get { return result.nestedmessageRepeatedForeignmessage_; }
+ get { return PrepareBuilder().nestedmessageRepeatedForeignmessage_; }
}
public int NestedmessageRepeatedForeignmessageCount {
get { return result.NestedmessageRepeatedForeignmessageCount; }
@@ -11971,29 +13104,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<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> values) {
- base.AddRange(values, result.nestedmessageRepeatedForeignmessage_);
+ PrepareBuilder();
+ result.nestedmessageRepeatedForeignmessage_.Add(values);
return this;
}
public Builder ClearNestedmessageRepeatedForeignmessage() {
+ PrepareBuilder();
result.nestedmessageRepeatedForeignmessage_.Clear();
return this;
}
@@ -12008,12 +13147,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 {
@@ -12077,11 +13216,15 @@ 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(); }
public static Builder CreateBuilder(TestNestedMessageHasBits prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -12091,21 +13234,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestNestedMessageHasBits cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestNestedMessageHasBits result;
+
+ private TestNestedMessageHasBits PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestNestedMessageHasBits original = result;
+ result = new TestNestedMessageHasBits();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestNestedMessageHasBits result = new TestNestedMessageHasBits();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -12117,12 +13287,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 (resultIsReadOnly) {
+ return result;
}
- TestNestedMessageHasBits returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -12136,6 +13305,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 +13318,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 +13380,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,8 +13405,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearOptionalNestedMessage() {
+ PrepareBuilder();
result.hasOptionalNestedMessage = false;
- result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance;
+ result.optionalNestedMessage_ = null;
return this;
}
}
@@ -12245,7 +13420,8 @@ 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<TestCamelCaseFieldNames, TestCamelCaseFieldNames.Builder> {
- private static readonly TestCamelCaseFieldNames defaultInstance = new Builder().BuildPartial();
+ private TestCamelCaseFieldNames() { }
+ 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 {
@@ -12253,7 +13429,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestCamelCaseFieldNames DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestCamelCaseFieldNames ThisMessage {
@@ -12300,12 +13476,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;
@@ -12554,11 +13730,21 @@ 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(); }
public static Builder CreateBuilder(TestCamelCaseFieldNames prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -12568,21 +13754,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestCamelCaseFieldNames cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestCamelCaseFieldNames result;
+
+ private TestCamelCaseFieldNames PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestCamelCaseFieldNames original = result;
+ result = new TestCamelCaseFieldNames();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -12594,18 +13807,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.repeatedPrimitiveField_.MakeReadOnly();
- result.repeatedStringField_.MakeReadOnly();
- result.repeatedEnumField_.MakeReadOnly();
- result.repeatedMessageField_.MakeReadOnly();
- result.repeatedStringPieceField_.MakeReadOnly();
- result.repeatedCordField_.MakeReadOnly();
- TestCamelCaseFieldNames returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -12619,6 +13825,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;
}
@@ -12638,22 +13845,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;
@@ -12664,6 +13871,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 +13995,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 +14016,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 +14036,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 +14057,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,8 +14082,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearMessageField() {
+ PrepareBuilder();
result.hasMessageField = false;
- result.messageField_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance;
+ result.messageField_ = null;
return this;
}
@@ -12879,11 +14097,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 +14118,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<int> RepeatedPrimitiveFieldList {
- get { return result.repeatedPrimitiveField_; }
+ get { return PrepareBuilder().repeatedPrimitiveField_; }
}
public int RepeatedPrimitiveFieldCount {
get { return result.RepeatedPrimitiveFieldCount; }
@@ -12918,24 +14140,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<int> values) {
- base.AddRange(values, result.repeatedPrimitiveField_);
+ PrepareBuilder();
+ result.repeatedPrimitiveField_.Add(values);
return this;
}
public Builder ClearRepeatedPrimitiveField() {
+ PrepareBuilder();
result.repeatedPrimitiveField_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedStringFieldList {
- get { return result.repeatedStringField_; }
+ get { return PrepareBuilder().repeatedStringField_; }
}
public int RepeatedStringFieldCount {
get { return result.RepeatedStringFieldCount; }
@@ -12945,25 +14171,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<string> values) {
- base.AddRange(values, result.repeatedStringField_);
+ PrepareBuilder();
+ result.repeatedStringField_.Add(values);
return this;
}
public Builder ClearRepeatedStringField() {
+ PrepareBuilder();
result.repeatedStringField_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> RepeatedEnumFieldList {
- get { return result.repeatedEnumField_; }
+ get { return PrepareBuilder().repeatedEnumField_; }
}
public int RepeatedEnumFieldCount {
get { return result.RepeatedEnumFieldCount; }
@@ -12972,24 +14202,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<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> values) {
- base.AddRange(values, result.repeatedEnumField_);
+ PrepareBuilder();
+ result.repeatedEnumField_.Add(values);
return this;
}
public Builder ClearRepeatedEnumField() {
+ PrepareBuilder();
result.repeatedEnumField_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> RepeatedMessageFieldList {
- get { return result.repeatedMessageField_; }
+ get { return PrepareBuilder().repeatedMessageField_; }
}
public int RepeatedMessageFieldCount {
get { return result.RepeatedMessageFieldCount; }
@@ -12999,35 +14233,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<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> values) {
- base.AddRange(values, result.repeatedMessageField_);
+ PrepareBuilder();
+ result.repeatedMessageField_.Add(values);
return this;
}
public Builder ClearRepeatedMessageField() {
+ PrepareBuilder();
result.repeatedMessageField_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedStringPieceFieldList {
- get { return result.repeatedStringPieceField_; }
+ get { return PrepareBuilder().repeatedStringPieceField_; }
}
public int RepeatedStringPieceFieldCount {
get { return result.RepeatedStringPieceFieldCount; }
@@ -13037,25 +14277,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<string> values) {
- base.AddRange(values, result.repeatedStringPieceField_);
+ PrepareBuilder();
+ result.repeatedStringPieceField_.Add(values);
return this;
}
public Builder ClearRepeatedStringPieceField() {
+ PrepareBuilder();
result.repeatedStringPieceField_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedCordFieldList {
- get { return result.repeatedCordField_; }
+ get { return PrepareBuilder().repeatedCordField_; }
}
public int RepeatedCordFieldCount {
get { return result.RepeatedCordFieldCount; }
@@ -13065,19 +14309,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<string> values) {
- base.AddRange(values, result.repeatedCordField_);
+ PrepareBuilder();
+ result.repeatedCordField_.Add(values);
return this;
}
public Builder ClearRepeatedCordField() {
+ PrepareBuilder();
result.repeatedCordField_.Clear();
return this;
}
@@ -13091,7 +14339,8 @@ 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<TestFieldOrderings, TestFieldOrderings.Builder> {
- private static readonly TestFieldOrderings defaultInstance = new Builder().BuildPartial();
+ private TestFieldOrderings() { }
+ 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 {
@@ -13099,7 +14348,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestFieldOrderings DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestFieldOrderings ThisMessage {
@@ -13222,11 +14471,15 @@ 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(); }
public static Builder CreateBuilder(TestFieldOrderings prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -13236,21 +14489,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestFieldOrderings cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestFieldOrderings result;
+
+ private TestFieldOrderings PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestFieldOrderings original = result;
+ result = new TestFieldOrderings();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -13262,12 +14542,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 (resultIsReadOnly) {
+ return result;
}
- TestFieldOrderings returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -13281,6 +14560,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 +14580,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 +14645,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 +14665,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 +14685,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;
@@ -13419,7 +14706,8 @@ 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<TestExtremeDefaultValues, TestExtremeDefaultValues.Builder> {
- private static readonly TestExtremeDefaultValues defaultInstance = new Builder().BuildPartial();
+ private TestExtremeDefaultValues() { }
+ 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 {
@@ -13427,7 +14715,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestExtremeDefaultValues DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestExtremeDefaultValues ThisMessage {
@@ -13803,11 +15091,15 @@ 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(); }
public static Builder CreateBuilder(TestExtremeDefaultValues prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -13817,21 +15109,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestExtremeDefaultValues cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestExtremeDefaultValues result;
+
+ private TestExtremeDefaultValues PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestExtremeDefaultValues original = result;
+ result = new TestExtremeDefaultValues();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestExtremeDefaultValues result = new TestExtremeDefaultValues();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -13843,12 +15162,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 (resultIsReadOnly) {
+ return result;
}
- TestExtremeDefaultValues returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -13862,6 +15180,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 +15247,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 +15376,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 +15398,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 +15420,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 +15440,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 +15460,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 +15481,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 +15501,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 +15521,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 +15541,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 +15561,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 +15581,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 +15601,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 +15621,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 +15641,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 +15661,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 +15681,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 +15701,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 +15721,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 +15741,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;
@@ -14404,7 +15762,8 @@ 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<OneString, OneString.Builder> {
- private static readonly OneString defaultInstance = new Builder().BuildPartial();
+ private OneString() { }
+ 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 {
@@ -14412,7 +15771,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override OneString DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override OneString ThisMessage {
@@ -14498,11 +15857,15 @@ 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(); }
public static Builder CreateBuilder(OneString prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -14512,21 +15875,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(OneString cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private OneString result;
+
+ private OneString PrepareBuilder() {
+ if (resultIsReadOnly) {
+ OneString original = result;
+ result = new OneString();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- OneString result = new OneString();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -14538,12 +15928,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 (resultIsReadOnly) {
+ return result;
}
- OneString returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -14557,6 +15946,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 +15959,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 +16016,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;
@@ -14644,7 +16037,8 @@ 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<OneBytes, OneBytes.Builder> {
- private static readonly OneBytes defaultInstance = new Builder().BuildPartial();
+ private OneBytes() { }
+ 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 {
@@ -14652,7 +16046,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override OneBytes DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override OneBytes ThisMessage {
@@ -14738,11 +16132,15 @@ 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(); }
public static Builder CreateBuilder(OneBytes prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -14752,21 +16150,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(OneBytes cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- OneBytes result = new OneBytes();
+ private bool resultIsReadOnly;
+ private OneBytes result;
+
+ private OneBytes PrepareBuilder() {
+ if (resultIsReadOnly) {
+ OneBytes original = result;
+ result = new OneBytes();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -14778,12 +16203,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 (resultIsReadOnly) {
+ return result;
}
- OneBytes returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -14797,6 +16221,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 +16234,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 +16291,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;
@@ -14884,7 +16312,8 @@ 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<TestPackedTypes, TestPackedTypes.Builder> {
- private static readonly TestPackedTypes defaultInstance = new Builder().BuildPartial();
+ private TestPackedTypes() { }
+ 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 {
@@ -14892,7 +16321,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestPackedTypes DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestPackedTypes ThisMessage {
@@ -15335,11 +16764,29 @@ 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(); }
public static Builder CreateBuilder(TestPackedTypes prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -15349,21 +16796,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestPackedTypes cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestPackedTypes result;
+
+ private TestPackedTypes PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestPackedTypes original = result;
+ result = new TestPackedTypes();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestPackedTypes result = new TestPackedTypes();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -15375,26 +16849,11 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestPackedTypes BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
- }
- 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();
- TestPackedTypes returnMe = result;
- result = null;
- return returnMe;
+ if (resultIsReadOnly) {
+ return result;
+ }
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -15408,47 +16867,48 @@ 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_);
+ 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;
@@ -15459,6 +16919,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 +17043,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList<int> PackedInt32List {
- get { return result.packedInt32_; }
+ get { return PrepareBuilder().packedInt32_; }
}
public int PackedInt32Count {
get { return result.PackedInt32Count; }
@@ -15591,24 +17052,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<int> values) {
- base.AddRange(values, result.packedInt32_);
+ PrepareBuilder();
+ result.packedInt32_.Add(values);
return this;
}
public Builder ClearPackedInt32() {
+ PrepareBuilder();
result.packedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<long> PackedInt64List {
- get { return result.packedInt64_; }
+ get { return PrepareBuilder().packedInt64_; }
}
public int PackedInt64Count {
get { return result.PackedInt64Count; }
@@ -15617,25 +17082,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<long> values) {
- base.AddRange(values, result.packedInt64_);
+ PrepareBuilder();
+ result.packedInt64_.Add(values);
return this;
}
public Builder ClearPackedInt64() {
+ PrepareBuilder();
result.packedInt64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> PackedUint32List {
- get { return result.packedUint32_; }
+ get { return PrepareBuilder().packedUint32_; }
}
public int PackedUint32Count {
get { return result.PackedUint32Count; }
@@ -15646,27 +17115,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<uint> values) {
- base.AddRange(values, result.packedUint32_);
+ PrepareBuilder();
+ result.packedUint32_.Add(values);
return this;
}
public Builder ClearPackedUint32() {
+ PrepareBuilder();
result.packedUint32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> PackedUint64List {
- get { return result.packedUint64_; }
+ get { return PrepareBuilder().packedUint64_; }
}
public int PackedUint64Count {
get { return result.PackedUint64Count; }
@@ -15677,26 +17150,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<ulong> values) {
- base.AddRange(values, result.packedUint64_);
+ PrepareBuilder();
+ result.packedUint64_.Add(values);
return this;
}
public Builder ClearPackedUint64() {
+ PrepareBuilder();
result.packedUint64_.Clear();
return this;
}
public pbc::IPopsicleList<int> PackedSint32List {
- get { return result.packedSint32_; }
+ get { return PrepareBuilder().packedSint32_; }
}
public int PackedSint32Count {
get { return result.PackedSint32Count; }
@@ -15705,24 +17182,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<int> values) {
- base.AddRange(values, result.packedSint32_);
+ PrepareBuilder();
+ result.packedSint32_.Add(values);
return this;
}
public Builder ClearPackedSint32() {
+ PrepareBuilder();
result.packedSint32_.Clear();
return this;
}
public pbc::IPopsicleList<long> PackedSint64List {
- get { return result.packedSint64_; }
+ get { return PrepareBuilder().packedSint64_; }
}
public int PackedSint64Count {
get { return result.PackedSint64Count; }
@@ -15731,25 +17212,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<long> values) {
- base.AddRange(values, result.packedSint64_);
+ PrepareBuilder();
+ result.packedSint64_.Add(values);
return this;
}
public Builder ClearPackedSint64() {
+ PrepareBuilder();
result.packedSint64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> PackedFixed32List {
- get { return result.packedFixed32_; }
+ get { return PrepareBuilder().packedFixed32_; }
}
public int PackedFixed32Count {
get { return result.PackedFixed32Count; }
@@ -15760,27 +17245,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<uint> values) {
- base.AddRange(values, result.packedFixed32_);
+ PrepareBuilder();
+ result.packedFixed32_.Add(values);
return this;
}
public Builder ClearPackedFixed32() {
+ PrepareBuilder();
result.packedFixed32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> PackedFixed64List {
- get { return result.packedFixed64_; }
+ get { return PrepareBuilder().packedFixed64_; }
}
public int PackedFixed64Count {
get { return result.PackedFixed64Count; }
@@ -15791,26 +17280,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<ulong> values) {
- base.AddRange(values, result.packedFixed64_);
+ PrepareBuilder();
+ result.packedFixed64_.Add(values);
return this;
}
public Builder ClearPackedFixed64() {
+ PrepareBuilder();
result.packedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<int> PackedSfixed32List {
- get { return result.packedSfixed32_; }
+ get { return PrepareBuilder().packedSfixed32_; }
}
public int PackedSfixed32Count {
get { return result.PackedSfixed32Count; }
@@ -15819,24 +17312,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<int> values) {
- base.AddRange(values, result.packedSfixed32_);
+ PrepareBuilder();
+ result.packedSfixed32_.Add(values);
return this;
}
public Builder ClearPackedSfixed32() {
+ PrepareBuilder();
result.packedSfixed32_.Clear();
return this;
}
public pbc::IPopsicleList<long> PackedSfixed64List {
- get { return result.packedSfixed64_; }
+ get { return PrepareBuilder().packedSfixed64_; }
}
public int PackedSfixed64Count {
get { return result.PackedSfixed64Count; }
@@ -15845,24 +17342,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<long> values) {
- base.AddRange(values, result.packedSfixed64_);
+ PrepareBuilder();
+ result.packedSfixed64_.Add(values);
return this;
}
public Builder ClearPackedSfixed64() {
+ PrepareBuilder();
result.packedSfixed64_.Clear();
return this;
}
public pbc::IPopsicleList<float> PackedFloatList {
- get { return result.packedFloat_; }
+ get { return PrepareBuilder().packedFloat_; }
}
public int PackedFloatCount {
get { return result.PackedFloatCount; }
@@ -15871,24 +17372,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<float> values) {
- base.AddRange(values, result.packedFloat_);
+ PrepareBuilder();
+ result.packedFloat_.Add(values);
return this;
}
public Builder ClearPackedFloat() {
+ PrepareBuilder();
result.packedFloat_.Clear();
return this;
}
public pbc::IPopsicleList<double> PackedDoubleList {
- get { return result.packedDouble_; }
+ get { return PrepareBuilder().packedDouble_; }
}
public int PackedDoubleCount {
get { return result.PackedDoubleCount; }
@@ -15897,24 +17402,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<double> values) {
- base.AddRange(values, result.packedDouble_);
+ PrepareBuilder();
+ result.packedDouble_.Add(values);
return this;
}
public Builder ClearPackedDouble() {
+ PrepareBuilder();
result.packedDouble_.Clear();
return this;
}
public pbc::IPopsicleList<bool> PackedBoolList {
- get { return result.packedBool_; }
+ get { return PrepareBuilder().packedBool_; }
}
public int PackedBoolCount {
get { return result.PackedBoolCount; }
@@ -15923,24 +17432,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<bool> values) {
- base.AddRange(values, result.packedBool_);
+ PrepareBuilder();
+ result.packedBool_.Add(values);
return this;
}
public Builder ClearPackedBool() {
+ PrepareBuilder();
result.packedBool_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> PackedEnumList {
- get { return result.packedEnum_; }
+ get { return PrepareBuilder().packedEnum_; }
}
public int PackedEnumCount {
get { return result.PackedEnumCount; }
@@ -15949,18 +17462,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<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> values) {
- base.AddRange(values, result.packedEnum_);
+ PrepareBuilder();
+ result.packedEnum_.Add(values);
return this;
}
public Builder ClearPackedEnum() {
+ PrepareBuilder();
result.packedEnum_.Clear();
return this;
}
@@ -15974,7 +17491,8 @@ 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<TestUnpackedTypes, TestUnpackedTypes.Builder> {
- private static readonly TestUnpackedTypes defaultInstance = new Builder().BuildPartial();
+ private TestUnpackedTypes() { }
+ 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 {
@@ -15982,7 +17500,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestUnpackedTypes DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestUnpackedTypes ThisMessage {
@@ -16370,11 +17888,29 @@ 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(); }
public static Builder CreateBuilder(TestUnpackedTypes prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -16384,21 +17920,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestUnpackedTypes cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestUnpackedTypes result;
+
+ private TestUnpackedTypes PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestUnpackedTypes original = result;
+ result = new TestUnpackedTypes();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -16410,26 +17973,11 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestUnpackedTypes BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
- }
- 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();
- TestUnpackedTypes returnMe = result;
- result = null;
- return returnMe;
+ if (resultIsReadOnly) {
+ return result;
+ }
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -16443,47 +17991,48 @@ 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_);
+ 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;
@@ -16494,6 +18043,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 +18167,7 @@ namespace Google.ProtocolBuffers.TestProtos { public pbc::IPopsicleList<int> UnpackedInt32List {
- get { return result.unpackedInt32_; }
+ get { return PrepareBuilder().unpackedInt32_; }
}
public int UnpackedInt32Count {
get { return result.UnpackedInt32Count; }
@@ -16626,24 +18176,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<int> values) {
- base.AddRange(values, result.unpackedInt32_);
+ PrepareBuilder();
+ result.unpackedInt32_.Add(values);
return this;
}
public Builder ClearUnpackedInt32() {
+ PrepareBuilder();
result.unpackedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<long> UnpackedInt64List {
- get { return result.unpackedInt64_; }
+ get { return PrepareBuilder().unpackedInt64_; }
}
public int UnpackedInt64Count {
get { return result.UnpackedInt64Count; }
@@ -16652,25 +18206,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<long> values) {
- base.AddRange(values, result.unpackedInt64_);
+ PrepareBuilder();
+ result.unpackedInt64_.Add(values);
return this;
}
public Builder ClearUnpackedInt64() {
+ PrepareBuilder();
result.unpackedInt64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> UnpackedUint32List {
- get { return result.unpackedUint32_; }
+ get { return PrepareBuilder().unpackedUint32_; }
}
public int UnpackedUint32Count {
get { return result.UnpackedUint32Count; }
@@ -16681,27 +18239,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<uint> values) {
- base.AddRange(values, result.unpackedUint32_);
+ PrepareBuilder();
+ result.unpackedUint32_.Add(values);
return this;
}
public Builder ClearUnpackedUint32() {
+ PrepareBuilder();
result.unpackedUint32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> UnpackedUint64List {
- get { return result.unpackedUint64_; }
+ get { return PrepareBuilder().unpackedUint64_; }
}
public int UnpackedUint64Count {
get { return result.UnpackedUint64Count; }
@@ -16712,26 +18274,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<ulong> values) {
- base.AddRange(values, result.unpackedUint64_);
+ PrepareBuilder();
+ result.unpackedUint64_.Add(values);
return this;
}
public Builder ClearUnpackedUint64() {
+ PrepareBuilder();
result.unpackedUint64_.Clear();
return this;
}
public pbc::IPopsicleList<int> UnpackedSint32List {
- get { return result.unpackedSint32_; }
+ get { return PrepareBuilder().unpackedSint32_; }
}
public int UnpackedSint32Count {
get { return result.UnpackedSint32Count; }
@@ -16740,24 +18306,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<int> values) {
- base.AddRange(values, result.unpackedSint32_);
+ PrepareBuilder();
+ result.unpackedSint32_.Add(values);
return this;
}
public Builder ClearUnpackedSint32() {
+ PrepareBuilder();
result.unpackedSint32_.Clear();
return this;
}
public pbc::IPopsicleList<long> UnpackedSint64List {
- get { return result.unpackedSint64_; }
+ get { return PrepareBuilder().unpackedSint64_; }
}
public int UnpackedSint64Count {
get { return result.UnpackedSint64Count; }
@@ -16766,25 +18336,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<long> values) {
- base.AddRange(values, result.unpackedSint64_);
+ PrepareBuilder();
+ result.unpackedSint64_.Add(values);
return this;
}
public Builder ClearUnpackedSint64() {
+ PrepareBuilder();
result.unpackedSint64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> UnpackedFixed32List {
- get { return result.unpackedFixed32_; }
+ get { return PrepareBuilder().unpackedFixed32_; }
}
public int UnpackedFixed32Count {
get { return result.UnpackedFixed32Count; }
@@ -16795,27 +18369,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<uint> values) {
- base.AddRange(values, result.unpackedFixed32_);
+ PrepareBuilder();
+ result.unpackedFixed32_.Add(values);
return this;
}
public Builder ClearUnpackedFixed32() {
+ PrepareBuilder();
result.unpackedFixed32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> UnpackedFixed64List {
- get { return result.unpackedFixed64_; }
+ get { return PrepareBuilder().unpackedFixed64_; }
}
public int UnpackedFixed64Count {
get { return result.UnpackedFixed64Count; }
@@ -16826,26 +18404,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<ulong> values) {
- base.AddRange(values, result.unpackedFixed64_);
+ PrepareBuilder();
+ result.unpackedFixed64_.Add(values);
return this;
}
public Builder ClearUnpackedFixed64() {
+ PrepareBuilder();
result.unpackedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<int> UnpackedSfixed32List {
- get { return result.unpackedSfixed32_; }
+ get { return PrepareBuilder().unpackedSfixed32_; }
}
public int UnpackedSfixed32Count {
get { return result.UnpackedSfixed32Count; }
@@ -16854,24 +18436,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<int> values) {
- base.AddRange(values, result.unpackedSfixed32_);
+ PrepareBuilder();
+ result.unpackedSfixed32_.Add(values);
return this;
}
public Builder ClearUnpackedSfixed32() {
+ PrepareBuilder();
result.unpackedSfixed32_.Clear();
return this;
}
public pbc::IPopsicleList<long> UnpackedSfixed64List {
- get { return result.unpackedSfixed64_; }
+ get { return PrepareBuilder().unpackedSfixed64_; }
}
public int UnpackedSfixed64Count {
get { return result.UnpackedSfixed64Count; }
@@ -16880,24 +18466,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<long> values) {
- base.AddRange(values, result.unpackedSfixed64_);
+ PrepareBuilder();
+ result.unpackedSfixed64_.Add(values);
return this;
}
public Builder ClearUnpackedSfixed64() {
+ PrepareBuilder();
result.unpackedSfixed64_.Clear();
return this;
}
public pbc::IPopsicleList<float> UnpackedFloatList {
- get { return result.unpackedFloat_; }
+ get { return PrepareBuilder().unpackedFloat_; }
}
public int UnpackedFloatCount {
get { return result.UnpackedFloatCount; }
@@ -16906,24 +18496,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<float> values) {
- base.AddRange(values, result.unpackedFloat_);
+ PrepareBuilder();
+ result.unpackedFloat_.Add(values);
return this;
}
public Builder ClearUnpackedFloat() {
+ PrepareBuilder();
result.unpackedFloat_.Clear();
return this;
}
public pbc::IPopsicleList<double> UnpackedDoubleList {
- get { return result.unpackedDouble_; }
+ get { return PrepareBuilder().unpackedDouble_; }
}
public int UnpackedDoubleCount {
get { return result.UnpackedDoubleCount; }
@@ -16932,24 +18526,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<double> values) {
- base.AddRange(values, result.unpackedDouble_);
+ PrepareBuilder();
+ result.unpackedDouble_.Add(values);
return this;
}
public Builder ClearUnpackedDouble() {
+ PrepareBuilder();
result.unpackedDouble_.Clear();
return this;
}
public pbc::IPopsicleList<bool> UnpackedBoolList {
- get { return result.unpackedBool_; }
+ get { return PrepareBuilder().unpackedBool_; }
}
public int UnpackedBoolCount {
get { return result.UnpackedBoolCount; }
@@ -16958,24 +18556,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<bool> values) {
- base.AddRange(values, result.unpackedBool_);
+ PrepareBuilder();
+ result.unpackedBool_.Add(values);
return this;
}
public Builder ClearUnpackedBool() {
+ PrepareBuilder();
result.unpackedBool_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> UnpackedEnumList {
- get { return result.unpackedEnum_; }
+ get { return PrepareBuilder().unpackedEnum_; }
}
public int UnpackedEnumCount {
get { return result.UnpackedEnumCount; }
@@ -16984,18 +18586,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<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> values) {
- base.AddRange(values, result.unpackedEnum_);
+ PrepareBuilder();
+ result.unpackedEnum_.Add(values);
return this;
}
public Builder ClearUnpackedEnum() {
+ PrepareBuilder();
result.unpackedEnum_.Clear();
return this;
}
@@ -17009,7 +18615,8 @@ 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<TestPackedExtensions, TestPackedExtensions.Builder> {
- private static readonly TestPackedExtensions defaultInstance = new Builder().BuildPartial();
+ private TestPackedExtensions() { }
+ 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 {
@@ -17017,7 +18624,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestPackedExtensions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestPackedExtensions ThisMessage {
@@ -17091,11 +18698,15 @@ 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(); }
public static Builder CreateBuilder(TestPackedExtensions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -17105,21 +18716,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestPackedExtensions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestPackedExtensions result;
+
+ private TestPackedExtensions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestPackedExtensions original = result;
+ result = new TestPackedExtensions();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -17131,12 +18769,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 (resultIsReadOnly) {
+ return result;
}
- TestPackedExtensions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -17150,6 +18787,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 +18798,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;
@@ -17212,7 +18851,8 @@ 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<TestUnpackedExtensions, TestUnpackedExtensions.Builder> {
- private static readonly TestUnpackedExtensions defaultInstance = new Builder().BuildPartial();
+ private TestUnpackedExtensions() { }
+ 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 {
@@ -17220,7 +18860,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestUnpackedExtensions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestUnpackedExtensions ThisMessage {
@@ -17294,11 +18934,15 @@ 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(); }
public static Builder CreateBuilder(TestUnpackedExtensions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -17308,21 +18952,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestUnpackedExtensions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestUnpackedExtensions result;
+
+ private TestUnpackedExtensions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestUnpackedExtensions original = result;
+ result = new TestUnpackedExtensions();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -17334,12 +19005,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 (resultIsReadOnly) {
+ return result;
}
- TestUnpackedExtensions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -17353,6 +19023,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 +19034,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;
@@ -17415,7 +19087,8 @@ 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<TestDynamicExtensions, TestDynamicExtensions.Builder> {
- private static readonly TestDynamicExtensions defaultInstance = new Builder().BuildPartial();
+ private TestDynamicExtensions() { }
+ 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 {
@@ -17423,7 +19096,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestDynamicExtensions DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestDynamicExtensions ThisMessage {
@@ -17455,7 +19128,8 @@ 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<DynamicMessageType, DynamicMessageType.Builder> {
- private static readonly DynamicMessageType defaultInstance = new Builder().BuildPartial();
+ private DynamicMessageType() { }
+ 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 {
@@ -17463,7 +19137,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override DynamicMessageType DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override DynamicMessageType ThisMessage {
@@ -17549,11 +19223,15 @@ 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(); }
public static Builder CreateBuilder(DynamicMessageType prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -17563,21 +19241,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(DynamicMessageType cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- DynamicMessageType result = new DynamicMessageType();
+ private bool resultIsReadOnly;
+ private DynamicMessageType result;
+
+ private DynamicMessageType PrepareBuilder() {
+ if (resultIsReadOnly) {
+ DynamicMessageType original = result;
+ result = new DynamicMessageType();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -17589,12 +19294,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 (resultIsReadOnly) {
+ return result;
}
- DynamicMessageType returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -17608,6 +19312,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 +19325,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 +19381,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;
@@ -17726,22 +19434,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;
@@ -17879,11 +19587,17 @@ 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(); }
public static Builder CreateBuilder(TestDynamicExtensions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -17893,21 +19607,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestDynamicExtensions cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private TestDynamicExtensions result;
+
+ private TestDynamicExtensions PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestDynamicExtensions original = result;
+ result = new TestDynamicExtensions();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestDynamicExtensions result = new TestDynamicExtensions();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -17919,14 +19660,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.repeatedExtension_.MakeReadOnly();
- result.packedExtension_.MakeReadOnly();
- TestDynamicExtensions returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -17940,6 +19678,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;
}
@@ -17956,10 +19695,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;
@@ -17970,6 +19709,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 +19818,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 +19838,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 +19858,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 +19879,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,8 +19904,9 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearMessageExtension() {
+ PrepareBuilder();
result.hasMessageExtension = false;
- result.messageExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance;
+ result.messageExtension_ = null;
return this;
}
@@ -18169,18 +19919,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 +19944,14 @@ namespace Google.ProtocolBuffers.TestProtos { return this;
}
public Builder ClearDynamicMessageExtension() {
+ PrepareBuilder();
result.hasDynamicMessageExtension = false;
- result.dynamicMessageExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance;
+ result.dynamicMessageExtension_ = null;
return this;
}
public pbc::IPopsicleList<string> RepeatedExtensionList {
- get { return result.repeatedExtension_; }
+ get { return PrepareBuilder().repeatedExtension_; }
}
public int RepeatedExtensionCount {
get { return result.RepeatedExtensionCount; }
@@ -18207,25 +19961,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<string> values) {
- base.AddRange(values, result.repeatedExtension_);
+ PrepareBuilder();
+ result.repeatedExtension_.Add(values);
return this;
}
public Builder ClearRepeatedExtension() {
+ PrepareBuilder();
result.repeatedExtension_.Clear();
return this;
}
public pbc::IPopsicleList<int> PackedExtensionList {
- get { return result.packedExtension_; }
+ get { return PrepareBuilder().packedExtension_; }
}
public int PackedExtensionCount {
get { return result.PackedExtensionCount; }
@@ -18234,18 +19992,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<int> values) {
- base.AddRange(values, result.packedExtension_);
+ PrepareBuilder();
+ result.packedExtension_.Add(values);
return this;
}
public Builder ClearPackedExtension() {
+ PrepareBuilder();
result.packedExtension_.Clear();
return this;
}
@@ -18259,7 +20021,8 @@ 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<TestRepeatedScalarDifferentTagSizes, TestRepeatedScalarDifferentTagSizes.Builder> {
- private static readonly TestRepeatedScalarDifferentTagSizes defaultInstance = new Builder().BuildPartial();
+ private TestRepeatedScalarDifferentTagSizes() { }
+ 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 {
@@ -18267,7 +20030,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override TestRepeatedScalarDifferentTagSizes DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override TestRepeatedScalarDifferentTagSizes ThisMessage {
@@ -18475,11 +20238,21 @@ 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(); }
public static Builder CreateBuilder(TestRepeatedScalarDifferentTagSizes prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -18489,21 +20262,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(TestRepeatedScalarDifferentTagSizes cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- TestRepeatedScalarDifferentTagSizes result = new TestRepeatedScalarDifferentTagSizes();
+ private bool resultIsReadOnly;
+ private TestRepeatedScalarDifferentTagSizes result;
+
+ private TestRepeatedScalarDifferentTagSizes PrepareBuilder() {
+ if (resultIsReadOnly) {
+ TestRepeatedScalarDifferentTagSizes original = result;
+ result = new TestRepeatedScalarDifferentTagSizes();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -18515,18 +20315,11 @@ 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 (resultIsReadOnly) {
+ return result;
}
- result.repeatedFixed32_.MakeReadOnly();
- result.repeatedInt32_.MakeReadOnly();
- result.repeatedFixed64_.MakeReadOnly();
- result.repeatedInt64_.MakeReadOnly();
- result.repeatedFloat_.MakeReadOnly();
- result.repeatedUint64_.MakeReadOnly();
- TestRepeatedScalarDifferentTagSizes returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -18540,23 +20333,24 @@ 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_);
+ 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;
@@ -18567,6 +20361,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 +20437,7 @@ namespace Google.ProtocolBuffers.TestProtos { [global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> RepeatedFixed32List {
- get { return result.repeatedFixed32_; }
+ get { return PrepareBuilder().repeatedFixed32_; }
}
public int RepeatedFixed32Count {
get { return result.RepeatedFixed32Count; }
@@ -18653,26 +20448,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<uint> values) {
- base.AddRange(values, result.repeatedFixed32_);
+ PrepareBuilder();
+ result.repeatedFixed32_.Add(values);
return this;
}
public Builder ClearRepeatedFixed32() {
+ PrepareBuilder();
result.repeatedFixed32_.Clear();
return this;
}
public pbc::IPopsicleList<int> RepeatedInt32List {
- get { return result.repeatedInt32_; }
+ get { return PrepareBuilder().repeatedInt32_; }
}
public int RepeatedInt32Count {
get { return result.RepeatedInt32Count; }
@@ -18681,25 +20480,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<int> values) {
- base.AddRange(values, result.repeatedInt32_);
+ PrepareBuilder();
+ result.repeatedInt32_.Add(values);
return this;
}
public Builder ClearRepeatedInt32() {
+ PrepareBuilder();
result.repeatedInt32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> RepeatedFixed64List {
- get { return result.repeatedFixed64_; }
+ get { return PrepareBuilder().repeatedFixed64_; }
}
public int RepeatedFixed64Count {
get { return result.RepeatedFixed64Count; }
@@ -18710,26 +20513,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<ulong> values) {
- base.AddRange(values, result.repeatedFixed64_);
+ PrepareBuilder();
+ result.repeatedFixed64_.Add(values);
return this;
}
public Builder ClearRepeatedFixed64() {
+ PrepareBuilder();
result.repeatedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedInt64List {
- get { return result.repeatedInt64_; }
+ get { return PrepareBuilder().repeatedInt64_; }
}
public int RepeatedInt64Count {
get { return result.RepeatedInt64Count; }
@@ -18738,24 +20545,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<long> values) {
- base.AddRange(values, result.repeatedInt64_);
+ PrepareBuilder();
+ result.repeatedInt64_.Add(values);
return this;
}
public Builder ClearRepeatedInt64() {
+ PrepareBuilder();
result.repeatedInt64_.Clear();
return this;
}
public pbc::IPopsicleList<float> RepeatedFloatList {
- get { return result.repeatedFloat_; }
+ get { return PrepareBuilder().repeatedFloat_; }
}
public int RepeatedFloatCount {
get { return result.RepeatedFloatCount; }
@@ -18764,25 +20575,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<float> values) {
- base.AddRange(values, result.repeatedFloat_);
+ PrepareBuilder();
+ result.repeatedFloat_.Add(values);
return this;
}
public Builder ClearRepeatedFloat() {
+ PrepareBuilder();
result.repeatedFloat_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> RepeatedUint64List {
- get { return result.repeatedUint64_; }
+ get { return PrepareBuilder().repeatedUint64_; }
}
public int RepeatedUint64Count {
get { return result.RepeatedUint64Count; }
@@ -18793,20 +20608,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<ulong> values) {
- base.AddRange(values, result.repeatedUint64_);
+ PrepareBuilder();
+ result.repeatedUint64_.Add(values);
return this;
}
public Builder ClearRepeatedUint64() {
+ PrepareBuilder();
result.repeatedUint64_.Clear();
return this;
}
@@ -18820,7 +20639,8 @@ 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<FooRequest, FooRequest.Builder> {
- private static readonly FooRequest defaultInstance = new Builder().BuildPartial();
+ private FooRequest() { }
+ 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 {
@@ -18828,7 +20648,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override FooRequest DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override FooRequest ThisMessage {
@@ -18898,11 +20718,15 @@ 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(); }
public static Builder CreateBuilder(FooRequest prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -18912,21 +20736,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(FooRequest cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
+
+ private bool resultIsReadOnly;
+ private FooRequest result;
+
+ private FooRequest PrepareBuilder() {
+ if (resultIsReadOnly) {
+ FooRequest original = result;
+ result = new FooRequest();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- FooRequest result = new FooRequest();
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -18938,12 +20789,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 (resultIsReadOnly) {
+ return result;
}
- FooRequest returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -18957,6 +20807,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 +20817,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;
@@ -19018,7 +20870,8 @@ 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<FooResponse, FooResponse.Builder> {
- private static readonly FooResponse defaultInstance = new Builder().BuildPartial();
+ private FooResponse() { }
+ 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 {
@@ -19026,7 +20879,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override FooResponse DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override FooResponse ThisMessage {
@@ -19096,11 +20949,15 @@ 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(); }
public static Builder CreateBuilder(FooResponse prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -19110,21 +20967,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(FooResponse cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- FooResponse result = new FooResponse();
+ private bool resultIsReadOnly;
+ private FooResponse result;
+
+ private FooResponse PrepareBuilder() {
+ if (resultIsReadOnly) {
+ FooResponse original = result;
+ result = new FooResponse();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -19136,12 +21020,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 (resultIsReadOnly) {
+ return result;
}
- FooResponse returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -19155,6 +21038,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 +21048,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;
@@ -19216,7 +21101,8 @@ 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<BarRequest, BarRequest.Builder> {
- private static readonly BarRequest defaultInstance = new Builder().BuildPartial();
+ private BarRequest() { }
+ 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 {
@@ -19224,7 +21110,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override BarRequest DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override BarRequest ThisMessage {
@@ -19294,11 +21180,15 @@ 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(); }
public static Builder CreateBuilder(BarRequest prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -19308,21 +21198,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(BarRequest cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- BarRequest result = new BarRequest();
+ private bool resultIsReadOnly;
+ private BarRequest result;
+
+ private BarRequest PrepareBuilder() {
+ if (resultIsReadOnly) {
+ BarRequest original = result;
+ result = new BarRequest();
+ resultIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -19334,12 +21251,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 (resultIsReadOnly) {
+ return result;
}
- BarRequest returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -19353,6 +21269,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 +21279,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;
@@ -19414,7 +21332,8 @@ 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<BarResponse, BarResponse.Builder> {
- private static readonly BarResponse defaultInstance = new Builder().BuildPartial();
+ private BarResponse() { }
+ 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 {
@@ -19422,7 +21341,7 @@ namespace Google.ProtocolBuffers.TestProtos { }
public override BarResponse DefaultInstanceForType {
- get { return defaultInstance; }
+ get { return DefaultInstance; }
}
protected override BarResponse ThisMessage {
@@ -19492,11 +21411,15 @@ 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(); }
public static Builder CreateBuilder(BarResponse prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -19506,21 +21429,48 @@ namespace Google.ProtocolBuffers.TestProtos { protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance;
+ resultIsReadOnly = true;
+ }
+ internal Builder(BarResponse cloneFrom) {
+ result = cloneFrom;
+ resultIsReadOnly = true;
+ }
- BarResponse result = new BarResponse();
+ private bool resultIsReadOnly;
+ private BarResponse result;
+
+ private BarResponse PrepareBuilder() {
+ if (resultIsReadOnly) {
+ BarResponse original = result;
+ result = new BarResponse();
+ resultIsReadOnly = 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;
+ resultIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (resultIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -19532,12 +21482,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 (resultIsReadOnly) {
+ return result;
}
- BarResponse returnMe = result;
- result = null;
- return returnMe;
+ resultIsReadOnly = true;
+ return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -19551,6 +21500,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 +21510,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/todo.txt b/todo.txt deleted file mode 100644 index 5256ca08..00000000 --- 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
|