diff options
65 files changed, 788 insertions, 502 deletions
diff --git a/Makefile.am b/Makefile.am index 188346fe..fbd27fc5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -133,7 +133,7 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf/LimitedInputStream.cs \ csharp/src/Google.Protobuf/MessageExtensions.cs \ csharp/src/Google.Protobuf/MessageParser.cs \ - csharp/src/Google.Protobuf/Preconditions.cs \ + csharp/src/Google.Protobuf/ProtoPreconditions.cs \ csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs \ csharp/src/Google.Protobuf/Reflection/Descriptor.cs \ csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs \ @@ -146,7 +146,7 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs \ csharp/src/Google.Protobuf/Reflection/FieldType.cs \ csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs \ - csharp/src/Google.Protobuf/Reflection/GeneratedCodeInfo.cs \ + csharp/src/Google.Protobuf/Reflection/GeneratedClrTypeInfo.cs \ csharp/src/Google.Protobuf/Reflection/IDescriptor.cs \ csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs \ csharp/src/Google.Protobuf/Reflection/MapFieldAccessor.cs \ @@ -12,7 +12,7 @@ Overview Protocol Buffers (a.k.a., protobuf) are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data. You -can find [protobuf's documentaion on the Google Developers site](https://developers.google.com/protocol-buffers/). +can find [protobuf's documentation on the Google Developers site](https://developers.google.com/protocol-buffers/). This README file contains protobuf installation instructions. To install protobuf, you need to install the protocol compiler (used to compile .proto @@ -44,7 +44,7 @@ to use the github master version at HEAD, or you need to modify protobuf code, or you are using C++, it's recommended to build your own protoc binary from source. -If you would like to build protoc binary from source, see the [C++ Installaton +If you would like to build protoc binary from source, see the [C++ Installation Instructions](src/README.md). Protobuf Runtime Installation diff --git a/cmake/README.md b/cmake/README.md index 58aae8e9..1e7410d8 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -157,7 +157,8 @@ And wait for the compilation to finish. Testing ======= -To run unit-tests: +To run unit-tests, first you must compile protobuf as described above. +Then run: C:\Path\to\protobuf\cmake\build\release>nmake check diff --git a/csharp/keys/Google.Protobuf.snk b/csharp/keys/Google.Protobuf.snk Binary files differnew file mode 100644 index 00000000..7515443c --- /dev/null +++ b/csharp/keys/Google.Protobuf.snk diff --git a/csharp/keys/README.md b/csharp/keys/README.md index 1a014198..ede67357 100644 --- a/csharp/keys/README.md +++ b/csharp/keys/README.md @@ -2,4 +2,8 @@ Contents -------- - Google.Protobuf.public.snk: - Public key to verify strong name of Google.Protobuf assemblies.
\ No newline at end of file + Public key to verify strong name of Google.Protobuf assemblies. +- Google.Protobuf.snk: + Signing key to provide strong name of Google.Protobuf assemblies. + As per [Microsoft guidance](https://msdn.microsoft.com/en-us/library/wd40t7ad(v=vs.110).aspx) + signing key should be checked into the repository. diff --git a/csharp/src/AddressBook/Addressbook.cs b/csharp/src/AddressBook/Addressbook.cs index 2c81004c..166dd49a 100644 --- a/csharp/src/AddressBook/Addressbook.cs +++ b/csharp/src/AddressBook/Addressbook.cs @@ -34,9 +34,9 @@ namespace Google.Protobuf.Examples.AddressBook { "cGxlcy5BZGRyZXNzQm9va2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person), global::Google.Protobuf.Examples.AddressBook.Person.Parser, new[]{ "Name", "Id", "Email", "Phones" }, null, new[]{ typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) }, new pbr::GeneratedCodeInfo[] { new pbr::GeneratedCodeInfo(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::GeneratedCodeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.AddressBook), global::Google.Protobuf.Examples.AddressBook.AddressBook.Parser, new[]{ "People" }, 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" }, 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 @@ -82,7 +82,7 @@ namespace Google.Protobuf.Examples.AddressBook { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -105,7 +105,7 @@ namespace Google.Protobuf.Examples.AddressBook { public string Email { get { return email_; } set { - email_ = pb::Preconditions.CheckNotNull(value, "value"); + email_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -267,7 +267,7 @@ namespace Google.Protobuf.Examples.AddressBook { public string Number { get { return number_; } set { - number_ = pb::Preconditions.CheckNotNull(value, "value"); + number_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } diff --git a/csharp/src/Google.Protobuf.Conformance/Conformance.cs b/csharp/src/Google.Protobuf.Conformance/Conformance.cs index f3b08855..7d85d28c 100644 --- a/csharp/src/Google.Protobuf.Conformance/Conformance.cs +++ b/csharp/src/Google.Protobuf.Conformance/Conformance.cs @@ -186,12 +186,12 @@ namespace Conformance { "dG9idWYuY29uZm9ybWFuY2ViBnByb3RvMw==")); 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::GeneratedCodeInfo(new[] {typeof(global::Conformance.WireFormat), typeof(global::Conformance.ForeignEnum), }, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::Conformance.ConformanceRequest), global::Conformance.ConformanceRequest.Parser, new[]{ "ProtobufPayload", "JsonPayload", "RequestedOutputFormat" }, new[]{ "Payload" }, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Conformance.ConformanceResponse), global::Conformance.ConformanceResponse.Parser, new[]{ "ParseError", "SerializeError", "RuntimeError", "ProtobufPayload", "JsonPayload", "Skipped" }, new[]{ "Result" }, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Conformance.TestAllTypes), global::Conformance.TestAllTypes.Parser, new[]{ "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalNestedMessage", "OptionalForeignMessage", "OptionalNestedEnum", "OptionalForeignEnum", "OptionalStringPiece", "OptionalCord", "RecursiveMessage", "RepeatedInt32", "RepeatedInt64", "RepeatedUint32", "RepeatedUint64", "RepeatedSint32", "RepeatedSint64", "RepeatedFixed32", "RepeatedFixed64", "RepeatedSfixed32", "RepeatedSfixed64", "RepeatedFloat", "RepeatedDouble", "RepeatedBool", "RepeatedString", "RepeatedBytes", "RepeatedNestedMessage", "RepeatedForeignMessage", "RepeatedNestedEnum", "RepeatedForeignEnum", "RepeatedStringPiece", "RepeatedCord", "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapStringString", "MapStringBytes", "MapStringNestedMessage", "MapStringForeignMessage", "MapStringNestedEnum", "MapStringForeignEnum", "OneofUint32", "OneofNestedMessage", "OneofString", "OneofBytes", "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", "Fieldname1", "FieldName2", "FieldName3", "FieldName4", "Field0Name5", "Field0Name6", "FieldName7", "FieldName8", "FieldName9", "FieldName10", "FIELDNAME11", "FIELDName12" }, new[]{ "OneofField" }, new[]{ typeof(global::Conformance.TestAllTypes.Types.NestedEnum) }, new pbr::GeneratedCodeInfo[] { new pbr::GeneratedCodeInfo(typeof(global::Conformance.TestAllTypes.Types.NestedMessage), global::Conformance.TestAllTypes.Types.NestedMessage.Parser, new[]{ "A", "Corecursive" }, null, null, null), + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Conformance.WireFormat), typeof(global::Conformance.ForeignEnum), }, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceRequest), global::Conformance.ConformanceRequest.Parser, new[]{ "ProtobufPayload", "JsonPayload", "RequestedOutputFormat" }, new[]{ "Payload" }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceResponse), global::Conformance.ConformanceResponse.Parser, new[]{ "ParseError", "SerializeError", "RuntimeError", "ProtobufPayload", "JsonPayload", "Skipped" }, new[]{ "Result" }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.TestAllTypes), global::Conformance.TestAllTypes.Parser, new[]{ "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalNestedMessage", "OptionalForeignMessage", "OptionalNestedEnum", "OptionalForeignEnum", "OptionalStringPiece", "OptionalCord", "RecursiveMessage", "RepeatedInt32", "RepeatedInt64", "RepeatedUint32", "RepeatedUint64", "RepeatedSint32", "RepeatedSint64", "RepeatedFixed32", "RepeatedFixed64", "RepeatedSfixed32", "RepeatedSfixed64", "RepeatedFloat", "RepeatedDouble", "RepeatedBool", "RepeatedString", "RepeatedBytes", "RepeatedNestedMessage", "RepeatedForeignMessage", "RepeatedNestedEnum", "RepeatedForeignEnum", "RepeatedStringPiece", "RepeatedCord", "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapStringString", "MapStringBytes", "MapStringNestedMessage", "MapStringForeignMessage", "MapStringNestedEnum", "MapStringForeignEnum", "OneofUint32", "OneofNestedMessage", "OneofString", "OneofBytes", "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", "Fieldname1", "FieldName2", "FieldName3", "FieldName4", "Field0Name5", "Field0Name6", "FieldName7", "FieldName8", "FieldName9", "FieldName10", "FIELDNAME11", "FIELDName12" }, new[]{ "OneofField" }, new[]{ typeof(global::Conformance.TestAllTypes.Types.NestedEnum) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.TestAllTypes.Types.NestedMessage), global::Conformance.TestAllTypes.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::GeneratedCodeInfo(typeof(global::Conformance.ForeignMessage), global::Conformance.ForeignMessage.Parser, new[]{ "C" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ForeignMessage), global::Conformance.ForeignMessage.Parser, new[]{ "C" }, null, null, null) })); } #endregion @@ -261,7 +261,7 @@ namespace Conformance { public pb::ByteString ProtobufPayload { get { return payloadCase_ == PayloadOneofCase.ProtobufPayload ? (pb::ByteString) payload_ : pb::ByteString.Empty; } set { - payload_ = pb::Preconditions.CheckNotNull(value, "value"); + payload_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); payloadCase_ = PayloadOneofCase.ProtobufPayload; } } @@ -271,7 +271,7 @@ namespace Conformance { public string JsonPayload { get { return payloadCase_ == PayloadOneofCase.JsonPayload ? (string) payload_ : ""; } set { - payload_ = pb::Preconditions.CheckNotNull(value, "value"); + payload_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); payloadCase_ = PayloadOneofCase.JsonPayload; } } @@ -471,7 +471,7 @@ namespace Conformance { public string ParseError { get { return resultCase_ == ResultOneofCase.ParseError ? (string) result_ : ""; } set { - result_ = pb::Preconditions.CheckNotNull(value, "value"); + result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); resultCase_ = ResultOneofCase.ParseError; } } @@ -486,7 +486,7 @@ namespace Conformance { public string SerializeError { get { return resultCase_ == ResultOneofCase.SerializeError ? (string) result_ : ""; } set { - result_ = pb::Preconditions.CheckNotNull(value, "value"); + result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); resultCase_ = ResultOneofCase.SerializeError; } } @@ -501,7 +501,7 @@ namespace Conformance { public string RuntimeError { get { return resultCase_ == ResultOneofCase.RuntimeError ? (string) result_ : ""; } set { - result_ = pb::Preconditions.CheckNotNull(value, "value"); + result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); resultCase_ = ResultOneofCase.RuntimeError; } } @@ -515,7 +515,7 @@ namespace Conformance { public pb::ByteString ProtobufPayload { get { return resultCase_ == ResultOneofCase.ProtobufPayload ? (pb::ByteString) result_ : pb::ByteString.Empty; } set { - result_ = pb::Preconditions.CheckNotNull(value, "value"); + result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); resultCase_ = ResultOneofCase.ProtobufPayload; } } @@ -529,7 +529,7 @@ namespace Conformance { public string JsonPayload { get { return resultCase_ == ResultOneofCase.JsonPayload ? (string) result_ : ""; } set { - result_ = pb::Preconditions.CheckNotNull(value, "value"); + result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); resultCase_ = ResultOneofCase.JsonPayload; } } @@ -543,7 +543,7 @@ namespace Conformance { public string Skipped { get { return resultCase_ == ResultOneofCase.Skipped ? (string) result_ : ""; } set { - result_ = pb::Preconditions.CheckNotNull(value, "value"); + result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); resultCase_ = ResultOneofCase.Skipped; } } @@ -1008,7 +1008,7 @@ namespace Conformance { public string OptionalString { get { return optionalString_; } set { - optionalString_ = pb::Preconditions.CheckNotNull(value, "value"); + optionalString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -1018,7 +1018,7 @@ namespace Conformance { public pb::ByteString OptionalBytes { get { return optionalBytes_; } set { - optionalBytes_ = pb::Preconditions.CheckNotNull(value, "value"); + optionalBytes_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -1068,7 +1068,7 @@ namespace Conformance { public string OptionalStringPiece { get { return optionalStringPiece_; } set { - optionalStringPiece_ = pb::Preconditions.CheckNotNull(value, "value"); + optionalStringPiece_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -1078,7 +1078,7 @@ namespace Conformance { public string OptionalCord { get { return optionalCord_; } set { - optionalCord_ = pb::Preconditions.CheckNotNull(value, "value"); + optionalCord_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -1483,7 +1483,7 @@ namespace Conformance { public string OneofString { get { return oneofFieldCase_ == OneofFieldOneofCase.OneofString ? (string) oneofField_ : ""; } set { - oneofField_ = pb::Preconditions.CheckNotNull(value, "value"); + oneofField_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); oneofFieldCase_ = OneofFieldOneofCase.OneofString; } } @@ -1493,7 +1493,7 @@ namespace Conformance { public pb::ByteString OneofBytes { get { return oneofFieldCase_ == OneofFieldOneofCase.OneofBytes ? (pb::ByteString) oneofField_ : pb::ByteString.Empty; } set { - oneofField_ = pb::Preconditions.CheckNotNull(value, "value"); + oneofField_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); oneofFieldCase_ = OneofFieldOneofCase.OneofBytes; } } diff --git a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj index 20ae8e48..4f37c5e2 100644 --- a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj +++ b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj @@ -55,7 +55,7 @@ <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<Prefer32Bit>false</Prefer32Bit>
<SignAssembly>True</SignAssembly>
- <AssemblyOriginatorKeyFile>C:\keys\Google.Protobuf.snk</AssemblyOriginatorKeyFile>
+ <AssemblyOriginatorKeyFile>..\..\keys\Google.Protobuf.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs index 3e9999e4..27c04787 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs @@ -149,14 +149,14 @@ namespace Google.Protobuf.TestProtos { "b2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor, }, - new pbr::GeneratedCodeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.MapEnum), }, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(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::GeneratedCodeInfo[] { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, }), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.TestMapSubmessage), global::Google.Protobuf.TestProtos.TestMapSubmessage.Parser, new[]{ "TestMap" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.TestMessageMap), global::Google.Protobuf.TestProtos.TestMessageMap.Parser, new[]{ "MapInt32Message" }, null, null, new pbr::GeneratedCodeInfo[] { null, }), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.TestSameTypeMap), global::Google.Protobuf.TestProtos.TestSameTypeMap.Parser, new[]{ "Map1", "Map2" }, null, null, new pbr::GeneratedCodeInfo[] { null, null, }), - new pbr::GeneratedCodeInfo(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::GeneratedCodeInfo[] { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, }), - new pbr::GeneratedCodeInfo(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::GeneratedCodeInfo[] { null, }), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.MessageContainingMapCalledEntry), global::Google.Protobuf.TestProtos.MessageContainingMapCalledEntry.Parser, new[]{ "Entry" }, null, null, new pbr::GeneratedCodeInfo[] { 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 diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs index 72ada3de..7b824dc7 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs @@ -33,8 +33,8 @@ namespace Google.Protobuf.TestProtos { "Mw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestImportPublicProto3Reflection.Descriptor, }, - new pbr::GeneratedCodeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.ImportEnum), }, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.ImportMessage), global::Google.Protobuf.TestProtos.ImportMessage.Parser, new[]{ "D" }, 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 45f0e247..b471a8cf 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs @@ -29,8 +29,8 @@ namespace Google.Protobuf.TestProtos { "Zi50ZXN0qgIaR29vZ2xlLlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.PublicImportMessage), global::Google.Protobuf.TestProtos.PublicImportMessage.Parser, new[]{ "E" }, 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 9ac2d7ac..16176a33 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs @@ -48,14 +48,14 @@ namespace UnitTest.Issues.TestProtos { "Qh9IAaoCGlVuaXRUZXN0Lklzc3Vlcy5UZXN0UHJvdG9zYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedCodeInfo(new[] {typeof(global::UnitTest.Issues.TestProtos.NegativeEnum), typeof(global::UnitTest.Issues.TestProtos.DeprecatedEnum), }, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::UnitTest.Issues.TestProtos.Issue307), global::UnitTest.Issues.TestProtos.Issue307.Parser, null, null, null, new pbr::GeneratedCodeInfo[] { new pbr::GeneratedCodeInfo(typeof(global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce), global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce.Parser, null, null, null, new pbr::GeneratedCodeInfo[] { new pbr::GeneratedCodeInfo(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::GeneratedCodeInfo(typeof(global::UnitTest.Issues.TestProtos.NegativeEnumMessage), global::UnitTest.Issues.TestProtos.NegativeEnumMessage.Parser, new[]{ "Value", "Values", "PackedValues" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::UnitTest.Issues.TestProtos.DeprecatedChild), global::UnitTest.Issues.TestProtos.DeprecatedChild.Parser, null, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage), global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage.Parser, new[]{ "PrimitiveValue", "PrimitiveArray", "MessageValue", "MessageArray", "EnumValue", "EnumArray" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::UnitTest.Issues.TestProtos.ItemField), global::UnitTest.Issues.TestProtos.ItemField.Parser, new[]{ "Item" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::UnitTest.Issues.TestProtos.ReservedNames), global::UnitTest.Issues.TestProtos.ReservedNames.Parser, new[]{ "Types_", "Descriptor_" }, null, null, new pbr::GeneratedCodeInfo[] { new pbr::GeneratedCodeInfo(typeof(global::UnitTest.Issues.TestProtos.ReservedNames.Types.SomeNestedType), global::UnitTest.Issues.TestProtos.ReservedNames.Types.SomeNestedType.Parser, null, null, null, null)}), - new pbr::GeneratedCodeInfo(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(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) })); } #endregion @@ -1164,7 +1164,7 @@ namespace UnitTest.Issues.TestProtos { public string O1String { get { return o1Case_ == O1OneofCase.O1String ? (string) o1_ : ""; } set { - o1_ = pb::Preconditions.CheckNotNull(value, "value"); + o1_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); o1Case_ = O1OneofCase.O1String; } } @@ -1185,7 +1185,7 @@ namespace UnitTest.Issues.TestProtos { public string PlainString { get { return plainString_; } set { - plainString_ = pb::Preconditions.CheckNotNull(value, "value"); + plainString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -1204,7 +1204,7 @@ namespace UnitTest.Issues.TestProtos { public string O2String { get { return o2Case_ == O2OneofCase.O2String ? (string) o2_ : ""; } set { - o2_ = pb::Preconditions.CheckNotNull(value, "value"); + o2_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); o2Case_ = O2OneofCase.O2String; } } diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs index 462ae9f9..d8465448 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs @@ -152,40 +152,40 @@ namespace Google.Protobuf.TestProtos { "+AEBqgIaR29vZ2xlLlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestImportProto3Reflection.Descriptor, }, - new pbr::GeneratedCodeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.ForeignEnum), typeof(global::Google.Protobuf.TestProtos.TestEnumWithDupValue), typeof(global::Google.Protobuf.TestProtos.TestSparseEnum), }, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(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::GeneratedCodeInfo[] { new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage), global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage.Parser, new[]{ "Bb" }, null, null, null)}), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.NestedTestAllTypes), global::Google.Protobuf.TestProtos.NestedTestAllTypes.Parser, new[]{ "Child", "Payload", "RepeatedChild" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.TestDeprecatedFields), global::Google.Protobuf.TestProtos.TestDeprecatedFields.Parser, new[]{ "DeprecatedInt32" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.ForeignMessage), global::Google.Protobuf.TestProtos.ForeignMessage.Parser, new[]{ "C" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.TestReservedFields), global::Google.Protobuf.TestProtos.TestReservedFields.Parser, null, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.TestForeignNested), global::Google.Protobuf.TestProtos.TestForeignNested.Parser, new[]{ "ForeignNested" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.TestReallyLargeTagNumber), global::Google.Protobuf.TestProtos.TestReallyLargeTagNumber.Parser, new[]{ "A", "Bb" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.TestRecursiveMessage), global::Google.Protobuf.TestProtos.TestRecursiveMessage.Parser, new[]{ "A", "I" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.TestMutualRecursionA), global::Google.Protobuf.TestProtos.TestMutualRecursionA.Parser, new[]{ "Bb" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.TestMutualRecursionB), global::Google.Protobuf.TestProtos.TestMutualRecursionB.Parser, new[]{ "A", "OptionalInt32" }, null, null, null), - new pbr::GeneratedCodeInfo(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::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.TestFieldOrderings), global::Google.Protobuf.TestProtos.TestFieldOrderings.Parser, new[]{ "MyString", "MyInt", "MyFloat", "SingleNestedMessage" }, null, null, new pbr::GeneratedCodeInfo[] { new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage), global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage.Parser, new[]{ "Oo", "Bb" }, null, null, null)}), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.SparseEnumMessage), global::Google.Protobuf.TestProtos.SparseEnumMessage.Parser, new[]{ "SparseEnum" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.OneString), global::Google.Protobuf.TestProtos.OneString.Parser, new[]{ "Data" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.MoreString), global::Google.Protobuf.TestProtos.MoreString.Parser, new[]{ "Data" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.OneBytes), global::Google.Protobuf.TestProtos.OneBytes.Parser, new[]{ "Data" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.MoreBytes), global::Google.Protobuf.TestProtos.MoreBytes.Parser, new[]{ "Data" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.Int32Message), global::Google.Protobuf.TestProtos.Int32Message.Parser, new[]{ "Data" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.Uint32Message), global::Google.Protobuf.TestProtos.Uint32Message.Parser, new[]{ "Data" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.Int64Message), global::Google.Protobuf.TestProtos.Int64Message.Parser, new[]{ "Data" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.Uint64Message), global::Google.Protobuf.TestProtos.Uint64Message.Parser, new[]{ "Data" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.BoolMessage), global::Google.Protobuf.TestProtos.BoolMessage.Parser, new[]{ "Data" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.TestOneof), global::Google.Protobuf.TestProtos.TestOneof.Parser, new[]{ "FooInt", "FooString", "FooMessage" }, new[]{ "Foo" }, null, null), - new pbr::GeneratedCodeInfo(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::GeneratedCodeInfo(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::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.TestRepeatedScalarDifferentTagSizes), global::Google.Protobuf.TestProtos.TestRepeatedScalarDifferentTagSizes.Parser, new[]{ "RepeatedFixed32", "RepeatedInt32", "RepeatedFixed64", "RepeatedInt64", "RepeatedFloat", "RepeatedUint64" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.TestCommentInjectionMessage), global::Google.Protobuf.TestProtos.TestCommentInjectionMessage.Parser, new[]{ "A" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.FooRequest), global::Google.Protobuf.TestProtos.FooRequest.Parser, null, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.FooResponse), global::Google.Protobuf.TestProtos.FooResponse.Parser, null, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.FooClientMessage), global::Google.Protobuf.TestProtos.FooClientMessage.Parser, null, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.FooServerMessage), global::Google.Protobuf.TestProtos.FooServerMessage.Parser, null, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.BarRequest), global::Google.Protobuf.TestProtos.BarRequest.Parser, null, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.TestProtos.BarResponse), global::Google.Protobuf.TestProtos.BarResponse.Parser, 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), }, 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.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) })); } #endregion @@ -459,7 +459,7 @@ namespace Google.Protobuf.TestProtos { public string SingleString { get { return singleString_; } set { - singleString_ = pb::Preconditions.CheckNotNull(value, "value"); + singleString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -469,7 +469,7 @@ namespace Google.Protobuf.TestProtos { public pb::ByteString SingleBytes { get { return singleBytes_; } set { - singleBytes_ = pb::Preconditions.CheckNotNull(value, "value"); + singleBytes_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -775,7 +775,7 @@ namespace Google.Protobuf.TestProtos { public string OneofString { get { return oneofFieldCase_ == OneofFieldOneofCase.OneofString ? (string) oneofField_ : ""; } set { - oneofField_ = pb::Preconditions.CheckNotNull(value, "value"); + oneofField_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); oneofFieldCase_ = OneofFieldOneofCase.OneofString; } } @@ -785,7 +785,7 @@ namespace Google.Protobuf.TestProtos { public pb::ByteString OneofBytes { get { return oneofFieldCase_ == OneofFieldOneofCase.OneofBytes ? (pb::ByteString) oneofField_ : pb::ByteString.Empty; } set { - oneofField_ = pb::Preconditions.CheckNotNull(value, "value"); + oneofField_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); oneofFieldCase_ = OneofFieldOneofCase.OneofBytes; } } @@ -2787,7 +2787,7 @@ namespace Google.Protobuf.TestProtos { public string StringField { get { return stringField_; } set { - stringField_ = pb::Preconditions.CheckNotNull(value, "value"); + stringField_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -3045,7 +3045,7 @@ namespace Google.Protobuf.TestProtos { public string MyString { get { return myString_; } set { - myString_ = pb::Preconditions.CheckNotNull(value, "value"); + myString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -3480,7 +3480,7 @@ namespace Google.Protobuf.TestProtos { public string Data { get { return data_; } set { - data_ = pb::Preconditions.CheckNotNull(value, "value"); + data_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -3678,7 +3678,7 @@ namespace Google.Protobuf.TestProtos { public pb::ByteString Data { get { return data_; } set { - data_ = pb::Preconditions.CheckNotNull(value, "value"); + data_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -3781,7 +3781,7 @@ namespace Google.Protobuf.TestProtos { public pb::ByteString Data { get { return data_; } set { - data_ = pb::Preconditions.CheckNotNull(value, "value"); + data_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -4425,7 +4425,7 @@ namespace Google.Protobuf.TestProtos { public string FooString { get { return fooCase_ == FooOneofCase.FooString ? (string) foo_ : ""; } set { - foo_ = pb::Preconditions.CheckNotNull(value, "value"); + foo_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); fooCase_ = FooOneofCase.FooString; } } @@ -5528,7 +5528,7 @@ namespace Google.Protobuf.TestProtos { public string A { get { return a_; } set { - a_ = pb::Preconditions.CheckNotNull(value, "value"); + a_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs index 2079a960..ae12f4a4 100644 --- a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs +++ b/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs @@ -162,11 +162,11 @@ namespace Google.Protobuf.TestProtos { "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::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(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::GeneratedCodeInfo(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::GeneratedCodeInfo(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::GeneratedCodeInfo(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::GeneratedCodeInfo[] { 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 diff --git a/csharp/src/Google.Protobuf/CodedInputStream.cs b/csharp/src/Google.Protobuf/CodedInputStream.cs index 65d0e710..91bed8e3 100644 --- a/csharp/src/Google.Protobuf/CodedInputStream.cs +++ b/csharp/src/Google.Protobuf/CodedInputStream.cs @@ -115,7 +115,7 @@ namespace Google.Protobuf /// <summary>
/// Creates a new CodedInputStream reading data from the given byte array.
/// </summary>
- public CodedInputStream(byte[] buffer) : this(null, Preconditions.CheckNotNull(buffer, "buffer"), 0, buffer.Length)
+ public CodedInputStream(byte[] buffer) : this(null, ProtoPreconditions.CheckNotNull(buffer, "buffer"), 0, buffer.Length)
{
}
@@ -123,7 +123,7 @@ namespace Google.Protobuf /// Creates a new CodedInputStream that reads from the given byte array slice.
/// </summary>
public CodedInputStream(byte[] buffer, int offset, int length)
- : this(null, Preconditions.CheckNotNull(buffer, "buffer"), offset, offset + length)
+ : this(null, ProtoPreconditions.CheckNotNull(buffer, "buffer"), offset, offset + length)
{
if (offset < 0 || offset > buffer.Length)
{
@@ -140,7 +140,7 @@ namespace Google.Protobuf /// </summary>
public CodedInputStream(Stream input) : this(input, new byte[BufferSize], 0, 0)
{
- Preconditions.CheckNotNull(input, "input");
+ ProtoPreconditions.CheckNotNull(input, "input");
}
/// <summary>
diff --git a/csharp/src/Google.Protobuf/Collections/MapField.cs b/csharp/src/Google.Protobuf/Collections/MapField.cs index 04754ae3..90a5ff1a 100644 --- a/csharp/src/Google.Protobuf/Collections/MapField.cs +++ b/csharp/src/Google.Protobuf/Collections/MapField.cs @@ -123,7 +123,7 @@ namespace Google.Protobuf.Collections /// <returns><c>true</c> if the map contains the given key; <c>false</c> otherwise.</returns> public bool ContainsKey(TKey key) { - Preconditions.CheckNotNullUnconstrained(key, "key"); + ProtoPreconditions.CheckNotNullUnconstrained(key, "key"); return map.ContainsKey(key); } @@ -140,7 +140,7 @@ namespace Google.Protobuf.Collections /// <returns><c>true</c> if the map contained the given key before the entry was removed; <c>false</c> otherwise.</returns> public bool Remove(TKey key) { - Preconditions.CheckNotNullUnconstrained(key, "key"); + ProtoPreconditions.CheckNotNullUnconstrained(key, "key"); LinkedListNode<KeyValuePair<TKey, TValue>> node; if (map.TryGetValue(key, out node)) { @@ -188,7 +188,7 @@ namespace Google.Protobuf.Collections { get { - Preconditions.CheckNotNullUnconstrained(key, "key"); + ProtoPreconditions.CheckNotNullUnconstrained(key, "key"); TValue value; if (TryGetValue(key, out value)) { @@ -198,11 +198,11 @@ namespace Google.Protobuf.Collections } set { - Preconditions.CheckNotNullUnconstrained(key, "key"); + ProtoPreconditions.CheckNotNullUnconstrained(key, "key"); // value == null check here is redundant, but avoids boxing. if (value == null) { - Preconditions.CheckNotNullUnconstrained(value, "value"); + ProtoPreconditions.CheckNotNullUnconstrained(value, "value"); } LinkedListNode<KeyValuePair<TKey, TValue>> node; var pair = new KeyValuePair<TKey, TValue>(key, value); @@ -234,7 +234,7 @@ namespace Google.Protobuf.Collections /// <param name="entries">The entries to add to the map.</param> public void Add(IDictionary<TKey, TValue> entries) { - Preconditions.CheckNotNull(entries, "entries"); + ProtoPreconditions.CheckNotNull(entries, "entries"); foreach (var pair in entries) { Add(pair.Key, pair.Value); @@ -501,7 +501,7 @@ namespace Google.Protobuf.Collections void IDictionary.Remove(object key) { - Preconditions.CheckNotNull(key, "key"); + ProtoPreconditions.CheckNotNull(key, "key"); if (!(key is TKey)) { return; @@ -530,7 +530,7 @@ namespace Google.Protobuf.Collections { get { - Preconditions.CheckNotNull(key, "key"); + ProtoPreconditions.CheckNotNull(key, "key"); if (!(key is TKey)) { return null; diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/csharp/src/Google.Protobuf/Google.Protobuf.csproj index f95bae07..ef524baf 100644 --- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj +++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj @@ -64,7 +64,7 @@ <NoStdLib>true</NoStdLib>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<SignAssembly>True</SignAssembly>
- <AssemblyOriginatorKeyFile>C:\keys\Google.Protobuf.snk</AssemblyOriginatorKeyFile>
+ <AssemblyOriginatorKeyFile>..\..\keys\Google.Protobuf.snk</AssemblyOriginatorKeyFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
@@ -109,7 +109,7 @@ <Compile Include="Reflection\FieldDescriptor.cs" />
<Compile Include="Reflection\FieldType.cs" />
<Compile Include="Reflection\FileDescriptor.cs" />
- <Compile Include="Reflection\GeneratedCodeInfo.cs" />
+ <Compile Include="Reflection\GeneratedClrTypeInfo.cs" />
<Compile Include="Reflection\IDescriptor.cs" />
<Compile Include="Reflection\IFieldAccessor.cs" />
<Compile Include="Reflection\MapFieldAccessor.cs" />
@@ -123,7 +123,7 @@ <Compile Include="Reflection\RepeatedFieldAccessor.cs" />
<Compile Include="Reflection\ServiceDescriptor.cs" />
<Compile Include="Reflection\SingleFieldAccessor.cs" />
- <Compile Include="Preconditions.cs" />
+ <Compile Include="ProtoPreconditions.cs" />
<Compile Include="Reflection\TypeRegistry.cs" />
<Compile Include="WellKnownTypes\Any.cs" />
<Compile Include="WellKnownTypes\AnyPartial.cs" />
diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.nuspec b/csharp/src/Google.Protobuf/Google.Protobuf.nuspec index 2f691e3c..d5302544 100644 --- a/csharp/src/Google.Protobuf/Google.Protobuf.nuspec +++ b/csharp/src/Google.Protobuf/Google.Protobuf.nuspec @@ -15,6 +15,16 @@ <copyright>Copyright 2015, Google Inc.</copyright> <tags>Protocol Buffers Binary Serialization Format Google proto proto3</tags> <dependencies> + <!-- Dependencies for older, monolithic-assembly platforms --> + <group targetFramework="net45" /> + <group targetFramework="wp8" /> + <group targetFramework="win8" /> + <group targetFramework="wpa81" /> + <group targetFramework="xamarin.ios" /> + <group targetFramework="monotouch" /> + <group targetFramework="monoandroid" /> + + <!-- Dependencies for newer, more granular platforms (.NET Core etc) --> <group targetFramework="dotnet"> <dependency id="System.Collections" version="4.0.0" /> <dependency id="System.Diagnostics.Debug" version="4.0.0" /> diff --git a/csharp/src/Google.Protobuf/JsonFormatter.cs b/csharp/src/Google.Protobuf/JsonFormatter.cs index 17495747..60f61fc8 100644 --- a/csharp/src/Google.Protobuf/JsonFormatter.cs +++ b/csharp/src/Google.Protobuf/JsonFormatter.cs @@ -141,7 +141,7 @@ namespace Google.Protobuf /// <returns>The formatted message.</returns> public string Format(IMessage message) { - Preconditions.CheckNotNull(message, nameof(message)); + ProtoPreconditions.CheckNotNull(message, nameof(message)); StringBuilder builder = new StringBuilder(); if (message.Descriptor.IsWellKnownType) { @@ -173,7 +173,7 @@ namespace Google.Protobuf /// <returns>The diagnostic-only JSON representation of the message</returns> public static string ToDiagnosticString(IMessage message) { - Preconditions.CheckNotNull(message, nameof(message)); + ProtoPreconditions.CheckNotNull(message, nameof(message)); return diagnosticFormatter.Format(message); } @@ -858,7 +858,7 @@ namespace Google.Protobuf public Settings(bool formatDefaultValues, TypeRegistry typeRegistry) { FormatDefaultValues = formatDefaultValues; - TypeRegistry = Preconditions.CheckNotNull(typeRegistry, nameof(typeRegistry)); + TypeRegistry = ProtoPreconditions.CheckNotNull(typeRegistry, nameof(typeRegistry)); } } } diff --git a/csharp/src/Google.Protobuf/JsonParser.cs b/csharp/src/Google.Protobuf/JsonParser.cs index c07b16ea..80d3013d 100644 --- a/csharp/src/Google.Protobuf/JsonParser.cs +++ b/csharp/src/Google.Protobuf/JsonParser.cs @@ -374,7 +374,7 @@ namespace Google.Protobuf /// <exception cref="InvalidProtocolBufferException">The JSON does not represent a Protocol Buffers message correctly</exception> public T Parse<T>(string json) where T : IMessage, new() { - Preconditions.CheckNotNull(json, nameof(json)); + ProtoPreconditions.CheckNotNull(json, nameof(json)); return Parse<T>(new StringReader(json)); } @@ -387,7 +387,7 @@ namespace Google.Protobuf /// <exception cref="InvalidProtocolBufferException">The JSON does not represent a Protocol Buffers message correctly</exception> public T Parse<T>(TextReader jsonReader) where T : IMessage, new() { - Preconditions.CheckNotNull(jsonReader, nameof(jsonReader)); + ProtoPreconditions.CheckNotNull(jsonReader, nameof(jsonReader)); T message = new T(); Merge(message, jsonReader); return message; @@ -402,8 +402,8 @@ namespace Google.Protobuf /// <exception cref="InvalidProtocolBufferException">The JSON does not represent a Protocol Buffers message correctly</exception> public IMessage Parse(string json, MessageDescriptor descriptor) { - Preconditions.CheckNotNull(json, nameof(json)); - Preconditions.CheckNotNull(descriptor, nameof(descriptor)); + ProtoPreconditions.CheckNotNull(json, nameof(json)); + ProtoPreconditions.CheckNotNull(descriptor, nameof(descriptor)); return Parse(new StringReader(json), descriptor); } @@ -416,8 +416,8 @@ namespace Google.Protobuf /// <exception cref="InvalidProtocolBufferException">The JSON does not represent a Protocol Buffers message correctly</exception> public IMessage Parse(TextReader jsonReader, MessageDescriptor descriptor) { - Preconditions.CheckNotNull(jsonReader, nameof(jsonReader)); - Preconditions.CheckNotNull(descriptor, nameof(descriptor)); + ProtoPreconditions.CheckNotNull(jsonReader, nameof(jsonReader)); + ProtoPreconditions.CheckNotNull(descriptor, nameof(descriptor)); IMessage message = descriptor.Parser.CreateTemplate(); Merge(message, jsonReader); return message; @@ -1011,7 +1011,7 @@ namespace Google.Protobuf public Settings(int recursionLimit, TypeRegistry typeRegistry) { RecursionLimit = recursionLimit; - TypeRegistry = Preconditions.CheckNotNull(typeRegistry, nameof(typeRegistry)); + TypeRegistry = ProtoPreconditions.CheckNotNull(typeRegistry, nameof(typeRegistry)); } } } diff --git a/csharp/src/Google.Protobuf/MessageExtensions.cs b/csharp/src/Google.Protobuf/MessageExtensions.cs index d2d057c0..047156c3 100644 --- a/csharp/src/Google.Protobuf/MessageExtensions.cs +++ b/csharp/src/Google.Protobuf/MessageExtensions.cs @@ -46,8 +46,8 @@ namespace Google.Protobuf /// <param name="data">The data to merge, which must be protobuf-encoded binary data.</param> public static void MergeFrom(this IMessage message, byte[] data) { - Preconditions.CheckNotNull(message, "message"); - Preconditions.CheckNotNull(data, "data"); + ProtoPreconditions.CheckNotNull(message, "message"); + ProtoPreconditions.CheckNotNull(data, "data"); CodedInputStream input = new CodedInputStream(data); message.MergeFrom(input); input.CheckReadEndOfStreamTag(); @@ -60,8 +60,8 @@ namespace Google.Protobuf /// <param name="data">The data to merge, which must be protobuf-encoded binary data.</param> public static void MergeFrom(this IMessage message, ByteString data) { - Preconditions.CheckNotNull(message, "message"); - Preconditions.CheckNotNull(data, "data"); + ProtoPreconditions.CheckNotNull(message, "message"); + ProtoPreconditions.CheckNotNull(data, "data"); CodedInputStream input = data.CreateCodedInput(); message.MergeFrom(input); input.CheckReadEndOfStreamTag(); @@ -74,8 +74,8 @@ namespace Google.Protobuf /// <param name="input">Stream containing the data to merge, which must be protobuf-encoded binary data.</param> public static void MergeFrom(this IMessage message, Stream input) { - Preconditions.CheckNotNull(message, "message"); - Preconditions.CheckNotNull(input, "input"); + ProtoPreconditions.CheckNotNull(message, "message"); + ProtoPreconditions.CheckNotNull(input, "input"); CodedInputStream codedInput = new CodedInputStream(input); message.MergeFrom(codedInput); codedInput.CheckReadEndOfStreamTag(); @@ -92,8 +92,8 @@ namespace Google.Protobuf /// <param name="input">Stream containing the data to merge, which must be protobuf-encoded binary data.</param> public static void MergeDelimitedFrom(this IMessage message, Stream input) { - Preconditions.CheckNotNull(message, "message"); - Preconditions.CheckNotNull(input, "input"); + ProtoPreconditions.CheckNotNull(message, "message"); + ProtoPreconditions.CheckNotNull(input, "input"); int size = (int) CodedInputStream.ReadRawVarint32(input); Stream limitedStream = new LimitedInputStream(input, size); message.MergeFrom(limitedStream); @@ -106,7 +106,7 @@ namespace Google.Protobuf /// <returns>The message data as a byte array.</returns> public static byte[] ToByteArray(this IMessage message) { - Preconditions.CheckNotNull(message, "message"); + ProtoPreconditions.CheckNotNull(message, "message"); byte[] result = new byte[message.CalculateSize()]; CodedOutputStream output = new CodedOutputStream(result); message.WriteTo(output); @@ -121,8 +121,8 @@ namespace Google.Protobuf /// <param name="output">The stream to write to.</param> public static void WriteTo(this IMessage message, Stream output) { - Preconditions.CheckNotNull(message, "message"); - Preconditions.CheckNotNull(output, "output"); + ProtoPreconditions.CheckNotNull(message, "message"); + ProtoPreconditions.CheckNotNull(output, "output"); CodedOutputStream codedOutput = new CodedOutputStream(output); message.WriteTo(codedOutput); codedOutput.Flush(); @@ -135,8 +135,8 @@ namespace Google.Protobuf /// <param name="output">The output stream to write to.</param> public static void WriteDelimitedTo(this IMessage message, Stream output) { - Preconditions.CheckNotNull(message, "message"); - Preconditions.CheckNotNull(output, "output"); + ProtoPreconditions.CheckNotNull(message, "message"); + ProtoPreconditions.CheckNotNull(output, "output"); CodedOutputStream codedOutput = new CodedOutputStream(output); codedOutput.WriteRawVarint32((uint)message.CalculateSize()); message.WriteTo(codedOutput); @@ -150,7 +150,7 @@ namespace Google.Protobuf /// <returns>The message data as a byte string.</returns> public static ByteString ToByteString(this IMessage message) { - Preconditions.CheckNotNull(message, "message"); + ProtoPreconditions.CheckNotNull(message, "message"); return ByteString.AttachBytes(message.ToByteArray()); } } diff --git a/csharp/src/Google.Protobuf/MessageParser.cs b/csharp/src/Google.Protobuf/MessageParser.cs index 81be3c2a..8889638b 100644 --- a/csharp/src/Google.Protobuf/MessageParser.cs +++ b/csharp/src/Google.Protobuf/MessageParser.cs @@ -64,7 +64,7 @@ namespace Google.Protobuf /// <returns>The newly parsed message.</returns> public IMessage ParseFrom(byte[] data) { - Preconditions.CheckNotNull(data, "data"); + ProtoPreconditions.CheckNotNull(data, "data"); IMessage message = factory(); message.MergeFrom(data); return message; @@ -77,7 +77,7 @@ namespace Google.Protobuf /// <returns>The parsed message.</returns> public IMessage ParseFrom(ByteString data) { - Preconditions.CheckNotNull(data, "data"); + ProtoPreconditions.CheckNotNull(data, "data"); IMessage message = factory(); message.MergeFrom(data); return message; @@ -191,7 +191,7 @@ namespace Google.Protobuf /// <returns>The newly parsed message.</returns> public new T ParseFrom(byte[] data) { - Preconditions.CheckNotNull(data, "data"); + ProtoPreconditions.CheckNotNull(data, "data"); T message = factory(); message.MergeFrom(data); return message; @@ -204,7 +204,7 @@ namespace Google.Protobuf /// <returns>The parsed message.</returns> public new T ParseFrom(ByteString data) { - Preconditions.CheckNotNull(data, "data"); + ProtoPreconditions.CheckNotNull(data, "data"); T message = factory(); message.MergeFrom(data); return message; diff --git a/csharp/src/Google.Protobuf/Preconditions.cs b/csharp/src/Google.Protobuf/ProtoPreconditions.cs index 2db35ff6..abaeb9b4 100644 --- a/csharp/src/Google.Protobuf/Preconditions.cs +++ b/csharp/src/Google.Protobuf/ProtoPreconditions.cs @@ -35,9 +35,14 @@ using System; namespace Google.Protobuf { /// <summary> - /// Helper methods for throwing exceptions + /// Helper methods for throwing exceptions when preconditions are not met. /// </summary> - public static class Preconditions + /// <remarks> + /// This class is used internally and by generated code; it is not particularly + /// expected to be used from application code, although nothing prevents it + /// from being used that way. + /// </remarks> + public static class ProtoPreconditions { /// <summary> /// Throws an ArgumentNullException if the given value is null, otherwise diff --git a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs index d29424ad..7de7b5fc 100644 --- a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs @@ -80,7 +80,7 @@ namespace Google.Protobuf.Reflection { "EhMKC291dHB1dF90eXBlGAMgASgJEi8KB29wdGlvbnMYBCABKAsyHi5nb29n", "bGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxIfChBjbGllbnRfc3RyZWFtaW5n", "GAUgASgIOgVmYWxzZRIfChBzZXJ2ZXJfc3RyZWFtaW5nGAYgASgIOgVmYWxz", - "ZSKqBQoLRmlsZU9wdGlvbnMSFAoMamF2YV9wYWNrYWdlGAEgASgJEhwKFGph", + "ZSKuBQoLRmlsZU9wdGlvbnMSFAoMamF2YV9wYWNrYWdlGAEgASgJEhwKFGph", "dmFfb3V0ZXJfY2xhc3NuYW1lGAggASgJEiIKE2phdmFfbXVsdGlwbGVfZmls", "ZXMYCiABKAg6BWZhbHNlEiwKHWphdmFfZ2VuZXJhdGVfZXF1YWxzX2FuZF9o", "YXNoGBQgASgIOgVmYWxzZRIlChZqYXZhX3N0cmluZ19jaGVja191dGY4GBsg", @@ -91,72 +91,77 @@ namespace Google.Protobuf.Reflection { "cHlfZ2VuZXJpY19zZXJ2aWNlcxgSIAEoCDoFZmFsc2USGQoKZGVwcmVjYXRl", "ZBgXIAEoCDoFZmFsc2USHwoQY2NfZW5hYmxlX2FyZW5hcxgfIAEoCDoFZmFs", "c2USGQoRb2JqY19jbGFzc19wcmVmaXgYJCABKAkSGAoQY3NoYXJwX25hbWVz", - "cGFjZRglIAEoCRInCh9qYXZhbmFub191c2VfZGVwcmVjYXRlZF9wYWNrYWdl", - "GCYgASgIEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2ds", - "ZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uIjoKDE9wdGltaXplTW9k", - "ZRIJCgVTUEVFRBABEg0KCUNPREVfU0laRRACEhAKDExJVEVfUlVOVElNRRAD", - "KgkI6AcQgICAgAIi5gEKDk1lc3NhZ2VPcHRpb25zEiYKF21lc3NhZ2Vfc2V0", - "X3dpcmVfZm9ybWF0GAEgASgIOgVmYWxzZRIuCh9ub19zdGFuZGFyZF9kZXNj", - "cmlwdG9yX2FjY2Vzc29yGAIgASgIOgVmYWxzZRIZCgpkZXByZWNhdGVkGAMg", - "ASgIOgVmYWxzZRIRCgltYXBfZW50cnkYByABKAgSQwoUdW5pbnRlcnByZXRl", - "ZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0", - "ZWRPcHRpb24qCQjoBxCAgICAAiKYAwoMRmllbGRPcHRpb25zEjoKBWN0eXBl", - "GAEgASgOMiMuZ29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucy5DVHlwZToG", - "U1RSSU5HEg4KBnBhY2tlZBgCIAEoCBI/CgZqc3R5cGUYBiABKA4yJC5nb29n", - "bGUucHJvdG9idWYuRmllbGRPcHRpb25zLkpTVHlwZToJSlNfTk9STUFMEhMK", - "BGxhenkYBSABKAg6BWZhbHNlEhkKCmRlcHJlY2F0ZWQYAyABKAg6BWZhbHNl", - "EhMKBHdlYWsYCiABKAg6BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9u", - "GOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9u", - "Ii8KBUNUeXBlEgoKBlNUUklORxAAEggKBENPUkQQARIQCgxTVFJJTkdfUElF", - "Q0UQAiI1CgZKU1R5cGUSDQoJSlNfTk9STUFMEAASDQoJSlNfU1RSSU5HEAES", - "DQoJSlNfTlVNQkVSEAIqCQjoBxCAgICAAiKNAQoLRW51bU9wdGlvbnMSEwoL", - "YWxsb3dfYWxpYXMYAiABKAgSGQoKZGVwcmVjYXRlZBgDIAEoCDoFZmFsc2US", - "QwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnByb3Rv", - "YnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCAgICAAiJ9ChBFbnVtVmFs", - "dWVPcHRpb25zEhkKCmRlcHJlY2F0ZWQYASABKAg6BWZhbHNlEkMKFHVuaW50", - "ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5Vbmlu", - "dGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIiewoOU2VydmljZU9wdGlvbnMS", - "GQoKZGVwcmVjYXRlZBghIAEoCDoFZmFsc2USQwoUdW5pbnRlcnByZXRlZF9v", - "cHRpb24Y5wcgAygLMiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRP", - "cHRpb24qCQjoBxCAgICAAiJ6Cg1NZXRob2RPcHRpb25zEhkKCmRlcHJlY2F0", - "ZWQYISABKAg6BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMo", - "CzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQ", - "gICAgAIingIKE1VuaW50ZXJwcmV0ZWRPcHRpb24SOwoEbmFtZRgCIAMoCzIt", - "Lmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uLk5hbWVQYXJ0", - "EhgKEGlkZW50aWZpZXJfdmFsdWUYAyABKAkSGgoScG9zaXRpdmVfaW50X3Zh", - "bHVlGAQgASgEEhoKEm5lZ2F0aXZlX2ludF92YWx1ZRgFIAEoAxIUCgxkb3Vi", - "bGVfdmFsdWUYBiABKAESFAoMc3RyaW5nX3ZhbHVlGAcgASgMEhcKD2FnZ3Jl", - "Z2F0ZV92YWx1ZRgIIAEoCRozCghOYW1lUGFydBIRCgluYW1lX3BhcnQYASAC", - "KAkSFAoMaXNfZXh0ZW5zaW9uGAIgAigIItUBCg5Tb3VyY2VDb2RlSW5mbxI6", - "Cghsb2NhdGlvbhgBIAMoCzIoLmdvb2dsZS5wcm90b2J1Zi5Tb3VyY2VDb2Rl", - "SW5mby5Mb2NhdGlvbhqGAQoITG9jYXRpb24SEAoEcGF0aBgBIAMoBUICEAES", - "EAoEc3BhbhgCIAMoBUICEAESGAoQbGVhZGluZ19jb21tZW50cxgDIAEoCRIZ", - "ChF0cmFpbGluZ19jb21tZW50cxgEIAEoCRIhChlsZWFkaW5nX2RldGFjaGVk", - "X2NvbW1lbnRzGAYgAygJQlgKE2NvbS5nb29nbGUucHJvdG9idWZCEERlc2Ny", - "aXB0b3JQcm90b3NIAVoKZGVzY3JpcHRvcqICA0dQQqoCGkdvb2dsZS5Qcm90", - "b2J1Zi5SZWZsZWN0aW9u")); + "cGFjZRglIAEoCRIrCh9qYXZhbmFub191c2VfZGVwcmVjYXRlZF9wYWNrYWdl", + "GCYgASgIQgIYARJDChR1bmludGVycHJldGVkX29wdGlvbhjnByADKAsyJC5n", + "b29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbiI6CgxPcHRpbWl6", + "ZU1vZGUSCQoFU1BFRUQQARINCglDT0RFX1NJWkUQAhIQCgxMSVRFX1JVTlRJ", + "TUUQAyoJCOgHEICAgIACIuYBCg5NZXNzYWdlT3B0aW9ucxImChdtZXNzYWdl", + "X3NldF93aXJlX2Zvcm1hdBgBIAEoCDoFZmFsc2USLgofbm9fc3RhbmRhcmRf", + "ZGVzY3JpcHRvcl9hY2Nlc3NvchgCIAEoCDoFZmFsc2USGQoKZGVwcmVjYXRl", + "ZBgDIAEoCDoFZmFsc2USEQoJbWFwX2VudHJ5GAcgASgIEkMKFHVuaW50ZXJw", + "cmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVy", + "cHJldGVkT3B0aW9uKgkI6AcQgICAgAIimAMKDEZpZWxkT3B0aW9ucxI6CgVj", + "dHlwZRgBIAEoDjIjLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE9wdGlvbnMuQ1R5", + "cGU6BlNUUklORxIOCgZwYWNrZWQYAiABKAgSPwoGanN0eXBlGAYgASgOMiQu", + "Z29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucy5KU1R5cGU6CUpTX05PUk1B", + "TBITCgRsYXp5GAUgASgIOgVmYWxzZRIZCgpkZXByZWNhdGVkGAMgASgIOgVm", + "YWxzZRITCgR3ZWFrGAogASgIOgVmYWxzZRJDChR1bmludGVycHJldGVkX29w", + "dGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9w", + "dGlvbiIvCgVDVHlwZRIKCgZTVFJJTkcQABIICgRDT1JEEAESEAoMU1RSSU5H", + "X1BJRUNFEAIiNQoGSlNUeXBlEg0KCUpTX05PUk1BTBAAEg0KCUpTX1NUUklO", + "RxABEg0KCUpTX05VTUJFUhACKgkI6AcQgICAgAIijQEKC0VudW1PcHRpb25z", + "EhMKC2FsbG93X2FsaWFzGAIgASgIEhkKCmRlcHJlY2F0ZWQYAyABKAg6BWZh", + "bHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5w", + "cm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIifQoQRW51", + "bVZhbHVlT3B0aW9ucxIZCgpkZXByZWNhdGVkGAEgASgIOgVmYWxzZRJDChR1", + "bmludGVycHJldGVkX29wdGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYu", + "VW5pbnRlcnByZXRlZE9wdGlvbioJCOgHEICAgIACInsKDlNlcnZpY2VPcHRp", + "b25zEhkKCmRlcHJlY2F0ZWQYISABKAg6BWZhbHNlEkMKFHVuaW50ZXJwcmV0", + "ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJl", + "dGVkT3B0aW9uKgkI6AcQgICAgAIiegoNTWV0aG9kT3B0aW9ucxIZCgpkZXBy", + "ZWNhdGVkGCEgASgIOgVmYWxzZRJDChR1bmludGVycHJldGVkX29wdGlvbhjn", + "ByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbioJ", + "COgHEICAgIACIp4CChNVbmludGVycHJldGVkT3B0aW9uEjsKBG5hbWUYAiAD", + "KAsyLS5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbi5OYW1l", + "UGFydBIYChBpZGVudGlmaWVyX3ZhbHVlGAMgASgJEhoKEnBvc2l0aXZlX2lu", + "dF92YWx1ZRgEIAEoBBIaChJuZWdhdGl2ZV9pbnRfdmFsdWUYBSABKAMSFAoM", + "ZG91YmxlX3ZhbHVlGAYgASgBEhQKDHN0cmluZ192YWx1ZRgHIAEoDBIXCg9h", + "Z2dyZWdhdGVfdmFsdWUYCCABKAkaMwoITmFtZVBhcnQSEQoJbmFtZV9wYXJ0", + "GAEgAigJEhQKDGlzX2V4dGVuc2lvbhgCIAIoCCLVAQoOU291cmNlQ29kZUlu", + "Zm8SOgoIbG9jYXRpb24YASADKAsyKC5nb29nbGUucHJvdG9idWYuU291cmNl", + "Q29kZUluZm8uTG9jYXRpb24ahgEKCExvY2F0aW9uEhAKBHBhdGgYASADKAVC", + "AhABEhAKBHNwYW4YAiADKAVCAhABEhgKEGxlYWRpbmdfY29tbWVudHMYAyAB", + "KAkSGQoRdHJhaWxpbmdfY29tbWVudHMYBCABKAkSIQoZbGVhZGluZ19kZXRh", + "Y2hlZF9jb21tZW50cxgGIAMoCSKnAQoRR2VuZXJhdGVkQ29kZUluZm8SQQoK", + "YW5ub3RhdGlvbhgBIAMoCzItLmdvb2dsZS5wcm90b2J1Zi5HZW5lcmF0ZWRD", + "b2RlSW5mby5Bbm5vdGF0aW9uGk8KCkFubm90YXRpb24SEAoEcGF0aBgBIAMo", + "BUICEAESEwoLc291cmNlX2ZpbGUYAiABKAkSDQoFYmVnaW4YAyABKAUSCwoD", + "ZW5kGAQgASgFQlgKE2NvbS5nb29nbGUucHJvdG9idWZCEERlc2NyaXB0b3JQ", + "cm90b3NIAVoKZGVzY3JpcHRvcqICA0dQQqoCGkdvb2dsZS5Qcm90b2J1Zi5S", + "ZWZsZWN0aW9u")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Reflection.FileDescriptorSet), global::Google.Protobuf.Reflection.FileDescriptorSet.Parser, new[]{ "File" }, null, null, null), - new pbr::GeneratedCodeInfo(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::GeneratedCodeInfo(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::GeneratedCodeInfo[] { new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange), global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange.Parser, new[]{ "Start", "End" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange), global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange.Parser, new[]{ "Start", "End" }, null, null, null)}), - new pbr::GeneratedCodeInfo(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::GeneratedCodeInfo(typeof(global::Google.Protobuf.Reflection.OneofDescriptorProto), global::Google.Protobuf.Reflection.OneofDescriptorProto.Parser, new[]{ "Name" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto), global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser, new[]{ "Name", "Value", "Options" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueDescriptorProto), global::Google.Protobuf.Reflection.EnumValueDescriptorProto.Parser, new[]{ "Name", "Number", "Options" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Reflection.ServiceDescriptorProto), global::Google.Protobuf.Reflection.ServiceDescriptorProto.Parser, new[]{ "Name", "Method", "Options" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Reflection.MethodDescriptorProto), global::Google.Protobuf.Reflection.MethodDescriptorProto.Parser, new[]{ "Name", "InputType", "OutputType", "Options", "ClientStreaming", "ServerStreaming" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Reflection.FileOptions), global::Google.Protobuf.Reflection.FileOptions.Parser, new[]{ "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "JavaStringCheckUtf8", "OptimizeFor", "GoPackage", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "JavananoUseDeprecatedPackage", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) }, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Reflection.MessageOptions), global::Google.Protobuf.Reflection.MessageOptions.Parser, new[]{ "MessageSetWireFormat", "NoStandardDescriptorAccessor", "Deprecated", "MapEntry", "UninterpretedOption" }, null, null, null), - new pbr::GeneratedCodeInfo(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::GeneratedCodeInfo(typeof(global::Google.Protobuf.Reflection.EnumOptions), global::Google.Protobuf.Reflection.EnumOptions.Parser, new[]{ "AllowAlias", "Deprecated", "UninterpretedOption" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueOptions), global::Google.Protobuf.Reflection.EnumValueOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Reflection.ServiceOptions), global::Google.Protobuf.Reflection.ServiceOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Reflection.MethodOptions), global::Google.Protobuf.Reflection.MethodOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption), global::Google.Protobuf.Reflection.UninterpretedOption.Parser, new[]{ "Name", "IdentifierValue", "PositiveIntValue", "NegativeIntValue", "DoubleValue", "StringValue", "AggregateValue" }, null, null, new pbr::GeneratedCodeInfo[] { new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart), global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart.Parser, new[]{ "NamePart_", "IsExtension" }, null, null, null)}), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo), global::Google.Protobuf.Reflection.SourceCodeInfo.Parser, new[]{ "Location" }, null, null, new pbr::GeneratedCodeInfo[] { new pbr::GeneratedCodeInfo(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(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" }, 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.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" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto), global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser, new[]{ "Name", "Value", "Options" }, 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", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "JavananoUseDeprecatedPackage", "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.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", "UninterpretedOption" }, null, 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, 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 @@ -312,7 +317,7 @@ namespace Google.Protobuf.Reflection { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -325,7 +330,7 @@ namespace Google.Protobuf.Reflection { public string Package { get { return package_; } set { - package_ = pb::Preconditions.CheckNotNull(value, "value"); + package_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -441,7 +446,7 @@ namespace Google.Protobuf.Reflection { public string Syntax { get { return syntax_; } set { - syntax_ = pb::Preconditions.CheckNotNull(value, "value"); + syntax_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -697,7 +702,7 @@ namespace Google.Protobuf.Reflection { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -1270,7 +1275,7 @@ namespace Google.Protobuf.Reflection { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -1321,7 +1326,7 @@ namespace Google.Protobuf.Reflection { public string TypeName { get { return typeName_; } set { - typeName_ = pb::Preconditions.CheckNotNull(value, "value"); + typeName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -1335,7 +1340,7 @@ namespace Google.Protobuf.Reflection { public string Extendee { get { return extendee_; } set { - extendee_ = pb::Preconditions.CheckNotNull(value, "value"); + extendee_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -1352,7 +1357,7 @@ namespace Google.Protobuf.Reflection { public string DefaultValue { get { return defaultValue_; } set { - defaultValue_ = pb::Preconditions.CheckNotNull(value, "value"); + defaultValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -1382,7 +1387,7 @@ namespace Google.Protobuf.Reflection { public string JsonName { get { return jsonName_; } set { - jsonName_ = pb::Preconditions.CheckNotNull(value, "value"); + jsonName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -1715,7 +1720,7 @@ namespace Google.Protobuf.Reflection { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -1823,7 +1828,7 @@ namespace Google.Protobuf.Reflection { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -1981,7 +1986,7 @@ namespace Google.Protobuf.Reflection { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -2147,7 +2152,7 @@ namespace Google.Protobuf.Reflection { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -2308,7 +2313,7 @@ namespace Google.Protobuf.Reflection { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -2322,7 +2327,7 @@ namespace Google.Protobuf.Reflection { public string InputType { get { return inputType_; } set { - inputType_ = pb::Preconditions.CheckNotNull(value, "value"); + inputType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -2332,7 +2337,7 @@ namespace Google.Protobuf.Reflection { public string OutputType { get { return outputType_; } set { - outputType_ = pb::Preconditions.CheckNotNull(value, "value"); + outputType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -2578,7 +2583,7 @@ namespace Google.Protobuf.Reflection { public string JavaPackage { get { return javaPackage_; } set { - javaPackage_ = pb::Preconditions.CheckNotNull(value, "value"); + javaPackage_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -2595,7 +2600,7 @@ namespace Google.Protobuf.Reflection { public string JavaOuterClassname { get { return javaOuterClassname_; } set { - javaOuterClassname_ = pb::Preconditions.CheckNotNull(value, "value"); + javaOuterClassname_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -2682,7 +2687,7 @@ namespace Google.Protobuf.Reflection { public string GoPackage { get { return goPackage_; } set { - goPackage_ = pb::Preconditions.CheckNotNull(value, "value"); + goPackage_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -2768,7 +2773,7 @@ namespace Google.Protobuf.Reflection { public string ObjcClassPrefix { get { return objcClassPrefix_; } set { - objcClassPrefix_ = pb::Preconditions.CheckNotNull(value, "value"); + objcClassPrefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -2781,7 +2786,7 @@ namespace Google.Protobuf.Reflection { public string CsharpNamespace { get { return csharpNamespace_; } set { - csharpNamespace_ = pb::Preconditions.CheckNotNull(value, "value"); + csharpNamespace_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -2792,6 +2797,7 @@ namespace Google.Protobuf.Reflection { /// Whether the nano proto compiler should generate in the deprecated non-nano /// suffixed package. /// </summary> + [global::System.ObsoleteAttribute()] public bool JavananoUseDeprecatedPackage { get { return javananoUseDeprecatedPackage_; } set { @@ -4363,7 +4369,7 @@ namespace Google.Protobuf.Reflection { public string IdentifierValue { get { return identifierValue_; } set { - identifierValue_ = pb::Preconditions.CheckNotNull(value, "value"); + identifierValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -4403,7 +4409,7 @@ namespace Google.Protobuf.Reflection { public pb::ByteString StringValue { get { return stringValue_; } set { - stringValue_ = pb::Preconditions.CheckNotNull(value, "value"); + stringValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -4413,7 +4419,7 @@ namespace Google.Protobuf.Reflection { public string AggregateValue { get { return aggregateValue_; } set { - aggregateValue_ = pb::Preconditions.CheckNotNull(value, "value"); + aggregateValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -4615,7 +4621,7 @@ namespace Google.Protobuf.Reflection { public string NamePart_ { get { return namePart_; } set { - namePart_ = pb::Preconditions.CheckNotNull(value, "value"); + namePart_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -4998,7 +5004,7 @@ namespace Google.Protobuf.Reflection { public string LeadingComments { get { return leadingComments_; } set { - leadingComments_ = pb::Preconditions.CheckNotNull(value, "value"); + leadingComments_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -5008,7 +5014,7 @@ namespace Google.Protobuf.Reflection { public string TrailingComments { get { return trailingComments_; } set { - trailingComments_ = pb::Preconditions.CheckNotNull(value, "value"); + trailingComments_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -5137,6 +5143,310 @@ namespace Google.Protobuf.Reflection { } + /// <summary> + /// Describes the relationship between generated code and its original source + /// file. A GeneratedCodeInfo message is associated with only one generated + /// source file, but may contain references to different source .proto files. + /// </summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal sealed partial class GeneratedCodeInfo : pb::IMessage<GeneratedCodeInfo> { + private static readonly pb::MessageParser<GeneratedCodeInfo> _parser = new pb::MessageParser<GeneratedCodeInfo>(() => new GeneratedCodeInfo()); + public static pb::MessageParser<GeneratedCodeInfo> Parser { get { return _parser; } } + + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[18]; } + } + + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + public GeneratedCodeInfo() { + OnConstruction(); + } + + partial void OnConstruction(); + + public GeneratedCodeInfo(GeneratedCodeInfo other) : this() { + annotation_ = other.annotation_.Clone(); + } + + public GeneratedCodeInfo Clone() { + return new GeneratedCodeInfo(this); + } + + /// <summary>Field number for the "annotation" field.</summary> + public const int AnnotationFieldNumber = 1; + private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation> _repeated_annotation_codec + = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation.Parser); + private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation> annotation_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation>(); + /// <summary> + /// An Annotation connects some span of text in generated code to an element + /// of its generating .proto file. + /// </summary> + public pbc::RepeatedField<global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation> Annotation { + get { return annotation_; } + } + + public override bool Equals(object other) { + return Equals(other as GeneratedCodeInfo); + } + + public bool Equals(GeneratedCodeInfo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!annotation_.Equals(other.annotation_)) return false; + return true; + } + + public override int GetHashCode() { + int hash = 1; + hash ^= annotation_.GetHashCode(); + return hash; + } + + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + public void WriteTo(pb::CodedOutputStream output) { + annotation_.WriteTo(output, _repeated_annotation_codec); + } + + public int CalculateSize() { + int size = 0; + size += annotation_.CalculateSize(_repeated_annotation_codec); + return size; + } + + public void MergeFrom(GeneratedCodeInfo other) { + if (other == null) { + return; + } + annotation_.Add(other.annotation_); + } + + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + annotation_.AddEntriesFrom(input, _repeated_annotation_codec); + break; + } + } + } + } + + #region Nested types + /// <summary>Container for nested types declared in the GeneratedCodeInfo message type.</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal sealed partial class Annotation : pb::IMessage<Annotation> { + private static readonly pb::MessageParser<Annotation> _parser = new pb::MessageParser<Annotation>(() => new Annotation()); + public static pb::MessageParser<Annotation> Parser { get { return _parser; } } + + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.GeneratedCodeInfo.Descriptor.NestedTypes[0]; } + } + + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + public Annotation() { + OnConstruction(); + } + + partial void OnConstruction(); + + public Annotation(Annotation other) : this() { + path_ = other.path_.Clone(); + sourceFile_ = other.sourceFile_; + begin_ = other.begin_; + end_ = other.end_; + } + + public Annotation Clone() { + return new Annotation(this); + } + + /// <summary>Field number for the "path" field.</summary> + public const int PathFieldNumber = 1; + private static readonly pb::FieldCodec<int> _repeated_path_codec + = pb::FieldCodec.ForInt32(10); + private readonly pbc::RepeatedField<int> path_ = new pbc::RepeatedField<int>(); + /// <summary> + /// Identifies the element in the original source .proto file. This field + /// is formatted the same as SourceCodeInfo.Location.path. + /// </summary> + public pbc::RepeatedField<int> Path { + get { return path_; } + } + + /// <summary>Field number for the "source_file" field.</summary> + public const int SourceFileFieldNumber = 2; + private string sourceFile_ = ""; + /// <summary> + /// Identifies the filesystem path to the original source .proto. + /// </summary> + public string SourceFile { + get { return sourceFile_; } + set { + sourceFile_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "begin" field.</summary> + public const int BeginFieldNumber = 3; + private int begin_; + /// <summary> + /// Identifies the starting offset in bytes in the generated code + /// that relates to the identified object. + /// </summary> + public int Begin { + get { return begin_; } + set { + begin_ = value; + } + } + + /// <summary>Field number for the "end" field.</summary> + public const int EndFieldNumber = 4; + private int end_; + /// <summary> + /// Identifies the ending offset in bytes in the generated code that + /// relates to the identified offset. The end offset should be one past + /// the last relevant byte (so the length of the text = end - begin). + /// </summary> + public int End { + get { return end_; } + set { + end_ = value; + } + } + + public override bool Equals(object other) { + return Equals(other as Annotation); + } + + public bool Equals(Annotation other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!path_.Equals(other.path_)) return false; + if (SourceFile != other.SourceFile) return false; + if (Begin != other.Begin) return false; + if (End != other.End) return false; + return true; + } + + public override int GetHashCode() { + int hash = 1; + hash ^= path_.GetHashCode(); + if (SourceFile.Length != 0) hash ^= SourceFile.GetHashCode(); + if (Begin != 0) hash ^= Begin.GetHashCode(); + if (End != 0) hash ^= End.GetHashCode(); + return hash; + } + + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + public void WriteTo(pb::CodedOutputStream output) { + path_.WriteTo(output, _repeated_path_codec); + if (SourceFile.Length != 0) { + output.WriteRawTag(18); + output.WriteString(SourceFile); + } + if (Begin != 0) { + output.WriteRawTag(24); + output.WriteInt32(Begin); + } + if (End != 0) { + output.WriteRawTag(32); + output.WriteInt32(End); + } + } + + public int CalculateSize() { + int size = 0; + size += path_.CalculateSize(_repeated_path_codec); + if (SourceFile.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SourceFile); + } + if (Begin != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Begin); + } + if (End != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(End); + } + return size; + } + + public void MergeFrom(Annotation other) { + if (other == null) { + return; + } + path_.Add(other.path_); + if (other.SourceFile.Length != 0) { + SourceFile = other.SourceFile; + } + if (other.Begin != 0) { + Begin = other.Begin; + } + if (other.End != 0) { + End = other.End; + } + } + + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: + case 8: { + path_.AddEntriesFrom(input, _repeated_path_codec); + break; + } + case 18: { + SourceFile = input.ReadString(); + break; + } + case 24: { + Begin = input.ReadInt32(); + break; + } + case 32: { + End = input.ReadInt32(); + break; + } + } + } + } + + } + + } + #endregion + + } + #endregion } diff --git a/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs index 48ee5596..ab7cd922 100644 --- a/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs @@ -43,7 +43,7 @@ namespace Google.Protobuf.Reflection /// </summary> public sealed class FileDescriptor : IDescriptor { - private FileDescriptor(ByteString descriptorData, FileDescriptorProto proto, FileDescriptor[] dependencies, DescriptorPool pool, bool allowUnknownDependencies, GeneratedCodeInfo generatedCodeInfo) + private FileDescriptor(ByteString descriptorData, FileDescriptorProto proto, FileDescriptor[] dependencies, DescriptorPool pool, bool allowUnknownDependencies, GeneratedClrTypeInfo generatedCodeInfo) { SerializedData = descriptorData; DescriptorPool = pool; @@ -223,7 +223,7 @@ namespace Google.Protobuf.Reflection /// <exception cref="DescriptorValidationException">If <paramref name="proto"/> is not /// a valid descriptor. This can occur for a number of reasons, such as a field /// having an undefined type or because two messages were defined with the same name.</exception> - private static FileDescriptor BuildFrom(ByteString descriptorData, FileDescriptorProto proto, FileDescriptor[] dependencies, bool allowUnknownDependencies, GeneratedCodeInfo generatedCodeInfo) + private static FileDescriptor BuildFrom(ByteString descriptorData, FileDescriptorProto proto, FileDescriptor[] dependencies, bool allowUnknownDependencies, GeneratedClrTypeInfo generatedCodeInfo) { // Building descriptors involves two steps: translating and linking. // In the translation step (implemented by FileDescriptor's @@ -291,7 +291,7 @@ namespace Google.Protobuf.Reflection public static FileDescriptor FromGeneratedCode( byte[] descriptorData, FileDescriptor[] dependencies, - GeneratedCodeInfo generatedCodeInfo) + GeneratedClrTypeInfo generatedCodeInfo) { FileDescriptorProto proto; try diff --git a/csharp/src/Google.Protobuf/Reflection/GeneratedCodeInfo.cs b/csharp/src/Google.Protobuf/Reflection/GeneratedClrTypeInfo.cs index e5fe9fb7..fe5db656 100644 --- a/csharp/src/Google.Protobuf/Reflection/GeneratedCodeInfo.cs +++ b/csharp/src/Google.Protobuf/Reflection/GeneratedClrTypeInfo.cs @@ -38,10 +38,10 @@ namespace Google.Protobuf.Reflection /// These are constructed as required, and are not long-lived. Hand-written code should /// never need to use this type. /// </summary> - public sealed class GeneratedCodeInfo + public sealed class GeneratedClrTypeInfo { private static readonly string[] EmptyNames = new string[0]; - private static readonly GeneratedCodeInfo[] EmptyCodeInfo = new GeneratedCodeInfo[0]; + private static readonly GeneratedClrTypeInfo[] EmptyCodeInfo = new GeneratedClrTypeInfo[0]; /// <summary> /// Irrelevant for file descriptors; the CLR type for the message for message descriptors. @@ -70,7 +70,7 @@ namespace Google.Protobuf.Reflection /// The reflection information for types within this file/message descriptor. Elements may be null /// if there is no corresponding generated type, e.g. for map entry types. /// </summary> - public GeneratedCodeInfo[] NestedTypes { get; } + public GeneratedClrTypeInfo[] NestedTypes { get; } /// <summary> /// The CLR types for enums within this file/message descriptor. @@ -78,11 +78,11 @@ namespace Google.Protobuf.Reflection public Type[] NestedEnums { get; } /// <summary> - /// Creates a GeneratedCodeInfo for a message descriptor, with nested types, nested enums, the CLR type, property names and oneof names. + /// Creates a GeneratedClrTypeInfo for a message descriptor, with nested types, nested enums, the CLR type, property names and oneof names. /// Each array parameter may be null, to indicate a lack of values. /// The parameter order is designed to make it feasible to format the generated code readably. /// </summary> - public GeneratedCodeInfo(Type clrType, MessageParser parser, string[] propertyNames, string[] oneofNames, Type[] nestedEnums, GeneratedCodeInfo[] nestedTypes) + public GeneratedClrTypeInfo(Type clrType, MessageParser parser, string[] propertyNames, string[] oneofNames, Type[] nestedEnums, GeneratedClrTypeInfo[] nestedTypes) { NestedTypes = nestedTypes ?? EmptyCodeInfo; NestedEnums = nestedEnums ?? ReflectionUtil.EmptyTypes; @@ -93,9 +93,9 @@ namespace Google.Protobuf.Reflection } /// <summary> - /// Creates a GeneratedCodeInfo for a file descriptor, with only types and enums. + /// Creates a GeneratedClrTypeInfo for a file descriptor, with only types and enums. /// </summary> - public GeneratedCodeInfo(Type[] nestedEnums, GeneratedCodeInfo[] nestedTypes) + public GeneratedClrTypeInfo(Type[] nestedEnums, GeneratedClrTypeInfo[] nestedTypes) : this(null, null, null, null, nestedEnums, nestedTypes) { } diff --git a/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs index f43803a6..f5798d1e 100644 --- a/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs @@ -60,7 +60,7 @@ namespace Google.Protobuf.Reflection private readonly IList<FieldDescriptor> fieldsInNumberOrder; private readonly IDictionary<string, FieldDescriptor> jsonFieldMap; - internal MessageDescriptor(DescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int typeIndex, GeneratedCodeInfo generatedCodeInfo) + internal MessageDescriptor(DescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int typeIndex, GeneratedClrTypeInfo generatedCodeInfo) : base(file, file.ComputeFullName(parent, proto.Name), typeIndex) { Proto = proto; diff --git a/csharp/src/Google.Protobuf/Reflection/TypeRegistry.cs b/csharp/src/Google.Protobuf/Reflection/TypeRegistry.cs index 31d5a30f..e94e3e6c 100644 --- a/csharp/src/Google.Protobuf/Reflection/TypeRegistry.cs +++ b/csharp/src/Google.Protobuf/Reflection/TypeRegistry.cs @@ -91,7 +91,7 @@ namespace Google.Protobuf.Reflection /// <returns>A type registry for the given files.</returns> public static TypeRegistry FromFiles(IEnumerable<FileDescriptor> fileDescriptors) { - Preconditions.CheckNotNull(fileDescriptors, nameof(fileDescriptors)); + ProtoPreconditions.CheckNotNull(fileDescriptors, nameof(fileDescriptors)); var builder = new Builder(); foreach (var file in fileDescriptors) { @@ -128,7 +128,7 @@ namespace Google.Protobuf.Reflection /// <returns>A type registry for the given files.</returns> public static TypeRegistry FromMessages(IEnumerable<MessageDescriptor> messageDescriptors) { - Preconditions.CheckNotNull(messageDescriptors, nameof(messageDescriptors)); + ProtoPreconditions.CheckNotNull(messageDescriptors, nameof(messageDescriptors)); return FromFiles(messageDescriptors.Select(md => md.File)); } diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs index ff391fc0..48cd99a1 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs @@ -29,8 +29,8 @@ namespace Google.Protobuf.WellKnownTypes { "bGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Any), global::Google.Protobuf.WellKnownTypes.Any.Parser, new[]{ "TypeUrl", "Value" }, 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 @@ -124,7 +124,7 @@ namespace Google.Protobuf.WellKnownTypes { public string TypeUrl { get { return typeUrl_; } set { - typeUrl_ = pb::Preconditions.CheckNotNull(value, "value"); + typeUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -137,7 +137,7 @@ namespace Google.Protobuf.WellKnownTypes { public pb::ByteString Value { get { return value_; } set { - value_ = pb::Preconditions.CheckNotNull(value, "value"); + value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs b/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs index 082f7432..9d43856e 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs @@ -72,7 +72,7 @@ namespace Google.Protobuf.WellKnownTypes /// <returns>An Any message with the content and type URL of <paramref name="message"/>.</returns> public static Any Pack(IMessage message) { - Preconditions.CheckNotNull(message, "message"); + ProtoPreconditions.CheckNotNull(message, "message"); return new Any { TypeUrl = GetTypeUrl(message.Descriptor), Value = message.ToByteString() }; } } diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs index ccb82a94..de7aea3a 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs @@ -41,10 +41,10 @@ namespace Google.Protobuf.WellKnownTypes { "ZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor, }, - new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(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::GeneratedCodeInfo(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::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Mixin), global::Google.Protobuf.WellKnownTypes.Mixin.Parser, new[]{ "Name", "Root" }, 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 @@ -97,7 +97,7 @@ namespace Google.Protobuf.WellKnownTypes { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -153,7 +153,7 @@ namespace Google.Protobuf.WellKnownTypes { public string Version { get { return version_; } set { - version_ = pb::Preconditions.CheckNotNull(value, "value"); + version_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -388,7 +388,7 @@ namespace Google.Protobuf.WellKnownTypes { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -401,7 +401,7 @@ namespace Google.Protobuf.WellKnownTypes { public string RequestTypeUrl { get { return requestTypeUrl_; } set { - requestTypeUrl_ = pb::Preconditions.CheckNotNull(value, "value"); + requestTypeUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -427,7 +427,7 @@ namespace Google.Protobuf.WellKnownTypes { public string ResponseTypeUrl { get { return responseTypeUrl_; } set { - responseTypeUrl_ = pb::Preconditions.CheckNotNull(value, "value"); + responseTypeUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -740,7 +740,7 @@ namespace Google.Protobuf.WellKnownTypes { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -754,7 +754,7 @@ namespace Google.Protobuf.WellKnownTypes { public string Root { get { return root_; } set { - root_ = pb::Preconditions.CheckNotNull(value, "value"); + root_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs index 4eeff4f0..73e221d4 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs @@ -30,8 +30,8 @@ namespace Google.Protobuf.WellKnownTypes { "dG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Duration), global::Google.Protobuf.WellKnownTypes.Duration.Parser, new[]{ "Seconds", "Nanos" }, 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/DurationPartial.cs b/csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs index e5247e90..f164bfd1 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs @@ -118,7 +118,7 @@ namespace Google.Protobuf.WellKnownTypes /// <returns>The negated value of this duration.</returns> public static Duration operator -(Duration value) { - Preconditions.CheckNotNull(value, "value"); + ProtoPreconditions.CheckNotNull(value, "value"); checked { return Normalize(-value.Seconds, -value.Nanos); @@ -133,8 +133,8 @@ namespace Google.Protobuf.WellKnownTypes /// <returns></returns> public static Duration operator +(Duration lhs, Duration rhs) { - Preconditions.CheckNotNull(lhs, "lhs"); - Preconditions.CheckNotNull(rhs, "rhs"); + ProtoPreconditions.CheckNotNull(lhs, "lhs"); + ProtoPreconditions.CheckNotNull(rhs, "rhs"); checked { return Normalize(lhs.Seconds + rhs.Seconds, lhs.Nanos + rhs.Nanos); @@ -149,8 +149,8 @@ namespace Google.Protobuf.WellKnownTypes /// <returns>The difference between the two specified durations.</returns> public static Duration operator -(Duration lhs, Duration rhs) { - Preconditions.CheckNotNull(lhs, "lhs"); - Preconditions.CheckNotNull(rhs, "rhs"); + ProtoPreconditions.CheckNotNull(lhs, "lhs"); + ProtoPreconditions.CheckNotNull(rhs, "rhs"); checked { return Normalize(lhs.Seconds - rhs.Seconds, lhs.Nanos - rhs.Nanos); diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs index 5cdd43c4..6cad4124 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs @@ -29,8 +29,8 @@ namespace Google.Protobuf.WellKnownTypes { "ZXNiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Empty), global::Google.Protobuf.WellKnownTypes.Empty.Parser, 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 2bfb6700..2ba2b96f 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs @@ -29,8 +29,8 @@ namespace Google.Protobuf.WellKnownTypes { "Z2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.FieldMask), global::Google.Protobuf.WellKnownTypes.FieldMask.Parser, new[]{ "Paths" }, 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 2972b346..a235ecef 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs @@ -30,8 +30,8 @@ namespace Google.Protobuf.WellKnownTypes { "cHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.SourceContext), global::Google.Protobuf.WellKnownTypes.SourceContext.Parser, new[]{ "FileName" }, 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 @@ -79,7 +79,7 @@ namespace Google.Protobuf.WellKnownTypes { public string FileName { get { return fileName_; } set { - fileName_ = pb::Preconditions.CheckNotNull(value, "value"); + fileName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs index a811ea8b..8e2ce8cf 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs @@ -39,10 +39,10 @@ namespace Google.Protobuf.WellKnownTypes { "b3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedCodeInfo(new[] {typeof(global::Google.Protobuf.WellKnownTypes.NullValue), }, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Struct), global::Google.Protobuf.WellKnownTypes.Struct.Parser, new[]{ "Fields" }, null, null, new pbr::GeneratedCodeInfo[] { null, }), - new pbr::GeneratedCodeInfo(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::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.ListValue), global::Google.Protobuf.WellKnownTypes.ListValue.Parser, new[]{ "Values" }, 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 @@ -262,7 +262,7 @@ namespace Google.Protobuf.WellKnownTypes { public string StringValue { get { return kindCase_ == KindOneofCase.StringValue ? (string) kind_ : ""; } set { - kind_ = pb::Preconditions.CheckNotNull(value, "value"); + kind_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); kindCase_ = KindOneofCase.StringValue; } } diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs index f0d656fa..318b0f61 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs @@ -30,8 +30,8 @@ namespace Google.Protobuf.WellKnownTypes { "c2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Timestamp), global::Google.Protobuf.WellKnownTypes.Timestamp.Parser, new[]{ "Seconds", "Nanos" }, 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/TimestampPartial.cs b/csharp/src/Google.Protobuf/WellKnownTypes/TimestampPartial.cs index 86998e27..aa403473 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/TimestampPartial.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/TimestampPartial.cs @@ -59,8 +59,8 @@ namespace Google.Protobuf.WellKnownTypes /// <returns>The difference between the two specified timestamps.</returns> public static Duration operator -(Timestamp lhs, Timestamp rhs) { - Preconditions.CheckNotNull(lhs, "lhs"); - Preconditions.CheckNotNull(rhs, "rhs"); + ProtoPreconditions.CheckNotNull(lhs, "lhs"); + ProtoPreconditions.CheckNotNull(rhs, "rhs"); checked { return Duration.Normalize(lhs.Seconds - rhs.Seconds, lhs.Nanos - rhs.Nanos); @@ -75,8 +75,8 @@ namespace Google.Protobuf.WellKnownTypes /// <returns>The result of adding the duration to the timestamp.</returns> public static Timestamp operator +(Timestamp lhs, Duration rhs) { - Preconditions.CheckNotNull(lhs, "lhs"); - Preconditions.CheckNotNull(rhs, "rhs"); + ProtoPreconditions.CheckNotNull(lhs, "lhs"); + ProtoPreconditions.CheckNotNull(rhs, "rhs"); checked { return Normalize(lhs.Seconds + rhs.Seconds, lhs.Nanos + rhs.Nanos); @@ -91,8 +91,8 @@ namespace Google.Protobuf.WellKnownTypes /// <returns>The result of subtracting the duration from the timestamp.</returns> public static Timestamp operator -(Timestamp lhs, Duration rhs) { - Preconditions.CheckNotNull(lhs, "lhs"); - Preconditions.CheckNotNull(rhs, "rhs"); + ProtoPreconditions.CheckNotNull(lhs, "lhs"); + ProtoPreconditions.CheckNotNull(rhs, "rhs"); checked { return Normalize(lhs.Seconds - rhs.Seconds, lhs.Nanos - rhs.Nanos); diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs index b5766916..8faa1d1c 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs @@ -60,12 +60,12 @@ namespace Google.Protobuf.WellKnownTypes { "d25UeXBlc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor, }, - new pbr::GeneratedCodeInfo(new[] {typeof(global::Google.Protobuf.WellKnownTypes.Syntax), }, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Type), global::Google.Protobuf.WellKnownTypes.Type.Parser, new[]{ "Name", "Fields", "Oneofs", "Options", "SourceContext", "Syntax" }, null, null, null), - new pbr::GeneratedCodeInfo(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::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Enum), global::Google.Protobuf.WellKnownTypes.Enum.Parser, new[]{ "Name", "Enumvalue", "Options", "SourceContext", "Syntax" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.EnumValue), global::Google.Protobuf.WellKnownTypes.EnumValue.Parser, new[]{ "Name", "Number", "Options" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Option), global::Google.Protobuf.WellKnownTypes.Option.Parser, new[]{ "Name", "Value" }, 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 @@ -133,7 +133,7 @@ namespace Google.Protobuf.WellKnownTypes { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -417,7 +417,7 @@ namespace Google.Protobuf.WellKnownTypes { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -431,7 +431,7 @@ namespace Google.Protobuf.WellKnownTypes { public string TypeUrl { get { return typeUrl_; } set { - typeUrl_ = pb::Preconditions.CheckNotNull(value, "value"); + typeUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -483,7 +483,7 @@ namespace Google.Protobuf.WellKnownTypes { public string JsonName { get { return jsonName_; } set { - jsonName_ = pb::Preconditions.CheckNotNull(value, "value"); + jsonName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -496,7 +496,7 @@ namespace Google.Protobuf.WellKnownTypes { public string DefaultValue { get { return defaultValue_; } set { - defaultValue_ = pb::Preconditions.CheckNotNull(value, "value"); + defaultValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -857,7 +857,7 @@ namespace Google.Protobuf.WellKnownTypes { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -1074,7 +1074,7 @@ namespace Google.Protobuf.WellKnownTypes { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -1235,7 +1235,7 @@ namespace Google.Protobuf.WellKnownTypes { public string Name { get { return name_; } set { - name_ = pb::Preconditions.CheckNotNull(value, "value"); + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs b/csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs index b4b6c05e..d34b560d 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs @@ -41,7 +41,7 @@ namespace Google.Protobuf.WellKnownTypes /// <returns>A newly-created Value message with the given value.</returns> public static Value ForString(string value) { - Preconditions.CheckNotNull(value, "value"); + ProtoPreconditions.CheckNotNull(value, "value"); return new Value { StringValue = value }; } @@ -81,7 +81,7 @@ namespace Google.Protobuf.WellKnownTypes /// <returns>A newly-created Value message an initial list value.</returns> public static Value ForList(params Value[] values) { - Preconditions.CheckNotNull(values, "values"); + ProtoPreconditions.CheckNotNull(values, "values"); return new Value { ListValue = new ListValue { Values = { values } } }; } @@ -92,7 +92,7 @@ namespace Google.Protobuf.WellKnownTypes /// <returns>A newly-created Value message an initial struct value.</returns> public static Value ForStruct(Struct value) { - Preconditions.CheckNotNull(value, "value"); + ProtoPreconditions.CheckNotNull(value, "value"); return new Value { StructValue = value }; } } diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs index a9d8e99c..d6796d1a 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs @@ -35,16 +35,16 @@ namespace Google.Protobuf.WellKnownTypes { "Mw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] { - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.DoubleValue), global::Google.Protobuf.WellKnownTypes.DoubleValue.Parser, new[]{ "Value" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.FloatValue), global::Google.Protobuf.WellKnownTypes.FloatValue.Parser, new[]{ "Value" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Int64Value), global::Google.Protobuf.WellKnownTypes.Int64Value.Parser, new[]{ "Value" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.UInt64Value), global::Google.Protobuf.WellKnownTypes.UInt64Value.Parser, new[]{ "Value" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Int32Value), global::Google.Protobuf.WellKnownTypes.Int32Value.Parser, new[]{ "Value" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.UInt32Value), global::Google.Protobuf.WellKnownTypes.UInt32Value.Parser, new[]{ "Value" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.BoolValue), global::Google.Protobuf.WellKnownTypes.BoolValue.Parser, new[]{ "Value" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.StringValue), global::Google.Protobuf.WellKnownTypes.StringValue.Parser, new[]{ "Value" }, null, null, null), - new pbr::GeneratedCodeInfo(typeof(global::Google.Protobuf.WellKnownTypes.BytesValue), global::Google.Protobuf.WellKnownTypes.BytesValue.Parser, new[]{ "Value" }, 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 @@ -869,7 +869,7 @@ namespace Google.Protobuf.WellKnownTypes { public string Value { get { return value_; } set { - value_ = pb::Preconditions.CheckNotNull(value, "value"); + value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } @@ -980,7 +980,7 @@ namespace Google.Protobuf.WellKnownTypes { public pb::ByteString Value { get { return value_; } set { - value_ = pb::Preconditions.CheckNotNull(value, "value"); + value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } diff --git a/examples/add_person.py b/examples/add_person.py index fd81c982..0b698579 100755 --- a/examples/add_person.py +++ b/examples/add_person.py @@ -43,9 +43,8 @@ address_book = addressbook_pb2.AddressBook() # Read the existing address book. try: - f = open(sys.argv[1], "rb") - address_book.ParseFromString(f.read()) - f.close() + with open(sys.argv[1], "rb") as f: + address_book.ParseFromString(f.read()) except IOError: print sys.argv[1] + ": File not found. Creating a new file." @@ -53,6 +52,5 @@ except IOError: PromptForAddress(address_book.people.add()) # Write the new address book back to disk. -f = open(sys.argv[1], "wb") -f.write(address_book.SerializeToString()) -f.close() +with open(sys.argv[1], "wb") as f: + f.write(address_book.SerializeToString()) diff --git a/examples/list_people.py b/examples/list_people.py index 755de901..f131872d 100755 --- a/examples/list_people.py +++ b/examples/list_people.py @@ -31,8 +31,7 @@ if len(sys.argv) != 2: address_book = addressbook_pb2.AddressBook() # Read the existing address book. -f = open(sys.argv[1], "rb") -address_book.ParseFromString(f.read()) -f.close() +with open(sys.argv[1], "rb") as f: + address_book.ParseFromString(f.read()) ListPeople(address_book) diff --git a/js/binary/proto_test.js b/js/binary/proto_test.js index 32d8412f..1cb7ff0e 100644 --- a/js/binary/proto_test.js +++ b/js/binary/proto_test.js @@ -67,10 +67,6 @@ function fillAllFields(msg) { submsg.setC(16); msg.setOptionalForeignMessage(submsg); msg.setOptionalForeignEnum(proto.jspb.test.ForeignEnum.FOREIGN_FOO); - msg.setOptionalInt32String('-12345'); - msg.setOptionalUint32String('12345'); - msg.setOptionalInt64String('-123456789012345'); - msg.setOptionalUint64String('987654321098765'); msg.setOneofString('oneof'); msg.setRepeatedInt32List([-42]); @@ -108,15 +104,6 @@ function fillAllFields(msg) { msg.setPackedRepeatedFloatList([1.5]); msg.setPackedRepeatedDoubleList([-1.5]); msg.setPackedRepeatedBoolList([true]); - - msg.setRepeatedInt32StringList(['-12345']); - msg.setRepeatedUint32StringList(['12345']); - msg.setRepeatedInt64StringList(['-123456789012345']); - msg.setRepeatedUint64StringList(['987654321098765']); - msg.setPackedRepeatedInt32StringList(['-12345']); - msg.setPackedRepeatedUint32StringList(['12345']); - msg.setPackedRepeatedInt64StringList(['-123456789012345']); - msg.setPackedRepeatedUint64StringList(['987654321098765']); } @@ -173,10 +160,6 @@ function checkAllFields(msg) { assertEquals(msg.getOptionalForeignMessage().getC(), 16); assertEquals(msg.getOptionalForeignEnum(), proto.jspb.test.ForeignEnum.FOREIGN_FOO); - assertEquals(msg.getOptionalInt32String(), '-12345'); - assertEquals(msg.getOptionalUint32String(), '12345'); - assertEquals(msg.getOptionalInt64String(), '-123456789012345'); - assertEquals(msg.getOptionalUint64String(), '987654321098765'); assertEquals(msg.getOneofString(), 'oneof'); assertEquals(msg.getOneofFieldCase(), proto.jspb.test.TestAllTypes.OneofFieldCase.ONEOF_STRING); @@ -221,26 +204,6 @@ function checkAllFields(msg) { assertElementsEquals(msg.getPackedRepeatedFloatList(), [1.5]); assertElementsEquals(msg.getPackedRepeatedDoubleList(), [-1.5]); assertElementsEquals(msg.getPackedRepeatedBoolList(), [true]); - - assertEquals(msg.getRepeatedInt32StringList().length, 1); - assertElementsEquals(msg.getRepeatedInt32StringList(), ['-12345']); - assertEquals(msg.getRepeatedUint32StringList().length, 1); - assertElementsEquals(msg.getRepeatedUint32StringList(), ['12345']); - assertEquals(msg.getRepeatedInt64StringList().length, 1); - assertElementsEquals(msg.getRepeatedInt64StringList(), ['-123456789012345']); - assertEquals(msg.getRepeatedUint64StringList().length, 1); - assertElementsEquals(msg.getRepeatedUint64StringList(), ['987654321098765']); - - assertEquals(msg.getPackedRepeatedInt32StringList().length, 1); - assertElementsEquals(msg.getPackedRepeatedInt32StringList(), ['-12345']); - assertEquals(msg.getPackedRepeatedUint32StringList().length, 1); - assertElementsEquals(msg.getPackedRepeatedUint32StringList(), ['12345']); - assertEquals(msg.getPackedRepeatedInt64StringList().length, 1); - assertElementsEquals(msg.getPackedRepeatedInt64StringList(), - ['-123456789012345']); - assertEquals(msg.getPackedRepeatedUint64StringList().length, 1); - assertElementsEquals(msg.getPackedRepeatedUint64StringList(), - ['987654321098765']); } @@ -285,14 +248,6 @@ function checkExtensions(msg) { proto.jspb.test.ExtendsWithMessage.optionalExtension).getFoo()); assertEquals(proto.jspb.test.ForeignEnum.FOREIGN_FOO, msg.getExtension(proto.jspb.test.extendOptionalForeignEnum)); - assertEquals('-12345', - msg.getExtension(proto.jspb.test.extendOptionalInt32String)); - assertEquals('12345', - msg.getExtension(proto.jspb.test.extendOptionalUint32String)); - assertEquals('-123456789012345', - msg.getExtension(proto.jspb.test.extendOptionalInt64String)); - assertEquals('987654321098765', - msg.getExtension(proto.jspb.test.extendOptionalUint64String)); assertElementsEquals( msg.getExtension(proto.jspb.test.extendRepeatedInt32List), @@ -349,19 +304,6 @@ function checkExtensions(msg) { [proto.jspb.test.ForeignEnum.FOREIGN_FOO]); assertElementsEquals( - msg.getExtension(proto.jspb.test.extendRepeatedInt32StringList), - ['-12345']); - assertElementsEquals( - msg.getExtension(proto.jspb.test.extendRepeatedUint32StringList), - ['12345']); - assertElementsEquals( - msg.getExtension(proto.jspb.test.extendRepeatedInt64StringList), - ['-123456789012345']); - assertElementsEquals( - msg.getExtension(proto.jspb.test.extendRepeatedUint64StringList), - ['987654321098765']); - - assertElementsEquals( msg.getExtension(proto.jspb.test.extendPackedRepeatedInt32List), [-42]); assertElementsEquals( @@ -403,19 +345,6 @@ function checkExtensions(msg) { assertElementsEquals( msg.getExtension(proto.jspb.test.extendPackedRepeatedForeignEnumList), [proto.jspb.test.ForeignEnum.FOREIGN_FOO]); - - assertElementsEquals( - msg.getExtension(proto.jspb.test.extendPackedRepeatedInt32StringList), - ['-12345']); - assertElementsEquals( - msg.getExtension(proto.jspb.test.extendPackedRepeatedUint32StringList), - ['12345']); - assertElementsEquals( - msg.getExtension(proto.jspb.test.extendPackedRepeatedInt64StringList), - ['-123456789012345']); - assertElementsEquals( - msg.getExtension(proto.jspb.test.extendPackedRepeatedUint64StringList), - ['987654321098765']); } @@ -475,14 +404,6 @@ describe('protoBinaryTest', function() { msg.setExtension( proto.jspb.test.extendOptionalForeignEnum, proto.jspb.test.ForeignEnum.FOREIGN_FOO); - msg.setExtension( - proto.jspb.test.extendOptionalInt32String, '-12345'); - msg.setExtension( - proto.jspb.test.extendOptionalUint32String, '12345'); - msg.setExtension( - proto.jspb.test.extendOptionalInt64String, '-123456789012345'); - msg.setExtension( - proto.jspb.test.extendOptionalUint64String, '987654321098765'); msg.setExtension( proto.jspb.test.extendRepeatedInt32List, [-42]); @@ -522,15 +443,6 @@ describe('protoBinaryTest', function() { [proto.jspb.test.ForeignEnum.FOREIGN_FOO]); msg.setExtension( - proto.jspb.test.extendRepeatedInt32StringList, ['-12345']); - msg.setExtension( - proto.jspb.test.extendRepeatedUint32StringList, ['12345']); - msg.setExtension( - proto.jspb.test.extendRepeatedInt64StringList, ['-123456789012345']); - msg.setExtension( - proto.jspb.test.extendRepeatedUint64StringList, ['987654321098765']); - - msg.setExtension( proto.jspb.test.extendPackedRepeatedInt32List, [-42]); msg.setExtension( proto.jspb.test.extendPackedRepeatedInt64List, [-0x7fffffff00000000]); @@ -559,19 +471,6 @@ describe('protoBinaryTest', function() { proto.jspb.test.extendPackedRepeatedBoolList, [true]); msg.setExtension(proto.jspb.test.extendPackedRepeatedForeignEnumList, [proto.jspb.test.ForeignEnum.FOREIGN_FOO]); - - msg.setExtension( - proto.jspb.test.extendPackedRepeatedInt32StringList, - ['-12345']); - msg.setExtension( - proto.jspb.test.extendPackedRepeatedUint32StringList, - ['12345']); - msg.setExtension( - proto.jspb.test.extendPackedRepeatedInt64StringList, - ['-123456789012345']); - msg.setExtension( - proto.jspb.test.extendPackedRepeatedUint64StringList, - ['987654321098765']); } diff --git a/js/jasmine.json b/js/jasmine.json index 05444550..f83c54c0 100644 --- a/js/jasmine.json +++ b/js/jasmine.json @@ -1,7 +1,8 @@ { "spec_dir": "", "spec_files": [ - "*_test.js" + "*_test.js", + "binary/*_test.js" ], "helpers": [ "node_modules/google-closure-library/closure/goog/bootstrap/nodejs.js", diff --git a/js/package.json b/js/package.json index 316be316..be93286f 100644 --- a/js/package.json +++ b/js/package.json @@ -4,7 +4,7 @@ "description": "Protocol Buffers for JavaScript", "main": "debug.js", "dependencies": { - "google-closure-library": "~20151015.0.0", + "google-closure-library": "~20160125.0.0", "gulp": "~3.9.0", "jasmine": "~2.4.1" }, diff --git a/ruby/Gemfile.lock b/ruby/Gemfile.lock index 8599da75..27e57506 100644 --- a/ruby/Gemfile.lock +++ b/ruby/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - google-protobuf (3.0.0.alpha.4.0) + google-protobuf (3.0.0.alpha.5.0) GEM remote: https://rubygems.org/ @@ -10,6 +10,7 @@ GEM rake (10.4.2) rake-compiler (0.9.5) rake + rake-compiler-dock (0.5.1) rubygems-tasks (0.2.4) test-unit (3.0.9) power_assert @@ -21,8 +22,9 @@ PLATFORMS DEPENDENCIES google-protobuf! rake-compiler + rake-compiler-dock rubygems-tasks test-unit BUNDLED WITH - 1.10.6 + 1.11.2 diff --git a/ruby/Rakefile b/ruby/Rakefile index c25103d8..81c3119e 100644 --- a/ruby/Rakefile +++ b/ruby/Rakefile @@ -20,6 +20,17 @@ else Rake::ExtensionTask.new("protobuf_c", spec) do |ext| ext.ext_dir = "ext/google/protobuf_c" ext.lib_dir = "lib/google" + ext.cross_compile = true + ext.cross_platform = [ + 'x86-mingw32', 'x64-mingw32', + 'x86_64-linux', 'x86-linux', + 'universal-darwin' + ] + end + + task 'gem:windows' do + require 'rake_compiler_dock' + RakeCompilerDock.sh "bundle && rake cross native gem RUBY_CC_VERSION=2.3.0:2.2.2:2.1.6" end end diff --git a/ruby/ext/google/protobuf_c/message.c b/ruby/ext/google/protobuf_c/message.c index ebe2f1ab..283939c9 100644 --- a/ruby/ext/google/protobuf_c/message.c +++ b/ruby/ext/google/protobuf_c/message.c @@ -166,7 +166,7 @@ VALUE Message_method_missing(int argc, VALUE* argv, VALUE _self) { name, name_len); if (f == NULL) { - rb_raise(rb_eArgError, "Unknown field"); + return rb_call_super(argc, argv); } if (setter) { @@ -197,7 +197,7 @@ int Message_initialize_kwarg(VALUE key, VALUE val, VALUE _self) { f = upb_msgdef_ntofz(self->descriptor->msgdef, name); if (f == NULL) { rb_raise(rb_eArgError, - "Unknown field name in initialization map entry."); + "Unknown field name '%s' in initialization map entry.", name); } if (is_map_field(f)) { @@ -205,7 +205,7 @@ int Message_initialize_kwarg(VALUE key, VALUE val, VALUE _self) { if (TYPE(val) != T_HASH) { rb_raise(rb_eArgError, - "Expected Hash object as initializer value for map field."); + "Expected Hash object as initializer value for map field '%s'.", name); } map = layout_get(self->descriptor->layout, Message_data(self), f); Map_merge_into_self(map, val); @@ -214,7 +214,7 @@ int Message_initialize_kwarg(VALUE key, VALUE val, VALUE _self) { if (TYPE(val) != T_ARRAY) { rb_raise(rb_eArgError, - "Expected array as initializer value for repeated field."); + "Expected array as initializer value for repeated field '%s'.", name); } ary = layout_get(self->descriptor->layout, Message_data(self), f); for (int i = 0; i < RARRAY_LEN(val); i++) { diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec index 312a0c8c..7b64ee77 100644 --- a/ruby/google-protobuf.gemspec +++ b/ruby/google-protobuf.gemspec @@ -8,12 +8,13 @@ Gem::Specification.new do |s| s.authors = ["Protobuf Authors"] s.email = "protobuf@googlegroups.com" s.require_paths = ["lib"] - s.files = `git ls-files -z`.split("\x0").find_all{|f| f =~ /lib\/.+\.rb/} - unless RUBY_PLATFORM == "java" - s.files += `git ls-files "*.c" "*.h" extconf.rb Makefile`.split - s.extensions= ["ext/google/protobuf_c/extconf.rb"] - else + s.files = Dir.glob('lib/**/*.rb') + if RUBY_PLATFORM == "java" s.files += ["lib/google/protobuf_java.jar"] + else + s.files += Dir.glob('ext/**/*') + s.extensions= ["ext/google/protobuf_c/extconf.rb"] + s.add_development_dependency "rake-compiler-dock" end s.test_files = ["tests/basic.rb", "tests/stress.rb", diff --git a/ruby/lib/google/protobuf.rb b/ruby/lib/google/protobuf.rb index f0eb6268..62bdd1bf 100644 --- a/ruby/lib/google/protobuf.rb +++ b/ruby/lib/google/protobuf.rb @@ -44,7 +44,11 @@ if RUBY_PLATFORM == "java" require 'json' require 'google/protobuf_java' else - require 'google/protobuf_c' + begin + require "google/#{RUBY_VERSION.sub(/\.\d$/, '')}/protobuf_c" + rescue LoadError + require 'google/protobuf_c' + end end require 'google/protobuf/repeated_field' diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java index 547ab22c..39213c4d 100644 --- a/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java +++ b/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java @@ -86,14 +86,14 @@ public class RubyMessage extends RubyObject { if (Utils.isMapEntry(fieldDescriptor)) { if (!(value instanceof RubyHash)) - throw runtime.newArgumentError("Expected Hash object as initializer value for map field."); + throw runtime.newArgumentError("Expected Hash object as initializer value for map field '" + key.asJavaString() + "'."); final RubyMap map = newMapForField(context, fieldDescriptor); map.mergeIntoSelf(context, value); maps.put(fieldDescriptor, map); } else if (fieldDescriptor.isRepeated()) { if (!(value instanceof RubyArray)) - throw runtime.newTypeError("Expected array as initializer var for repeated field."); + throw runtime.newArgumentError("Expected array as initializer value for repeated field '" + key.asJavaString() + "'."); RubyRepeatedField repeatedField = rubyToRepeatedField(context, fieldDescriptor, value); addRepeatedField(fieldDescriptor, repeatedField); } else { @@ -217,6 +217,9 @@ public class RubyMessage extends RubyObject { RubyDescriptor rubyDescriptor = (RubyDescriptor) getDescriptor(context, metaClass); IRubyObject oneofDescriptor = rubyDescriptor.lookupOneof(context, args[0]); if (oneofDescriptor.isNil()) { + if (!hasField(args[0])) { + return Helpers.invokeSuper(context, this, metaClass, "method_missing", args, Block.NULL_BLOCK); + } return index(context, args[0]); } RubyOneofDescriptor rubyOneofDescriptor = (RubyOneofDescriptor) oneofDescriptor; @@ -233,6 +236,10 @@ public class RubyMessage extends RubyObject { if (field.end_with_p(context, equalSign).isTrue()) { field.chomp_bang(context, equalSign); } + + if (!hasField(field)) { + return Helpers.invokeSuper(context, this, metaClass, "method_missing", args, Block.NULL_BLOCK); + } return indexSet(context, field, args[1]); } } @@ -435,6 +442,11 @@ public class RubyMessage extends RubyObject { return ret; } + private boolean hasField(IRubyObject fieldName) { + String nameStr = fieldName.asJavaString(); + return this.descriptor.findFieldByName(Utils.escapeIdentifier(nameStr)) != null; + } + private void checkRepeatedFieldType(ThreadContext context, IRubyObject value, Descriptors.FieldDescriptor fieldDescriptor) { Ruby runtime = context.runtime; diff --git a/ruby/tests/basic.rb b/ruby/tests/basic.rb index 40c20078..da85520f 100644 --- a/ruby/tests/basic.rb +++ b/ruby/tests/basic.rb @@ -191,6 +191,35 @@ module BasicTest assert m1.hash != m2.hash end + def test_unknown_field_errors + e = assert_raise NoMethodError do + TestMessage.new.hello + end + assert_match(/hello/, e.message) + + e = assert_raise NoMethodError do + TestMessage.new.hello = "world" + end + assert_match(/hello/, e.message) + end + + def test_initialization_map_errors + e = assert_raise ArgumentError do + TestMessage.new(:hello => "world") + end + assert_match(/hello/, e.message) + + e = assert_raise ArgumentError do + MapMessage.new(:map_string_int32 => "hello") + end + assert_equal e.message, "Expected Hash object as initializer value for map field 'map_string_int32'." + + e = assert_raise ArgumentError do + TestMessage.new(:repeated_uint32 => "hello") + end + assert_equal e.message, "Expected array as initializer value for repeated field 'repeated_uint32'." + end + def test_type_errors m = TestMessage.new assert_raise TypeError do diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h index 6a35183e..5ad94fa9 100644 --- a/src/google/protobuf/arena.h +++ b/src/google/protobuf/arena.h @@ -76,7 +76,7 @@ template<typename T> void arena_destruct_object(void* object) { template<typename T> void arena_delete_object(void* object) { delete reinterpret_cast<T*>(object); } -inline void arena_free(void* object, size_t size) { +inline void arena_free(void* object, size_t /* size */) { free(object); } diff --git a/src/google/protobuf/arenastring.h b/src/google/protobuf/arenastring.h index ef57033b..e2e2f254 100755 --- a/src/google/protobuf/arenastring.h +++ b/src/google/protobuf/arenastring.h @@ -64,7 +64,7 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { } // Basic accessors. - inline const ::std::string& Get(const ::std::string* default_value) const { + inline const ::std::string& Get(const ::std::string* /* default_value */) const { return *ptr_; } @@ -102,7 +102,7 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { // state. Used to implement unsafe_arena_release_<field>() methods on // generated classes. inline ::std::string* UnsafeArenaRelease(const ::std::string* default_value, - ::google::protobuf::Arena* arena) { + ::google::protobuf::Arena* /* arena */) { if (ptr_ == default_value) { return NULL; } @@ -134,7 +134,7 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { // UnsafeArenaRelease() on another field of a message in the same arena. Used // to implement unsafe_arena_set_allocated_<field> in generated classes. inline void UnsafeArenaSetAllocated(const ::std::string* default_value, - ::std::string* value, ::google::protobuf::Arena* arena) { + ::std::string* value, ::google::protobuf::Arena* /* arena */) { if (value != NULL) { ptr_ = value; } else { @@ -163,7 +163,7 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { // the user) will always be the empty string. Assumes that |default_value| // is an empty string. inline void ClearToEmpty(const ::std::string* default_value, - ::google::protobuf::Arena* arena) { + ::google::protobuf::Arena* /* arena */) { if (ptr_ == default_value) { // Already set to default (which is empty) -- do nothing. } else { @@ -175,7 +175,7 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { // overhead of heap operations. After this returns, the content (as seen by // the user) will always be equal to |default_value|. inline void ClearToDefault(const ::std::string* default_value, - ::google::protobuf::Arena* arena) { + ::google::protobuf::Arena* /* arena */) { if (ptr_ == default_value) { // Already set to default -- do nothing. } else { @@ -215,7 +215,7 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { void AssignWithDefault(const ::std::string* default_value, ArenaStringPtr value); - inline const ::std::string& GetNoArena(const ::std::string* default_value) const { + inline const ::std::string& GetNoArena(const ::std::string* /* default_value */) const { return *ptr_; } diff --git a/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc b/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc index 76d5b247..60afd892 100644 --- a/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc +++ b/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc @@ -83,7 +83,7 @@ void PrimitiveFieldGenerator::GenerateMembers(io::Printer* printer) { } else { printer->Print( variables_, - " $name$_ = pb::Preconditions.CheckNotNull(value, \"value\");\n"); + " $name$_ = pb::ProtoPreconditions.CheckNotNull(value, \"value\");\n"); } printer->Print( " }\n" @@ -186,7 +186,7 @@ void PrimitiveOneofFieldGenerator::GenerateMembers(io::Printer* printer) { } else { printer->Print( variables_, - " $oneof_name$_ = pb::Preconditions.CheckNotNull(value, \"value\");\n"); + " $oneof_name$_ = pb::ProtoPreconditions.CheckNotNull(value, \"value\");\n"); } printer->Print( variables_, diff --git a/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc b/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc index 3862f001..22dae43b 100644 --- a/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc +++ b/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc @@ -182,7 +182,7 @@ void ReflectionClassGenerator::WriteDescriptor(io::Printer* printer) { } } printer->Print("},\n" - " new pbr::GeneratedCodeInfo("); + " new pbr::GeneratedClrTypeInfo("); // Specify all the generated code information, recursively. if (file_->enum_type_count() > 0) { printer->Print("new[] {"); @@ -195,7 +195,7 @@ void ReflectionClassGenerator::WriteDescriptor(io::Printer* printer) { printer->Print("null, "); } if (file_->message_type_count() > 0) { - printer->Print("new pbr::GeneratedCodeInfo[] {\n"); + printer->Print("new pbr::GeneratedClrTypeInfo[] {\n"); printer->Indent(); printer->Indent(); printer->Indent(); @@ -232,7 +232,7 @@ void ReflectionClassGenerator::WriteGeneratedCodeInfo(const Descriptor* descript return; } // Generated message type - printer->Print("new pbr::GeneratedCodeInfo(typeof($type_name$), $type_name$.Parser, ", "type_name", GetClassName(descriptor)); + printer->Print("new pbr::GeneratedClrTypeInfo(typeof($type_name$), $type_name$.Parser, ", "type_name", GetClassName(descriptor)); // Fields if (descriptor->field_count() > 0) { @@ -273,7 +273,7 @@ void ReflectionClassGenerator::WriteGeneratedCodeInfo(const Descriptor* descript // Nested types if (descriptor->nested_type_count() > 0) { // Need to specify array type explicitly here, as all elements may be null. - printer->Print("new pbr::GeneratedCodeInfo[] { "); + printer->Print("new pbr::GeneratedClrTypeInfo[] { "); for (int i = 0; i < descriptor->nested_type_count(); i++) { WriteGeneratedCodeInfo(descriptor->nested_type(i), printer, i == descriptor->nested_type_count() - 1); } diff --git a/src/google/protobuf/compiler/parser.cc b/src/google/protobuf/compiler/parser.cc index ea792a9d..90ded4de 100644 --- a/src/google/protobuf/compiler/parser.cc +++ b/src/google/protobuf/compiler/parser.cc @@ -544,9 +544,9 @@ bool Parser::Parse(io::Tokenizer* input, FileDescriptorProto* file) { // Store the syntax into the file. if (file != NULL) file->set_syntax(syntax_identifier_); } else if (!stop_after_syntax_identifier_) { - GOOGLE_LOG(WARNING) << "No syntax specified for the proto file. " - << "Please use 'syntax = \"proto2\";' or " - << "'syntax = \"proto3\";' to specify a syntax " + GOOGLE_LOG(WARNING) << "No syntax specified for the proto file: " + << file->name() << ". Please use 'syntax = \"proto2\";' " + << "or 'syntax = \"proto3\";' to specify a syntax " << "version. (Defaulted to proto2 syntax.)"; syntax_identifier_ = "proto2"; } diff --git a/src/google/protobuf/descriptor.h b/src/google/protobuf/descriptor.h index e7e8c6af..7e3a7496 100644 --- a/src/google/protobuf/descriptor.h +++ b/src/google/protobuf/descriptor.h @@ -1645,7 +1645,7 @@ PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, reserved_range, const Descriptor::ReservedRange*) PROTOBUF_DEFINE_ACCESSOR(Descriptor, reserved_name_count, int) -PROTOBUF_DEFINE_OPTIONS_ACCESSOR(Descriptor, MessageOptions); +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(Descriptor, MessageOptions) PROTOBUF_DEFINE_ACCESSOR(Descriptor, is_placeholder, bool) PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, name) @@ -1690,7 +1690,7 @@ PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, containing_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, value_count, int) PROTOBUF_DEFINE_ARRAY_ACCESSOR(EnumDescriptor, value, const EnumValueDescriptor*) -PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumDescriptor, EnumOptions); +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumDescriptor, EnumOptions) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, is_placeholder, bool) PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, name) @@ -1705,14 +1705,14 @@ PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, method_count, int) PROTOBUF_DEFINE_ARRAY_ACCESSOR(ServiceDescriptor, method, const MethodDescriptor*) -PROTOBUF_DEFINE_OPTIONS_ACCESSOR(ServiceDescriptor, ServiceOptions); +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(ServiceDescriptor, ServiceOptions) PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, name) PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, full_name) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, service, const ServiceDescriptor*) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, input_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, output_type, const Descriptor*) -PROTOBUF_DEFINE_OPTIONS_ACCESSOR(MethodDescriptor, MethodOptions); +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(MethodDescriptor, MethodOptions) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, client_streaming, bool) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, server_streaming, bool) @@ -1726,7 +1726,7 @@ PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, message_type_count, int) PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, enum_type_count, int) PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, service_count, int) PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, extension_count, int) -PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FileDescriptor, FileOptions); +PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FileDescriptor, FileOptions) PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, is_placeholder, bool) PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, message_type, const Descriptor*) diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h index 020f20c7..e3771003 100644 --- a/src/google/protobuf/io/coded_stream.h +++ b/src/google/protobuf/io/coded_stream.h @@ -117,7 +117,7 @@ #if !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) #define PROTOBUF_LITTLE_ENDIAN 1 #endif - #if _MSC_VER >= 1300 + #if _MSC_VER >= 1300 && !defined(__INTEL_COMPILER) // If MSVC has "/RTCc" set, it will complain about truncating casts at // runtime. This file contains some intentional truncating casts. #pragma runtime_checks("c", off) @@ -1286,9 +1286,9 @@ inline bool CodedInputStream::IsFlat() const { } // namespace protobuf -#if defined(_MSC_VER) && _MSC_VER >= 1300 +#if _MSC_VER >= 1300 && !defined(__INTEL_COMPILER) #pragma runtime_checks("c", restore) -#endif // _MSC_VER +#endif // _MSC_VER && !defined(__INTEL_COMPILER) } // namespace google #endif // GOOGLE_PROTOBUF_IO_CODED_STREAM_H__ diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h index 7c27afd9..a4d9277e 100644 --- a/src/google/protobuf/message.h +++ b/src/google/protobuf/message.h @@ -739,9 +739,9 @@ class LIBPROTOBUF_EXPORT Reflection { // specifyed by 'field' passing ownership to the message. // TODO(tmarek): Make virtual after all subclasses have been // updated. - virtual void AddAllocatedMessage(Message* message, - const FieldDescriptor* field, - Message* new_entry) const {} + virtual void AddAllocatedMessage(Message* /* message */, + const FieldDescriptor* /*field */, + Message* /* new_entry */) const {} // Get a RepeatedFieldRef object that can be used to read the underlying @@ -947,27 +947,27 @@ class LIBPROTOBUF_EXPORT Reflection { // TODO(jieluo) - make the map APIs pure virtual after updating // all the subclasses. // Returns true if key is in map. Returns false if key is not in map field. - virtual bool ContainsMapKey(const Message& message, - const FieldDescriptor* field, - const MapKey& key) const { + virtual bool ContainsMapKey(const Message& /* message*/, + const FieldDescriptor* /* field */, + const MapKey& /* key */) const { return false; } // If key is in map field: Saves the value pointer to val and returns // false. If key in not in map field: Insert the key into map, saves // value pointer to val and retuns true. - virtual bool InsertOrLookupMapValue(Message* message, - const FieldDescriptor* field, - const MapKey& key, - MapValueRef* val) const { + virtual bool InsertOrLookupMapValue(Message* /* message */, + const FieldDescriptor* /* field */, + const MapKey& /* key */, + MapValueRef* /* val */) const { return false; } // Delete and returns true if key is in the map field. Returns false // otherwise. - virtual bool DeleteMapValue(Message* message, - const FieldDescriptor* field, - const MapKey& key) const { + virtual bool DeleteMapValue(Message* /* mesage */, + const FieldDescriptor* /* field */, + const MapKey& /* key */) const { return false; } @@ -987,15 +987,15 @@ class LIBPROTOBUF_EXPORT Reflection { // Get the number of <key, value> pair of a map field. The result may be // different from FieldSize which can have duplicate keys. - virtual int MapSize(const Message& message, - const FieldDescriptor* field) const { + virtual int MapSize(const Message& /* message */, + const FieldDescriptor* /* field */) const { return 0; } // Help method for MapIterator. friend class MapIterator; virtual internal::MapFieldBase* MapData( - Message* message, const FieldDescriptor* field) const { + Message* /* message */, const FieldDescriptor* /* field */) const { return NULL; } diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index 61f3f558..5447fa42 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -574,7 +574,7 @@ class GenericTypeHandler { template <typename GenericType> GenericType* GenericTypeHandler<GenericType>::NewFromPrototype( - const GenericType* prototype, ::google::protobuf::Arena* arena) { + const GenericType* /* prototype */, ::google::protobuf::Arena* arena) { return New(arena); } template <typename GenericType> @@ -627,7 +627,7 @@ void GenericTypeHandler<MessageLite>::Merge(const MessageLite& from, // Message specialization bodies defined in message.cc. This split is necessary // to allow proto2-lite (which includes this header) to be independent of // Message. -DECLARE_SPECIALIZATIONS_FOR_BASE_PROTO_TYPES(Message); +DECLARE_SPECIALIZATIONS_FOR_BASE_PROTO_TYPES(Message) #undef DECLARE_SPECIALIZATIONS_FOR_BASE_PROTO_TYPES @@ -674,7 +674,7 @@ class LIBPROTOBUF_EXPORT StringTypeHandlerBase { static inline ::google::protobuf::Arena* GetArena(string*) { return NULL; } - static inline void* GetMaybeArenaPointer(string* value) { + static inline void* GetMaybeArenaPointer(string* /* value */) { return NULL; } static inline void Delete(string* value, Arena* arena) { diff --git a/src/google/protobuf/stubs/port.h b/src/google/protobuf/stubs/port.h index b35a3afe..1036dff1 100644 --- a/src/google/protobuf/stubs/port.h +++ b/src/google/protobuf/stubs/port.h @@ -53,7 +53,7 @@ #if !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) #define PROTOBUF_LITTLE_ENDIAN 1 #endif - #if defined(_MSC_VER) && _MSC_VER >= 1300 + #if _MSC_VER >= 1300 && !defined(__INTEL_COMPILER) // If MSVC has "/RTCc" set, it will complain about truncating casts at // runtime. This file contains some intentional truncating casts. #pragma runtime_checks("c", off) diff --git a/src/google/protobuf/wire_format_lite_inl.h b/src/google/protobuf/wire_format_lite_inl.h index b1c477d1..79493ca0 100644 --- a/src/google/protobuf/wire_format_lite_inl.h +++ b/src/google/protobuf/wire_format_lite_inl.h @@ -412,12 +412,12 @@ inline bool WireFormatLite::ReadPackedPrimitive< \ CPPTYPE, WireFormatLite::DECLARED_TYPE>(input, values); \ } -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(uint32, TYPE_FIXED32); -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(uint64, TYPE_FIXED64); -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(int32, TYPE_SFIXED32); -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(int64, TYPE_SFIXED64); -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(float, TYPE_FLOAT); -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(double, TYPE_DOUBLE); +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(uint32, TYPE_FIXED32) +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(uint64, TYPE_FIXED64) +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(int32, TYPE_SFIXED32) +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(int64, TYPE_SFIXED64) +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(float, TYPE_FLOAT) +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(double, TYPE_DOUBLE) #undef READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE |