aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/Google.Protobuf.Test
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/src/Google.Protobuf.Test')
-rw-r--r--csharp/src/Google.Protobuf.Test/ByteStringTest.cs2
-rw-r--r--csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj4
-rw-r--r--csharp/src/Google.Protobuf.Test/Reflection/DescriptorDeclarationTest.cs175
-rw-r--r--csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs150
-rw-r--r--csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs6
-rw-r--r--csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs73
-rw-r--r--csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs18
-rw-r--r--csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs10
-rw-r--r--csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs417
-rw-r--r--csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs69
-rw-r--r--csharp/src/Google.Protobuf.Test/testprotos.pbbin0 -> 204268 bytes
11 files changed, 761 insertions, 163 deletions
diff --git a/csharp/src/Google.Protobuf.Test/ByteStringTest.cs b/csharp/src/Google.Protobuf.Test/ByteStringTest.cs
index afdd491f..84e6341e 100644
--- a/csharp/src/Google.Protobuf.Test/ByteStringTest.cs
+++ b/csharp/src/Google.Protobuf.Test/ByteStringTest.cs
@@ -227,7 +227,7 @@ namespace Google.Protobuf
{
// We used to have an awful hash algorithm where only the last four
// bytes were relevant. This is a regression test for
- // https://github.com/google/protobuf/issues/2511
+ // https://github.com/protocolbuffers/protobuf/issues/2511
ByteString b1 = ByteString.CopyFrom(100, 1, 2, 3, 4);
ByteString b2 = ByteString.CopyFrom(200, 1, 2, 3, 4);
diff --git a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
index 6a430116..f286e0aa 100644
--- a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
+++ b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
@@ -27,4 +27,8 @@
<TargetFrameworks>netcoreapp1.0</TargetFrameworks>
</PropertyGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="testprotos.pb" />
+ </ItemGroup>
+
</Project>
diff --git a/csharp/src/Google.Protobuf.Test/Reflection/DescriptorDeclarationTest.cs b/csharp/src/Google.Protobuf.Test/Reflection/DescriptorDeclarationTest.cs
new file mode 100644
index 00000000..d9d56672
--- /dev/null
+++ b/csharp/src/Google.Protobuf.Test/Reflection/DescriptorDeclarationTest.cs
@@ -0,0 +1,175 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2018 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// 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 Google.Protobuf.Reflection;
+using NUnit.Framework;
+using System.Linq;
+using System.Reflection;
+
+namespace Google.Protobuf.Test.Reflection
+{
+ // In reality this isn't a test for DescriptorDeclaration so much as the way they're loaded.
+ public class DescriptorDeclarationTest
+ {
+ static readonly FileDescriptor unitTestProto3Descriptor = LoadProtos();
+
+ // Note: we don't expose a declaration for FileDescriptor as it doesn't have comments
+ // at the moment and the locations aren't terribly useful.
+
+ // The tests for most elements are quite basic: we don't test every aspect of every element.
+ // The code within the library falls into two categories:
+ // - Exposing the properties for *any* declaration
+ // - Finding the right declaration for an element from the descriptor data
+ // We have a per-element check to make sure we *are* finding the right declaration, and we
+ // check every property of declarations in at least one test, but we don't have a cross-product.
+ // That would effectively be testing protoc, which seems redundant here.
+
+ [Test]
+ public void ServiceComments()
+ {
+ var service = unitTestProto3Descriptor.FindTypeByName<ServiceDescriptor>("TestService");
+ Assert.NotNull(service.Declaration);
+ Assert.AreEqual(" This is a test service\n", service.Declaration.LeadingComments);
+ }
+
+ [Test]
+ public void MethodComments()
+ {
+ var service = unitTestProto3Descriptor.FindTypeByName<ServiceDescriptor>("TestService");
+ var method = service.FindMethodByName("Foo");
+ Assert.NotNull(method.Declaration);
+ Assert.AreEqual(" This is a test method\n", method.Declaration.LeadingComments);
+ }
+
+ [Test]
+ public void MessageComments()
+ {
+ var message = unitTestProto3Descriptor.FindTypeByName<MessageDescriptor>("CommentMessage");
+ Assert.NotNull(message.Declaration);
+ Assert.AreEqual(" This is a leading comment\n", message.Declaration.LeadingComments);
+ Assert.AreEqual(new[] { " This is leading detached comment 1\n", " This is leading detached comment 2\n" },
+ message.Declaration.LeadingDetachedComments);
+ }
+
+ // Note: this test is somewhat brittle; a change earlier in the proto will break it.
+ [Test]
+ public void MessageLocations()
+ {
+ var message = unitTestProto3Descriptor.FindTypeByName<MessageDescriptor>("CommentMessage");
+ Assert.NotNull(message.Declaration);
+ Assert.AreEqual(389, message.Declaration.StartLine);
+ Assert.AreEqual(1, message.Declaration.StartColumn);
+
+ Assert.AreEqual(404, message.Declaration.EndLine);
+ Assert.AreEqual(2, message.Declaration.EndColumn);
+ }
+
+ [Test]
+ public void EnumComments()
+ {
+ var descriptor = unitTestProto3Descriptor.FindTypeByName<EnumDescriptor>("CommentEnum");
+ Assert.NotNull(descriptor.Declaration);
+ Assert.AreEqual(" Leading enum comment\n", descriptor.Declaration.LeadingComments);
+ }
+
+ [Test]
+ public void NestedMessageComments()
+ {
+ var outer = unitTestProto3Descriptor.FindTypeByName<MessageDescriptor>("CommentMessage");
+ var nested = outer.FindDescriptor<MessageDescriptor>("NestedCommentMessage");
+ Assert.NotNull(nested.Declaration);
+ Assert.AreEqual(" Leading nested message comment\n", nested.Declaration.LeadingComments);
+ }
+
+ [Test]
+ public void NestedEnumComments()
+ {
+ var outer = unitTestProto3Descriptor.FindTypeByName<MessageDescriptor>("CommentMessage");
+ var nested = outer.FindDescriptor<EnumDescriptor>("NestedCommentEnum");
+ Assert.NotNull(nested.Declaration);
+ Assert.AreEqual(" Leading nested enum comment\n", nested.Declaration.LeadingComments);
+ }
+
+ [Test]
+ public void FieldComments()
+ {
+ var message = unitTestProto3Descriptor.FindTypeByName<MessageDescriptor>("CommentMessage");
+ var field = message.FindFieldByName("text");
+ Assert.NotNull(field.Declaration);
+ Assert.AreEqual(" Leading field comment\n", field.Declaration.LeadingComments);
+ Assert.AreEqual(" Trailing field comment\n", field.Declaration.TrailingComments);
+ }
+
+ [Test]
+ public void NestedMessageFieldComments()
+ {
+ var outer = unitTestProto3Descriptor.FindTypeByName<MessageDescriptor>("CommentMessage");
+ var nested = outer.FindDescriptor<MessageDescriptor>("NestedCommentMessage");
+ var field = nested.FindFieldByName("nested_text");
+ Assert.NotNull(field.Declaration);
+ Assert.AreEqual(" Leading nested message field comment\n", field.Declaration.LeadingComments);
+ }
+
+ [Test]
+ public void EnumValueComments()
+ {
+ var enumDescriptor = unitTestProto3Descriptor.FindTypeByName<EnumDescriptor>("CommentEnum");
+ var value = enumDescriptor.FindValueByName("ZERO_VALUE");
+ Assert.NotNull(value.Declaration);
+ Assert.AreEqual(" Zero value comment\n", value.Declaration.LeadingComments);
+ }
+
+ [Test]
+ public void NestedEnumValueComments()
+ {
+ var outer = unitTestProto3Descriptor.FindTypeByName<MessageDescriptor>("CommentMessage");
+ var nested = outer.FindDescriptor<EnumDescriptor>("NestedCommentEnum");
+ var value = nested.FindValueByName("ZERO_VALUE");
+ Assert.NotNull(value.Declaration);
+ Assert.AreEqual(" Zero value comment\n", value.Declaration.LeadingComments);
+ }
+
+ private static FileDescriptor LoadProtos()
+ {
+ var type = typeof(DescriptorDeclarationTest);
+ // TODO: Make this simpler :)
+ FileDescriptorSet descriptorSet;
+ using (var stream = type.GetTypeInfo().Assembly.GetManifestResourceStream($"Google.Protobuf.Test.testprotos.pb"))
+ {
+ descriptorSet = FileDescriptorSet.Parser.ParseFrom(stream);
+ }
+ var byteStrings = descriptorSet.File.Select(f => f.ToByteString()).ToList();
+ var descriptors = FileDescriptor.BuildFromByteStrings(byteStrings);
+ return descriptors.Single(d => d.Name == "unittest_proto3.proto");
+ }
+ }
+}
diff --git a/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs b/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
index 29a376e0..8e1097aa 100644
--- a/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
+++ b/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
@@ -30,10 +30,11 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
-using System.Linq;
using Google.Protobuf.TestProtos;
using NUnit.Framework;
-using UnitTest.Issues.TestProtos;
+using System;
+using System.Collections.Generic;
+using System.Linq;
namespace Google.Protobuf.Reflection
{
@@ -44,10 +45,32 @@ namespace Google.Protobuf.Reflection
public class DescriptorsTest
{
[Test]
- public void FileDescriptor()
+ public void FileDescriptor_GeneratedCode()
{
- FileDescriptor file = UnittestProto3Reflection.Descriptor;
+ TestFileDescriptor(
+ UnittestProto3Reflection.Descriptor,
+ UnittestImportProto3Reflection.Descriptor,
+ UnittestImportPublicProto3Reflection.Descriptor);
+ }
+ [Test]
+ public void FileDescriptor_BuildFromByteStrings()
+ {
+ // The descriptors have to be supplied in an order such that all the
+ // dependencies come before the descriptors depending on them.
+ var descriptorData = new List<ByteString>
+ {
+ UnittestImportPublicProto3Reflection.Descriptor.SerializedData,
+ UnittestImportProto3Reflection.Descriptor.SerializedData,
+ UnittestProto3Reflection.Descriptor.SerializedData
+ };
+ var converted = FileDescriptor.BuildFromByteStrings(descriptorData);
+ Assert.AreEqual(3, converted.Count);
+ TestFileDescriptor(converted[2], converted[1], converted[0]);
+ }
+
+ private void TestFileDescriptor(FileDescriptor file, FileDescriptor importedFile, FileDescriptor importedPublicFile)
+ {
Assert.AreEqual("unittest_proto3.proto", file.Name);
Assert.AreEqual("protobuf_unittest3", file.Package);
@@ -56,17 +79,12 @@ namespace Google.Protobuf.Reflection
// unittest_proto3.proto doesn't have any public imports, but unittest_import_proto3.proto does.
Assert.AreEqual(0, file.PublicDependencies.Count);
- Assert.AreEqual(1, UnittestImportProto3Reflection.Descriptor.PublicDependencies.Count);
- Assert.AreEqual(UnittestImportPublicProto3Reflection.Descriptor, UnittestImportProto3Reflection.Descriptor.PublicDependencies[0]);
+ Assert.AreEqual(1, importedFile.PublicDependencies.Count);
+ Assert.AreEqual(importedPublicFile, importedFile.PublicDependencies[0]);
Assert.AreEqual(1, file.Dependencies.Count);
- Assert.AreEqual(UnittestImportProto3Reflection.Descriptor, file.Dependencies[0]);
+ Assert.AreEqual(importedFile, file.Dependencies[0]);
- MessageDescriptor messageType = TestAllTypes.Descriptor;
- Assert.AreSame(typeof(TestAllTypes), messageType.ClrType);
- Assert.AreSame(TestAllTypes.Parser, messageType.Parser);
- Assert.AreEqual(messageType, file.MessageTypes[0]);
- Assert.AreEqual(messageType, file.FindTypeByName<MessageDescriptor>("TestAllTypes"));
Assert.Null(file.FindTypeByName<MessageDescriptor>("NoSuchType"));
Assert.Null(file.FindTypeByName<MessageDescriptor>("protobuf_unittest3.TestAllTypes"));
for (int i = 0; i < file.MessageTypes.Count; i++)
@@ -77,8 +95,8 @@ namespace Google.Protobuf.Reflection
Assert.AreEqual(file.EnumTypes[0], file.FindTypeByName<EnumDescriptor>("ForeignEnum"));
Assert.Null(file.FindTypeByName<EnumDescriptor>("NoSuchType"));
Assert.Null(file.FindTypeByName<EnumDescriptor>("protobuf_unittest3.ForeignEnum"));
- Assert.AreEqual(1, UnittestImportProto3Reflection.Descriptor.EnumTypes.Count);
- Assert.AreEqual("ImportEnum", UnittestImportProto3Reflection.Descriptor.EnumTypes[0].Name);
+ Assert.AreEqual(1, importedFile.EnumTypes.Count);
+ Assert.AreEqual("ImportEnum", importedFile.EnumTypes[0].Name);
for (int i = 0; i < file.EnumTypes.Count; i++)
{
Assert.AreEqual(i, file.EnumTypes[i].Index);
@@ -98,6 +116,56 @@ namespace Google.Protobuf.Reflection
}
[Test]
+ public void FileDescriptor_BuildFromByteStrings_MissingDependency()
+ {
+ var descriptorData = new List<ByteString>
+ {
+ UnittestImportProto3Reflection.Descriptor.SerializedData,
+ UnittestProto3Reflection.Descriptor.SerializedData,
+ };
+ // This will fail, because we're missing UnittestImportPublicProto3Reflection
+ Assert.Throws<ArgumentException>(() => FileDescriptor.BuildFromByteStrings(descriptorData));
+ }
+
+ [Test]
+ public void FileDescriptor_BuildFromByteStrings_DuplicateNames()
+ {
+ var descriptorData = new List<ByteString>
+ {
+ UnittestImportPublicProto3Reflection.Descriptor.SerializedData,
+ UnittestImportPublicProto3Reflection.Descriptor.SerializedData,
+ };
+ // This will fail due to the same name being used twice
+ Assert.Throws<ArgumentException>(() => FileDescriptor.BuildFromByteStrings(descriptorData));
+ }
+
+ [Test]
+ public void FileDescriptor_BuildFromByteStrings_IncorrectOrder()
+ {
+ var descriptorData = new List<ByteString>
+ {
+ UnittestProto3Reflection.Descriptor.SerializedData,
+ UnittestImportPublicProto3Reflection.Descriptor.SerializedData,
+ UnittestImportProto3Reflection.Descriptor.SerializedData
+ };
+ // This will fail, because the dependencies should come first
+ Assert.Throws<ArgumentException>(() => FileDescriptor.BuildFromByteStrings(descriptorData));
+
+ }
+
+ [Test]
+ public void MessageDescriptorFromGeneratedCodeFileDescriptor()
+ {
+ var file = UnittestProto3Reflection.Descriptor;
+
+ MessageDescriptor messageType = TestAllTypes.Descriptor;
+ Assert.AreSame(typeof(TestAllTypes), messageType.ClrType);
+ Assert.AreSame(TestAllTypes.Parser, messageType.Parser);
+ Assert.AreEqual(messageType, file.MessageTypes[0]);
+ Assert.AreEqual(messageType, file.FindTypeByName<MessageDescriptor>("TestAllTypes"));
+ }
+
+ [Test]
public void MessageDescriptor()
{
MessageDescriptor messageType = TestAllTypes.Descriptor;
@@ -145,29 +213,61 @@ namespace Google.Protobuf.Reflection
}
[Test]
- public void FieldDescriptor()
+ public void FieldDescriptor_GeneratedCode()
{
- MessageDescriptor messageType = TestAllTypes.Descriptor;
- FieldDescriptor primitiveField = messageType.FindDescriptor<FieldDescriptor>("single_int32");
- FieldDescriptor enumField = messageType.FindDescriptor<FieldDescriptor>("single_nested_enum");
- FieldDescriptor messageField = messageType.FindDescriptor<FieldDescriptor>("single_foreign_message");
+ TestFieldDescriptor(UnittestProto3Reflection.Descriptor, TestAllTypes.Descriptor, ForeignMessage.Descriptor, ImportMessage.Descriptor);
+ }
+
+ [Test]
+ public void FieldDescriptor_BuildFromByteStrings()
+ {
+ // The descriptors have to be supplied in an order such that all the
+ // dependencies come before the descriptors depending on them.
+ var descriptorData = new List<ByteString>
+ {
+ UnittestImportPublicProto3Reflection.Descriptor.SerializedData,
+ UnittestImportProto3Reflection.Descriptor.SerializedData,
+ UnittestProto3Reflection.Descriptor.SerializedData
+ };
+ var converted = FileDescriptor.BuildFromByteStrings(descriptorData);
+ TestFieldDescriptor(
+ converted[2],
+ converted[2].FindTypeByName<MessageDescriptor>("TestAllTypes"),
+ converted[2].FindTypeByName<MessageDescriptor>("ForeignMessage"),
+ converted[1].FindTypeByName<MessageDescriptor>("ImportMessage"));
+ }
+
+ public void TestFieldDescriptor(
+ FileDescriptor unitTestProto3Descriptor,
+ MessageDescriptor testAllTypesDescriptor,
+ MessageDescriptor foreignMessageDescriptor,
+ MessageDescriptor importMessageDescriptor)
+ {
+ FieldDescriptor primitiveField = testAllTypesDescriptor.FindDescriptor<FieldDescriptor>("single_int32");
+ FieldDescriptor enumField = testAllTypesDescriptor.FindDescriptor<FieldDescriptor>("single_nested_enum");
+ FieldDescriptor foreignMessageField = testAllTypesDescriptor.FindDescriptor<FieldDescriptor>("single_foreign_message");
+ FieldDescriptor importMessageField = testAllTypesDescriptor.FindDescriptor<FieldDescriptor>("single_import_message");
Assert.AreEqual("single_int32", primitiveField.Name);
Assert.AreEqual("protobuf_unittest3.TestAllTypes.single_int32",
primitiveField.FullName);
Assert.AreEqual(1, primitiveField.FieldNumber);
- Assert.AreEqual(messageType, primitiveField.ContainingType);
- Assert.AreEqual(UnittestProto3Reflection.Descriptor, primitiveField.File);
+ Assert.AreEqual(testAllTypesDescriptor, primitiveField.ContainingType);
+ Assert.AreEqual(unitTestProto3Descriptor, primitiveField.File);
Assert.AreEqual(FieldType.Int32, primitiveField.FieldType);
Assert.IsNull(primitiveField.Proto.Options);
Assert.AreEqual("single_nested_enum", enumField.Name);
Assert.AreEqual(FieldType.Enum, enumField.FieldType);
- // Assert.AreEqual(TestAllTypes.Types.NestedEnum.DescriptorProtoFile, enumField.EnumType);
+ Assert.AreEqual(testAllTypesDescriptor.EnumTypes[0], enumField.EnumType);
+
+ Assert.AreEqual("single_foreign_message", foreignMessageField.Name);
+ Assert.AreEqual(FieldType.Message, foreignMessageField.FieldType);
+ Assert.AreEqual(foreignMessageDescriptor, foreignMessageField.MessageType);
- Assert.AreEqual("single_foreign_message", messageField.Name);
- Assert.AreEqual(FieldType.Message, messageField.FieldType);
- Assert.AreEqual(ForeignMessage.Descriptor, messageField.MessageType);
+ Assert.AreEqual("single_import_message", importMessageField.Name);
+ Assert.AreEqual(FieldType.Message, importMessageField.FieldType);
+ Assert.AreEqual(importMessageDescriptor, importMessageField.MessageType);
}
[Test]
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
index 51715a0c..6d3cd026 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
@@ -724,7 +724,7 @@ namespace Google.Protobuf.TestProtos {
}
if (other.testMap_ != null) {
if (testMap_ == null) {
- testMap_ = new global::Google.Protobuf.TestProtos.TestMap();
+ TestMap = new global::Google.Protobuf.TestProtos.TestMap();
}
TestMap.MergeFrom(other.TestMap);
}
@@ -741,9 +741,9 @@ namespace Google.Protobuf.TestProtos {
break;
case 10: {
if (testMap_ == null) {
- testMap_ = new global::Google.Protobuf.TestProtos.TestMap();
+ TestMap = new global::Google.Protobuf.TestProtos.TestMap();
}
- input.ReadMessage(testMap_);
+ input.ReadMessage(TestMap);
break;
}
}
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs
index 7353be7b..d74422b5 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs
@@ -1171,6 +1171,7 @@ namespace ProtobufTestMessages.Proto3 {
}
}
+
/// <summary>Field number for the "optional_int32_wrapper" field.</summary>
public const int OptionalInt32WrapperFieldNumber = 202;
private static readonly pb::FieldCodec<int?> _single_optionalInt32Wrapper_codec = pb::FieldCodec.ForStructWrapper<int>(1618);
@@ -1183,6 +1184,7 @@ namespace ProtobufTestMessages.Proto3 {
}
}
+
/// <summary>Field number for the "optional_int64_wrapper" field.</summary>
public const int OptionalInt64WrapperFieldNumber = 203;
private static readonly pb::FieldCodec<long?> _single_optionalInt64Wrapper_codec = pb::FieldCodec.ForStructWrapper<long>(1626);
@@ -1195,6 +1197,7 @@ namespace ProtobufTestMessages.Proto3 {
}
}
+
/// <summary>Field number for the "optional_uint32_wrapper" field.</summary>
public const int OptionalUint32WrapperFieldNumber = 204;
private static readonly pb::FieldCodec<uint?> _single_optionalUint32Wrapper_codec = pb::FieldCodec.ForStructWrapper<uint>(1634);
@@ -1207,6 +1210,7 @@ namespace ProtobufTestMessages.Proto3 {
}
}
+
/// <summary>Field number for the "optional_uint64_wrapper" field.</summary>
public const int OptionalUint64WrapperFieldNumber = 205;
private static readonly pb::FieldCodec<ulong?> _single_optionalUint64Wrapper_codec = pb::FieldCodec.ForStructWrapper<ulong>(1642);
@@ -1219,6 +1223,7 @@ namespace ProtobufTestMessages.Proto3 {
}
}
+
/// <summary>Field number for the "optional_float_wrapper" field.</summary>
public const int OptionalFloatWrapperFieldNumber = 206;
private static readonly pb::FieldCodec<float?> _single_optionalFloatWrapper_codec = pb::FieldCodec.ForStructWrapper<float>(1650);
@@ -1231,6 +1236,7 @@ namespace ProtobufTestMessages.Proto3 {
}
}
+
/// <summary>Field number for the "optional_double_wrapper" field.</summary>
public const int OptionalDoubleWrapperFieldNumber = 207;
private static readonly pb::FieldCodec<double?> _single_optionalDoubleWrapper_codec = pb::FieldCodec.ForStructWrapper<double>(1658);
@@ -1243,6 +1249,7 @@ namespace ProtobufTestMessages.Proto3 {
}
}
+
/// <summary>Field number for the "optional_string_wrapper" field.</summary>
public const int OptionalStringWrapperFieldNumber = 208;
private static readonly pb::FieldCodec<string> _single_optionalStringWrapper_codec = pb::FieldCodec.ForClassWrapper<string>(1666);
@@ -1255,6 +1262,7 @@ namespace ProtobufTestMessages.Proto3 {
}
}
+
/// <summary>Field number for the "optional_bytes_wrapper" field.</summary>
public const int OptionalBytesWrapperFieldNumber = 209;
private static readonly pb::FieldCodec<pb::ByteString> _single_optionalBytesWrapper_codec = pb::FieldCodec.ForClassWrapper<pb::ByteString>(1674);
@@ -1267,6 +1275,7 @@ namespace ProtobufTestMessages.Proto3 {
}
}
+
/// <summary>Field number for the "repeated_bool_wrapper" field.</summary>
public const int RepeatedBoolWrapperFieldNumber = 211;
private static readonly pb::FieldCodec<bool?> _repeated_repeatedBoolWrapper_codec
@@ -2598,13 +2607,13 @@ namespace ProtobufTestMessages.Proto3 {
}
if (other.optionalNestedMessage_ != null) {
if (optionalNestedMessage_ == null) {
- optionalNestedMessage_ = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage();
+ OptionalNestedMessage = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage();
}
OptionalNestedMessage.MergeFrom(other.OptionalNestedMessage);
}
if (other.optionalForeignMessage_ != null) {
if (optionalForeignMessage_ == null) {
- optionalForeignMessage_ = new global::ProtobufTestMessages.Proto3.ForeignMessage();
+ OptionalForeignMessage = new global::ProtobufTestMessages.Proto3.ForeignMessage();
}
OptionalForeignMessage.MergeFrom(other.OptionalForeignMessage);
}
@@ -2622,7 +2631,7 @@ namespace ProtobufTestMessages.Proto3 {
}
if (other.recursiveMessage_ != null) {
if (recursiveMessage_ == null) {
- recursiveMessage_ = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3();
+ RecursiveMessage = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3();
}
RecursiveMessage.MergeFrom(other.RecursiveMessage);
}
@@ -2722,37 +2731,37 @@ namespace ProtobufTestMessages.Proto3 {
repeatedBytesWrapper_.Add(other.repeatedBytesWrapper_);
if (other.optionalDuration_ != null) {
if (optionalDuration_ == null) {
- optionalDuration_ = new global::Google.Protobuf.WellKnownTypes.Duration();
+ OptionalDuration = new global::Google.Protobuf.WellKnownTypes.Duration();
}
OptionalDuration.MergeFrom(other.OptionalDuration);
}
if (other.optionalTimestamp_ != null) {
if (optionalTimestamp_ == null) {
- optionalTimestamp_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
+ OptionalTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
OptionalTimestamp.MergeFrom(other.OptionalTimestamp);
}
if (other.optionalFieldMask_ != null) {
if (optionalFieldMask_ == null) {
- optionalFieldMask_ = new global::Google.Protobuf.WellKnownTypes.FieldMask();
+ OptionalFieldMask = new global::Google.Protobuf.WellKnownTypes.FieldMask();
}
OptionalFieldMask.MergeFrom(other.OptionalFieldMask);
}
if (other.optionalStruct_ != null) {
if (optionalStruct_ == null) {
- optionalStruct_ = new global::Google.Protobuf.WellKnownTypes.Struct();
+ OptionalStruct = new global::Google.Protobuf.WellKnownTypes.Struct();
}
OptionalStruct.MergeFrom(other.OptionalStruct);
}
if (other.optionalAny_ != null) {
if (optionalAny_ == null) {
- optionalAny_ = new global::Google.Protobuf.WellKnownTypes.Any();
+ OptionalAny = new global::Google.Protobuf.WellKnownTypes.Any();
}
OptionalAny.MergeFrom(other.OptionalAny);
}
if (other.optionalValue_ != null) {
if (optionalValue_ == null) {
- optionalValue_ = new global::Google.Protobuf.WellKnownTypes.Value();
+ OptionalValue = new global::Google.Protobuf.WellKnownTypes.Value();
}
OptionalValue.MergeFrom(other.OptionalValue);
}
@@ -2922,24 +2931,24 @@ namespace ProtobufTestMessages.Proto3 {
}
case 146: {
if (optionalNestedMessage_ == null) {
- optionalNestedMessage_ = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage();
+ OptionalNestedMessage = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage();
}
- input.ReadMessage(optionalNestedMessage_);
+ input.ReadMessage(OptionalNestedMessage);
break;
}
case 154: {
if (optionalForeignMessage_ == null) {
- optionalForeignMessage_ = new global::ProtobufTestMessages.Proto3.ForeignMessage();
+ OptionalForeignMessage = new global::ProtobufTestMessages.Proto3.ForeignMessage();
}
- input.ReadMessage(optionalForeignMessage_);
+ input.ReadMessage(OptionalForeignMessage);
break;
}
case 168: {
- optionalNestedEnum_ = (global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedEnum) input.ReadEnum();
+ OptionalNestedEnum = (global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedEnum) input.ReadEnum();
break;
}
case 176: {
- optionalForeignEnum_ = (global::ProtobufTestMessages.Proto3.ForeignEnum) input.ReadEnum();
+ OptionalForeignEnum = (global::ProtobufTestMessages.Proto3.ForeignEnum) input.ReadEnum();
break;
}
case 194: {
@@ -2952,9 +2961,9 @@ namespace ProtobufTestMessages.Proto3 {
}
case 218: {
if (recursiveMessage_ == null) {
- recursiveMessage_ = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3();
+ RecursiveMessage = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3();
}
- input.ReadMessage(recursiveMessage_);
+ input.ReadMessage(RecursiveMessage);
break;
}
case 250:
@@ -3275,44 +3284,44 @@ namespace ProtobufTestMessages.Proto3 {
}
case 2410: {
if (optionalDuration_ == null) {
- optionalDuration_ = new global::Google.Protobuf.WellKnownTypes.Duration();
+ OptionalDuration = new global::Google.Protobuf.WellKnownTypes.Duration();
}
- input.ReadMessage(optionalDuration_);
+ input.ReadMessage(OptionalDuration);
break;
}
case 2418: {
if (optionalTimestamp_ == null) {
- optionalTimestamp_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
+ OptionalTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
- input.ReadMessage(optionalTimestamp_);
+ input.ReadMessage(OptionalTimestamp);
break;
}
case 2426: {
if (optionalFieldMask_ == null) {
- optionalFieldMask_ = new global::Google.Protobuf.WellKnownTypes.FieldMask();
+ OptionalFieldMask = new global::Google.Protobuf.WellKnownTypes.FieldMask();
}
- input.ReadMessage(optionalFieldMask_);
+ input.ReadMessage(OptionalFieldMask);
break;
}
case 2434: {
if (optionalStruct_ == null) {
- optionalStruct_ = new global::Google.Protobuf.WellKnownTypes.Struct();
+ OptionalStruct = new global::Google.Protobuf.WellKnownTypes.Struct();
}
- input.ReadMessage(optionalStruct_);
+ input.ReadMessage(OptionalStruct);
break;
}
case 2442: {
if (optionalAny_ == null) {
- optionalAny_ = new global::Google.Protobuf.WellKnownTypes.Any();
+ OptionalAny = new global::Google.Protobuf.WellKnownTypes.Any();
}
- input.ReadMessage(optionalAny_);
+ input.ReadMessage(OptionalAny);
break;
}
case 2450: {
if (optionalValue_ == null) {
- optionalValue_ = new global::Google.Protobuf.WellKnownTypes.Value();
+ OptionalValue = new global::Google.Protobuf.WellKnownTypes.Value();
}
- input.ReadMessage(optionalValue_);
+ input.ReadMessage(OptionalValue);
break;
}
case 2490: {
@@ -3560,7 +3569,7 @@ namespace ProtobufTestMessages.Proto3 {
}
if (other.corecursive_ != null) {
if (corecursive_ == null) {
- corecursive_ = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3();
+ Corecursive = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3();
}
Corecursive.MergeFrom(other.Corecursive);
}
@@ -3581,9 +3590,9 @@ namespace ProtobufTestMessages.Proto3 {
}
case 18: {
if (corecursive_ == null) {
- corecursive_ = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3();
+ Corecursive = new global::ProtobufTestMessages.Proto3.TestAllTypesProto3();
}
- input.ReadMessage(corecursive_);
+ input.ReadMessage(Corecursive);
break;
}
}
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs
index 3ab5a48b..2a9efe55 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs
@@ -1879,7 +1879,7 @@ namespace UnitTest.Issues.TestProtos {
}
if (other.bar_ != null) {
if (bar_ == null) {
- bar_ = new global::UnitTest.Issues.TestProtos.ComplexOptionType1();
+ Bar = new global::UnitTest.Issues.TestProtos.ComplexOptionType1();
}
Bar.MergeFrom(other.Bar);
}
@@ -1888,7 +1888,7 @@ namespace UnitTest.Issues.TestProtos {
}
if (other.fred_ != null) {
if (fred_ == null) {
- fred_ = new global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4();
+ Fred = new global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4();
}
Fred.MergeFrom(other.Fred);
}
@@ -1906,9 +1906,9 @@ namespace UnitTest.Issues.TestProtos {
break;
case 10: {
if (bar_ == null) {
- bar_ = new global::UnitTest.Issues.TestProtos.ComplexOptionType1();
+ Bar = new global::UnitTest.Issues.TestProtos.ComplexOptionType1();
}
- input.ReadMessage(bar_);
+ input.ReadMessage(Bar);
break;
}
case 16: {
@@ -1917,9 +1917,9 @@ namespace UnitTest.Issues.TestProtos {
}
case 26: {
if (fred_ == null) {
- fred_ = new global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4();
+ Fred = new global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4();
}
- input.ReadMessage(fred_);
+ input.ReadMessage(Fred);
break;
}
case 34: {
@@ -2462,7 +2462,7 @@ namespace UnitTest.Issues.TestProtos {
}
if (other.sub_ != null) {
if (sub_ == null) {
- sub_ = new global::UnitTest.Issues.TestProtos.Aggregate();
+ Sub = new global::UnitTest.Issues.TestProtos.Aggregate();
}
Sub.MergeFrom(other.Sub);
}
@@ -2487,9 +2487,9 @@ namespace UnitTest.Issues.TestProtos {
}
case 26: {
if (sub_ == null) {
- sub_ = new global::UnitTest.Issues.TestProtos.Aggregate();
+ Sub = new global::UnitTest.Issues.TestProtos.Aggregate();
}
- input.ReadMessage(sub_);
+ input.ReadMessage(Sub);
break;
}
}
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
index 819fc201..f27ab640 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
@@ -557,7 +557,7 @@ namespace UnitTest.Issues.TestProtos {
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
- value_ = (global::UnitTest.Issues.TestProtos.NegativeEnum) input.ReadEnum();
+ Value = (global::UnitTest.Issues.TestProtos.NegativeEnum) input.ReadEnum();
break;
}
case 18:
@@ -881,7 +881,7 @@ namespace UnitTest.Issues.TestProtos {
primitiveArray_.Add(other.primitiveArray_);
if (other.messageValue_ != null) {
if (messageValue_ == null) {
- messageValue_ = new global::UnitTest.Issues.TestProtos.DeprecatedChild();
+ MessageValue = new global::UnitTest.Issues.TestProtos.DeprecatedChild();
}
MessageValue.MergeFrom(other.MessageValue);
}
@@ -912,9 +912,9 @@ namespace UnitTest.Issues.TestProtos {
}
case 26: {
if (messageValue_ == null) {
- messageValue_ = new global::UnitTest.Issues.TestProtos.DeprecatedChild();
+ MessageValue = new global::UnitTest.Issues.TestProtos.DeprecatedChild();
}
- input.ReadMessage(messageValue_);
+ input.ReadMessage(MessageValue);
break;
}
case 34: {
@@ -922,7 +922,7 @@ namespace UnitTest.Issues.TestProtos {
break;
}
case 40: {
- enumValue_ = (global::UnitTest.Issues.TestProtos.DeprecatedEnum) input.ReadEnum();
+ EnumValue = (global::UnitTest.Issues.TestProtos.DeprecatedEnum) input.ReadEnum();
break;
}
case 50:
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
index d5dbe866..bbbee22c 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
@@ -139,23 +139,26 @@ namespace Google.Protobuf.TestProtos {
"NBj//w8gAygEIigKG1Rlc3RDb21tZW50SW5qZWN0aW9uTWVzc2FnZRIJCgFh",
"GAEgASgJIgwKCkZvb1JlcXVlc3QiDQoLRm9vUmVzcG9uc2UiEgoQRm9vQ2xp",
"ZW50TWVzc2FnZSISChBGb29TZXJ2ZXJNZXNzYWdlIgwKCkJhclJlcXVlc3Qi",
- "DQoLQmFyUmVzcG9uc2UiEgoQVGVzdEVtcHR5TWVzc2FnZSpZCgtGb3JlaWdu",
- "RW51bRIXChNGT1JFSUdOX1VOU1BFQ0lGSUVEEAASDwoLRk9SRUlHTl9GT08Q",
- "BBIPCgtGT1JFSUdOX0JBUhAFEg8KC0ZPUkVJR05fQkFaEAYqdQoUVGVzdEVu",
- "dW1XaXRoRHVwVmFsdWUSKAokVEVTVF9FTlVNX1dJVEhfRFVQX1ZBTFVFX1VO",
- "U1BFQ0lGSUVEEAASCAoERk9PMRABEggKBEJBUjEQAhIHCgNCQVoQAxIICgRG",
- "T08yEAESCAoEQkFSMhACGgIQASqdAQoOVGVzdFNwYXJzZUVudW0SIAocVEVT",
- "VF9TUEFSU0VfRU5VTV9VTlNQRUNJRklFRBAAEgwKCFNQQVJTRV9BEHsSDgoI",
- "U1BBUlNFX0IQpucDEg8KCFNQQVJTRV9DELKxgAYSFQoIU1BBUlNFX0QQ8f//",
- "////////ARIVCghTUEFSU0VfRRC03vz///////8BEgwKCFNQQVJTRV9HEAIy",
- "nQEKC1Rlc3RTZXJ2aWNlEkYKA0ZvbxIeLnByb3RvYnVmX3VuaXR0ZXN0My5G",
- "b29SZXF1ZXN0Gh8ucHJvdG9idWZfdW5pdHRlc3QzLkZvb1Jlc3BvbnNlEkYK",
- "A0JhchIeLnByb3RvYnVmX3VuaXR0ZXN0My5CYXJSZXF1ZXN0Gh8ucHJvdG9i",
- "dWZfdW5pdHRlc3QzLkJhclJlc3BvbnNlQixCDVVuaXR0ZXN0UHJvdG+qAhpH",
- "b29nbGUuUHJvdG9idWYuVGVzdFByb3Rvc2IGcHJvdG8z"));
+ "DQoLQmFyUmVzcG9uc2UiEgoQVGVzdEVtcHR5TWVzc2FnZSJwCg5Db21tZW50",
+ "TWVzc2FnZRIMCgR0ZXh0GAEgASgJGisKFE5lc3RlZENvbW1lbnRNZXNzYWdl",
+ "EhMKC25lc3RlZF90ZXh0GAEgASgJIiMKEU5lc3RlZENvbW1lbnRFbnVtEg4K",
+ "ClpFUk9fVkFMVUUQACpZCgtGb3JlaWduRW51bRIXChNGT1JFSUdOX1VOU1BF",
+ "Q0lGSUVEEAASDwoLRk9SRUlHTl9GT08QBBIPCgtGT1JFSUdOX0JBUhAFEg8K",
+ "C0ZPUkVJR05fQkFaEAYqdQoUVGVzdEVudW1XaXRoRHVwVmFsdWUSKAokVEVT",
+ "VF9FTlVNX1dJVEhfRFVQX1ZBTFVFX1VOU1BFQ0lGSUVEEAASCAoERk9PMRAB",
+ "EggKBEJBUjEQAhIHCgNCQVoQAxIICgRGT08yEAESCAoEQkFSMhACGgIQASqd",
+ "AQoOVGVzdFNwYXJzZUVudW0SIAocVEVTVF9TUEFSU0VfRU5VTV9VTlNQRUNJ",
+ "RklFRBAAEgwKCFNQQVJTRV9BEHsSDgoIU1BBUlNFX0IQpucDEg8KCFNQQVJT",
+ "RV9DELKxgAYSFQoIU1BBUlNFX0QQ8f//////////ARIVCghTUEFSU0VfRRC0",
+ "3vz///////8BEgwKCFNQQVJTRV9HEAIqHQoLQ29tbWVudEVudW0SDgoKWkVS",
+ "T19WQUxVRRAAMp0BCgtUZXN0U2VydmljZRJGCgNGb28SHi5wcm90b2J1Zl91",
+ "bml0dGVzdDMuRm9vUmVxdWVzdBofLnByb3RvYnVmX3VuaXR0ZXN0My5Gb29S",
+ "ZXNwb25zZRJGCgNCYXISHi5wcm90b2J1Zl91bml0dGVzdDMuQmFyUmVxdWVz",
+ "dBofLnByb3RvYnVmX3VuaXR0ZXN0My5CYXJSZXNwb25zZUIsQg1Vbml0dGVz",
+ "dFByb3RvqgIaR29vZ2xlLlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestImportProto3Reflection.Descriptor, },
- new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.ForeignEnum), typeof(global::Google.Protobuf.TestProtos.TestEnumWithDupValue), typeof(global::Google.Protobuf.TestProtos.TestSparseEnum), }, new pbr::GeneratedClrTypeInfo[] {
+ new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.ForeignEnum), typeof(global::Google.Protobuf.TestProtos.TestEnumWithDupValue), typeof(global::Google.Protobuf.TestProtos.TestSparseEnum), typeof(global::Google.Protobuf.TestProtos.CommentEnum), }, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestAllTypes), global::Google.Protobuf.TestProtos.TestAllTypes.Parser, new[]{ "SingleInt32", "SingleInt64", "SingleUint32", "SingleUint64", "SingleSint32", "SingleSint64", "SingleFixed32", "SingleFixed64", "SingleSfixed32", "SingleSfixed64", "SingleFloat", "SingleDouble", "SingleBool", "SingleString", "SingleBytes", "SingleNestedMessage", "SingleForeignMessage", "SingleImportMessage", "SingleNestedEnum", "SingleForeignEnum", "SingleImportEnum", "SinglePublicImportMessage", "RepeatedInt32", "RepeatedInt64", "RepeatedUint32", "RepeatedUint64", "RepeatedSint32", "RepeatedSint64", "RepeatedFixed32", "RepeatedFixed64", "RepeatedSfixed32", "RepeatedSfixed64", "RepeatedFloat", "RepeatedDouble", "RepeatedBool", "RepeatedString", "RepeatedBytes", "RepeatedNestedMessage", "RepeatedForeignMessage", "RepeatedImportMessage", "RepeatedNestedEnum", "RepeatedForeignEnum", "RepeatedImportEnum", "RepeatedPublicImportMessage", "OneofUint32", "OneofNestedMessage", "OneofString", "OneofBytes" }, new[]{ "OneofField" }, new[]{ typeof(global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage), global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage.Parser, new[]{ "Bb" }, null, null, null)}),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.NestedTestAllTypes), global::Google.Protobuf.TestProtos.NestedTestAllTypes.Parser, new[]{ "Child", "Payload", "RepeatedChild" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestDeprecatedFields), global::Google.Protobuf.TestProtos.TestDeprecatedFields.Parser, new[]{ "DeprecatedInt32" }, null, null, null),
@@ -190,7 +193,8 @@ namespace Google.Protobuf.TestProtos {
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.FooServerMessage), global::Google.Protobuf.TestProtos.FooServerMessage.Parser, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.BarRequest), global::Google.Protobuf.TestProtos.BarRequest.Parser, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.BarResponse), global::Google.Protobuf.TestProtos.BarResponse.Parser, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestEmptyMessage), global::Google.Protobuf.TestProtos.TestEmptyMessage.Parser, null, null, null, null)
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestEmptyMessage), global::Google.Protobuf.TestProtos.TestEmptyMessage.Parser, null, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.CommentMessage), global::Google.Protobuf.TestProtos.CommentMessage.Parser, new[]{ "Text" }, null, new[]{ typeof(global::Google.Protobuf.TestProtos.CommentMessage.Types.NestedCommentEnum) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.CommentMessage.Types.NestedCommentMessage), global::Google.Protobuf.TestProtos.CommentMessage.Types.NestedCommentMessage.Parser, new[]{ "NestedText" }, null, null, null)})
}));
}
#endregion
@@ -233,6 +237,16 @@ namespace Google.Protobuf.TestProtos {
[pbr::OriginalName("SPARSE_G")] SparseG = 2,
}
+ /// <summary>
+ /// Leading enum comment
+ /// </summary>
+ public enum CommentEnum {
+ /// <summary>
+ /// Zero value comment
+ /// </summary>
+ [pbr::OriginalName("ZERO_VALUE")] ZeroValue = 0,
+ }
+
#endregion
#region Messages
@@ -1293,19 +1307,19 @@ namespace Google.Protobuf.TestProtos {
}
if (other.singleNestedMessage_ != null) {
if (singleNestedMessage_ == null) {
- singleNestedMessage_ = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
+ SingleNestedMessage = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
}
SingleNestedMessage.MergeFrom(other.SingleNestedMessage);
}
if (other.singleForeignMessage_ != null) {
if (singleForeignMessage_ == null) {
- singleForeignMessage_ = new global::Google.Protobuf.TestProtos.ForeignMessage();
+ SingleForeignMessage = new global::Google.Protobuf.TestProtos.ForeignMessage();
}
SingleForeignMessage.MergeFrom(other.SingleForeignMessage);
}
if (other.singleImportMessage_ != null) {
if (singleImportMessage_ == null) {
- singleImportMessage_ = new global::Google.Protobuf.TestProtos.ImportMessage();
+ SingleImportMessage = new global::Google.Protobuf.TestProtos.ImportMessage();
}
SingleImportMessage.MergeFrom(other.SingleImportMessage);
}
@@ -1320,7 +1334,7 @@ namespace Google.Protobuf.TestProtos {
}
if (other.singlePublicImportMessage_ != null) {
if (singlePublicImportMessage_ == null) {
- singlePublicImportMessage_ = new global::Google.Protobuf.TestProtos.PublicImportMessage();
+ SinglePublicImportMessage = new global::Google.Protobuf.TestProtos.PublicImportMessage();
}
SinglePublicImportMessage.MergeFrom(other.SinglePublicImportMessage);
}
@@ -1437,42 +1451,42 @@ namespace Google.Protobuf.TestProtos {
}
case 146: {
if (singleNestedMessage_ == null) {
- singleNestedMessage_ = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
+ SingleNestedMessage = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
}
- input.ReadMessage(singleNestedMessage_);
+ input.ReadMessage(SingleNestedMessage);
break;
}
case 154: {
if (singleForeignMessage_ == null) {
- singleForeignMessage_ = new global::Google.Protobuf.TestProtos.ForeignMessage();
+ SingleForeignMessage = new global::Google.Protobuf.TestProtos.ForeignMessage();
}
- input.ReadMessage(singleForeignMessage_);
+ input.ReadMessage(SingleForeignMessage);
break;
}
case 162: {
if (singleImportMessage_ == null) {
- singleImportMessage_ = new global::Google.Protobuf.TestProtos.ImportMessage();
+ SingleImportMessage = new global::Google.Protobuf.TestProtos.ImportMessage();
}
- input.ReadMessage(singleImportMessage_);
+ input.ReadMessage(SingleImportMessage);
break;
}
case 168: {
- singleNestedEnum_ = (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum) input.ReadEnum();
+ SingleNestedEnum = (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum) input.ReadEnum();
break;
}
case 176: {
- singleForeignEnum_ = (global::Google.Protobuf.TestProtos.ForeignEnum) input.ReadEnum();
+ SingleForeignEnum = (global::Google.Protobuf.TestProtos.ForeignEnum) input.ReadEnum();
break;
}
case 184: {
- singleImportEnum_ = (global::Google.Protobuf.TestProtos.ImportEnum) input.ReadEnum();
+ SingleImportEnum = (global::Google.Protobuf.TestProtos.ImportEnum) input.ReadEnum();
break;
}
case 210: {
if (singlePublicImportMessage_ == null) {
- singlePublicImportMessage_ = new global::Google.Protobuf.TestProtos.PublicImportMessage();
+ SinglePublicImportMessage = new global::Google.Protobuf.TestProtos.PublicImportMessage();
}
- input.ReadMessage(singlePublicImportMessage_);
+ input.ReadMessage(SinglePublicImportMessage);
break;
}
case 250:
@@ -1904,13 +1918,13 @@ namespace Google.Protobuf.TestProtos {
}
if (other.child_ != null) {
if (child_ == null) {
- child_ = new global::Google.Protobuf.TestProtos.NestedTestAllTypes();
+ Child = new global::Google.Protobuf.TestProtos.NestedTestAllTypes();
}
Child.MergeFrom(other.Child);
}
if (other.payload_ != null) {
if (payload_ == null) {
- payload_ = new global::Google.Protobuf.TestProtos.TestAllTypes();
+ Payload = new global::Google.Protobuf.TestProtos.TestAllTypes();
}
Payload.MergeFrom(other.Payload);
}
@@ -1928,16 +1942,16 @@ namespace Google.Protobuf.TestProtos {
break;
case 10: {
if (child_ == null) {
- child_ = new global::Google.Protobuf.TestProtos.NestedTestAllTypes();
+ Child = new global::Google.Protobuf.TestProtos.NestedTestAllTypes();
}
- input.ReadMessage(child_);
+ input.ReadMessage(Child);
break;
}
case 18: {
if (payload_ == null) {
- payload_ = new global::Google.Protobuf.TestProtos.TestAllTypes();
+ Payload = new global::Google.Protobuf.TestProtos.TestAllTypes();
}
- input.ReadMessage(payload_);
+ input.ReadMessage(Payload);
break;
}
case 26: {
@@ -2424,7 +2438,7 @@ namespace Google.Protobuf.TestProtos {
}
if (other.foreignNested_ != null) {
if (foreignNested_ == null) {
- foreignNested_ = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
+ ForeignNested = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
}
ForeignNested.MergeFrom(other.ForeignNested);
}
@@ -2441,9 +2455,9 @@ namespace Google.Protobuf.TestProtos {
break;
case 10: {
if (foreignNested_ == null) {
- foreignNested_ = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
+ ForeignNested = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage();
}
- input.ReadMessage(foreignNested_);
+ input.ReadMessage(ForeignNested);
break;
}
}
@@ -2744,7 +2758,7 @@ namespace Google.Protobuf.TestProtos {
}
if (other.a_ != null) {
if (a_ == null) {
- a_ = new global::Google.Protobuf.TestProtos.TestRecursiveMessage();
+ A = new global::Google.Protobuf.TestProtos.TestRecursiveMessage();
}
A.MergeFrom(other.A);
}
@@ -2764,9 +2778,9 @@ namespace Google.Protobuf.TestProtos {
break;
case 10: {
if (a_ == null) {
- a_ = new global::Google.Protobuf.TestProtos.TestRecursiveMessage();
+ A = new global::Google.Protobuf.TestProtos.TestRecursiveMessage();
}
- input.ReadMessage(a_);
+ input.ReadMessage(A);
break;
}
case 16: {
@@ -2889,7 +2903,7 @@ namespace Google.Protobuf.TestProtos {
}
if (other.bb_ != null) {
if (bb_ == null) {
- bb_ = new global::Google.Protobuf.TestProtos.TestMutualRecursionB();
+ Bb = new global::Google.Protobuf.TestProtos.TestMutualRecursionB();
}
Bb.MergeFrom(other.Bb);
}
@@ -2906,9 +2920,9 @@ namespace Google.Protobuf.TestProtos {
break;
case 10: {
if (bb_ == null) {
- bb_ = new global::Google.Protobuf.TestProtos.TestMutualRecursionB();
+ Bb = new global::Google.Protobuf.TestProtos.TestMutualRecursionB();
}
- input.ReadMessage(bb_);
+ input.ReadMessage(Bb);
break;
}
}
@@ -3045,7 +3059,7 @@ namespace Google.Protobuf.TestProtos {
}
if (other.a_ != null) {
if (a_ == null) {
- a_ = new global::Google.Protobuf.TestProtos.TestMutualRecursionA();
+ A = new global::Google.Protobuf.TestProtos.TestMutualRecursionA();
}
A.MergeFrom(other.A);
}
@@ -3065,9 +3079,9 @@ namespace Google.Protobuf.TestProtos {
break;
case 10: {
if (a_ == null) {
- a_ = new global::Google.Protobuf.TestProtos.TestMutualRecursionA();
+ A = new global::Google.Protobuf.TestProtos.TestMutualRecursionA();
}
- input.ReadMessage(a_);
+ input.ReadMessage(A);
break;
}
case 16: {
@@ -3200,7 +3214,7 @@ namespace Google.Protobuf.TestProtos {
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
- value_ = (global::Google.Protobuf.TestProtos.TestEnumWithDupValue) input.ReadEnum();
+ Value = (global::Google.Protobuf.TestProtos.TestEnumWithDupValue) input.ReadEnum();
break;
}
}
@@ -3452,7 +3466,7 @@ namespace Google.Protobuf.TestProtos {
}
if (other.messageField_ != null) {
if (messageField_ == null) {
- messageField_ = new global::Google.Protobuf.TestProtos.ForeignMessage();
+ MessageField = new global::Google.Protobuf.TestProtos.ForeignMessage();
}
MessageField.MergeFrom(other.MessageField);
}
@@ -3480,14 +3494,14 @@ namespace Google.Protobuf.TestProtos {
break;
}
case 24: {
- enumField_ = (global::Google.Protobuf.TestProtos.ForeignEnum) input.ReadEnum();
+ EnumField = (global::Google.Protobuf.TestProtos.ForeignEnum) input.ReadEnum();
break;
}
case 34: {
if (messageField_ == null) {
- messageField_ = new global::Google.Protobuf.TestProtos.ForeignMessage();
+ MessageField = new global::Google.Protobuf.TestProtos.ForeignMessage();
}
- input.ReadMessage(messageField_);
+ input.ReadMessage(MessageField);
break;
}
case 58:
@@ -3697,7 +3711,7 @@ namespace Google.Protobuf.TestProtos {
}
if (other.singleNestedMessage_ != null) {
if (singleNestedMessage_ == null) {
- singleNestedMessage_ = new global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage();
+ SingleNestedMessage = new global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage();
}
SingleNestedMessage.MergeFrom(other.SingleNestedMessage);
}
@@ -3726,9 +3740,9 @@ namespace Google.Protobuf.TestProtos {
}
case 1602: {
if (singleNestedMessage_ == null) {
- singleNestedMessage_ = new global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage();
+ SingleNestedMessage = new global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage();
}
- input.ReadMessage(singleNestedMessage_);
+ input.ReadMessage(SingleNestedMessage);
break;
}
}
@@ -4026,7 +4040,7 @@ namespace Google.Protobuf.TestProtos {
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
- sparseEnum_ = (global::Google.Protobuf.TestProtos.TestSparseEnum) input.ReadEnum();
+ SparseEnum = (global::Google.Protobuf.TestProtos.TestSparseEnum) input.ReadEnum();
break;
}
}
@@ -7301,6 +7315,293 @@ namespace Google.Protobuf.TestProtos {
}
+ /// <summary>
+ /// This is a leading comment
+ /// </summary>
+ public sealed partial class CommentMessage : pb::IMessage<CommentMessage> {
+ private static readonly pb::MessageParser<CommentMessage> _parser = new pb::MessageParser<CommentMessage>(() => new CommentMessage());
+ private pb::UnknownFieldSet _unknownFields;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<CommentMessage> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[35]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public CommentMessage() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public CommentMessage(CommentMessage other) : this() {
+ text_ = other.text_;
+ _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public CommentMessage Clone() {
+ return new CommentMessage(this);
+ }
+
+ /// <summary>Field number for the "text" field.</summary>
+ public const int TextFieldNumber = 1;
+ private string text_ = "";
+ /// <summary>
+ /// Leading field comment
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string Text {
+ get { return text_; }
+ set {
+ text_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as CommentMessage);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(CommentMessage other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Text != other.Text) return false;
+ return Equals(_unknownFields, other._unknownFields);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Text.Length != 0) hash ^= Text.GetHashCode();
+ if (_unknownFields != null) {
+ hash ^= _unknownFields.GetHashCode();
+ }
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Text.Length != 0) {
+ output.WriteRawTag(10);
+ output.WriteString(Text);
+ }
+ if (_unknownFields != null) {
+ _unknownFields.WriteTo(output);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (Text.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(Text);
+ }
+ if (_unknownFields != null) {
+ size += _unknownFields.CalculateSize();
+ }
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(CommentMessage other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Text.Length != 0) {
+ Text = other.Text;
+ }
+ _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 10: {
+ Text = input.ReadString();
+ break;
+ }
+ }
+ }
+ }
+
+ #region Nested types
+ /// <summary>Container for nested types declared in the CommentMessage message type.</summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static partial class Types {
+ /// <summary>
+ /// Leading nested enum comment
+ /// </summary>
+ public enum NestedCommentEnum {
+ /// <summary>
+ /// Zero value comment
+ /// </summary>
+ [pbr::OriginalName("ZERO_VALUE")] ZeroValue = 0,
+ }
+
+ /// <summary>
+ /// Leading nested message comment
+ /// </summary>
+ public sealed partial class NestedCommentMessage : pb::IMessage<NestedCommentMessage> {
+ private static readonly pb::MessageParser<NestedCommentMessage> _parser = new pb::MessageParser<NestedCommentMessage>(() => new NestedCommentMessage());
+ private pb::UnknownFieldSet _unknownFields;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<NestedCommentMessage> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.TestProtos.CommentMessage.Descriptor.NestedTypes[0]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public NestedCommentMessage() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public NestedCommentMessage(NestedCommentMessage other) : this() {
+ nestedText_ = other.nestedText_;
+ _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public NestedCommentMessage Clone() {
+ return new NestedCommentMessage(this);
+ }
+
+ /// <summary>Field number for the "nested_text" field.</summary>
+ public const int NestedTextFieldNumber = 1;
+ private string nestedText_ = "";
+ /// <summary>
+ /// Leading nested message field comment
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string NestedText {
+ get { return nestedText_; }
+ set {
+ nestedText_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as NestedCommentMessage);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(NestedCommentMessage other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (NestedText != other.NestedText) return false;
+ return Equals(_unknownFields, other._unknownFields);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (NestedText.Length != 0) hash ^= NestedText.GetHashCode();
+ if (_unknownFields != null) {
+ hash ^= _unknownFields.GetHashCode();
+ }
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (NestedText.Length != 0) {
+ output.WriteRawTag(10);
+ output.WriteString(NestedText);
+ }
+ if (_unknownFields != null) {
+ _unknownFields.WriteTo(output);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (NestedText.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(NestedText);
+ }
+ if (_unknownFields != null) {
+ size += _unknownFields.CalculateSize();
+ }
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(NestedCommentMessage other) {
+ if (other == null) {
+ return;
+ }
+ if (other.NestedText.Length != 0) {
+ NestedText = other.NestedText;
+ }
+ _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 10: {
+ NestedText = input.ReadString();
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ }
+ #endregion
+
+ }
+
#endregion
}
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs
index fe913802..45f8ece6 100644
--- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs
+++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs
@@ -342,6 +342,7 @@ namespace Google.Protobuf.TestProtos {
}
}
+
/// <summary>Field number for the "float_field" field.</summary>
public const int FloatFieldFieldNumber = 11;
private static readonly pb::FieldCodec<float?> _single_floatField_codec = pb::FieldCodec.ForStructWrapper<float>(90);
@@ -354,6 +355,7 @@ namespace Google.Protobuf.TestProtos {
}
}
+
/// <summary>Field number for the "int64_field" field.</summary>
public const int Int64FieldFieldNumber = 12;
private static readonly pb::FieldCodec<long?> _single_int64Field_codec = pb::FieldCodec.ForStructWrapper<long>(98);
@@ -366,6 +368,7 @@ namespace Google.Protobuf.TestProtos {
}
}
+
/// <summary>Field number for the "uint64_field" field.</summary>
public const int Uint64FieldFieldNumber = 13;
private static readonly pb::FieldCodec<ulong?> _single_uint64Field_codec = pb::FieldCodec.ForStructWrapper<ulong>(106);
@@ -378,6 +381,7 @@ namespace Google.Protobuf.TestProtos {
}
}
+
/// <summary>Field number for the "int32_field" field.</summary>
public const int Int32FieldFieldNumber = 14;
private static readonly pb::FieldCodec<int?> _single_int32Field_codec = pb::FieldCodec.ForStructWrapper<int>(114);
@@ -390,6 +394,7 @@ namespace Google.Protobuf.TestProtos {
}
}
+
/// <summary>Field number for the "uint32_field" field.</summary>
public const int Uint32FieldFieldNumber = 15;
private static readonly pb::FieldCodec<uint?> _single_uint32Field_codec = pb::FieldCodec.ForStructWrapper<uint>(122);
@@ -402,6 +407,7 @@ namespace Google.Protobuf.TestProtos {
}
}
+
/// <summary>Field number for the "bool_field" field.</summary>
public const int BoolFieldFieldNumber = 16;
private static readonly pb::FieldCodec<bool?> _single_boolField_codec = pb::FieldCodec.ForStructWrapper<bool>(130);
@@ -414,6 +420,7 @@ namespace Google.Protobuf.TestProtos {
}
}
+
/// <summary>Field number for the "string_field" field.</summary>
public const int StringFieldFieldNumber = 17;
private static readonly pb::FieldCodec<string> _single_stringField_codec = pb::FieldCodec.ForClassWrapper<string>(138);
@@ -426,6 +433,7 @@ namespace Google.Protobuf.TestProtos {
}
}
+
/// <summary>Field number for the "bytes_field" field.</summary>
public const int BytesFieldFieldNumber = 18;
private static readonly pb::FieldCodec<pb::ByteString> _single_bytesField_codec = pb::FieldCodec.ForClassWrapper<pb::ByteString>(146);
@@ -438,6 +446,7 @@ namespace Google.Protobuf.TestProtos {
}
}
+
/// <summary>Field number for the "value_field" field.</summary>
public const int ValueFieldFieldNumber = 19;
private global::Google.Protobuf.WellKnownTypes.Value valueField_;
@@ -667,55 +676,55 @@ namespace Google.Protobuf.TestProtos {
}
if (other.anyField_ != null) {
if (anyField_ == null) {
- anyField_ = new global::Google.Protobuf.WellKnownTypes.Any();
+ AnyField = new global::Google.Protobuf.WellKnownTypes.Any();
}
AnyField.MergeFrom(other.AnyField);
}
if (other.apiField_ != null) {
if (apiField_ == null) {
- apiField_ = new global::Google.Protobuf.WellKnownTypes.Api();
+ ApiField = new global::Google.Protobuf.WellKnownTypes.Api();
}
ApiField.MergeFrom(other.ApiField);
}
if (other.durationField_ != null) {
if (durationField_ == null) {
- durationField_ = new global::Google.Protobuf.WellKnownTypes.Duration();
+ DurationField = new global::Google.Protobuf.WellKnownTypes.Duration();
}
DurationField.MergeFrom(other.DurationField);
}
if (other.emptyField_ != null) {
if (emptyField_ == null) {
- emptyField_ = new global::Google.Protobuf.WellKnownTypes.Empty();
+ EmptyField = new global::Google.Protobuf.WellKnownTypes.Empty();
}
EmptyField.MergeFrom(other.EmptyField);
}
if (other.fieldMaskField_ != null) {
if (fieldMaskField_ == null) {
- fieldMaskField_ = new global::Google.Protobuf.WellKnownTypes.FieldMask();
+ FieldMaskField = new global::Google.Protobuf.WellKnownTypes.FieldMask();
}
FieldMaskField.MergeFrom(other.FieldMaskField);
}
if (other.sourceContextField_ != null) {
if (sourceContextField_ == null) {
- sourceContextField_ = new global::Google.Protobuf.WellKnownTypes.SourceContext();
+ SourceContextField = new global::Google.Protobuf.WellKnownTypes.SourceContext();
}
SourceContextField.MergeFrom(other.SourceContextField);
}
if (other.structField_ != null) {
if (structField_ == null) {
- structField_ = new global::Google.Protobuf.WellKnownTypes.Struct();
+ StructField = new global::Google.Protobuf.WellKnownTypes.Struct();
}
StructField.MergeFrom(other.StructField);
}
if (other.timestampField_ != null) {
if (timestampField_ == null) {
- timestampField_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
+ TimestampField = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
TimestampField.MergeFrom(other.TimestampField);
}
if (other.typeField_ != null) {
if (typeField_ == null) {
- typeField_ = new global::Google.Protobuf.WellKnownTypes.Type();
+ TypeField = new global::Google.Protobuf.WellKnownTypes.Type();
}
TypeField.MergeFrom(other.TypeField);
}
@@ -766,7 +775,7 @@ namespace Google.Protobuf.TestProtos {
}
if (other.valueField_ != null) {
if (valueField_ == null) {
- valueField_ = new global::Google.Protobuf.WellKnownTypes.Value();
+ ValueField = new global::Google.Protobuf.WellKnownTypes.Value();
}
ValueField.MergeFrom(other.ValueField);
}
@@ -783,65 +792,65 @@ namespace Google.Protobuf.TestProtos {
break;
case 10: {
if (anyField_ == null) {
- anyField_ = new global::Google.Protobuf.WellKnownTypes.Any();
+ AnyField = new global::Google.Protobuf.WellKnownTypes.Any();
}
- input.ReadMessage(anyField_);
+ input.ReadMessage(AnyField);
break;
}
case 18: {
if (apiField_ == null) {
- apiField_ = new global::Google.Protobuf.WellKnownTypes.Api();
+ ApiField = new global::Google.Protobuf.WellKnownTypes.Api();
}
- input.ReadMessage(apiField_);
+ input.ReadMessage(ApiField);
break;
}
case 26: {
if (durationField_ == null) {
- durationField_ = new global::Google.Protobuf.WellKnownTypes.Duration();
+ DurationField = new global::Google.Protobuf.WellKnownTypes.Duration();
}
- input.ReadMessage(durationField_);
+ input.ReadMessage(DurationField);
break;
}
case 34: {
if (emptyField_ == null) {
- emptyField_ = new global::Google.Protobuf.WellKnownTypes.Empty();
+ EmptyField = new global::Google.Protobuf.WellKnownTypes.Empty();
}
- input.ReadMessage(emptyField_);
+ input.ReadMessage(EmptyField);
break;
}
case 42: {
if (fieldMaskField_ == null) {
- fieldMaskField_ = new global::Google.Protobuf.WellKnownTypes.FieldMask();
+ FieldMaskField = new global::Google.Protobuf.WellKnownTypes.FieldMask();
}
- input.ReadMessage(fieldMaskField_);
+ input.ReadMessage(FieldMaskField);
break;
}
case 50: {
if (sourceContextField_ == null) {
- sourceContextField_ = new global::Google.Protobuf.WellKnownTypes.SourceContext();
+ SourceContextField = new global::Google.Protobuf.WellKnownTypes.SourceContext();
}
- input.ReadMessage(sourceContextField_);
+ input.ReadMessage(SourceContextField);
break;
}
case 58: {
if (structField_ == null) {
- structField_ = new global::Google.Protobuf.WellKnownTypes.Struct();
+ StructField = new global::Google.Protobuf.WellKnownTypes.Struct();
}
- input.ReadMessage(structField_);
+ input.ReadMessage(StructField);
break;
}
case 66: {
if (timestampField_ == null) {
- timestampField_ = new global::Google.Protobuf.WellKnownTypes.Timestamp();
+ TimestampField = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
- input.ReadMessage(timestampField_);
+ input.ReadMessage(TimestampField);
break;
}
case 74: {
if (typeField_ == null) {
- typeField_ = new global::Google.Protobuf.WellKnownTypes.Type();
+ TypeField = new global::Google.Protobuf.WellKnownTypes.Type();
}
- input.ReadMessage(typeField_);
+ input.ReadMessage(TypeField);
break;
}
case 82: {
@@ -909,9 +918,9 @@ namespace Google.Protobuf.TestProtos {
}
case 154: {
if (valueField_ == null) {
- valueField_ = new global::Google.Protobuf.WellKnownTypes.Value();
+ ValueField = new global::Google.Protobuf.WellKnownTypes.Value();
}
- input.ReadMessage(valueField_);
+ input.ReadMessage(ValueField);
break;
}
}
diff --git a/csharp/src/Google.Protobuf.Test/testprotos.pb b/csharp/src/Google.Protobuf.Test/testprotos.pb
new file mode 100644
index 00000000..94ff3817
--- /dev/null
+++ b/csharp/src/Google.Protobuf.Test/testprotos.pb
Binary files differ