From 461f94b680ef6da9442fb84cda3c694c11b0f7e9 Mon Sep 17 00:00:00 2001 From: Sydney Acksman Date: Fri, 11 Oct 2019 20:23:07 -0500 Subject: [PATCH 1/2] Add length checks to ExtensionCollection --- .../Reflection/ExtensionCollection.cs | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/csharp/src/Google.Protobuf/Reflection/ExtensionCollection.cs b/csharp/src/Google.Protobuf/Reflection/ExtensionCollection.cs index 9cb6abaf9a7d..dfe91e37ef3b 100644 --- a/csharp/src/Google.Protobuf/Reflection/ExtensionCollection.cs +++ b/csharp/src/Google.Protobuf/Reflection/ExtensionCollection.cs @@ -48,14 +48,32 @@ internal ExtensionCollection(FileDescriptor file, Extension[] extensions) { UnorderedExtensions = DescriptorUtil.ConvertAndMakeReadOnly( file.Proto.Extension, - (extension, i) => new FieldDescriptor(extension, file, null, i, null, extensions?[i])); + (extension, i) => { + if (extensions?.Length != 0) + { + return new FieldDescriptor(extension, file, null, i, null, extensions?[i]); + } + else + { + return new FieldDescriptor(extension, file, null, i, null, null); // return null if there's no extensions in this array for old code-gen + } + }); } internal ExtensionCollection(MessageDescriptor message, Extension[] extensions) { UnorderedExtensions = DescriptorUtil.ConvertAndMakeReadOnly( message.Proto.Extension, - (extension, i) => new FieldDescriptor(extension, message.File, message, i, null, extensions?[i])); + (extension, i) => { + if (extensions?.Length != 0) + { + return new FieldDescriptor(extension, message.File, message, i, null, extensions?[i]); + } + else + { + return new FieldDescriptor(extension, message.File, message, i, null, null); + } + }); } /// From d32e6194ac3dce2ad7db3c2772ec411ee425308b Mon Sep 17 00:00:00 2001 From: Sydney Acksman Date: Wed, 14 Aug 2019 09:02:29 -0500 Subject: [PATCH 2/2] Revert code generation changes from extensions feature PR --- csharp/src/AddressBook/Addressbook.cs | 6 +- .../BenchmarkMessage1Proto3.cs | 6 +- .../Google.Protobuf.Benchmarks/Benchmarks.cs | 4 +- .../Conformance.cs | 10 +- .../TestProtos/MapUnittestProto3.cs | 90 ++-- .../TestProtos/TestMessagesProto3.cs | 44 +- .../TestProtos/UnittestCustomOptionsProto3.cs | 125 +---- .../TestProtos/UnittestImportProto3.cs | 4 +- .../TestProtos/UnittestImportPublicProto3.cs | 4 +- .../TestProtos/UnittestIssues.cs | 20 +- .../TestProtos/UnittestProto3.cs | 74 +-- .../TestProtos/UnittestWellKnownTypes.cs | 46 +- .../Reflection/CustomOptions.cs | 282 +++++++---- .../Google.Protobuf/Reflection/Descriptor.cs | 449 +++--------------- .../Reflection/EnumDescriptor.cs | 2 +- .../Reflection/EnumValueDescriptor.cs | 2 +- .../Reflection/FieldDescriptor.cs | 2 +- .../Reflection/FileDescriptor.cs | 2 +- .../Reflection/MessageDescriptor.cs | 2 +- .../Reflection/MethodDescriptor.cs | 2 +- .../Reflection/OneofDescriptor.cs | 2 +- .../Reflection/ServiceDescriptor.cs | 2 +- .../src/Google.Protobuf/WellKnownTypes/Any.cs | 4 +- .../src/Google.Protobuf/WellKnownTypes/Api.cs | 8 +- .../WellKnownTypes/Duration.cs | 4 +- .../Google.Protobuf/WellKnownTypes/Empty.cs | 4 +- .../WellKnownTypes/FieldMask.cs | 4 +- .../WellKnownTypes/SourceContext.cs | 4 +- .../Google.Protobuf/WellKnownTypes/Struct.cs | 10 +- .../WellKnownTypes/Timestamp.cs | 4 +- .../Google.Protobuf/WellKnownTypes/Type.cs | 12 +- .../WellKnownTypes/Wrappers.cs | 20 +- .../compiler/csharp/csharp_enum_field.cc | 18 +- .../compiler/csharp/csharp_enum_field.h | 1 - .../compiler/csharp/csharp_field_base.cc | 5 - .../compiler/csharp/csharp_field_base.h | 1 - .../compiler/csharp/csharp_helpers.cc | 15 - .../protobuf/compiler/csharp/csharp_helpers.h | 4 - .../compiler/csharp/csharp_message.cc | 128 +---- .../protobuf/compiler/csharp/csharp_message.h | 1 - .../compiler/csharp/csharp_message_field.cc | 10 - .../compiler/csharp/csharp_message_field.h | 1 - .../compiler/csharp/csharp_primitive_field.cc | 13 +- .../compiler/csharp/csharp_primitive_field.h | 1 - .../csharp/csharp_reflection_class.cc | 56 +-- .../compiler/csharp/csharp_reflection_class.h | 1 - .../csharp/csharp_repeated_enum_field.cc | 10 - .../csharp/csharp_repeated_enum_field.h | 1 - .../csharp/csharp_repeated_message_field.cc | 19 - .../csharp/csharp_repeated_message_field.h | 1 - .../csharp/csharp_repeated_primitive_field.cc | 9 - .../csharp/csharp_repeated_primitive_field.h | 1 - .../compiler/csharp/csharp_wrapper_field.cc | 11 - .../compiler/csharp/csharp_wrapper_field.h | 1 - 54 files changed, 489 insertions(+), 1073 deletions(-) diff --git a/csharp/src/AddressBook/Addressbook.cs b/csharp/src/AddressBook/Addressbook.cs index cbd977269620..0efebcade216 100644 --- a/csharp/src/AddressBook/Addressbook.cs +++ b/csharp/src/AddressBook/Addressbook.cs @@ -37,9 +37,9 @@ public static partial class AddressbookReflection { "ZHJlc3NCb29rYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person), global::Google.Protobuf.Examples.AddressBook.Person.Parser, new[]{ "Name", "Id", "Email", "Phones", "LastUpdated" }, null, new[]{ typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber), global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser, new[]{ "Number", "Type" }, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.AddressBook), global::Google.Protobuf.Examples.AddressBook.AddressBook.Parser, new[]{ "People" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person), global::Google.Protobuf.Examples.AddressBook.Person.Parser, new[]{ "Name", "Id", "Email", "Phones", "LastUpdated" }, null, new[]{ typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber), global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser, new[]{ "Number", "Type" }, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.AddressBook), global::Google.Protobuf.Examples.AddressBook.AddressBook.Parser, new[]{ "People" }, null, null, null) })); } #endregion diff --git a/csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs b/csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs index 9e8c330a2b63..c0c6d666d90e 100644 --- a/csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs +++ b/csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs @@ -55,9 +55,9 @@ public static partial class BenchmarkMessage1Proto3Reflection { "YmVuY2htYXJrc0gB+AEBYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Benchmarks.Proto3.GoogleMessage1), global::Benchmarks.Proto3.GoogleMessage1.Parser, new[]{ "Field1", "Field9", "Field18", "Field80", "Field81", "Field2", "Field3", "Field280", "Field6", "Field22", "Field4", "Field5", "Field59", "Field7", "Field16", "Field130", "Field12", "Field17", "Field13", "Field14", "Field104", "Field100", "Field101", "Field102", "Field103", "Field29", "Field30", "Field60", "Field271", "Field272", "Field150", "Field23", "Field24", "Field25", "Field15", "Field78", "Field67", "Field68", "Field128", "Field129", "Field131" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Benchmarks.Proto3.GoogleMessage1SubMessage), global::Benchmarks.Proto3.GoogleMessage1SubMessage.Parser, new[]{ "Field1", "Field2", "Field3", "Field15", "Field12", "Field13", "Field14", "Field16", "Field19", "Field20", "Field28", "Field21", "Field22", "Field23", "Field206", "Field203", "Field204", "Field205", "Field207", "Field300" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Benchmarks.Proto3.GoogleMessage1), global::Benchmarks.Proto3.GoogleMessage1.Parser, new[]{ "Field1", "Field9", "Field18", "Field80", "Field81", "Field2", "Field3", "Field280", "Field6", "Field22", "Field4", "Field5", "Field59", "Field7", "Field16", "Field130", "Field12", "Field17", "Field13", "Field14", "Field104", "Field100", "Field101", "Field102", "Field103", "Field29", "Field30", "Field60", "Field271", "Field272", "Field150", "Field23", "Field24", "Field25", "Field15", "Field78", "Field67", "Field68", "Field128", "Field129", "Field131" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Benchmarks.Proto3.GoogleMessage1SubMessage), global::Benchmarks.Proto3.GoogleMessage1SubMessage.Parser, new[]{ "Field1", "Field2", "Field3", "Field15", "Field12", "Field13", "Field14", "Field16", "Field19", "Field20", "Field28", "Field21", "Field22", "Field23", "Field206", "Field203", "Field204", "Field205", "Field207", "Field300" }, null, null, null) })); } #endregion diff --git a/csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs b/csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs index 01dfcd72dc6f..d2af7eefa6bc 100644 --- a/csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs +++ b/csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs @@ -30,8 +30,8 @@ public static partial class BenchmarksReflection { "a3NiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Benchmarks.BenchmarkDataset), global::Benchmarks.BenchmarkDataset.Parser, new[]{ "Name", "MessageName", "Payload" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Benchmarks.BenchmarkDataset), global::Benchmarks.BenchmarkDataset.Parser, new[]{ "Name", "MessageName", "Payload" }, null, null, null) })); } #endregion diff --git a/csharp/src/Google.Protobuf.Conformance/Conformance.cs b/csharp/src/Google.Protobuf.Conformance/Conformance.cs index 65ba9b1265ad..836a9a2275bc 100644 --- a/csharp/src/Google.Protobuf.Conformance/Conformance.cs +++ b/csharp/src/Google.Protobuf.Conformance/Conformance.cs @@ -48,11 +48,11 @@ public static partial class ConformanceReflection { "Z2xlLnByb3RvYnVmLmNvbmZvcm1hbmNlYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Conformance.WireFormat), typeof(global::Conformance.TestCategory), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.FailureSet), global::Conformance.FailureSet.Parser, new[]{ "Failure" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceRequest), global::Conformance.ConformanceRequest.Parser, new[]{ "ProtobufPayload", "JsonPayload", "JspbPayload", "TextPayload", "RequestedOutputFormat", "MessageType", "TestCategory", "JspbEncodingOptions", "PrintUnknownFields" }, new[]{ "Payload" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceResponse), global::Conformance.ConformanceResponse.Parser, new[]{ "ParseError", "SerializeError", "RuntimeError", "ProtobufPayload", "JsonPayload", "Skipped", "JspbPayload", "TextPayload" }, new[]{ "Result" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.JspbEncodingConfig), global::Conformance.JspbEncodingConfig.Parser, new[]{ "UseJspbArrayAnyFormat" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Conformance.WireFormat), typeof(global::Conformance.TestCategory), }, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.FailureSet), global::Conformance.FailureSet.Parser, new[]{ "Failure" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceRequest), global::Conformance.ConformanceRequest.Parser, new[]{ "ProtobufPayload", "JsonPayload", "JspbPayload", "TextPayload", "RequestedOutputFormat", "MessageType", "TestCategory", "JspbEncodingOptions", "PrintUnknownFields" }, new[]{ "Payload" }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceResponse), global::Conformance.ConformanceResponse.Parser, new[]{ "ParseError", "SerializeError", "RuntimeError", "ProtobufPayload", "JsonPayload", "Skipped", "JspbPayload", "TextPayload" }, new[]{ "Result" }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.JspbEncodingConfig), global::Conformance.JspbEncodingConfig.Parser, new[]{ "UseJspbArrayAnyFormat" }, null, null, null) })); } #endregion diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs index 197b197d0ea4..6d3cd026d112 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs @@ -150,14 +150,14 @@ public static partial class MapUnittestProto3Reflection { "WhACQh2qAhpHb29nbGUuUHJvdG9idWYuVGVzdFByb3Rvc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.MapEnum), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMap), global::Google.Protobuf.TestProtos.TestMap.Parser, new[]{ "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapStringString", "MapInt32Bytes", "MapInt32Enum", "MapInt32ForeignMessage" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMapSubmessage), global::Google.Protobuf.TestProtos.TestMapSubmessage.Parser, new[]{ "TestMap" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMessageMap), global::Google.Protobuf.TestProtos.TestMessageMap.Parser, new[]{ "MapInt32Message" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestSameTypeMap), global::Google.Protobuf.TestProtos.TestSameTypeMap.Parser, new[]{ "Map1", "Map2" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestArenaMap), global::Google.Protobuf.TestProtos.TestArenaMap.Parser, new[]{ "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapInt32Enum", "MapInt32ForeignMessage" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType), global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType.Parser, new[]{ "Type" }, null, new[]{ typeof(global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType.Types.Type) }, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.MessageContainingMapCalledEntry), global::Google.Protobuf.TestProtos.MessageContainingMapCalledEntry.Parser, new[]{ "Entry" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }) + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.MapEnum), }, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMap), global::Google.Protobuf.TestProtos.TestMap.Parser, new[]{ "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapStringString", "MapInt32Bytes", "MapInt32Enum", "MapInt32ForeignMessage" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMapSubmessage), global::Google.Protobuf.TestProtos.TestMapSubmessage.Parser, new[]{ "TestMap" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMessageMap), global::Google.Protobuf.TestProtos.TestMessageMap.Parser, new[]{ "MapInt32Message" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestSameTypeMap), global::Google.Protobuf.TestProtos.TestSameTypeMap.Parser, new[]{ "Map1", "Map2" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestArenaMap), global::Google.Protobuf.TestProtos.TestArenaMap.Parser, new[]{ "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapInt32Enum", "MapInt32ForeignMessage" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType), global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType.Parser, new[]{ "Type" }, null, new[]{ typeof(global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType.Types.Type) }, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.MessageContainingMapCalledEntry), global::Google.Protobuf.TestProtos.MessageContainingMapCalledEntry.Parser, new[]{ "Entry" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }) })); } #endregion @@ -229,7 +229,7 @@ public sealed partial class TestMap : pb::IMessage { /// Field number for the "map_int32_int32" field. public const int MapInt32Int32FieldNumber = 1; private static readonly pbc::MapField.Codec _map_mapInt32Int32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForInt32(16, 0), 10); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10); private readonly pbc::MapField mapInt32Int32_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Int32 { @@ -239,7 +239,7 @@ public sealed partial class TestMap : pb::IMessage { /// Field number for the "map_int64_int64" field. public const int MapInt64Int64FieldNumber = 2; private static readonly pbc::MapField.Codec _map_mapInt64Int64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt64(8, 0L), pb::FieldCodec.ForInt64(16, 0L), 18); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt64(8), pb::FieldCodec.ForInt64(16), 18); private readonly pbc::MapField mapInt64Int64_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt64Int64 { @@ -249,7 +249,7 @@ public sealed partial class TestMap : pb::IMessage { /// Field number for the "map_uint32_uint32" field. public const int MapUint32Uint32FieldNumber = 3; private static readonly pbc::MapField.Codec _map_mapUint32Uint32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForUInt32(8, 0), pb::FieldCodec.ForUInt32(16, 0), 26); + = new pbc::MapField.Codec(pb::FieldCodec.ForUInt32(8), pb::FieldCodec.ForUInt32(16), 26); private readonly pbc::MapField mapUint32Uint32_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapUint32Uint32 { @@ -259,7 +259,7 @@ public sealed partial class TestMap : pb::IMessage { /// Field number for the "map_uint64_uint64" field. public const int MapUint64Uint64FieldNumber = 4; private static readonly pbc::MapField.Codec _map_mapUint64Uint64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForUInt64(8, 0UL), pb::FieldCodec.ForUInt64(16, 0UL), 34); + = new pbc::MapField.Codec(pb::FieldCodec.ForUInt64(8), pb::FieldCodec.ForUInt64(16), 34); private readonly pbc::MapField mapUint64Uint64_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapUint64Uint64 { @@ -269,7 +269,7 @@ public sealed partial class TestMap : pb::IMessage { /// Field number for the "map_sint32_sint32" field. public const int MapSint32Sint32FieldNumber = 5; private static readonly pbc::MapField.Codec _map_mapSint32Sint32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForSInt32(8, 0), pb::FieldCodec.ForSInt32(16, 0), 42); + = new pbc::MapField.Codec(pb::FieldCodec.ForSInt32(8), pb::FieldCodec.ForSInt32(16), 42); private readonly pbc::MapField mapSint32Sint32_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSint32Sint32 { @@ -279,7 +279,7 @@ public sealed partial class TestMap : pb::IMessage { /// Field number for the "map_sint64_sint64" field. public const int MapSint64Sint64FieldNumber = 6; private static readonly pbc::MapField.Codec _map_mapSint64Sint64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForSInt64(8, 0L), pb::FieldCodec.ForSInt64(16, 0L), 50); + = new pbc::MapField.Codec(pb::FieldCodec.ForSInt64(8), pb::FieldCodec.ForSInt64(16), 50); private readonly pbc::MapField mapSint64Sint64_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSint64Sint64 { @@ -289,7 +289,7 @@ public sealed partial class TestMap : pb::IMessage { /// Field number for the "map_fixed32_fixed32" field. public const int MapFixed32Fixed32FieldNumber = 7; private static readonly pbc::MapField.Codec _map_mapFixed32Fixed32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForFixed32(13, 0), pb::FieldCodec.ForFixed32(21, 0), 58); + = new pbc::MapField.Codec(pb::FieldCodec.ForFixed32(13), pb::FieldCodec.ForFixed32(21), 58); private readonly pbc::MapField mapFixed32Fixed32_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapFixed32Fixed32 { @@ -299,7 +299,7 @@ public sealed partial class TestMap : pb::IMessage { /// Field number for the "map_fixed64_fixed64" field. public const int MapFixed64Fixed64FieldNumber = 8; private static readonly pbc::MapField.Codec _map_mapFixed64Fixed64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForFixed64(9, 0UL), pb::FieldCodec.ForFixed64(17, 0UL), 66); + = new pbc::MapField.Codec(pb::FieldCodec.ForFixed64(9), pb::FieldCodec.ForFixed64(17), 66); private readonly pbc::MapField mapFixed64Fixed64_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapFixed64Fixed64 { @@ -309,7 +309,7 @@ public sealed partial class TestMap : pb::IMessage { /// Field number for the "map_sfixed32_sfixed32" field. public const int MapSfixed32Sfixed32FieldNumber = 9; private static readonly pbc::MapField.Codec _map_mapSfixed32Sfixed32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed32(13, 0), pb::FieldCodec.ForSFixed32(21, 0), 74); + = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed32(13), pb::FieldCodec.ForSFixed32(21), 74); private readonly pbc::MapField mapSfixed32Sfixed32_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSfixed32Sfixed32 { @@ -319,7 +319,7 @@ public sealed partial class TestMap : pb::IMessage { /// Field number for the "map_sfixed64_sfixed64" field. public const int MapSfixed64Sfixed64FieldNumber = 10; private static readonly pbc::MapField.Codec _map_mapSfixed64Sfixed64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed64(9, 0L), pb::FieldCodec.ForSFixed64(17, 0L), 82); + = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed64(9), pb::FieldCodec.ForSFixed64(17), 82); private readonly pbc::MapField mapSfixed64Sfixed64_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSfixed64Sfixed64 { @@ -329,7 +329,7 @@ public sealed partial class TestMap : pb::IMessage { /// Field number for the "map_int32_float" field. public const int MapInt32FloatFieldNumber = 11; private static readonly pbc::MapField.Codec _map_mapInt32Float_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForFloat(21, 0F), 90); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForFloat(21), 90); private readonly pbc::MapField mapInt32Float_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Float { @@ -339,7 +339,7 @@ public sealed partial class TestMap : pb::IMessage { /// Field number for the "map_int32_double" field. public const int MapInt32DoubleFieldNumber = 12; private static readonly pbc::MapField.Codec _map_mapInt32Double_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForDouble(17, 0D), 98); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForDouble(17), 98); private readonly pbc::MapField mapInt32Double_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Double { @@ -349,7 +349,7 @@ public sealed partial class TestMap : pb::IMessage { /// Field number for the "map_bool_bool" field. public const int MapBoolBoolFieldNumber = 13; private static readonly pbc::MapField.Codec _map_mapBoolBool_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForBool(8, false), pb::FieldCodec.ForBool(16, false), 106); + = new pbc::MapField.Codec(pb::FieldCodec.ForBool(8), pb::FieldCodec.ForBool(16), 106); private readonly pbc::MapField mapBoolBool_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapBoolBool { @@ -359,7 +359,7 @@ public sealed partial class TestMap : pb::IMessage { /// Field number for the "map_string_string" field. public const int MapStringStringFieldNumber = 14; private static readonly pbc::MapField.Codec _map_mapStringString_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 114); + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 114); private readonly pbc::MapField mapStringString_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapStringString { @@ -369,7 +369,7 @@ public sealed partial class TestMap : pb::IMessage { /// Field number for the "map_int32_bytes" field. public const int MapInt32BytesFieldNumber = 15; private static readonly pbc::MapField.Codec _map_mapInt32Bytes_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForBytes(18, pb::ByteString.Empty), 122); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForBytes(18), 122); private readonly pbc::MapField mapInt32Bytes_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Bytes { @@ -379,7 +379,7 @@ public sealed partial class TestMap : pb::IMessage { /// Field number for the "map_int32_enum" field. public const int MapInt32EnumFieldNumber = 16; private static readonly pbc::MapField.Codec _map_mapInt32Enum_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::Google.Protobuf.TestProtos.MapEnum) x, global::Google.Protobuf.TestProtos.MapEnum.Foo), 130); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::Google.Protobuf.TestProtos.MapEnum) x), 130); private readonly pbc::MapField mapInt32Enum_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Enum { @@ -389,7 +389,7 @@ public sealed partial class TestMap : pb::IMessage { /// Field number for the "map_int32_foreign_message" field. public const int MapInt32ForeignMessageFieldNumber = 17; private static readonly pbc::MapField.Codec _map_mapInt32ForeignMessage_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.ForeignMessage.Parser), 138); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.ForeignMessage.Parser), 138); private readonly pbc::MapField mapInt32ForeignMessage_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32ForeignMessage { @@ -789,7 +789,7 @@ public sealed partial class TestMessageMap : pb::IMessage { /// Field number for the "map_int32_message" field. public const int MapInt32MessageFieldNumber = 1; private static readonly pbc::MapField.Codec _map_mapInt32Message_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.TestAllTypes.Parser), 10); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.TestAllTypes.Parser), 10); private readonly pbc::MapField mapInt32Message_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Message { @@ -914,7 +914,7 @@ public sealed partial class TestSameTypeMap : pb::IMessage { /// Field number for the "map1" field. public const int Map1FieldNumber = 1; private static readonly pbc::MapField.Codec _map_map1_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForInt32(16, 0), 10); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10); private readonly pbc::MapField map1_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Map1 { @@ -924,7 +924,7 @@ public sealed partial class TestSameTypeMap : pb::IMessage { /// Field number for the "map2" field. public const int Map2FieldNumber = 2; private static readonly pbc::MapField.Codec _map_map2_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForInt32(16, 0), 18); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 18); private readonly pbc::MapField map2_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Map2 { @@ -1068,7 +1068,7 @@ public sealed partial class TestArenaMap : pb::IMessage { /// Field number for the "map_int32_int32" field. public const int MapInt32Int32FieldNumber = 1; private static readonly pbc::MapField.Codec _map_mapInt32Int32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForInt32(16, 0), 10); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10); private readonly pbc::MapField mapInt32Int32_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Int32 { @@ -1078,7 +1078,7 @@ public sealed partial class TestArenaMap : pb::IMessage { /// Field number for the "map_int64_int64" field. public const int MapInt64Int64FieldNumber = 2; private static readonly pbc::MapField.Codec _map_mapInt64Int64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt64(8, 0L), pb::FieldCodec.ForInt64(16, 0L), 18); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt64(8), pb::FieldCodec.ForInt64(16), 18); private readonly pbc::MapField mapInt64Int64_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt64Int64 { @@ -1088,7 +1088,7 @@ public sealed partial class TestArenaMap : pb::IMessage { /// Field number for the "map_uint32_uint32" field. public const int MapUint32Uint32FieldNumber = 3; private static readonly pbc::MapField.Codec _map_mapUint32Uint32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForUInt32(8, 0), pb::FieldCodec.ForUInt32(16, 0), 26); + = new pbc::MapField.Codec(pb::FieldCodec.ForUInt32(8), pb::FieldCodec.ForUInt32(16), 26); private readonly pbc::MapField mapUint32Uint32_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapUint32Uint32 { @@ -1098,7 +1098,7 @@ public sealed partial class TestArenaMap : pb::IMessage { /// Field number for the "map_uint64_uint64" field. public const int MapUint64Uint64FieldNumber = 4; private static readonly pbc::MapField.Codec _map_mapUint64Uint64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForUInt64(8, 0UL), pb::FieldCodec.ForUInt64(16, 0UL), 34); + = new pbc::MapField.Codec(pb::FieldCodec.ForUInt64(8), pb::FieldCodec.ForUInt64(16), 34); private readonly pbc::MapField mapUint64Uint64_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapUint64Uint64 { @@ -1108,7 +1108,7 @@ public sealed partial class TestArenaMap : pb::IMessage { /// Field number for the "map_sint32_sint32" field. public const int MapSint32Sint32FieldNumber = 5; private static readonly pbc::MapField.Codec _map_mapSint32Sint32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForSInt32(8, 0), pb::FieldCodec.ForSInt32(16, 0), 42); + = new pbc::MapField.Codec(pb::FieldCodec.ForSInt32(8), pb::FieldCodec.ForSInt32(16), 42); private readonly pbc::MapField mapSint32Sint32_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSint32Sint32 { @@ -1118,7 +1118,7 @@ public sealed partial class TestArenaMap : pb::IMessage { /// Field number for the "map_sint64_sint64" field. public const int MapSint64Sint64FieldNumber = 6; private static readonly pbc::MapField.Codec _map_mapSint64Sint64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForSInt64(8, 0L), pb::FieldCodec.ForSInt64(16, 0L), 50); + = new pbc::MapField.Codec(pb::FieldCodec.ForSInt64(8), pb::FieldCodec.ForSInt64(16), 50); private readonly pbc::MapField mapSint64Sint64_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSint64Sint64 { @@ -1128,7 +1128,7 @@ public sealed partial class TestArenaMap : pb::IMessage { /// Field number for the "map_fixed32_fixed32" field. public const int MapFixed32Fixed32FieldNumber = 7; private static readonly pbc::MapField.Codec _map_mapFixed32Fixed32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForFixed32(13, 0), pb::FieldCodec.ForFixed32(21, 0), 58); + = new pbc::MapField.Codec(pb::FieldCodec.ForFixed32(13), pb::FieldCodec.ForFixed32(21), 58); private readonly pbc::MapField mapFixed32Fixed32_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapFixed32Fixed32 { @@ -1138,7 +1138,7 @@ public sealed partial class TestArenaMap : pb::IMessage { /// Field number for the "map_fixed64_fixed64" field. public const int MapFixed64Fixed64FieldNumber = 8; private static readonly pbc::MapField.Codec _map_mapFixed64Fixed64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForFixed64(9, 0UL), pb::FieldCodec.ForFixed64(17, 0UL), 66); + = new pbc::MapField.Codec(pb::FieldCodec.ForFixed64(9), pb::FieldCodec.ForFixed64(17), 66); private readonly pbc::MapField mapFixed64Fixed64_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapFixed64Fixed64 { @@ -1148,7 +1148,7 @@ public sealed partial class TestArenaMap : pb::IMessage { /// Field number for the "map_sfixed32_sfixed32" field. public const int MapSfixed32Sfixed32FieldNumber = 9; private static readonly pbc::MapField.Codec _map_mapSfixed32Sfixed32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed32(13, 0), pb::FieldCodec.ForSFixed32(21, 0), 74); + = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed32(13), pb::FieldCodec.ForSFixed32(21), 74); private readonly pbc::MapField mapSfixed32Sfixed32_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSfixed32Sfixed32 { @@ -1158,7 +1158,7 @@ public sealed partial class TestArenaMap : pb::IMessage { /// Field number for the "map_sfixed64_sfixed64" field. public const int MapSfixed64Sfixed64FieldNumber = 10; private static readonly pbc::MapField.Codec _map_mapSfixed64Sfixed64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed64(9, 0L), pb::FieldCodec.ForSFixed64(17, 0L), 82); + = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed64(9), pb::FieldCodec.ForSFixed64(17), 82); private readonly pbc::MapField mapSfixed64Sfixed64_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSfixed64Sfixed64 { @@ -1168,7 +1168,7 @@ public sealed partial class TestArenaMap : pb::IMessage { /// Field number for the "map_int32_float" field. public const int MapInt32FloatFieldNumber = 11; private static readonly pbc::MapField.Codec _map_mapInt32Float_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForFloat(21, 0F), 90); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForFloat(21), 90); private readonly pbc::MapField mapInt32Float_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Float { @@ -1178,7 +1178,7 @@ public sealed partial class TestArenaMap : pb::IMessage { /// Field number for the "map_int32_double" field. public const int MapInt32DoubleFieldNumber = 12; private static readonly pbc::MapField.Codec _map_mapInt32Double_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForDouble(17, 0D), 98); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForDouble(17), 98); private readonly pbc::MapField mapInt32Double_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Double { @@ -1188,7 +1188,7 @@ public sealed partial class TestArenaMap : pb::IMessage { /// Field number for the "map_bool_bool" field. public const int MapBoolBoolFieldNumber = 13; private static readonly pbc::MapField.Codec _map_mapBoolBool_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForBool(8, false), pb::FieldCodec.ForBool(16, false), 106); + = new pbc::MapField.Codec(pb::FieldCodec.ForBool(8), pb::FieldCodec.ForBool(16), 106); private readonly pbc::MapField mapBoolBool_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapBoolBool { @@ -1198,7 +1198,7 @@ public sealed partial class TestArenaMap : pb::IMessage { /// Field number for the "map_int32_enum" field. public const int MapInt32EnumFieldNumber = 14; private static readonly pbc::MapField.Codec _map_mapInt32Enum_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::Google.Protobuf.TestProtos.MapEnum) x, global::Google.Protobuf.TestProtos.MapEnum.Foo), 114); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::Google.Protobuf.TestProtos.MapEnum) x), 114); private readonly pbc::MapField mapInt32Enum_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Enum { @@ -1208,7 +1208,7 @@ public sealed partial class TestArenaMap : pb::IMessage { /// Field number for the "map_int32_foreign_message" field. public const int MapInt32ForeignMessageFieldNumber = 15; private static readonly pbc::MapField.Codec _map_mapInt32ForeignMessage_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.ForeignMessage.Parser), 122); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.ForeignMessage.Parser), 122); private readonly pbc::MapField mapInt32ForeignMessage_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32ForeignMessage { @@ -1459,7 +1459,7 @@ public sealed partial class MessageContainingEnumCalledType : pb::IMessageField number for the "type" field. public const int TypeFieldNumber = 1; private static readonly pbc::MapField.Codec _map_type_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType.Parser), 10); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType.Parser), 10); private readonly pbc::MapField type_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Type { @@ -1594,7 +1594,7 @@ public sealed partial class MessageContainingMapCalledEntry : pb::IMessageField number for the "entry" field. public const int EntryFieldNumber = 1; private static readonly pbc::MapField.Codec _map_entry_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForInt32(16, 0), 10); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10); private readonly pbc::MapField entry_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Entry { diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs index 064d0c0acec0..c74fcdfff446 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs @@ -231,10 +231,10 @@ public static partial class TestMessagesProto3Reflection { "UHJvdG8zYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.FieldMaskReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ProtobufTestMessages.Proto3.ForeignEnum), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto3.TestAllTypesProto3), global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Parser, new[]{ "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalNestedMessage", "OptionalForeignMessage", "OptionalNestedEnum", "OptionalForeignEnum", "OptionalAliasedEnum", "OptionalStringPiece", "OptionalCord", "RecursiveMessage", "RepeatedInt32", "RepeatedInt64", "RepeatedUint32", "RepeatedUint64", "RepeatedSint32", "RepeatedSint64", "RepeatedFixed32", "RepeatedFixed64", "RepeatedSfixed32", "RepeatedSfixed64", "RepeatedFloat", "RepeatedDouble", "RepeatedBool", "RepeatedString", "RepeatedBytes", "RepeatedNestedMessage", "RepeatedForeignMessage", "RepeatedNestedEnum", "RepeatedForeignEnum", "RepeatedStringPiece", "RepeatedCord", "PackedInt32", "PackedInt64", "PackedUint32", "PackedUint64", "PackedSint32", "PackedSint64", "PackedFixed32", "PackedFixed64", "PackedSfixed32", "PackedSfixed64", "PackedFloat", "PackedDouble", "PackedBool", "PackedNestedEnum", "UnpackedInt32", "UnpackedInt64", "UnpackedUint32", "UnpackedUint64", "UnpackedSint32", "UnpackedSint64", "UnpackedFixed32", "UnpackedFixed64", "UnpackedSfixed32", "UnpackedSfixed64", "UnpackedFloat", "UnpackedDouble", "UnpackedBool", "UnpackedNestedEnum", "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapStringString", "MapStringBytes", "MapStringNestedMessage", "MapStringForeignMessage", "MapStringNestedEnum", "MapStringForeignEnum", "OneofUint32", "OneofNestedMessage", "OneofString", "OneofBytes", "OneofBool", "OneofUint64", "OneofFloat", "OneofDouble", "OneofEnum", "OptionalBoolWrapper", "OptionalInt32Wrapper", "OptionalInt64Wrapper", "OptionalUint32Wrapper", "OptionalUint64Wrapper", "OptionalFloatWrapper", "OptionalDoubleWrapper", "OptionalStringWrapper", "OptionalBytesWrapper", "RepeatedBoolWrapper", "RepeatedInt32Wrapper", "RepeatedInt64Wrapper", "RepeatedUint32Wrapper", "RepeatedUint64Wrapper", "RepeatedFloatWrapper", "RepeatedDoubleWrapper", "RepeatedStringWrapper", "RepeatedBytesWrapper", "OptionalDuration", "OptionalTimestamp", "OptionalFieldMask", "OptionalStruct", "OptionalAny", "OptionalValue", "RepeatedDuration", "RepeatedTimestamp", "RepeatedFieldmask", "RepeatedStruct", "RepeatedAny", "RepeatedValue", "RepeatedListValue", "Fieldname1", "FieldName2", "FieldName3", "FieldName4", "Field0Name5", "Field0Name6", "FieldName7", "FieldName8", "FieldName9", "FieldName10", "FIELDNAME11", "FIELDName12", "FieldName13", "FieldName14", "FieldName15", "FieldName16", "FieldName17", "FieldName18" }, new[]{ "OneofField" }, new[]{ typeof(global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedEnum), typeof(global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.AliasedEnum) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage), global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage.Parser, new[]{ "A", "Corecursive" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ProtobufTestMessages.Proto3.ForeignEnum), }, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto3.TestAllTypesProto3), global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Parser, new[]{ "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalNestedMessage", "OptionalForeignMessage", "OptionalNestedEnum", "OptionalForeignEnum", "OptionalAliasedEnum", "OptionalStringPiece", "OptionalCord", "RecursiveMessage", "RepeatedInt32", "RepeatedInt64", "RepeatedUint32", "RepeatedUint64", "RepeatedSint32", "RepeatedSint64", "RepeatedFixed32", "RepeatedFixed64", "RepeatedSfixed32", "RepeatedSfixed64", "RepeatedFloat", "RepeatedDouble", "RepeatedBool", "RepeatedString", "RepeatedBytes", "RepeatedNestedMessage", "RepeatedForeignMessage", "RepeatedNestedEnum", "RepeatedForeignEnum", "RepeatedStringPiece", "RepeatedCord", "PackedInt32", "PackedInt64", "PackedUint32", "PackedUint64", "PackedSint32", "PackedSint64", "PackedFixed32", "PackedFixed64", "PackedSfixed32", "PackedSfixed64", "PackedFloat", "PackedDouble", "PackedBool", "PackedNestedEnum", "UnpackedInt32", "UnpackedInt64", "UnpackedUint32", "UnpackedUint64", "UnpackedSint32", "UnpackedSint64", "UnpackedFixed32", "UnpackedFixed64", "UnpackedSfixed32", "UnpackedSfixed64", "UnpackedFloat", "UnpackedDouble", "UnpackedBool", "UnpackedNestedEnum", "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapStringString", "MapStringBytes", "MapStringNestedMessage", "MapStringForeignMessage", "MapStringNestedEnum", "MapStringForeignEnum", "OneofUint32", "OneofNestedMessage", "OneofString", "OneofBytes", "OneofBool", "OneofUint64", "OneofFloat", "OneofDouble", "OneofEnum", "OptionalBoolWrapper", "OptionalInt32Wrapper", "OptionalInt64Wrapper", "OptionalUint32Wrapper", "OptionalUint64Wrapper", "OptionalFloatWrapper", "OptionalDoubleWrapper", "OptionalStringWrapper", "OptionalBytesWrapper", "RepeatedBoolWrapper", "RepeatedInt32Wrapper", "RepeatedInt64Wrapper", "RepeatedUint32Wrapper", "RepeatedUint64Wrapper", "RepeatedFloatWrapper", "RepeatedDoubleWrapper", "RepeatedStringWrapper", "RepeatedBytesWrapper", "OptionalDuration", "OptionalTimestamp", "OptionalFieldMask", "OptionalStruct", "OptionalAny", "OptionalValue", "RepeatedDuration", "RepeatedTimestamp", "RepeatedFieldmask", "RepeatedStruct", "RepeatedAny", "RepeatedValue", "RepeatedListValue", "Fieldname1", "FieldName2", "FieldName3", "FieldName4", "Field0Name5", "Field0Name6", "FieldName7", "FieldName8", "FieldName9", "FieldName10", "FIELDNAME11", "FIELDName12", "FieldName13", "FieldName14", "FieldName15", "FieldName16", "FieldName17", "FieldName18" }, new[]{ "OneofField" }, new[]{ typeof(global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedEnum), typeof(global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.AliasedEnum) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage), global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage.Parser, new[]{ "A", "Corecursive" }, null, null, null), null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto3.ForeignMessage), global::ProtobufTestMessages.Proto3.ForeignMessage.Parser, new[]{ "C" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto3.ForeignMessage), global::ProtobufTestMessages.Proto3.ForeignMessage.Parser, new[]{ "C" }, null, null, null) })); } #endregion @@ -1220,7 +1220,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_int32_int32" field. public const int MapInt32Int32FieldNumber = 56; private static readonly pbc::MapField.Codec _map_mapInt32Int32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForInt32(16, 0), 450); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 450); private readonly pbc::MapField mapInt32Int32_ = new pbc::MapField(); /// /// Map @@ -1233,7 +1233,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_int64_int64" field. public const int MapInt64Int64FieldNumber = 57; private static readonly pbc::MapField.Codec _map_mapInt64Int64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt64(8, 0L), pb::FieldCodec.ForInt64(16, 0L), 458); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt64(8), pb::FieldCodec.ForInt64(16), 458); private readonly pbc::MapField mapInt64Int64_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt64Int64 { @@ -1243,7 +1243,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_uint32_uint32" field. public const int MapUint32Uint32FieldNumber = 58; private static readonly pbc::MapField.Codec _map_mapUint32Uint32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForUInt32(8, 0), pb::FieldCodec.ForUInt32(16, 0), 466); + = new pbc::MapField.Codec(pb::FieldCodec.ForUInt32(8), pb::FieldCodec.ForUInt32(16), 466); private readonly pbc::MapField mapUint32Uint32_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapUint32Uint32 { @@ -1253,7 +1253,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_uint64_uint64" field. public const int MapUint64Uint64FieldNumber = 59; private static readonly pbc::MapField.Codec _map_mapUint64Uint64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForUInt64(8, 0UL), pb::FieldCodec.ForUInt64(16, 0UL), 474); + = new pbc::MapField.Codec(pb::FieldCodec.ForUInt64(8), pb::FieldCodec.ForUInt64(16), 474); private readonly pbc::MapField mapUint64Uint64_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapUint64Uint64 { @@ -1263,7 +1263,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_sint32_sint32" field. public const int MapSint32Sint32FieldNumber = 60; private static readonly pbc::MapField.Codec _map_mapSint32Sint32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForSInt32(8, 0), pb::FieldCodec.ForSInt32(16, 0), 482); + = new pbc::MapField.Codec(pb::FieldCodec.ForSInt32(8), pb::FieldCodec.ForSInt32(16), 482); private readonly pbc::MapField mapSint32Sint32_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSint32Sint32 { @@ -1273,7 +1273,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_sint64_sint64" field. public const int MapSint64Sint64FieldNumber = 61; private static readonly pbc::MapField.Codec _map_mapSint64Sint64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForSInt64(8, 0L), pb::FieldCodec.ForSInt64(16, 0L), 490); + = new pbc::MapField.Codec(pb::FieldCodec.ForSInt64(8), pb::FieldCodec.ForSInt64(16), 490); private readonly pbc::MapField mapSint64Sint64_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSint64Sint64 { @@ -1283,7 +1283,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_fixed32_fixed32" field. public const int MapFixed32Fixed32FieldNumber = 62; private static readonly pbc::MapField.Codec _map_mapFixed32Fixed32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForFixed32(13, 0), pb::FieldCodec.ForFixed32(21, 0), 498); + = new pbc::MapField.Codec(pb::FieldCodec.ForFixed32(13), pb::FieldCodec.ForFixed32(21), 498); private readonly pbc::MapField mapFixed32Fixed32_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapFixed32Fixed32 { @@ -1293,7 +1293,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_fixed64_fixed64" field. public const int MapFixed64Fixed64FieldNumber = 63; private static readonly pbc::MapField.Codec _map_mapFixed64Fixed64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForFixed64(9, 0UL), pb::FieldCodec.ForFixed64(17, 0UL), 506); + = new pbc::MapField.Codec(pb::FieldCodec.ForFixed64(9), pb::FieldCodec.ForFixed64(17), 506); private readonly pbc::MapField mapFixed64Fixed64_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapFixed64Fixed64 { @@ -1303,7 +1303,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_sfixed32_sfixed32" field. public const int MapSfixed32Sfixed32FieldNumber = 64; private static readonly pbc::MapField.Codec _map_mapSfixed32Sfixed32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed32(13, 0), pb::FieldCodec.ForSFixed32(21, 0), 514); + = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed32(13), pb::FieldCodec.ForSFixed32(21), 514); private readonly pbc::MapField mapSfixed32Sfixed32_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSfixed32Sfixed32 { @@ -1313,7 +1313,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_sfixed64_sfixed64" field. public const int MapSfixed64Sfixed64FieldNumber = 65; private static readonly pbc::MapField.Codec _map_mapSfixed64Sfixed64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed64(9, 0L), pb::FieldCodec.ForSFixed64(17, 0L), 522); + = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed64(9), pb::FieldCodec.ForSFixed64(17), 522); private readonly pbc::MapField mapSfixed64Sfixed64_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSfixed64Sfixed64 { @@ -1323,7 +1323,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_int32_float" field. public const int MapInt32FloatFieldNumber = 66; private static readonly pbc::MapField.Codec _map_mapInt32Float_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForFloat(21, 0F), 530); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForFloat(21), 530); private readonly pbc::MapField mapInt32Float_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Float { @@ -1333,7 +1333,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_int32_double" field. public const int MapInt32DoubleFieldNumber = 67; private static readonly pbc::MapField.Codec _map_mapInt32Double_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForDouble(17, 0D), 538); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForDouble(17), 538); private readonly pbc::MapField mapInt32Double_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Double { @@ -1343,7 +1343,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_bool_bool" field. public const int MapBoolBoolFieldNumber = 68; private static readonly pbc::MapField.Codec _map_mapBoolBool_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForBool(8, false), pb::FieldCodec.ForBool(16, false), 546); + = new pbc::MapField.Codec(pb::FieldCodec.ForBool(8), pb::FieldCodec.ForBool(16), 546); private readonly pbc::MapField mapBoolBool_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapBoolBool { @@ -1353,7 +1353,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_string_string" field. public const int MapStringStringFieldNumber = 69; private static readonly pbc::MapField.Codec _map_mapStringString_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 554); + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 554); private readonly pbc::MapField mapStringString_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapStringString { @@ -1363,7 +1363,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_string_bytes" field. public const int MapStringBytesFieldNumber = 70; private static readonly pbc::MapField.Codec _map_mapStringBytes_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForBytes(18, pb::ByteString.Empty), 562); + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForBytes(18), 562); private readonly pbc::MapField mapStringBytes_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapStringBytes { @@ -1373,7 +1373,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_string_nested_message" field. public const int MapStringNestedMessageFieldNumber = 71; private static readonly pbc::MapField.Codec _map_mapStringNestedMessage_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage.Parser), 570); + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedMessage.Parser), 570); private readonly pbc::MapField mapStringNestedMessage_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapStringNestedMessage { @@ -1383,7 +1383,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_string_foreign_message" field. public const int MapStringForeignMessageFieldNumber = 72; private static readonly pbc::MapField.Codec _map_mapStringForeignMessage_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::ProtobufTestMessages.Proto3.ForeignMessage.Parser), 578); + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::ProtobufTestMessages.Proto3.ForeignMessage.Parser), 578); private readonly pbc::MapField mapStringForeignMessage_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapStringForeignMessage { @@ -1393,7 +1393,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_string_nested_enum" field. public const int MapStringNestedEnumFieldNumber = 73; private static readonly pbc::MapField.Codec _map_mapStringNestedEnum_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedEnum) x, global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedEnum.Foo), 586); + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::ProtobufTestMessages.Proto3.TestAllTypesProto3.Types.NestedEnum) x), 586); private readonly pbc::MapField mapStringNestedEnum_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapStringNestedEnum { @@ -1403,7 +1403,7 @@ public sealed partial class TestAllTypesProto3 : pb::IMessageField number for the "map_string_foreign_enum" field. public const int MapStringForeignEnumFieldNumber = 74; private static readonly pbc::MapField.Codec _map_mapStringForeignEnum_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::ProtobufTestMessages.Proto3.ForeignEnum) x, global::ProtobufTestMessages.Proto3.ForeignEnum.ForeignFoo), 594); + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::ProtobufTestMessages.Proto3.ForeignEnum) x), 594); private readonly pbc::MapField mapStringForeignEnum_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapStringForeignEnum { diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs index 6b19b5cce362..2a9efe55fff1 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs @@ -138,106 +138,32 @@ public static partial class UnittestCustomOptionsProto3Reflection { "Eg5GaWxlQW5ub3RhdGlvbhoWEhROZXN0ZWRGaWxlQW5ub3RhdGlvbmIGcHJv", "dG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::UnitTest.Issues.TestProtos.MethodOpt1), typeof(global::UnitTest.Issues.TestProtos.AggregateEnum), }, new pb::Extension[] { UnittestCustomOptionsProto3Extensions.FileOpt1, UnittestCustomOptionsProto3Extensions.MessageOpt1, UnittestCustomOptionsProto3Extensions.FieldOpt1, UnittestCustomOptionsProto3Extensions.OneofOpt1, UnittestCustomOptionsProto3Extensions.EnumOpt1, UnittestCustomOptionsProto3Extensions.EnumValueOpt1, UnittestCustomOptionsProto3Extensions.ServiceOpt1, UnittestCustomOptionsProto3Extensions.MethodOpt1, UnittestCustomOptionsProto3Extensions.BoolOpt, UnittestCustomOptionsProto3Extensions.Int32Opt, UnittestCustomOptionsProto3Extensions.Int64Opt, UnittestCustomOptionsProto3Extensions.Uint32Opt, UnittestCustomOptionsProto3Extensions.Uint64Opt, UnittestCustomOptionsProto3Extensions.Sint32Opt, UnittestCustomOptionsProto3Extensions.Sint64Opt, UnittestCustomOptionsProto3Extensions.Fixed32Opt, UnittestCustomOptionsProto3Extensions.Fixed64Opt, UnittestCustomOptionsProto3Extensions.Sfixed32Opt, UnittestCustomOptionsProto3Extensions.Sfixed64Opt, UnittestCustomOptionsProto3Extensions.FloatOpt, UnittestCustomOptionsProto3Extensions.DoubleOpt, UnittestCustomOptionsProto3Extensions.StringOpt, UnittestCustomOptionsProto3Extensions.BytesOpt, UnittestCustomOptionsProto3Extensions.EnumOpt, UnittestCustomOptionsProto3Extensions.MessageTypeOpt, UnittestCustomOptionsProto3Extensions.ComplexOpt1, UnittestCustomOptionsProto3Extensions.ComplexOpt2, UnittestCustomOptionsProto3Extensions.ComplexOpt3, UnittestCustomOptionsProto3Extensions.Fileopt, UnittestCustomOptionsProto3Extensions.Msgopt, UnittestCustomOptionsProto3Extensions.Fieldopt, UnittestCustomOptionsProto3Extensions.Enumopt, UnittestCustomOptionsProto3Extensions.Enumvalopt, UnittestCustomOptionsProto3Extensions.Serviceopt, UnittestCustomOptionsProto3Extensions.Methodopt }, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.TestMessageWithCustomOptions), global::UnitTest.Issues.TestProtos.TestMessageWithCustomOptions.Parser, new[]{ "Field1", "OneofField" }, new[]{ "AnOneof" }, new[]{ typeof(global::UnitTest.Issues.TestProtos.TestMessageWithCustomOptions.Types.AnEnum) }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionFooRequest), global::UnitTest.Issues.TestProtos.CustomOptionFooRequest.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionFooResponse), global::UnitTest.Issues.TestProtos.CustomOptionFooResponse.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionFooClientMessage), global::UnitTest.Issues.TestProtos.CustomOptionFooClientMessage.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionFooServerMessage), global::UnitTest.Issues.TestProtos.CustomOptionFooServerMessage.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.DummyMessageContainingEnum), global::UnitTest.Issues.TestProtos.DummyMessageContainingEnum.Parser, null, null, new[]{ typeof(global::UnitTest.Issues.TestProtos.DummyMessageContainingEnum.Types.TestEnumType) }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.DummyMessageInvalidAsOptionType), global::UnitTest.Issues.TestProtos.DummyMessageInvalidAsOptionType.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionMinIntegerValues), global::UnitTest.Issues.TestProtos.CustomOptionMinIntegerValues.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionMaxIntegerValues), global::UnitTest.Issues.TestProtos.CustomOptionMaxIntegerValues.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionOtherValues), global::UnitTest.Issues.TestProtos.CustomOptionOtherValues.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.SettingRealsFromPositiveInts), global::UnitTest.Issues.TestProtos.SettingRealsFromPositiveInts.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.SettingRealsFromNegativeInts), global::UnitTest.Issues.TestProtos.SettingRealsFromNegativeInts.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ComplexOptionType1), global::UnitTest.Issues.TestProtos.ComplexOptionType1.Parser, new[]{ "Foo", "Foo2", "Foo3", "Foo4" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ComplexOptionType2), global::UnitTest.Issues.TestProtos.ComplexOptionType2.Parser, new[]{ "Bar", "Baz", "Fred", "Barney" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4), global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.Parser, new[]{ "Waldo" }, null, null, new pb::Extension[] { global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.Extensions.ComplexOpt4 }, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ComplexOptionType3), global::UnitTest.Issues.TestProtos.ComplexOptionType3.Parser, new[]{ "Qux" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.VariousComplexOptions), global::UnitTest.Issues.TestProtos.VariousComplexOptions.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Aggregate), global::UnitTest.Issues.TestProtos.Aggregate.Parser, new[]{ "I", "S", "Sub" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.AggregateMessage), global::UnitTest.Issues.TestProtos.AggregateMessage.Parser, new[]{ "Fieldname" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.NestedOptionType), global::UnitTest.Issues.TestProtos.NestedOptionType.Parser, null, null, new[]{ typeof(global::UnitTest.Issues.TestProtos.NestedOptionType.Types.NestedEnum) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.NestedOptionType.Types.NestedMessage), global::UnitTest.Issues.TestProtos.NestedOptionType.Types.NestedMessage.Parser, new[]{ "NestedField" }, null, null, null, null)}) + new pbr::FileDescriptor[] { pbr::FileDescriptor.DescriptorProtoFileDescriptor, }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::UnitTest.Issues.TestProtos.MethodOpt1), typeof(global::UnitTest.Issues.TestProtos.AggregateEnum), }, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.TestMessageWithCustomOptions), global::UnitTest.Issues.TestProtos.TestMessageWithCustomOptions.Parser, new[]{ "Field1", "OneofField" }, new[]{ "AnOneof" }, new[]{ typeof(global::UnitTest.Issues.TestProtos.TestMessageWithCustomOptions.Types.AnEnum) }, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionFooRequest), global::UnitTest.Issues.TestProtos.CustomOptionFooRequest.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionFooResponse), global::UnitTest.Issues.TestProtos.CustomOptionFooResponse.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionFooClientMessage), global::UnitTest.Issues.TestProtos.CustomOptionFooClientMessage.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionFooServerMessage), global::UnitTest.Issues.TestProtos.CustomOptionFooServerMessage.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.DummyMessageContainingEnum), global::UnitTest.Issues.TestProtos.DummyMessageContainingEnum.Parser, null, null, new[]{ typeof(global::UnitTest.Issues.TestProtos.DummyMessageContainingEnum.Types.TestEnumType) }, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.DummyMessageInvalidAsOptionType), global::UnitTest.Issues.TestProtos.DummyMessageInvalidAsOptionType.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionMinIntegerValues), global::UnitTest.Issues.TestProtos.CustomOptionMinIntegerValues.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionMaxIntegerValues), global::UnitTest.Issues.TestProtos.CustomOptionMaxIntegerValues.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionOtherValues), global::UnitTest.Issues.TestProtos.CustomOptionOtherValues.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.SettingRealsFromPositiveInts), global::UnitTest.Issues.TestProtos.SettingRealsFromPositiveInts.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.SettingRealsFromNegativeInts), global::UnitTest.Issues.TestProtos.SettingRealsFromNegativeInts.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ComplexOptionType1), global::UnitTest.Issues.TestProtos.ComplexOptionType1.Parser, new[]{ "Foo", "Foo2", "Foo3", "Foo4" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ComplexOptionType2), global::UnitTest.Issues.TestProtos.ComplexOptionType2.Parser, new[]{ "Bar", "Baz", "Fred", "Barney" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4), global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.Parser, new[]{ "Waldo" }, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ComplexOptionType3), global::UnitTest.Issues.TestProtos.ComplexOptionType3.Parser, new[]{ "Qux" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.VariousComplexOptions), global::UnitTest.Issues.TestProtos.VariousComplexOptions.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Aggregate), global::UnitTest.Issues.TestProtos.Aggregate.Parser, new[]{ "I", "S", "Sub" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.AggregateMessage), global::UnitTest.Issues.TestProtos.AggregateMessage.Parser, new[]{ "Fieldname" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.NestedOptionType), global::UnitTest.Issues.TestProtos.NestedOptionType.Parser, null, null, new[]{ typeof(global::UnitTest.Issues.TestProtos.NestedOptionType.Types.NestedEnum) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.NestedOptionType.Types.NestedMessage), global::UnitTest.Issues.TestProtos.NestedOptionType.Types.NestedMessage.Parser, new[]{ "NestedField" }, null, null, null)}) })); } #endregion } - /// Holder for extension identifiers generated from the top level of unittest_custom_options_proto3.proto - internal static partial class UnittestCustomOptionsProto3Extensions { - public static readonly pb::Extension FileOpt1 = - new pb::Extension(7736974, pb::FieldCodec.ForUInt64(61895792, 0UL)); - public static readonly pb::Extension MessageOpt1 = - new pb::Extension(7739036, pb::FieldCodec.ForInt32(61912288, 0)); - public static readonly pb::Extension FieldOpt1 = - new pb::Extension(7740936, pb::FieldCodec.ForFixed64(61927489, 0UL)); - public static readonly pb::Extension OneofOpt1 = - new pb::Extension(7740111, pb::FieldCodec.ForInt32(61920888, 0)); - public static readonly pb::Extension EnumOpt1 = - new pb::Extension(7753576, pb::FieldCodec.ForSFixed32(62028613, 0)); - public static readonly pb::Extension EnumValueOpt1 = - new pb::Extension(1560678, pb::FieldCodec.ForInt32(12485424, 0)); - public static readonly pb::Extension ServiceOpt1 = - new pb::Extension(7887650, pb::FieldCodec.ForSInt64(63101200, 0L)); - public static readonly pb::Extension MethodOpt1 = - new pb::Extension(7890860, pb::FieldCodec.ForEnum(63126880, x => (int) x, x => (global::UnitTest.Issues.TestProtos.MethodOpt1) x, global::UnitTest.Issues.TestProtos.MethodOpt1.Unspecified)); - public static readonly pb::Extension BoolOpt = - new pb::Extension(7706090, pb::FieldCodec.ForBool(61648720, false)); - public static readonly pb::Extension Int32Opt = - new pb::Extension(7705709, pb::FieldCodec.ForInt32(61645672, 0)); - public static readonly pb::Extension Int64Opt = - new pb::Extension(7705542, pb::FieldCodec.ForInt64(61644336, 0L)); - public static readonly pb::Extension Uint32Opt = - new pb::Extension(7704880, pb::FieldCodec.ForUInt32(61639040, 0)); - public static readonly pb::Extension Uint64Opt = - new pb::Extension(7702367, pb::FieldCodec.ForUInt64(61618936, 0UL)); - public static readonly pb::Extension Sint32Opt = - new pb::Extension(7701568, pb::FieldCodec.ForSInt32(61612544, 0)); - public static readonly pb::Extension Sint64Opt = - new pb::Extension(7700863, pb::FieldCodec.ForSInt64(61606904, 0L)); - public static readonly pb::Extension Fixed32Opt = - new pb::Extension(7700307, pb::FieldCodec.ForFixed32(61602461, 0)); - public static readonly pb::Extension Fixed64Opt = - new pb::Extension(7700194, pb::FieldCodec.ForFixed64(61601553, 0UL)); - public static readonly pb::Extension Sfixed32Opt = - new pb::Extension(7698645, pb::FieldCodec.ForSFixed32(61589165, 0)); - public static readonly pb::Extension Sfixed64Opt = - new pb::Extension(7685475, pb::FieldCodec.ForSFixed64(61483801, 0L)); - public static readonly pb::Extension FloatOpt = - new pb::Extension(7675390, pb::FieldCodec.ForFloat(61403125, 0F)); - public static readonly pb::Extension DoubleOpt = - new pb::Extension(7673293, pb::FieldCodec.ForDouble(61386345, 0D)); - public static readonly pb::Extension StringOpt = - new pb::Extension(7673285, pb::FieldCodec.ForString(61386282, "")); - public static readonly pb::Extension BytesOpt = - new pb::Extension(7673238, pb::FieldCodec.ForBytes(61385906, pb::ByteString.Empty)); - public static readonly pb::Extension EnumOpt = - new pb::Extension(7673233, pb::FieldCodec.ForEnum(61385864, x => (int) x, x => (global::UnitTest.Issues.TestProtos.DummyMessageContainingEnum.Types.TestEnumType) x, global::UnitTest.Issues.TestProtos.DummyMessageContainingEnum.Types.TestEnumType.TestOptionEnumUnspecified)); - public static readonly pb::Extension MessageTypeOpt = - new pb::Extension(7665967, pb::FieldCodec.ForMessage(61327738, global::UnitTest.Issues.TestProtos.DummyMessageInvalidAsOptionType.Parser)); - public static readonly pb::Extension ComplexOpt1 = - new pb::Extension(7646756, pb::FieldCodec.ForMessage(61174050, global::UnitTest.Issues.TestProtos.ComplexOptionType1.Parser)); - public static readonly pb::Extension ComplexOpt2 = - new pb::Extension(7636949, pb::FieldCodec.ForMessage(61095594, global::UnitTest.Issues.TestProtos.ComplexOptionType2.Parser)); - public static readonly pb::Extension ComplexOpt3 = - new pb::Extension(7636463, pb::FieldCodec.ForMessage(61091706, global::UnitTest.Issues.TestProtos.ComplexOptionType3.Parser)); - public static readonly pb::Extension Fileopt = - new pb::Extension(15478479, pb::FieldCodec.ForMessage(123827834, global::UnitTest.Issues.TestProtos.Aggregate.Parser)); - public static readonly pb::Extension Msgopt = - new pb::Extension(15480088, pb::FieldCodec.ForMessage(123840706, global::UnitTest.Issues.TestProtos.Aggregate.Parser)); - public static readonly pb::Extension Fieldopt = - new pb::Extension(15481374, pb::FieldCodec.ForMessage(123850994, global::UnitTest.Issues.TestProtos.Aggregate.Parser)); - public static readonly pb::Extension Enumopt = - new pb::Extension(15483218, pb::FieldCodec.ForMessage(123865746, global::UnitTest.Issues.TestProtos.Aggregate.Parser)); - public static readonly pb::Extension Enumvalopt = - new pb::Extension(15486921, pb::FieldCodec.ForMessage(123895370, global::UnitTest.Issues.TestProtos.Aggregate.Parser)); - public static readonly pb::Extension Serviceopt = - new pb::Extension(15497145, pb::FieldCodec.ForMessage(123977162, global::UnitTest.Issues.TestProtos.Aggregate.Parser)); - public static readonly pb::Extension Methodopt = - new pb::Extension(15512713, pb::FieldCodec.ForMessage(124101706, global::UnitTest.Issues.TestProtos.Aggregate.Parser)); - } - #region Enums public enum MethodOpt1 { [pbr::OriginalName("METHODOPT1_UNSPECIFIED")] Unspecified = 0, @@ -2135,15 +2061,6 @@ public sealed partial class ComplexOptionType4 : pb::IMessageContainer for extensions for other messages declared in the ComplexOptionType4 message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - internal static partial class Extensions { - public static readonly pb::Extension ComplexOpt4 = - new pb::Extension(7633546, pb::FieldCodec.ForMessage(61068370, global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.Parser)); - } - #endregion - } } diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs index 19a1a34634f9..6bf97151715e 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs @@ -32,8 +32,8 @@ public static partial class UnittestImportProto3Reflection { "cm90b2J1Zi5UZXN0UHJvdG9zUABiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestImportPublicProto3Reflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.ImportEnum), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.ImportMessage), global::Google.Protobuf.TestProtos.ImportMessage.Parser, new[]{ "D" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.ImportEnum), }, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.ImportMessage), global::Google.Protobuf.TestProtos.ImportMessage.Parser, new[]{ "D" }, null, null, null) })); } #endregion diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs index a45565546989..97d181aff48c 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs @@ -30,8 +30,8 @@ public static partial class UnittestImportPublicProto3Reflection { "Mw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.PublicImportMessage), global::Google.Protobuf.TestProtos.PublicImportMessage.Parser, new[]{ "E" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.PublicImportMessage), global::Google.Protobuf.TestProtos.PublicImportMessage.Parser, new[]{ "E" }, null, null, null) })); } #endregion diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs index f3f40c6a70cf..a0cffe4076b2 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs @@ -54,16 +54,16 @@ public static partial class UnittestIssuesReflection { "cy5UZXN0UHJvdG9zYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::UnitTest.Issues.TestProtos.NegativeEnum), typeof(global::UnitTest.Issues.TestProtos.DeprecatedEnum), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Issue307), global::UnitTest.Issues.TestProtos.Issue307.Parser, null, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce), global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce.Parser, null, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce.Types.NestedTwice), global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce.Types.NestedTwice.Parser, null, null, null, null, null)})}), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.NegativeEnumMessage), global::UnitTest.Issues.TestProtos.NegativeEnumMessage.Parser, new[]{ "Value", "Values", "PackedValues" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.DeprecatedChild), global::UnitTest.Issues.TestProtos.DeprecatedChild.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage), global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage.Parser, new[]{ "PrimitiveValue", "PrimitiveArray", "MessageValue", "MessageArray", "EnumValue", "EnumArray" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ItemField), global::UnitTest.Issues.TestProtos.ItemField.Parser, new[]{ "Item" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ReservedNames), global::UnitTest.Issues.TestProtos.ReservedNames.Parser, new[]{ "Types_", "Descriptor_" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ReservedNames.Types.SomeNestedType), global::UnitTest.Issues.TestProtos.ReservedNames.Types.SomeNestedType.Parser, null, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.TestJsonFieldOrdering), global::UnitTest.Issues.TestProtos.TestJsonFieldOrdering.Parser, new[]{ "PlainInt32", "O1String", "O1Int32", "PlainString", "O2Int32", "O2String" }, new[]{ "O1", "O2" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.TestJsonName), global::UnitTest.Issues.TestProtos.TestJsonName.Parser, new[]{ "Name", "Description", "Guid" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.OneofMerging), global::UnitTest.Issues.TestProtos.OneofMerging.Parser, new[]{ "Text", "Nested" }, new[]{ "Value" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.OneofMerging.Types.Nested), global::UnitTest.Issues.TestProtos.OneofMerging.Types.Nested.Parser, new[]{ "X", "Y" }, null, null, null, null)}) + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::UnitTest.Issues.TestProtos.NegativeEnum), typeof(global::UnitTest.Issues.TestProtos.DeprecatedEnum), }, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Issue307), global::UnitTest.Issues.TestProtos.Issue307.Parser, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce), global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce.Parser, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce.Types.NestedTwice), global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce.Types.NestedTwice.Parser, null, null, null, null)})}), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.NegativeEnumMessage), global::UnitTest.Issues.TestProtos.NegativeEnumMessage.Parser, new[]{ "Value", "Values", "PackedValues" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.DeprecatedChild), global::UnitTest.Issues.TestProtos.DeprecatedChild.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage), global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage.Parser, new[]{ "PrimitiveValue", "PrimitiveArray", "MessageValue", "MessageArray", "EnumValue", "EnumArray" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ItemField), global::UnitTest.Issues.TestProtos.ItemField.Parser, new[]{ "Item" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ReservedNames), global::UnitTest.Issues.TestProtos.ReservedNames.Parser, new[]{ "Types_", "Descriptor_" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ReservedNames.Types.SomeNestedType), global::UnitTest.Issues.TestProtos.ReservedNames.Types.SomeNestedType.Parser, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.TestJsonFieldOrdering), global::UnitTest.Issues.TestProtos.TestJsonFieldOrdering.Parser, new[]{ "PlainInt32", "O1String", "O1Int32", "PlainString", "O2Int32", "O2String" }, new[]{ "O1", "O2" }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.TestJsonName), global::UnitTest.Issues.TestProtos.TestJsonName.Parser, new[]{ "Name", "Description", "Guid" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.OneofMerging), global::UnitTest.Issues.TestProtos.OneofMerging.Parser, new[]{ "Text", "Nested" }, new[]{ "Value" }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.OneofMerging.Types.Nested), global::UnitTest.Issues.TestProtos.OneofMerging.Types.Nested.Parser, new[]{ "X", "Y" }, null, null, null)}) })); } #endregion diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs index 2f489ad7430a..30778e4c3204 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs @@ -158,43 +158,43 @@ public static partial class UnittestProto3Reflection { "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), typeof(global::Google.Protobuf.TestProtos.CommentEnum), }, null, 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) }, null, 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, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.NestedTestAllTypes), global::Google.Protobuf.TestProtos.NestedTestAllTypes.Parser, new[]{ "Child", "Payload", "RepeatedChild" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestDeprecatedFields), global::Google.Protobuf.TestProtos.TestDeprecatedFields.Parser, new[]{ "DeprecatedInt32" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.ForeignMessage), global::Google.Protobuf.TestProtos.ForeignMessage.Parser, new[]{ "C" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestReservedFields), global::Google.Protobuf.TestProtos.TestReservedFields.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestForeignNested), global::Google.Protobuf.TestProtos.TestForeignNested.Parser, new[]{ "ForeignNested" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestReallyLargeTagNumber), global::Google.Protobuf.TestProtos.TestReallyLargeTagNumber.Parser, new[]{ "A", "Bb" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestRecursiveMessage), global::Google.Protobuf.TestProtos.TestRecursiveMessage.Parser, new[]{ "A", "I" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMutualRecursionA), global::Google.Protobuf.TestProtos.TestMutualRecursionA.Parser, new[]{ "Bb" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMutualRecursionB), global::Google.Protobuf.TestProtos.TestMutualRecursionB.Parser, new[]{ "A", "OptionalInt32" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestEnumAllowAlias), global::Google.Protobuf.TestProtos.TestEnumAllowAlias.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestCamelCaseFieldNames), global::Google.Protobuf.TestProtos.TestCamelCaseFieldNames.Parser, new[]{ "PrimitiveField", "StringField", "EnumField", "MessageField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedEnumField", "RepeatedMessageField" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestFieldOrderings), global::Google.Protobuf.TestProtos.TestFieldOrderings.Parser, new[]{ "MyString", "MyInt", "MyFloat", "SingleNestedMessage" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage), global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage.Parser, new[]{ "Oo", "Bb" }, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.SparseEnumMessage), global::Google.Protobuf.TestProtos.SparseEnumMessage.Parser, new[]{ "SparseEnum" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.OneString), global::Google.Protobuf.TestProtos.OneString.Parser, new[]{ "Data" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.MoreString), global::Google.Protobuf.TestProtos.MoreString.Parser, new[]{ "Data" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.OneBytes), global::Google.Protobuf.TestProtos.OneBytes.Parser, new[]{ "Data" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.MoreBytes), global::Google.Protobuf.TestProtos.MoreBytes.Parser, new[]{ "Data" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Int32Message), global::Google.Protobuf.TestProtos.Int32Message.Parser, new[]{ "Data" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Uint32Message), global::Google.Protobuf.TestProtos.Uint32Message.Parser, new[]{ "Data" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Int64Message), global::Google.Protobuf.TestProtos.Int64Message.Parser, new[]{ "Data" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Uint64Message), global::Google.Protobuf.TestProtos.Uint64Message.Parser, new[]{ "Data" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.BoolMessage), global::Google.Protobuf.TestProtos.BoolMessage.Parser, new[]{ "Data" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestOneof), global::Google.Protobuf.TestProtos.TestOneof.Parser, new[]{ "FooInt", "FooString", "FooMessage" }, new[]{ "Foo" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestPackedTypes), global::Google.Protobuf.TestProtos.TestPackedTypes.Parser, new[]{ "PackedInt32", "PackedInt64", "PackedUint32", "PackedUint64", "PackedSint32", "PackedSint64", "PackedFixed32", "PackedFixed64", "PackedSfixed32", "PackedSfixed64", "PackedFloat", "PackedDouble", "PackedBool", "PackedEnum" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestUnpackedTypes), global::Google.Protobuf.TestProtos.TestUnpackedTypes.Parser, new[]{ "UnpackedInt32", "UnpackedInt64", "UnpackedUint32", "UnpackedUint64", "UnpackedSint32", "UnpackedSint64", "UnpackedFixed32", "UnpackedFixed64", "UnpackedSfixed32", "UnpackedSfixed64", "UnpackedFloat", "UnpackedDouble", "UnpackedBool", "UnpackedEnum" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestRepeatedScalarDifferentTagSizes), global::Google.Protobuf.TestProtos.TestRepeatedScalarDifferentTagSizes.Parser, new[]{ "RepeatedFixed32", "RepeatedInt32", "RepeatedFixed64", "RepeatedInt64", "RepeatedFloat", "RepeatedUint64" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestCommentInjectionMessage), global::Google.Protobuf.TestProtos.TestCommentInjectionMessage.Parser, new[]{ "A" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.FooRequest), global::Google.Protobuf.TestProtos.FooRequest.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.FooResponse), global::Google.Protobuf.TestProtos.FooResponse.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.FooClientMessage), global::Google.Protobuf.TestProtos.FooClientMessage.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.FooServerMessage), global::Google.Protobuf.TestProtos.FooServerMessage.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.BarRequest), global::Google.Protobuf.TestProtos.BarRequest.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.BarResponse), global::Google.Protobuf.TestProtos.BarResponse.Parser, null, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestEmptyMessage), global::Google.Protobuf.TestProtos.TestEmptyMessage.Parser, null, 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) }, null, 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, null)}) + 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), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.ForeignMessage), global::Google.Protobuf.TestProtos.ForeignMessage.Parser, new[]{ "C" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestReservedFields), global::Google.Protobuf.TestProtos.TestReservedFields.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestForeignNested), global::Google.Protobuf.TestProtos.TestForeignNested.Parser, new[]{ "ForeignNested" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestReallyLargeTagNumber), global::Google.Protobuf.TestProtos.TestReallyLargeTagNumber.Parser, new[]{ "A", "Bb" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestRecursiveMessage), global::Google.Protobuf.TestProtos.TestRecursiveMessage.Parser, new[]{ "A", "I" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMutualRecursionA), global::Google.Protobuf.TestProtos.TestMutualRecursionA.Parser, new[]{ "Bb" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMutualRecursionB), global::Google.Protobuf.TestProtos.TestMutualRecursionB.Parser, new[]{ "A", "OptionalInt32" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestEnumAllowAlias), global::Google.Protobuf.TestProtos.TestEnumAllowAlias.Parser, new[]{ "Value" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestCamelCaseFieldNames), global::Google.Protobuf.TestProtos.TestCamelCaseFieldNames.Parser, new[]{ "PrimitiveField", "StringField", "EnumField", "MessageField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedEnumField", "RepeatedMessageField" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestFieldOrderings), global::Google.Protobuf.TestProtos.TestFieldOrderings.Parser, new[]{ "MyString", "MyInt", "MyFloat", "SingleNestedMessage" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage), global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage.Parser, new[]{ "Oo", "Bb" }, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.SparseEnumMessage), global::Google.Protobuf.TestProtos.SparseEnumMessage.Parser, new[]{ "SparseEnum" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.OneString), global::Google.Protobuf.TestProtos.OneString.Parser, new[]{ "Data" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.MoreString), global::Google.Protobuf.TestProtos.MoreString.Parser, new[]{ "Data" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.OneBytes), global::Google.Protobuf.TestProtos.OneBytes.Parser, new[]{ "Data" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.MoreBytes), global::Google.Protobuf.TestProtos.MoreBytes.Parser, new[]{ "Data" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Int32Message), global::Google.Protobuf.TestProtos.Int32Message.Parser, new[]{ "Data" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Uint32Message), global::Google.Protobuf.TestProtos.Uint32Message.Parser, new[]{ "Data" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Int64Message), global::Google.Protobuf.TestProtos.Int64Message.Parser, new[]{ "Data" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Uint64Message), global::Google.Protobuf.TestProtos.Uint64Message.Parser, new[]{ "Data" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.BoolMessage), global::Google.Protobuf.TestProtos.BoolMessage.Parser, new[]{ "Data" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestOneof), global::Google.Protobuf.TestProtos.TestOneof.Parser, new[]{ "FooInt", "FooString", "FooMessage" }, new[]{ "Foo" }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestPackedTypes), global::Google.Protobuf.TestProtos.TestPackedTypes.Parser, new[]{ "PackedInt32", "PackedInt64", "PackedUint32", "PackedUint64", "PackedSint32", "PackedSint64", "PackedFixed32", "PackedFixed64", "PackedSfixed32", "PackedSfixed64", "PackedFloat", "PackedDouble", "PackedBool", "PackedEnum" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestUnpackedTypes), global::Google.Protobuf.TestProtos.TestUnpackedTypes.Parser, new[]{ "UnpackedInt32", "UnpackedInt64", "UnpackedUint32", "UnpackedUint64", "UnpackedSint32", "UnpackedSint64", "UnpackedFixed32", "UnpackedFixed64", "UnpackedSfixed32", "UnpackedSfixed64", "UnpackedFloat", "UnpackedDouble", "UnpackedBool", "UnpackedEnum" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestRepeatedScalarDifferentTagSizes), global::Google.Protobuf.TestProtos.TestRepeatedScalarDifferentTagSizes.Parser, new[]{ "RepeatedFixed32", "RepeatedInt32", "RepeatedFixed64", "RepeatedInt64", "RepeatedFloat", "RepeatedUint64" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestCommentInjectionMessage), global::Google.Protobuf.TestProtos.TestCommentInjectionMessage.Parser, new[]{ "A" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.FooRequest), global::Google.Protobuf.TestProtos.FooRequest.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.FooResponse), global::Google.Protobuf.TestProtos.FooResponse.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.FooClientMessage), global::Google.Protobuf.TestProtos.FooClientMessage.Parser, null, null, null, null), + 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.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 diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs index 90b338436bc9..45f8ece64695 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs @@ -163,11 +163,11 @@ public static partial class UnittestWellKnownTypesReflection { "dFByb3Rvc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.ApiReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.FieldMaskReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestWellKnownTypes), global::Google.Protobuf.TestProtos.TestWellKnownTypes.Parser, new[]{ "AnyField", "ApiField", "DurationField", "EmptyField", "FieldMaskField", "SourceContextField", "StructField", "TimestampField", "TypeField", "DoubleField", "FloatField", "Int64Field", "Uint64Field", "Int32Field", "Uint32Field", "BoolField", "StringField", "BytesField", "ValueField" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.RepeatedWellKnownTypes), global::Google.Protobuf.TestProtos.RepeatedWellKnownTypes.Parser, new[]{ "AnyField", "ApiField", "DurationField", "EmptyField", "FieldMaskField", "SourceContextField", "StructField", "TimestampField", "TypeField", "DoubleField", "FloatField", "Int64Field", "Uint64Field", "Int32Field", "Uint32Field", "BoolField", "StringField", "BytesField" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.OneofWellKnownTypes), global::Google.Protobuf.TestProtos.OneofWellKnownTypes.Parser, new[]{ "AnyField", "ApiField", "DurationField", "EmptyField", "FieldMaskField", "SourceContextField", "StructField", "TimestampField", "TypeField", "DoubleField", "FloatField", "Int64Field", "Uint64Field", "Int32Field", "Uint32Field", "BoolField", "StringField", "BytesField" }, new[]{ "OneofField" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.MapWellKnownTypes), global::Google.Protobuf.TestProtos.MapWellKnownTypes.Parser, new[]{ "AnyField", "ApiField", "DurationField", "EmptyField", "FieldMaskField", "SourceContextField", "StructField", "TimestampField", "TypeField", "DoubleField", "FloatField", "Int64Field", "Uint64Field", "Int32Field", "Uint32Field", "BoolField", "StringField", "BytesField" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, }) + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestWellKnownTypes), global::Google.Protobuf.TestProtos.TestWellKnownTypes.Parser, new[]{ "AnyField", "ApiField", "DurationField", "EmptyField", "FieldMaskField", "SourceContextField", "StructField", "TimestampField", "TypeField", "DoubleField", "FloatField", "Int64Field", "Uint64Field", "Int32Field", "Uint32Field", "BoolField", "StringField", "BytesField", "ValueField" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.RepeatedWellKnownTypes), global::Google.Protobuf.TestProtos.RepeatedWellKnownTypes.Parser, new[]{ "AnyField", "ApiField", "DurationField", "EmptyField", "FieldMaskField", "SourceContextField", "StructField", "TimestampField", "TypeField", "DoubleField", "FloatField", "Int64Field", "Uint64Field", "Int32Field", "Uint32Field", "BoolField", "StringField", "BytesField" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.OneofWellKnownTypes), global::Google.Protobuf.TestProtos.OneofWellKnownTypes.Parser, new[]{ "AnyField", "ApiField", "DurationField", "EmptyField", "FieldMaskField", "SourceContextField", "StructField", "TimestampField", "TypeField", "DoubleField", "FloatField", "Int64Field", "Uint64Field", "Int32Field", "Uint32Field", "BoolField", "StringField", "BytesField" }, new[]{ "OneofField" }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.MapWellKnownTypes), global::Google.Protobuf.TestProtos.MapWellKnownTypes.Parser, new[]{ "AnyField", "ApiField", "DurationField", "EmptyField", "FieldMaskField", "SourceContextField", "StructField", "TimestampField", "TypeField", "DoubleField", "FloatField", "Int64Field", "Uint64Field", "Int32Field", "Uint32Field", "BoolField", "StringField", "BytesField" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, }) })); } #endregion @@ -2211,7 +2211,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "any_field" field. public const int AnyFieldFieldNumber = 1; private static readonly pbc::MapField.Codec _map_anyField_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Any.Parser), 10); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Any.Parser), 10); private readonly pbc::MapField anyField_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField AnyField { @@ -2221,7 +2221,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "api_field" field. public const int ApiFieldFieldNumber = 2; private static readonly pbc::MapField.Codec _map_apiField_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Api.Parser), 18); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Api.Parser), 18); private readonly pbc::MapField apiField_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField ApiField { @@ -2231,7 +2231,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "duration_field" field. public const int DurationFieldFieldNumber = 3; private static readonly pbc::MapField.Codec _map_durationField_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Duration.Parser), 26); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Duration.Parser), 26); private readonly pbc::MapField durationField_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField DurationField { @@ -2241,7 +2241,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "empty_field" field. public const int EmptyFieldFieldNumber = 4; private static readonly pbc::MapField.Codec _map_emptyField_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Empty.Parser), 34); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Empty.Parser), 34); private readonly pbc::MapField emptyField_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField EmptyField { @@ -2251,7 +2251,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "field_mask_field" field. public const int FieldMaskFieldFieldNumber = 5; private static readonly pbc::MapField.Codec _map_fieldMaskField_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.FieldMask.Parser), 42); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.FieldMask.Parser), 42); private readonly pbc::MapField fieldMaskField_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField FieldMaskField { @@ -2261,7 +2261,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "source_context_field" field. public const int SourceContextFieldFieldNumber = 6; private static readonly pbc::MapField.Codec _map_sourceContextField_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.SourceContext.Parser), 50); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.SourceContext.Parser), 50); private readonly pbc::MapField sourceContextField_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField SourceContextField { @@ -2271,7 +2271,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "struct_field" field. public const int StructFieldFieldNumber = 7; private static readonly pbc::MapField.Codec _map_structField_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Struct.Parser), 58); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Struct.Parser), 58); private readonly pbc::MapField structField_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField StructField { @@ -2281,7 +2281,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "timestamp_field" field. public const int TimestampFieldFieldNumber = 8; private static readonly pbc::MapField.Codec _map_timestampField_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Timestamp.Parser), 66); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Timestamp.Parser), 66); private readonly pbc::MapField timestampField_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField TimestampField { @@ -2291,7 +2291,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "type_field" field. public const int TypeFieldFieldNumber = 9; private static readonly pbc::MapField.Codec _map_typeField_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Type.Parser), 74); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Type.Parser), 74); private readonly pbc::MapField typeField_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField TypeField { @@ -2301,7 +2301,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "double_field" field. public const int DoubleFieldFieldNumber = 10; private static readonly pbc::MapField.Codec _map_doubleField_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForStructWrapper(18), 82); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper(18), 82); private readonly pbc::MapField doubleField_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField DoubleField { @@ -2311,7 +2311,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "float_field" field. public const int FloatFieldFieldNumber = 11; private static readonly pbc::MapField.Codec _map_floatField_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForStructWrapper(18), 90); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper(18), 90); private readonly pbc::MapField floatField_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField FloatField { @@ -2321,7 +2321,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "int64_field" field. public const int Int64FieldFieldNumber = 12; private static readonly pbc::MapField.Codec _map_int64Field_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForStructWrapper(18), 98); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper(18), 98); private readonly pbc::MapField int64Field_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Int64Field { @@ -2331,7 +2331,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "uint64_field" field. public const int Uint64FieldFieldNumber = 13; private static readonly pbc::MapField.Codec _map_uint64Field_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForStructWrapper(18), 106); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper(18), 106); private readonly pbc::MapField uint64Field_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Uint64Field { @@ -2341,7 +2341,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "int32_field" field. public const int Int32FieldFieldNumber = 14; private static readonly pbc::MapField.Codec _map_int32Field_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForStructWrapper(18), 114); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper(18), 114); private readonly pbc::MapField int32Field_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Int32Field { @@ -2351,7 +2351,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "uint32_field" field. public const int Uint32FieldFieldNumber = 15; private static readonly pbc::MapField.Codec _map_uint32Field_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForStructWrapper(18), 122); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper(18), 122); private readonly pbc::MapField uint32Field_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Uint32Field { @@ -2361,7 +2361,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "bool_field" field. public const int BoolFieldFieldNumber = 16; private static readonly pbc::MapField.Codec _map_boolField_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForStructWrapper(18), 130); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper(18), 130); private readonly pbc::MapField boolField_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField BoolField { @@ -2371,7 +2371,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "string_field" field. public const int StringFieldFieldNumber = 17; private static readonly pbc::MapField.Codec _map_stringField_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForClassWrapper(18), 138); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForClassWrapper(18), 138); private readonly pbc::MapField stringField_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField StringField { @@ -2381,7 +2381,7 @@ public sealed partial class MapWellKnownTypes : pb::IMessage /// Field number for the "bytes_field" field. public const int BytesFieldFieldNumber = 18; private static readonly pbc::MapField.Codec _map_bytesField_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForClassWrapper(18), 146); + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForClassWrapper(18), 146); private readonly pbc::MapField bytesField_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField BytesField { diff --git a/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs b/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs index 57df2ed4a8ab..82e59cdcfa6c 100644 --- a/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs +++ b/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs @@ -30,12 +30,8 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endregion -using Google.Protobuf.Collections; using System; -using System.Collections; using System.Collections.Generic; -using System.Linq; -using System.Reflection; namespace Google.Protobuf.Reflection { @@ -63,13 +59,19 @@ namespace Google.Protobuf.Reflection /// public sealed class CustomOptions { - private static readonly object[] EmptyParameters = new object[0]; - private readonly IDictionary values; + /// + /// Singleton for all descriptors with an empty set of options. + /// + internal static readonly CustomOptions Empty = new CustomOptions(); - internal CustomOptions(IDictionary values) - { - this.values = values; - } + /// + /// A sequence of values per field. This needs to be per field rather than per tag to allow correct deserialization + /// of repeated fields which could be "int, ByteString, int" - unlikely as that is. The fact that values are boxed + /// is unfortunate; we might be able to use a struct instead, and we could combine uint and ulong values. + /// + private readonly Dictionary> valuesByField = new Dictionary>(); + + private CustomOptions() { } /// /// Retrieves a Boolean value for the specified option field. @@ -77,7 +79,12 @@ internal CustomOptions(IDictionary values) /// The field to fetch the value for. /// The output variable to populate. /// true if a suitable value for the field was found; false otherwise. - public bool TryGetBool(int field, out bool value) => TryGetPrimitiveValue(field, out value); + public bool TryGetBool(int field, out bool value) + { + ulong? tmp = GetLastNumericValue(field); + value = tmp == 1UL; + return tmp != null; + } /// /// Retrieves a signed 32-bit integer value for the specified option field. @@ -85,7 +92,12 @@ internal CustomOptions(IDictionary values) /// The field to fetch the value for. /// The output variable to populate. /// true if a suitable value for the field was found; false otherwise. - public bool TryGetInt32(int field, out int value) => TryGetPrimitiveValue(field, out value); + public bool TryGetInt32(int field, out int value) + { + ulong? tmp = GetLastNumericValue(field); + value = (int) tmp.GetValueOrDefault(); + return tmp != null; + } /// /// Retrieves a signed 64-bit integer value for the specified option field. @@ -93,7 +105,12 @@ internal CustomOptions(IDictionary values) /// The field to fetch the value for. /// The output variable to populate. /// true if a suitable value for the field was found; false otherwise. - public bool TryGetInt64(int field, out long value) => TryGetPrimitiveValue(field, out value); + public bool TryGetInt64(int field, out long value) + { + ulong? tmp = GetLastNumericValue(field); + value = (long) tmp.GetValueOrDefault(); + return tmp != null; + } /// /// Retrieves an unsigned 32-bit integer value for the specified option field, @@ -138,7 +155,12 @@ internal CustomOptions(IDictionary values) /// The field to fetch the value for. /// The output variable to populate. /// true if a suitable value for the field was found; false otherwise. - public bool TryGetSInt32(int field, out int value) => TryGetPrimitiveValue(field, out value); + public bool TryGetSInt32(int field, out int value) + { + ulong? tmp = GetLastNumericValue(field); + value = CodedInputStream.DecodeZigZag32((uint) tmp.GetValueOrDefault()); + return tmp != null; + } /// /// Retrieves a signed 64-bit integer value for the specified option field, @@ -147,7 +169,12 @@ internal CustomOptions(IDictionary values) /// The field to fetch the value for. /// The output variable to populate. /// true if a suitable value for the field was found; false otherwise. - public bool TryGetSInt64(int field, out long value) => TryGetPrimitiveValue(field, out value); + public bool TryGetSInt64(int field, out long value) + { + ulong? tmp = GetLastNumericValue(field); + value = CodedInputStream.DecodeZigZag64(tmp.GetValueOrDefault()); + return tmp != null; + } /// /// Retrieves an unsigned 32-bit integer value for the specified option field. @@ -155,7 +182,12 @@ internal CustomOptions(IDictionary values) /// The field to fetch the value for. /// The output variable to populate. /// true if a suitable value for the field was found; false otherwise. - public bool TryGetUInt32(int field, out uint value) => TryGetPrimitiveValue(field, out value); + public bool TryGetUInt32(int field, out uint value) + { + ulong? tmp = GetLastNumericValue(field); + value = (uint) tmp.GetValueOrDefault(); + return tmp != null; + } /// /// Retrieves an unsigned 64-bit integer value for the specified option field. @@ -163,7 +195,12 @@ internal CustomOptions(IDictionary values) /// The field to fetch the value for. /// The output variable to populate. /// true if a suitable value for the field was found; false otherwise. - public bool TryGetUInt64(int field, out ulong value) => TryGetPrimitiveValue(field, out value); + public bool TryGetUInt64(int field, out ulong value) + { + ulong? tmp = GetLastNumericValue(field); + value = tmp.GetValueOrDefault(); + return tmp != null; + } /// /// Retrieves a 32-bit floating point value for the specified option field. @@ -171,7 +208,14 @@ internal CustomOptions(IDictionary values) /// The field to fetch the value for. /// The output variable to populate. /// true if a suitable value for the field was found; false otherwise. - public bool TryGetFloat(int field, out float value) => TryGetPrimitiveValue(field, out value); + public bool TryGetFloat(int field, out float value) + { + ulong? tmp = GetLastNumericValue(field); + int int32 = (int) tmp.GetValueOrDefault(); + byte[] bytes = BitConverter.GetBytes(int32); + value = BitConverter.ToSingle(bytes, 0); + return tmp != null; + } /// /// Retrieves a 64-bit floating point value for the specified option field. @@ -179,7 +223,12 @@ internal CustomOptions(IDictionary values) /// The field to fetch the value for. /// The output variable to populate. /// true if a suitable value for the field was found; false otherwise. - public bool TryGetDouble(int field, out double value) => TryGetPrimitiveValue(field, out value); + public bool TryGetDouble(int field, out double value) + { + ulong? tmp = GetLastNumericValue(field); + value = BitConverter.Int64BitsToDouble((long) tmp.GetValueOrDefault()); + return tmp != null; + } /// /// Retrieves a string value for the specified option field. @@ -187,7 +236,12 @@ internal CustomOptions(IDictionary values) /// The field to fetch the value for. /// The output variable to populate. /// true if a suitable value for the field was found; false otherwise. - public bool TryGetString(int field, out string value) => TryGetPrimitiveValue(field, out value); + public bool TryGetString(int field, out string value) + { + ByteString bytes = GetLastByteStringValue(field); + value = bytes?.ToStringUtf8(); + return bytes != null; + } /// /// Retrieves a bytes value for the specified option field. @@ -195,7 +249,12 @@ internal CustomOptions(IDictionary values) /// The field to fetch the value for. /// The output variable to populate. /// true if a suitable value for the field was found; false otherwise. - public bool TryGetBytes(int field, out ByteString value) => TryGetPrimitiveValue(field, out value); + public bool TryGetBytes(int field, out ByteString value) + { + ByteString bytes = GetLastByteStringValue(field); + value = bytes; + return bytes != null; + } /// /// Retrieves a message value for the specified option field. @@ -205,106 +264,127 @@ internal CustomOptions(IDictionary values) /// true if a suitable value for the field was found; false otherwise. public bool TryGetMessage(int field, out T value) where T : class, IMessage, new() { - if (values == null) + value = null; + List values; + if (!valuesByField.TryGetValue(field, out values)) { - value = default(T); return false; } + foreach (FieldValue fieldValue in values) + { + if (fieldValue.ByteString != null) + { + if (value == null) + { + value = new T(); + } + value.MergeFrom(fieldValue.ByteString); + } + } + return value != null; + } - IExtensionValue extensionValue; - if (values.TryGetValue(field, out extensionValue)) + private ulong? GetLastNumericValue(int field) + { + List values; + if (!valuesByField.TryGetValue(field, out values)) { - if (extensionValue is ExtensionValue) + return null; + } + for (int i = values.Count - 1; i >= 0; i--) + { + // A non-bytestring value is a numeric value + if (values[i].ByteString == null) { - ExtensionValue single = extensionValue as ExtensionValue; - ByteString bytes = single.GetValue().ToByteString(); - value = new T(); - value.MergeFrom(bytes); - return true; + return values[i].Number; } - else if (extensionValue is RepeatedExtensionValue) + } + return null; + } + + private ByteString GetLastByteStringValue(int field) + { + List values; + if (!valuesByField.TryGetValue(field, out values)) + { + return null; + } + for (int i = values.Count - 1; i >= 0; i--) + { + if (values[i].ByteString != null) { - RepeatedExtensionValue repeated = extensionValue as RepeatedExtensionValue; - value = repeated.GetValue() - .Select(v => v.ToByteString()) - .Aggregate(new T(), (t, b) => - { - t.MergeFrom(b); - return t; - }); - return true; + return values[i].ByteString; } } + return null; + } - value = null; - return false; + /// + /// Reads an unknown field, either parsing it and storing it or skipping it. + /// + /// + /// If the current set of options is empty and we manage to read a field, a new set of options + /// will be created and returned. Otherwise, the return value is this. This allows + /// us to start with a singleton empty set of options and just create new ones where necessary. + /// + /// Input stream to read from. + /// The resulting set of custom options, either this or a new set. + internal CustomOptions ReadOrSkipUnknownField(CodedInputStream input) + { + var tag = input.LastTag; + var field = WireFormat.GetTagFieldNumber(tag); + switch (WireFormat.GetTagWireType(tag)) + { + case WireFormat.WireType.LengthDelimited: + return AddValue(field, new FieldValue(input.ReadBytes())); + case WireFormat.WireType.Fixed32: + return AddValue(field, new FieldValue(input.ReadFixed32())); + case WireFormat.WireType.Fixed64: + return AddValue(field, new FieldValue(input.ReadFixed64())); + case WireFormat.WireType.Varint: + return AddValue(field, new FieldValue(input.ReadRawVarint64())); + // For StartGroup, EndGroup or any wire format we don't understand, + // just use the normal behavior (call SkipLastField). + default: + input.SkipLastField(); + return this; + } } - private bool TryGetPrimitiveValue(int field, out T value) + private CustomOptions AddValue(int field, FieldValue value) { - if (values == null) + var ret = valuesByField.Count == 0 ? new CustomOptions() : this; + List valuesForField; + if (!ret.valuesByField.TryGetValue(field, out valuesForField)) { - value = default(T); - return false; + // Expect almost all + valuesForField = new List(1); + ret.valuesByField[field] = valuesForField; } + valuesForField.Add(value); + return ret; + } + + /// + /// All field values can be stored as a byte string or a 64-bit integer. + /// This struct avoids unnecessary boxing. + /// + private struct FieldValue + { + internal ulong Number { get; } + internal ByteString ByteString { get; } - IExtensionValue extensionValue; - if (values.TryGetValue(field, out extensionValue)) + internal FieldValue(ulong number) { - if (extensionValue is ExtensionValue) - { - ExtensionValue single = extensionValue as ExtensionValue; - if (single.HasValue) - { - value = single.GetValue(); - return true; - } - } - else if (extensionValue is RepeatedExtensionValue) - { - RepeatedExtensionValue repeated = extensionValue as RepeatedExtensionValue; - if (repeated.GetValue().Count != 0) - { - RepeatedField repeatedField = repeated.GetValue(); - value = repeatedField[repeatedField.Count - 1]; - return true; - } - } - else // and here we find explicit enum handling since T : Enum ! x is ExtensionValue - { - var type = extensionValue.GetType(); - if (type.GetGenericTypeDefinition() == typeof(ExtensionValue<>)) - { - var typeInfo = type.GetTypeInfo(); - var typeArgs = typeInfo.GenericTypeArguments; - if (typeArgs.Length == 1 && typeArgs[0].GetTypeInfo().IsEnum) - { - if ((bool)typeInfo.GetDeclaredProperty(nameof(ExtensionValue.HasValue)).GetValue(extensionValue)) - { - value = (T)typeInfo.GetDeclaredMethod(nameof(ExtensionValue.GetValue)).Invoke(extensionValue, EmptyParameters); - return true; - } - } - } - else if (type.GetGenericTypeDefinition() == typeof(RepeatedExtensionValue<>)) - { - var typeInfo = type.GetTypeInfo(); - var typeArgs = typeInfo.GenericTypeArguments; - if (typeArgs.Length == 1 && typeArgs[0].GetTypeInfo().IsEnum) - { - var values = (IList)typeInfo.GetDeclaredMethod(nameof(RepeatedExtensionValue.GetValue)).Invoke(extensionValue, EmptyParameters); - if (values.Count != 0) - { - value = (T)values[values.Count - 1]; - return true; - } - } - } - } + Number = number; + ByteString = null; } - value = default(T); - return false; + internal FieldValue(ByteString byteString) + { + Number = 0; + ByteString = byteString; + } } } } diff --git a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs index 162f17512e62..b5620ba57f14 100644 --- a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs @@ -160,29 +160,29 @@ internal static partial class DescriptorReflection { "AQGiAgNHUEKqAhpHb29nbGUuUHJvdG9idWYuUmVmbGVjdGlvbg==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileDescriptorSet), global::Google.Protobuf.Reflection.FileDescriptorSet.Parser, new[]{ "File" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileDescriptorProto), global::Google.Protobuf.Reflection.FileDescriptorProto.Parser, new[]{ "Name", "Package", "Dependency", "PublicDependency", "WeakDependency", "MessageType", "EnumType", "Service", "Extension", "Options", "SourceCodeInfo", "Syntax" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto), global::Google.Protobuf.Reflection.DescriptorProto.Parser, new[]{ "Name", "Field", "Extension", "NestedType", "EnumType", "ExtensionRange", "OneofDecl", "Options", "ReservedRange", "ReservedName" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange), global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange.Parser, new[]{ "Start", "End", "Options" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange), global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange.Parser, new[]{ "Start", "End" }, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ExtensionRangeOptions), global::Google.Protobuf.Reflection.ExtensionRangeOptions.Parser, new[]{ "UninterpretedOption" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto), global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser, new[]{ "Name", "Number", "Label", "Type", "TypeName", "Extendee", "DefaultValue", "OneofIndex", "JsonName", "Options" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type), typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label) }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.OneofDescriptorProto), global::Google.Protobuf.Reflection.OneofDescriptorProto.Parser, new[]{ "Name", "Options" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto), global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser, new[]{ "Name", "Value", "Options", "ReservedRange", "ReservedName" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto.Types.EnumReservedRange), global::Google.Protobuf.Reflection.EnumDescriptorProto.Types.EnumReservedRange.Parser, new[]{ "Start", "End" }, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueDescriptorProto), global::Google.Protobuf.Reflection.EnumValueDescriptorProto.Parser, new[]{ "Name", "Number", "Options" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ServiceDescriptorProto), global::Google.Protobuf.Reflection.ServiceDescriptorProto.Parser, new[]{ "Name", "Method", "Options" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodDescriptorProto), global::Google.Protobuf.Reflection.MethodDescriptorProto.Parser, new[]{ "Name", "InputType", "OutputType", "Options", "ClientStreaming", "ServerStreaming" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileOptions), global::Google.Protobuf.Reflection.FileOptions.Parser, new[]{ "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "JavaStringCheckUtf8", "OptimizeFor", "GoPackage", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "PhpGenericServices", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "SwiftPrefix", "PhpClassPrefix", "PhpNamespace", "PhpMetadataNamespace", "RubyPackage", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MessageOptions), global::Google.Protobuf.Reflection.MessageOptions.Parser, new[]{ "MessageSetWireFormat", "NoStandardDescriptorAccessor", "Deprecated", "MapEntry", "UninterpretedOption" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FieldOptions), global::Google.Protobuf.Reflection.FieldOptions.Parser, new[]{ "Ctype", "Packed", "Jstype", "Lazy", "Deprecated", "Weak", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.CType), typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.OneofOptions), global::Google.Protobuf.Reflection.OneofOptions.Parser, new[]{ "UninterpretedOption" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumOptions), global::Google.Protobuf.Reflection.EnumOptions.Parser, new[]{ "AllowAlias", "Deprecated", "UninterpretedOption" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueOptions), global::Google.Protobuf.Reflection.EnumValueOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ServiceOptions), global::Google.Protobuf.Reflection.ServiceOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodOptions), global::Google.Protobuf.Reflection.MethodOptions.Parser, new[]{ "Deprecated", "IdempotencyLevel", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel) }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption), global::Google.Protobuf.Reflection.UninterpretedOption.Parser, new[]{ "Name", "IdentifierValue", "PositiveIntValue", "NegativeIntValue", "DoubleValue", "StringValue", "AggregateValue" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart), global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart.Parser, new[]{ "NamePart_", "IsExtension" }, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo), global::Google.Protobuf.Reflection.SourceCodeInfo.Parser, new[]{ "Location" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location), global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location.Parser, new[]{ "Path", "Span", "LeadingComments", "TrailingComments", "LeadingDetachedComments" }, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.GeneratedCodeInfo), global::Google.Protobuf.Reflection.GeneratedCodeInfo.Parser, new[]{ "Annotation" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation), global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation.Parser, new[]{ "Path", "SourceFile", "Begin", "End" }, null, null, null, null)}) + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileDescriptorSet), global::Google.Protobuf.Reflection.FileDescriptorSet.Parser, new[]{ "File" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileDescriptorProto), global::Google.Protobuf.Reflection.FileDescriptorProto.Parser, new[]{ "Name", "Package", "Dependency", "PublicDependency", "WeakDependency", "MessageType", "EnumType", "Service", "Extension", "Options", "SourceCodeInfo", "Syntax" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto), global::Google.Protobuf.Reflection.DescriptorProto.Parser, new[]{ "Name", "Field", "Extension", "NestedType", "EnumType", "ExtensionRange", "OneofDecl", "Options", "ReservedRange", "ReservedName" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange), global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange.Parser, new[]{ "Start", "End", "Options" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange), global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange.Parser, new[]{ "Start", "End" }, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ExtensionRangeOptions), global::Google.Protobuf.Reflection.ExtensionRangeOptions.Parser, new[]{ "UninterpretedOption" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto), global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser, new[]{ "Name", "Number", "Label", "Type", "TypeName", "Extendee", "DefaultValue", "OneofIndex", "JsonName", "Options" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type), typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label) }, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.OneofDescriptorProto), global::Google.Protobuf.Reflection.OneofDescriptorProto.Parser, new[]{ "Name", "Options" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto), global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser, new[]{ "Name", "Value", "Options", "ReservedRange", "ReservedName" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto.Types.EnumReservedRange), global::Google.Protobuf.Reflection.EnumDescriptorProto.Types.EnumReservedRange.Parser, new[]{ "Start", "End" }, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueDescriptorProto), global::Google.Protobuf.Reflection.EnumValueDescriptorProto.Parser, new[]{ "Name", "Number", "Options" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ServiceDescriptorProto), global::Google.Protobuf.Reflection.ServiceDescriptorProto.Parser, new[]{ "Name", "Method", "Options" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodDescriptorProto), global::Google.Protobuf.Reflection.MethodDescriptorProto.Parser, new[]{ "Name", "InputType", "OutputType", "Options", "ClientStreaming", "ServerStreaming" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileOptions), global::Google.Protobuf.Reflection.FileOptions.Parser, new[]{ "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "JavaStringCheckUtf8", "OptimizeFor", "GoPackage", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "PhpGenericServices", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "SwiftPrefix", "PhpClassPrefix", "PhpNamespace", "PhpMetadataNamespace", "RubyPackage", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) }, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MessageOptions), global::Google.Protobuf.Reflection.MessageOptions.Parser, new[]{ "MessageSetWireFormat", "NoStandardDescriptorAccessor", "Deprecated", "MapEntry", "UninterpretedOption" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FieldOptions), global::Google.Protobuf.Reflection.FieldOptions.Parser, new[]{ "Ctype", "Packed", "Jstype", "Lazy", "Deprecated", "Weak", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.CType), typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) }, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.OneofOptions), global::Google.Protobuf.Reflection.OneofOptions.Parser, new[]{ "UninterpretedOption" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumOptions), global::Google.Protobuf.Reflection.EnumOptions.Parser, new[]{ "AllowAlias", "Deprecated", "UninterpretedOption" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueOptions), global::Google.Protobuf.Reflection.EnumValueOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ServiceOptions), global::Google.Protobuf.Reflection.ServiceOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodOptions), global::Google.Protobuf.Reflection.MethodOptions.Parser, new[]{ "Deprecated", "IdempotencyLevel", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel) }, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption), global::Google.Protobuf.Reflection.UninterpretedOption.Parser, new[]{ "Name", "IdentifierValue", "PositiveIntValue", "NegativeIntValue", "DoubleValue", "StringValue", "AggregateValue" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart), global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart.Parser, new[]{ "NamePart_", "IsExtension" }, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo), global::Google.Protobuf.Reflection.SourceCodeInfo.Parser, new[]{ "Location" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location), global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location.Parser, new[]{ "Path", "Span", "LeadingComments", "TrailingComments", "LeadingDetachedComments" }, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.GeneratedCodeInfo), global::Google.Protobuf.Reflection.GeneratedCodeInfo.Parser, new[]{ "Annotation" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation), global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation.Parser, new[]{ "Path", "SourceFile", "Begin", "End" }, null, null, null)}) })); } #endregion @@ -1587,10 +1587,9 @@ internal sealed partial class ReservedRange : pb::IMessage { } - internal sealed partial class ExtensionRangeOptions : pb::IExtendableMessage { + internal sealed partial class ExtensionRangeOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExtensionRangeOptions()); private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -1615,7 +1614,6 @@ internal sealed partial class ExtensionRangeOptions : pb::IExtendableMessage(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrRegisterExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrRegister(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - } /// @@ -3815,10 +3776,9 @@ internal sealed partial class MethodDescriptorProto : pb::IMessage { + internal sealed partial class FileOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileOptions()); private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -3833,6 +3793,8 @@ internal sealed partial class FileOptions : pb::IExtendableMessage get { return Descriptor; } } + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FileOptions() { OnConstruction(); @@ -3865,7 +3827,6 @@ internal sealed partial class FileOptions : pb::IExtendableMessage rubyPackage_ = other.rubyPackage_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - _extensions = pb::ExtensionSet.Clone(other._extensions); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4487,9 +4448,6 @@ internal sealed partial class FileOptions : pb::IExtendableMessage if (PhpMetadataNamespace != other.PhpMetadataNamespace) return false; if (RubyPackage != other.RubyPackage) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - if (!Equals(_extensions, other._extensions)) { - return false; - } return Equals(_unknownFields, other._unknownFields); } @@ -4517,9 +4475,6 @@ internal sealed partial class FileOptions : pb::IExtendableMessage if (HasPhpMetadataNamespace) hash ^= PhpMetadataNamespace.GetHashCode(); if (HasRubyPackage) hash ^= RubyPackage.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); - if (_extensions != null) { - hash ^= _extensions.GetHashCode(); - } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -4614,9 +4569,6 @@ internal sealed partial class FileOptions : pb::IExtendableMessage output.WriteString(RubyPackage); } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(output); - } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -4686,9 +4638,6 @@ internal sealed partial class FileOptions : pb::IExtendableMessage size += 2 + pb::CodedOutputStream.ComputeStringSize(RubyPackage); } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); - if (_extensions != null) { - size += _extensions.CalculateSize(); - } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -4761,7 +4710,6 @@ internal sealed partial class FileOptions : pb::IExtendableMessage RubyPackage = other.RubyPackage; } uninterpretedOption_.Add(other.uninterpretedOption_); - pb::ExtensionSet.MergeFrom(ref _extensions, other._extensions); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -4771,9 +4719,7 @@ internal sealed partial class FileOptions : pb::IExtendableMessage while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - } + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 10: { JavaPackage = input.ReadString(); @@ -4863,28 +4809,6 @@ internal sealed partial class FileOptions : pb::IExtendableMessage } } - public TValue GetExtension(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrRegisterExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrRegister(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - #region Nested types /// Container for nested types declared in the FileOptions message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4912,10 +4836,9 @@ internal enum OptimizeMode { } - internal sealed partial class MessageOptions : pb::IExtendableMessage { + internal sealed partial class MessageOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MessageOptions()); private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -4930,6 +4853,8 @@ internal sealed partial class MessageOptions : pb::IExtendableMessage(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrRegisterExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrRegister(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - } - internal sealed partial class FieldOptions : pb::IExtendableMessage { + internal sealed partial class FieldOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FieldOptions()); private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -5313,6 +5199,8 @@ internal sealed partial class FieldOptions : pb::IExtendableMessage(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrRegisterExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrRegister(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - #region Nested types /// Container for nested types declared in the FieldOptions message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5801,10 +5651,9 @@ internal enum JSType { } - internal sealed partial class OneofOptions : pb::IExtendableMessage { + internal sealed partial class OneofOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneofOptions()); private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -5818,6 +5667,8 @@ internal sealed partial class OneofOptions : pb::IExtendableMessage(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrRegisterExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrRegister(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - } - internal sealed partial class EnumOptions : pb::IExtendableMessage { + internal sealed partial class EnumOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumOptions()); private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -5982,6 +5794,8 @@ internal sealed partial class EnumOptions : pb::IExtendableMessage get { return Descriptor; } } + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumOptions() { OnConstruction(); @@ -5996,7 +5810,6 @@ internal sealed partial class EnumOptions : pb::IExtendableMessage deprecated_ = other.deprecated_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - _extensions = pb::ExtensionSet.Clone(other._extensions); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6091,9 +5904,6 @@ internal sealed partial class EnumOptions : pb::IExtendableMessage if (AllowAlias != other.AllowAlias) return false; if (Deprecated != other.Deprecated) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - if (!Equals(_extensions, other._extensions)) { - return false; - } return Equals(_unknownFields, other._unknownFields); } @@ -6103,9 +5913,6 @@ internal sealed partial class EnumOptions : pb::IExtendableMessage if (HasAllowAlias) hash ^= AllowAlias.GetHashCode(); if (HasDeprecated) hash ^= Deprecated.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); - if (_extensions != null) { - hash ^= _extensions.GetHashCode(); - } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -6128,9 +5935,6 @@ internal sealed partial class EnumOptions : pb::IExtendableMessage output.WriteBool(Deprecated); } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(output); - } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -6146,9 +5950,6 @@ internal sealed partial class EnumOptions : pb::IExtendableMessage size += 1 + 1; } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); - if (_extensions != null) { - size += _extensions.CalculateSize(); - } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -6167,7 +5968,6 @@ internal sealed partial class EnumOptions : pb::IExtendableMessage Deprecated = other.Deprecated; } uninterpretedOption_.Add(other.uninterpretedOption_); - pb::ExtensionSet.MergeFrom(ref _extensions, other._extensions); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -6177,9 +5977,7 @@ internal sealed partial class EnumOptions : pb::IExtendableMessage while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - } + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 16: { AllowAlias = input.ReadBool(); @@ -6197,34 +5995,11 @@ internal sealed partial class EnumOptions : pb::IExtendableMessage } } - public TValue GetExtension(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrRegisterExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrRegister(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - } - internal sealed partial class EnumValueOptions : pb::IExtendableMessage { + internal sealed partial class EnumValueOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumValueOptions()); private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -6239,6 +6014,8 @@ internal sealed partial class EnumValueOptions : pb::IExtendableMessage(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrRegisterExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrRegister(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - } - internal sealed partial class ServiceOptions : pb::IExtendableMessage { + internal sealed partial class ServiceOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServiceOptions()); private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -6451,6 +6189,8 @@ internal sealed partial class ServiceOptions : pb::IExtendableMessage(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrRegisterExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrRegister(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - } - internal sealed partial class MethodOptions : pb::IExtendableMessage { + internal sealed partial class MethodOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MethodOptions()); private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } @@ -6663,6 +6364,8 @@ internal sealed partial class MethodOptions : pb::IExtendableMessage(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrRegisterExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrRegister(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - #region Nested types /// Container for nested types declared in the MethodOptions message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] diff --git a/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs index 36a1d0a5ecd9..253c2c9456fb 100644 --- a/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs @@ -129,7 +129,7 @@ public EnumValueDescriptor FindValueByName(string name) /// The (possibly empty) set of custom options for this enum. /// //[Obsolete("CustomOptions are obsolete. Use GetOption")] - public CustomOptions CustomOptions => new CustomOptions(Proto.Options._extensions?.ValuesByNumber); + public CustomOptions CustomOptions => Proto.Options.CustomOptions; /* // uncomment this in the full proto2 support PR /// diff --git a/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs index 99c989130c8e..d8c4cae8be88 100644 --- a/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs @@ -74,7 +74,7 @@ public sealed class EnumValueDescriptor : DescriptorBase /// The (possibly empty) set of custom options for this enum value. /// //[Obsolete("CustomOptions are obsolete. Use GetOption")] - public CustomOptions CustomOptions => new CustomOptions(Proto.Options._extensions?.ValuesByNumber); + public CustomOptions CustomOptions => Proto.Options.CustomOptions; /* // uncomment this in the full proto2 support PR /// diff --git a/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs index 5a2f7f3d8e1f..f8297f73294e 100644 --- a/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs @@ -278,7 +278,7 @@ public MessageDescriptor ExtendeeType /// The (possibly empty) set of custom options for this field. /// //[Obsolete("CustomOptions are obsolete. Use GetOption")] - public CustomOptions CustomOptions => new CustomOptions(Proto.Options._extensions?.ValuesByNumber); + public CustomOptions CustomOptions => Proto.Options.CustomOptions; /* // uncomment this in the full proto2 support PR /// diff --git a/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs index 9b20e3d22ad6..9d449a999d53 100644 --- a/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs @@ -505,7 +505,7 @@ public override string ToString() /// The (possibly empty) set of custom options for this file. /// //[Obsolete("CustomOptions are obsolete. Use GetOption")] - public CustomOptions CustomOptions => new CustomOptions(Proto.Options._extensions?.ValuesByNumber); + public CustomOptions CustomOptions => Proto.Options.CustomOptions; /* // uncomment this in the full proto2 support PR /// diff --git a/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs index 15bfbfadd04e..aeaafd0fcd39 100644 --- a/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs @@ -244,7 +244,7 @@ internal override IReadOnlyList GetNestedDescriptorListForField( /// The (possibly empty) set of custom options for this message. /// //[Obsolete("CustomOptions are obsolete. Use GetOption")] - public CustomOptions CustomOptions => new CustomOptions(Proto.Options._extensions?.ValuesByNumber); + public CustomOptions CustomOptions => Proto.Options.CustomOptions; /* // uncomment this in the full proto2 support PR /// diff --git a/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs index 1b37d9b17226..d18e700ac696 100644 --- a/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs @@ -74,7 +74,7 @@ public sealed class MethodDescriptor : DescriptorBase /// The (possibly empty) set of custom options for this method. /// //[Obsolete("CustomOptions are obsolete. Use GetOption")] - public CustomOptions CustomOptions => new CustomOptions(Proto.Options._extensions?.ValuesByNumber); + public CustomOptions CustomOptions => Proto.Options.CustomOptions; /* // uncomment this in the full proto2 support PR /// diff --git a/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs index 9f3d805d05bd..d811b5c8a508 100644 --- a/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs @@ -106,7 +106,7 @@ public MessageDescriptor ContainingType /// The (possibly empty) set of custom options for this oneof. /// //[Obsolete("CustomOptions are obsolete. Use GetOption")] - public CustomOptions CustomOptions => new CustomOptions(proto.Options._extensions?.ValuesByNumber); + public CustomOptions CustomOptions => proto.Options.CustomOptions; /* // uncomment this in the full proto2 support PR /// diff --git a/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs index 54f4df7298a0..848fe0917139 100644 --- a/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs @@ -95,7 +95,7 @@ public MethodDescriptor FindMethodByName(String name) /// The (possibly empty) set of custom options for this service. /// //[Obsolete("CustomOptions are obsolete. Use GetOption")] - public CustomOptions CustomOptions => new CustomOptions(Proto.Options._extensions?.ValuesByNumber); + public CustomOptions CustomOptions => Proto.Options.CustomOptions; /* // uncomment this in the full proto2 support PR /// diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs index 09e0e29f0de9..dd9911067ed9 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs @@ -31,8 +31,8 @@ public static partial class AnyReflection { "dWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Any), global::Google.Protobuf.WellKnownTypes.Any.Parser, new[]{ "TypeUrl", "Value" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Any), global::Google.Protobuf.WellKnownTypes.Any.Parser, new[]{ "TypeUrl", "Value" }, null, null, null) })); } #endregion diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs index 06a990591940..f66502b2bc36 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs @@ -43,10 +43,10 @@ public static partial class ApiReflection { "cm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Api), global::Google.Protobuf.WellKnownTypes.Api.Parser, new[]{ "Name", "Methods", "Options", "Version", "SourceContext", "Mixins", "Syntax" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Method), global::Google.Protobuf.WellKnownTypes.Method.Parser, new[]{ "Name", "RequestTypeUrl", "RequestStreaming", "ResponseTypeUrl", "ResponseStreaming", "Options", "Syntax" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Mixin), global::Google.Protobuf.WellKnownTypes.Mixin.Parser, new[]{ "Name", "Root" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Api), global::Google.Protobuf.WellKnownTypes.Api.Parser, new[]{ "Name", "Methods", "Options", "Version", "SourceContext", "Mixins", "Syntax" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Method), global::Google.Protobuf.WellKnownTypes.Method.Parser, new[]{ "Name", "RequestTypeUrl", "RequestStreaming", "ResponseTypeUrl", "ResponseStreaming", "Options", "Syntax" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Mixin), global::Google.Protobuf.WellKnownTypes.Mixin.Parser, new[]{ "Name", "Root" }, null, null, null) })); } #endregion diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs index f0078c4dd4e0..2521c9a890e1 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs @@ -32,8 +32,8 @@ public static partial class DurationReflection { "bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Duration), global::Google.Protobuf.WellKnownTypes.Duration.Parser, new[]{ "Seconds", "Nanos" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Duration), global::Google.Protobuf.WellKnownTypes.Duration.Parser, new[]{ "Seconds", "Nanos" }, null, null, null) })); } #endregion diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs index fa435cd23edf..2113add9bca1 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs @@ -31,8 +31,8 @@ public static partial class EmptyReflection { "dG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Empty), global::Google.Protobuf.WellKnownTypes.Empty.Parser, null, null, null, null, null) + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Empty), global::Google.Protobuf.WellKnownTypes.Empty.Parser, null, null, null, null) })); } #endregion diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs index 0bbf31397162..6ad31a50eacc 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs @@ -32,8 +32,8 @@ public static partial class FieldMaskReflection { "cm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.FieldMask), global::Google.Protobuf.WellKnownTypes.FieldMask.Parser, new[]{ "Paths" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.FieldMask), global::Google.Protobuf.WellKnownTypes.FieldMask.Parser, new[]{ "Paths" }, null, null, null) })); } #endregion diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs index d7076196e0fd..124ddaa71234 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs @@ -32,8 +32,8 @@ public static partial class SourceContextReflection { "YnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.SourceContext), global::Google.Protobuf.WellKnownTypes.SourceContext.Parser, new[]{ "FileName" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.SourceContext), global::Google.Protobuf.WellKnownTypes.SourceContext.Parser, new[]{ "FileName" }, null, null, null) })); } #endregion diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs index b1dbe239cc9c..beb19cfe09c7 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs @@ -41,10 +41,10 @@ public static partial class StructReflection { "cGVzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.WellKnownTypes.NullValue), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Struct), global::Google.Protobuf.WellKnownTypes.Struct.Parser, new[]{ "Fields" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Value), global::Google.Protobuf.WellKnownTypes.Value.Parser, new[]{ "NullValue", "NumberValue", "StringValue", "BoolValue", "StructValue", "ListValue" }, new[]{ "Kind" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.ListValue), global::Google.Protobuf.WellKnownTypes.ListValue.Parser, new[]{ "Values" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.WellKnownTypes.NullValue), }, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Struct), global::Google.Protobuf.WellKnownTypes.Struct.Parser, new[]{ "Fields" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Value), global::Google.Protobuf.WellKnownTypes.Value.Parser, new[]{ "NullValue", "NumberValue", "StringValue", "BoolValue", "StructValue", "ListValue" }, new[]{ "Kind" }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.ListValue), global::Google.Protobuf.WellKnownTypes.ListValue.Parser, new[]{ "Values" }, null, null, null) })); } #endregion @@ -114,7 +114,7 @@ public sealed partial class Struct : pb::IMessage { /// Field number for the "fields" field. public const int FieldsFieldNumber = 1; private static readonly pbc::MapField.Codec _map_fields_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Value.Parser), 10); + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Value.Parser), 10); private readonly pbc::MapField fields_ = new pbc::MapField(); /// /// Unordered map of dynamically typed values. diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs index 12f4812af37f..9df237cfc0dd 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs @@ -32,8 +32,8 @@ public static partial class TimestampReflection { "cHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Timestamp), global::Google.Protobuf.WellKnownTypes.Timestamp.Parser, new[]{ "Seconds", "Nanos" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Timestamp), global::Google.Protobuf.WellKnownTypes.Timestamp.Parser, new[]{ "Seconds", "Nanos" }, null, null, null) })); } #endregion diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs index bfd4b8ec8221..bef4a82c89b8 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs @@ -62,12 +62,12 @@ public static partial class TypeReflection { "bEtub3duVHlwZXNiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.WellKnownTypes.Syntax), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Type), global::Google.Protobuf.WellKnownTypes.Type.Parser, new[]{ "Name", "Fields", "Oneofs", "Options", "SourceContext", "Syntax" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Field), global::Google.Protobuf.WellKnownTypes.Field.Parser, new[]{ "Kind", "Cardinality", "Number", "Name", "TypeUrl", "OneofIndex", "Packed", "Options", "JsonName", "DefaultValue" }, null, new[]{ typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Kind), typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality) }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Enum), global::Google.Protobuf.WellKnownTypes.Enum.Parser, new[]{ "Name", "Enumvalue", "Options", "SourceContext", "Syntax" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.EnumValue), global::Google.Protobuf.WellKnownTypes.EnumValue.Parser, new[]{ "Name", "Number", "Options" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Option), global::Google.Protobuf.WellKnownTypes.Option.Parser, new[]{ "Name", "Value" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.WellKnownTypes.Syntax), }, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Type), global::Google.Protobuf.WellKnownTypes.Type.Parser, new[]{ "Name", "Fields", "Oneofs", "Options", "SourceContext", "Syntax" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Field), global::Google.Protobuf.WellKnownTypes.Field.Parser, new[]{ "Kind", "Cardinality", "Number", "Name", "TypeUrl", "OneofIndex", "Packed", "Options", "JsonName", "DefaultValue" }, null, new[]{ typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Kind), typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality) }, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Enum), global::Google.Protobuf.WellKnownTypes.Enum.Parser, new[]{ "Name", "Enumvalue", "Options", "SourceContext", "Syntax" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.EnumValue), global::Google.Protobuf.WellKnownTypes.EnumValue.Parser, new[]{ "Name", "Number", "Options" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Option), global::Google.Protobuf.WellKnownTypes.Option.Parser, new[]{ "Name", "Value" }, null, null, null) })); } #endregion diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs index 556af3c931b6..25a65aa72c98 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs @@ -36,16 +36,16 @@ public static partial class WrappersReflection { "QqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.DoubleValue), global::Google.Protobuf.WellKnownTypes.DoubleValue.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.FloatValue), global::Google.Protobuf.WellKnownTypes.FloatValue.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Int64Value), global::Google.Protobuf.WellKnownTypes.Int64Value.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.UInt64Value), global::Google.Protobuf.WellKnownTypes.UInt64Value.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Int32Value), global::Google.Protobuf.WellKnownTypes.Int32Value.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.UInt32Value), global::Google.Protobuf.WellKnownTypes.UInt32Value.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.BoolValue), global::Google.Protobuf.WellKnownTypes.BoolValue.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.StringValue), global::Google.Protobuf.WellKnownTypes.StringValue.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.BytesValue), global::Google.Protobuf.WellKnownTypes.BytesValue.Parser, new[]{ "Value" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.DoubleValue), global::Google.Protobuf.WellKnownTypes.DoubleValue.Parser, new[]{ "Value" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.FloatValue), global::Google.Protobuf.WellKnownTypes.FloatValue.Parser, new[]{ "Value" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Int64Value), global::Google.Protobuf.WellKnownTypes.Int64Value.Parser, new[]{ "Value" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.UInt64Value), global::Google.Protobuf.WellKnownTypes.UInt64Value.Parser, new[]{ "Value" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Int32Value), global::Google.Protobuf.WellKnownTypes.Int32Value.Parser, new[]{ "Value" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.UInt32Value), global::Google.Protobuf.WellKnownTypes.UInt32Value.Parser, new[]{ "Value" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.BoolValue), global::Google.Protobuf.WellKnownTypes.BoolValue.Parser, new[]{ "Value" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.StringValue), global::Google.Protobuf.WellKnownTypes.StringValue.Parser, new[]{ "Value" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.BytesValue), global::Google.Protobuf.WellKnownTypes.BytesValue.Parser, new[]{ "Value" }, null, null, null) })); } #endregion diff --git a/src/google/protobuf/compiler/csharp/csharp_enum_field.cc b/src/google/protobuf/compiler/csharp/csharp_enum_field.cc index 186fa27e5b36..4d9bb67224c1 100644 --- a/src/google/protobuf/compiler/csharp/csharp_enum_field.cc +++ b/src/google/protobuf/compiler/csharp/csharp_enum_field.cc @@ -36,7 +36,6 @@ #include #include -#include #include #include #include @@ -76,20 +75,9 @@ void EnumFieldGenerator::GenerateSerializedSizeCode(io::Printer* printer) { } void EnumFieldGenerator::GenerateCodecCode(io::Printer* printer) { - printer->Print( - variables_, - "pb::FieldCodec.ForEnum($tag$, x => (int) x, x => ($type_name$) x, $default_value$)"); -} - -void EnumFieldGenerator::GenerateExtensionCode(io::Printer* printer) { - WritePropertyDocComment(printer, descriptor_); - AddDeprecatedFlag(printer); - printer->Print( - variables_, - "$access_level$ static readonly pb::Extension<$extended_type$, $type_name$> $property_name$ =\n" - " new pb::Extension<$extended_type$, $type_name$>($number$, "); - GenerateCodecCode(printer); - printer->Print(");\n"); + printer->Print( + variables_, + "pb::FieldCodec.ForEnum($tag$, x => (int) x, x => ($type_name$) x)"); } EnumOneofFieldGenerator::EnumOneofFieldGenerator( diff --git a/src/google/protobuf/compiler/csharp/csharp_enum_field.h b/src/google/protobuf/compiler/csharp/csharp_enum_field.h index 9f1a2ea777c4..04ca68da6e1e 100644 --- a/src/google/protobuf/compiler/csharp/csharp_enum_field.h +++ b/src/google/protobuf/compiler/csharp/csharp_enum_field.h @@ -55,7 +55,6 @@ class EnumFieldGenerator : public PrimitiveFieldGenerator { virtual void GenerateParsingCode(io::Printer* printer); virtual void GenerateSerializationCode(io::Printer* printer); virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); }; class EnumOneofFieldGenerator : public PrimitiveOneofFieldGenerator { diff --git a/src/google/protobuf/compiler/csharp/csharp_field_base.cc b/src/google/protobuf/compiler/csharp/csharp_field_base.cc index 9be7b70e0b9a..bea8aff0fcee 100644 --- a/src/google/protobuf/compiler/csharp/csharp_field_base.cc +++ b/src/google/protobuf/compiler/csharp/csharp_field_base.cc @@ -156,11 +156,6 @@ void FieldGeneratorBase::GenerateCodecCode(io::Printer* printer) { // Could fail if we get called here though... } -void FieldGeneratorBase::GenerateExtensionCode(io::Printer* printer) { - // No-op: only message fields, enum fields, primitives, - // and repeated fields need this default is to not generate any code -} - void FieldGeneratorBase::AddDeprecatedFlag(io::Printer* printer) { if (descriptor_->options().deprecated()) { printer->Print("[global::System.ObsoleteAttribute]\n"); diff --git a/src/google/protobuf/compiler/csharp/csharp_field_base.h b/src/google/protobuf/compiler/csharp/csharp_field_base.h index 594461da7845..28a096217a92 100644 --- a/src/google/protobuf/compiler/csharp/csharp_field_base.h +++ b/src/google/protobuf/compiler/csharp/csharp_field_base.h @@ -57,7 +57,6 @@ class FieldGeneratorBase : public SourceGeneratorBase { virtual void GenerateCloningCode(io::Printer* printer) = 0; virtual void GenerateFreezingCode(io::Printer* printer); virtual void GenerateCodecCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); virtual void GenerateMembers(io::Printer* printer) = 0; virtual void GenerateMergingCode(io::Printer* printer) = 0; virtual void GenerateParsingCode(io::Printer* printer) = 0; diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.cc b/src/google/protobuf/compiler/csharp/csharp_helpers.cc index 50c2c9766d89..35b5c2e51251 100644 --- a/src/google/protobuf/compiler/csharp/csharp_helpers.cc +++ b/src/google/protobuf/compiler/csharp/csharp_helpers.cc @@ -133,12 +133,6 @@ std::string GetReflectionClassUnqualifiedName(const FileDescriptor* descriptor) return GetFileNameBase(descriptor) + "Reflection"; } -std::string GetExtensionClassUnqualifiedName(const FileDescriptor* descriptor) { - // TODO: Detect collisions with existing messages, - // and append an underscore if necessary. - return GetFileNameBase(descriptor) + "Extensions"; -} - // TODO(jtattermusch): can we reuse a utility function? std::string UnderscoresToCamelCase(const std::string& input, bool cap_next_letter, @@ -321,15 +315,6 @@ std::string GetReflectionClassName(const FileDescriptor* descriptor) { return "global::" + result; } -std::string GetFullExtensionName(const FieldDescriptor* descriptor) { - if (descriptor->extension_scope()) { - return GetClassName(descriptor->extension_scope()) + ".Extensions." + GetPropertyName(descriptor); - } - else { - return GetExtensionClassUnqualifiedName(descriptor->file()) + "." + GetPropertyName(descriptor); - } -} - std::string GetClassName(const Descriptor* descriptor) { return ToCSharpName(descriptor->full_name(), descriptor->file()); } diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.h b/src/google/protobuf/compiler/csharp/csharp_helpers.h index c51681edf79f..5933d6e35ff6 100644 --- a/src/google/protobuf/compiler/csharp/csharp_helpers.h +++ b/src/google/protobuf/compiler/csharp/csharp_helpers.h @@ -75,8 +75,6 @@ std::string StripDotProto(const std::string& proto_file); // Gets unqualified name of the reflection class std::string GetReflectionClassUnqualifiedName(const FileDescriptor* descriptor); -// Gets unqualified name of the extension class -std::string GetExtensionClassUnqualifiedName(const FileDescriptor* descriptor); std::string GetClassName(const EnumDescriptor* descriptor); @@ -112,8 +110,6 @@ FieldGeneratorBase* CreateFieldGenerator(const FieldDescriptor* descriptor, int presenceIndex, const Options* options); -std::string GetFullExtensionName(const FieldDescriptor* descriptor); - bool IsNullable(const FieldDescriptor* descriptor); // Determines whether the given message is a map entry message, diff --git a/src/google/protobuf/compiler/csharp/csharp_message.cc b/src/google/protobuf/compiler/csharp/csharp_message.cc index 6ebd89f02fe2..513f8e9d5db3 100644 --- a/src/google/protobuf/compiler/csharp/csharp_message.cc +++ b/src/google/protobuf/compiler/csharp/csharp_message.cc @@ -63,8 +63,7 @@ MessageGenerator::MessageGenerator(const Descriptor* descriptor, : SourceGeneratorBase(descriptor->file(), options), descriptor_(descriptor), has_bit_field_count_(0), - end_tag_(GetGroupEndTag(descriptor)), - has_extension_ranges_(descriptor->extension_range_count() > 0) { + end_tag_(GetGroupEndTag(descriptor)) { // fields by number for (int i = 0; i < descriptor_->field_count(); i++) { fields_by_number_.push_back(descriptor_->field(i)); @@ -124,15 +123,7 @@ void MessageGenerator::Generate(io::Printer* printer) { printer->Print( vars, - "$access_level$ sealed partial class $class_name$ : "); - - if (has_extension_ranges_) { - printer->Print(vars, "pb::IExtendableMessage<$class_name$>"); - } - else { - printer->Print(vars, "pb::IMessage<$class_name$>"); - } - printer->Print(" {\n"); + "$access_level$ sealed partial class $class_name$ : pb::IMessage<$class_name$> {\n"); printer->Indent(); // All static fields and properties @@ -143,14 +134,6 @@ void MessageGenerator::Generate(io::Printer* printer) { printer->Print( "private pb::UnknownFieldSet _unknownFields;\n"); - if (has_extension_ranges_) { - if (IsDescriptorProto(descriptor_->file())) { - printer->Print(vars, "internal pb::ExtensionSet<$class_name$> _extensions;\n"); // CustomOptions compatibility - } else { - printer->Print(vars, "private pb::ExtensionSet<$class_name$> _extensions;\n"); - } - } - for (int i = 0; i < has_bit_field_count_; i++) { // don't use arrays since all arrays are heap allocated, saving allocations // use ints instead of bytes since bytes lack bitwise operators, saving casts @@ -186,6 +169,12 @@ void MessageGenerator::Generate(io::Printer* printer) { " get { return Descriptor; }\n" "}\n" "\n"); + // CustomOptions property, only for options messages + if (IsDescriptorOptionMessage(descriptor_)) { + printer->Print( + "internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty;\n" + "\n"); + } // Parameterless constructor and partial OnConstruction method. WriteGeneratedCodeAttributes(printer); @@ -261,32 +250,6 @@ void MessageGenerator::Generate(io::Printer* printer) { GenerateMessageSerializationMethods(printer); GenerateMergingMethods(printer); - if (has_extension_ranges_) { - printer->Print( - vars, - "public TValue GetExtension(pb::Extension<$class_name$, TValue> extension) {\n" - " return pb::ExtensionSet.Get(ref _extensions, extension);\n" - "}\n" - "public pbc::RepeatedField GetExtension(pb::RepeatedExtension<$class_name$, TValue> extension) {\n" - " return pb::ExtensionSet.Get(ref _extensions, extension);\n" - "}\n" - "public pbc::RepeatedField GetOrRegisterExtension(pb::RepeatedExtension<$class_name$, TValue> extension) {\n" - " return pb::ExtensionSet.GetOrRegister(ref _extensions, extension);\n" - "}\n" - "public void SetExtension(pb::Extension<$class_name$, TValue> extension, TValue value) {\n" - " pb::ExtensionSet.Set(ref _extensions, extension, value);\n" - "}\n" - "public bool HasExtension(pb::Extension<$class_name$, TValue> extension) {\n" - " return pb::ExtensionSet.Has(ref _extensions, extension);\n" - "}\n" - "public void ClearExtension(pb::Extension<$class_name$, TValue> extension) {\n" - " pb::ExtensionSet.Clear(ref _extensions, extension);\n" - "}\n" - "public void ClearExtension(pb::RepeatedExtension<$class_name$, TValue> extension) {\n" - " pb::ExtensionSet.Clear(ref _extensions, extension);\n" - "}\n\n"); - } - // Nested messages and enums if (HasNestedGeneratedTypes()) { printer->Print( @@ -314,26 +277,6 @@ void MessageGenerator::Generate(io::Printer* printer) { "\n"); } - if (descriptor_->extension_count() > 0) { - printer->Print( - vars, - "#region Extensions\n" - "/// Container for extensions for other messages declared in the $class_name$ message type.\n"); - WriteGeneratedCodeAttributes(printer); - printer->Print("internal static partial class Extensions {\n"); - printer->Indent(); - for (int i = 0; i < descriptor_->extension_count(); i++) { - std::unique_ptr generator( - CreateFieldGeneratorInternal(descriptor_->extension(i))); - generator->GenerateExtensionCode(printer); - } - printer->Outdent(); - printer->Print( - "}\n" - "#endregion\n" - "\n"); - } - printer->Outdent(); printer->Print("}\n"); printer->Print("\n"); @@ -398,10 +341,6 @@ void MessageGenerator::GenerateCloningCode(io::Printer* printer) { // Clone unknown fields printer->Print( "_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);\n"); - if (has_extension_ranges_) { - printer->Print( - "_extensions = pb::ExtensionSet.Clone(other._extensions);\n"); - } printer->Outdent(); printer->Print("}\n\n"); @@ -448,12 +387,6 @@ void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) { printer->Print("if ($property_name$Case != other.$property_name$Case) return false;\n", "property_name", UnderscoresToCamelCase(descriptor_->oneof_decl(i)->name(), true)); } - if (has_extension_ranges_) { - printer->Print( - "if (!Equals(_extensions, other._extensions)) {\n" - " return false;\n" - "}\n"); - } printer->Outdent(); printer->Print( " return Equals(_unknownFields, other._unknownFields);\n" @@ -475,12 +408,6 @@ void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) { printer->Print("hash ^= (int) $name$Case_;\n", "name", UnderscoresToCamelCase(descriptor_->oneof_decl(i)->name(), false)); } - if (has_extension_ranges_) { - printer->Print( - "if (_extensions != null) {\n" - " hash ^= _extensions.GetHashCode();\n" - "}\n"); - } printer->Print( "if (_unknownFields != null) {\n" " hash ^= _unknownFields.GetHashCode();\n" @@ -509,14 +436,6 @@ void MessageGenerator::GenerateMessageSerializationMethods(io::Printer* printer) generator->GenerateSerializationCode(printer); } - if (has_extension_ranges_) { - // Serialize extensions - printer->Print( - "if (_extensions != null) {\n" - " _extensions.WriteTo(output);\n" - "}\n"); - } - // Serialize unknown fields printer->Print( "if (_unknownFields != null) {\n" @@ -539,13 +458,6 @@ void MessageGenerator::GenerateMessageSerializationMethods(io::Printer* printer) generator->GenerateSerializedSizeCode(printer); } - if (has_extension_ranges_) { - printer->Print( - "if (_extensions != null) {\n" - " size += _extensions.CalculateSize();\n" - "}\n"); - } - printer->Print( "if (_unknownFields != null) {\n" " size += _unknownFields.CalculateSize();\n" @@ -601,11 +513,6 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) { printer->Outdent(); printer->Print("}\n\n"); } - // Merge extensions - if (has_extension_ranges_) { - printer->Print("pb::ExtensionSet.MergeFrom(ref _extensions, other._extensions);\n"); - } - // Merge unknown fields. printer->Print( "_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);\n"); @@ -623,24 +530,23 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) { " switch(tag) {\n"); printer->Indent(); printer->Indent(); - if (end_tag_ != 0) { - printer->Print( - "$end_tag$:\n" - " return;\n", - "end_tag", StrCat(end_tag_)); - } - if (has_extension_ranges_) { + // Option messages need to store unknown fields so that options can be parsed later. + if (IsDescriptorOptionMessage(descriptor_)) { printer->Print( "default:\n" - " if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, input)) {\n" - " _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);\n" - " }\n" + " CustomOptions = CustomOptions.ReadOrSkipUnknownField(input);\n" " break;\n"); } else { printer->Print( "default:\n" " _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);\n" " break;\n"); + if (end_tag_ != 0) { + printer->Print( + "$end_tag$:\n" + " return;\n", + "end_tag", StrCat(end_tag_)); + } } for (int i = 0; i < fields_by_number().size(); i++) { const FieldDescriptor* field = fields_by_number()[i]; diff --git a/src/google/protobuf/compiler/csharp/csharp_message.h b/src/google/protobuf/compiler/csharp/csharp_message.h index 5642dc88120c..7e88ecf13214 100644 --- a/src/google/protobuf/compiler/csharp/csharp_message.h +++ b/src/google/protobuf/compiler/csharp/csharp_message.h @@ -63,7 +63,6 @@ class MessageGenerator : public SourceGeneratorBase { std::vector fields_by_number_; int has_bit_field_count_; uint end_tag_; - bool has_extension_ranges_; void GenerateMessageSerializationMethods(io::Printer* printer); void GenerateMergingMethods(io::Printer* printer); diff --git a/src/google/protobuf/compiler/csharp/csharp_message_field.cc b/src/google/protobuf/compiler/csharp/csharp_message_field.cc index 412579831258..5f35f47710d0 100644 --- a/src/google/protobuf/compiler/csharp/csharp_message_field.cc +++ b/src/google/protobuf/compiler/csharp/csharp_message_field.cc @@ -174,16 +174,6 @@ void MessageFieldGenerator::WriteToString(io::Printer* printer) { variables_, "PrintField(\"$field_name$\", has$property_name$, $name$_, writer);\n"); } -void MessageFieldGenerator::GenerateExtensionCode(io::Printer* printer) { - WritePropertyDocComment(printer, descriptor_); - AddDeprecatedFlag(printer); - printer->Print( - variables_, - "$access_level$ static readonly pb::Extension<$extended_type$, $type_name$> $property_name$ =\n" - " new pb::Extension<$extended_type$, $type_name$>($number$, "); - GenerateCodecCode(printer); - printer->Print(");\n"); -} void MessageFieldGenerator::GenerateCloningCode(io::Printer* printer) { printer->Print(variables_, "$name$_ = other.$has_property_check$ ? other.$name$_.Clone() : null;\n"); diff --git a/src/google/protobuf/compiler/csharp/csharp_message_field.h b/src/google/protobuf/compiler/csharp/csharp_message_field.h index 2463d912ba98..224bc28ead15 100644 --- a/src/google/protobuf/compiler/csharp/csharp_message_field.h +++ b/src/google/protobuf/compiler/csharp/csharp_message_field.h @@ -59,7 +59,6 @@ class MessageFieldGenerator : public FieldGeneratorBase { virtual void GenerateParsingCode(io::Printer* printer); virtual void GenerateSerializationCode(io::Printer* printer); virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); virtual void WriteHash(io::Printer* printer); virtual void WriteEquals(io::Printer* printer); diff --git a/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc b/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc index eb7f70dda6b5..9e4bb49db00f 100644 --- a/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc +++ b/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc @@ -225,18 +225,7 @@ void PrimitiveFieldGenerator::GenerateCloningCode(io::Printer* printer) { void PrimitiveFieldGenerator::GenerateCodecCode(io::Printer* printer) { printer->Print( variables_, - "pb::FieldCodec.For$capitalized_type_name$($tag$, $default_value$)"); -} - -void PrimitiveFieldGenerator::GenerateExtensionCode(io::Printer* printer) { - WritePropertyDocComment(printer, descriptor_); - AddDeprecatedFlag(printer); - printer->Print( - variables_, - "$access_level$ static readonly pb::Extension<$extended_type$, $type_name$> $property_name$ =\n" - " new pb::Extension<$extended_type$, $type_name$>($number$, "); - GenerateCodecCode(printer); - printer->Print(");\n"); + "pb::FieldCodec.For$capitalized_type_name$($tag$)"); } PrimitiveOneofFieldGenerator::PrimitiveOneofFieldGenerator( diff --git a/src/google/protobuf/compiler/csharp/csharp_primitive_field.h b/src/google/protobuf/compiler/csharp/csharp_primitive_field.h index 5edcc42b7ba4..54782e15f088 100644 --- a/src/google/protobuf/compiler/csharp/csharp_primitive_field.h +++ b/src/google/protobuf/compiler/csharp/csharp_primitive_field.h @@ -60,7 +60,6 @@ class PrimitiveFieldGenerator : public FieldGeneratorBase { virtual void GenerateParsingCode(io::Printer* printer); virtual void GenerateSerializationCode(io::Printer* printer); virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); virtual void WriteHash(io::Printer* printer); virtual void WriteEquals(io::Printer* printer); diff --git a/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc b/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc index ec816a7584f6..82a1e8af41d3 100644 --- a/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc +++ b/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc @@ -40,7 +40,6 @@ #include #include -#include #include #include #include @@ -57,7 +56,6 @@ ReflectionClassGenerator::ReflectionClassGenerator(const FileDescriptor* file, file_(file) { namespace_ = GetFileNamespace(file); reflectionClassname_ = GetReflectionClassUnqualifiedName(file); - extensionClassname_ = GetExtensionClassUnqualifiedName(file); } ReflectionClassGenerator::~ReflectionClassGenerator() { @@ -71,25 +69,6 @@ void ReflectionClassGenerator::Generate(io::Printer* printer) { printer->Outdent(); printer->Print("}\n"); - if (file_->extension_count() > 0) { - printer->Print( - "/// Holder for extension identifiers generated from the top level of $file_name$\n" - "internal static partial class $class_name$ {\n", - "access_level", class_access_level(), - "class_name", extensionClassname_, - "file_name", file_->name()); - printer->Indent(); - for (int i = 0; i < file_->extension_count(); i++) { - std::unique_ptr generator( - CreateFieldGenerator(file_->extension(i), -1, this->options())); - generator->GenerateExtensionCode(printer); - } - printer->Outdent(); - printer->Print( - "}\n" - "\n"); - } - // write children: Enums if (file_->enum_type_count() > 0) { printer->Print("#region Enums\n"); @@ -190,10 +169,17 @@ void ReflectionClassGenerator::WriteDescriptor(io::Printer* printer) { "descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,\n"); printer->Print(" new pbr::FileDescriptor[] { "); for (int i = 0; i < file_->dependency_count(); i++) { + // descriptor.proto is special: we don't allow access to the generated code, but there's + // a separately-exposed property to get at the file descriptor, specifically to allow this + // kind of dependency. + if (IsDescriptorProto(file_->dependency(i))) { + printer->Print("pbr::FileDescriptor.DescriptorProtoFileDescriptor, "); + } else { printer->Print( "$full_reflection_class_name$.Descriptor, ", "full_reflection_class_name", GetReflectionClassName(file_->dependency(i))); + } } printer->Print("},\n" " new pbr::GeneratedClrTypeInfo("); @@ -207,16 +193,6 @@ void ReflectionClassGenerator::WriteDescriptor(io::Printer* printer) { } else { printer->Print("null, "); - } - if (file_->extension_count() > 0) { - std::vector extensions; - for (int i = 0; i < file_->extension_count(); i++) { - extensions.push_back(GetFullExtensionName(file_->extension(i))); - } - printer->Print("new pb::Extension[] { $extensions$ }, ", "extensions", Join(extensions, ", ")); - } - else { - printer->Print("null, "); } if (file_->message_type_count() > 0) { printer->Print("new pbr::GeneratedClrTypeInfo[] {\n"); @@ -265,7 +241,7 @@ void ReflectionClassGenerator::WriteGeneratedCodeInfo(const Descriptor* descript for (int i = 0; i < descriptor->field_count(); i++) { fields.push_back(GetPropertyName(descriptor->field(i))); } - printer->Print("new[]{ \"$fields$\" }, ", "fields", Join(fields, "\", \"")); + printer->Print("new[]{ \"$fields$\" }, ", "fields", JoinStrings(fields, "\", \"")); } else { printer->Print("null, "); @@ -278,7 +254,7 @@ void ReflectionClassGenerator::WriteGeneratedCodeInfo(const Descriptor* descript for (int i = 0; i < descriptor->oneof_decl_count(); i++) { oneofs.push_back(UnderscoresToCamelCase(descriptor->oneof_decl(i)->name(), true)); } - printer->Print("new[]{ \"$oneofs$\" }, ", "oneofs", Join(oneofs, "\", \"")); + printer->Print("new[]{ \"$oneofs$\" }, ", "oneofs", JoinStrings(oneofs, "\", \"")); } else { printer->Print("null, "); @@ -291,24 +267,12 @@ void ReflectionClassGenerator::WriteGeneratedCodeInfo(const Descriptor* descript for (int i = 0; i < descriptor->enum_type_count(); i++) { enums.push_back(GetClassName(descriptor->enum_type(i))); } - printer->Print("new[]{ typeof($enums$) }, ", "enums", Join(enums, "), typeof(")); + printer->Print("new[]{ typeof($enums$) }, ", "enums", JoinStrings(enums, "), typeof(")); } else { printer->Print("null, "); } - // Extensions - if (descriptor->extension_count() > 0) { - std::vector extensions; - for (int i = 0; i < descriptor->extension_count(); i++) { - extensions.push_back(GetFullExtensionName(descriptor->extension(i))); - } - printer->Print("new pb::Extension[] { $extensions$ }, ", "extensions", Join(extensions, ", ")); - } - else { - printer->Print("null, "); - } - // Nested types if (descriptor->nested_type_count() > 0) { // Need to specify array type explicitly here, as all elements may be null. diff --git a/src/google/protobuf/compiler/csharp/csharp_reflection_class.h b/src/google/protobuf/compiler/csharp/csharp_reflection_class.h index 955472776686..1a4a2f4a7d29 100644 --- a/src/google/protobuf/compiler/csharp/csharp_reflection_class.h +++ b/src/google/protobuf/compiler/csharp/csharp_reflection_class.h @@ -58,7 +58,6 @@ class ReflectionClassGenerator : public SourceGeneratorBase { std::string namespace_; std::string reflectionClassname_; - std::string extensionClassname_; void WriteIntroduction(io::Printer* printer); void WriteDescriptor(io::Printer* printer); diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc index 73309a7edd1e..b8e66abb2b21 100644 --- a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc @@ -117,16 +117,6 @@ void RepeatedEnumFieldGenerator::GenerateCloningCode(io::Printer* printer) { "$name$_ = other.$name$_.Clone();\n"); } -void RepeatedEnumFieldGenerator::GenerateExtensionCode(io::Printer* printer) { - WritePropertyDocComment(printer, descriptor_); - AddDeprecatedFlag(printer); - printer->Print( - variables_, - "$access_level$ static readonly pb::RepeatedExtension<$extended_type$, $type_name$> $property_name$ =\n" - " new pb::RepeatedExtension<$extended_type$, $type_name$>($number$, " - "pb::FieldCodec.ForEnum($tag$, x => (int) x, x => ($type_name$) x));\n"); -} - void RepeatedEnumFieldGenerator::GenerateFreezingCode(io::Printer* printer) { } diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h index c7a632a17d4f..75de1adab339 100644 --- a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h @@ -61,7 +61,6 @@ class RepeatedEnumFieldGenerator : public FieldGeneratorBase { virtual void GenerateParsingCode(io::Printer* printer); virtual void GenerateSerializationCode(io::Printer* printer); virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); virtual void WriteHash(io::Printer* printer); virtual void WriteEquals(io::Printer* printer); diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc index 4b4b37de1bb4..bf76c0d37851 100644 --- a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc @@ -137,25 +137,6 @@ void RepeatedMessageFieldGenerator::GenerateCloningCode(io::Printer* printer) { void RepeatedMessageFieldGenerator::GenerateFreezingCode(io::Printer* printer) { } -void RepeatedMessageFieldGenerator::GenerateExtensionCode(io::Printer* printer) { - WritePropertyDocComment(printer, descriptor_); - AddDeprecatedFlag(printer); - printer->Print( - variables_, - "$access_level$ static readonly pb::RepeatedExtension<$extended_type$, $type_name$> $property_name$ =\n" - " new pb::RepeatedExtension<$extended_type$, $type_name$>($number$, "); - if (IsWrapperType(descriptor_)) { - std::unique_ptr single_generator( - new WrapperFieldGenerator(descriptor_, -1, this->options())); - single_generator->GenerateCodecCode(printer); - } else { - std::unique_ptr single_generator( - new MessageFieldGenerator(descriptor_, -1, this->options())); - single_generator->GenerateCodecCode(printer); - } - printer->Print(");\n"); -} - } // namespace csharp } // namespace compiler } // namespace protobuf diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h index 74f6874df263..e1b5f27c17d3 100644 --- a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h @@ -61,7 +61,6 @@ class RepeatedMessageFieldGenerator : public FieldGeneratorBase { virtual void GenerateParsingCode(io::Printer* printer); virtual void GenerateSerializationCode(io::Printer* printer); virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); virtual void WriteHash(io::Printer* printer); virtual void WriteEquals(io::Printer* printer); diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc index c1444ea124aa..78fcdc674f94 100644 --- a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc @@ -118,15 +118,6 @@ void RepeatedPrimitiveFieldGenerator::GenerateCloningCode(io::Printer* printer) void RepeatedPrimitiveFieldGenerator::GenerateFreezingCode(io::Printer* printer) { } -void RepeatedPrimitiveFieldGenerator::GenerateExtensionCode(io::Printer* printer) { - WritePropertyDocComment(printer, descriptor_); - AddDeprecatedFlag(printer); - printer->Print( - variables_, - "$access_level$ static readonly pb::RepeatedExtension<$extended_type$, $type_name$> $property_name$ =\n" - " new pb::RepeatedExtension<$extended_type$, $type_name$>($number$, pb::FieldCodec.For$capitalized_type_name$($tag$));\n"); -} - } // namespace csharp } // namespace compiler } // namespace protobuf diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h index 2a3be4816809..7d9826fcd9ba 100644 --- a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h @@ -57,7 +57,6 @@ class RepeatedPrimitiveFieldGenerator : public FieldGeneratorBase { virtual void GenerateParsingCode(io::Printer* printer); virtual void GenerateSerializationCode(io::Printer* printer); virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); virtual void WriteHash(io::Printer* printer); virtual void WriteEquals(io::Printer* printer); diff --git a/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc b/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc index add20ab9fe63..f284763dfd13 100644 --- a/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc +++ b/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc @@ -181,17 +181,6 @@ void WrapperFieldGenerator::GenerateCodecCode(io::Printer* printer) { } } -void WrapperFieldGenerator::GenerateExtensionCode(io::Printer* printer) { - WritePropertyDocComment(printer, descriptor_); - AddDeprecatedFlag(printer); - printer->Print( - variables_, - "$access_level$ static readonly pb::Extension<$extended_type$, $type_name$> $property_name$ =\n" - " new pb::Extension<$extended_type$, $type_name$>($number$, "); - GenerateCodecCode(printer); - printer->Print(");\n"); -} - WrapperOneofFieldGenerator::WrapperOneofFieldGenerator( const FieldDescriptor* descriptor, int presenceIndex, const Options *options) : WrapperFieldGenerator(descriptor, presenceIndex, options) { diff --git a/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h b/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h index 394e27de595d..ee684dda7c5f 100644 --- a/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h +++ b/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h @@ -60,7 +60,6 @@ class WrapperFieldGenerator : public FieldGeneratorBase { virtual void GenerateParsingCode(io::Printer* printer); virtual void GenerateSerializationCode(io::Printer* printer); virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); virtual void WriteHash(io::Printer* printer); virtual void WriteEquals(io::Printer* printer);